Changeset c52722
- Timestamp:
- 01/12/12 14:17:24 (4 months ago)
- Branches:
- ('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
- Children:
- 3ce58f019fbe42e77592b30166a1f44a732eeee5
- Parents:
- b84e8b3806d9db62cfda5035e274ef6fe0b9f817
- git-author:
- Stefan Persson <stefan.persson@telldus.se>2012-01-12 14:17:24+01:00
- git-committer:
- Stefan Persson <stefan.persson@telldus.se>2012-01-12 14:17:24+01:00
- File:
-
- 1 edited
-
telldus-core/service/TellStick_ftd2xx.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
telldus-core/service/TellStick_ftd2xx.cpp
r406874 rc52722 11 11 // 12 12 #include "TellStick.h" 13 #include "common.h" 13 14 #include "Mutex.h" 14 15 #include "Settings.h" … … 211 212 return TELLSTICK_ERROR_NOT_FOUND; 212 213 } 213 bool c = true; 214 214 215 215 //This lock does two things 216 216 // 1 Prevents two calls from different threads to this function … … 231 231 free(tempMessage); 232 232 233 if(d->ignoreControllerConfirmation || (strMessage == "N+" && ((pid() == 0x0C31 && firmwareVersion() < 5) || (pid() == 0x0C30 && firmwareVersion() < 6)))){ 233 if(ftStatus != FT_OK){ 234 Log::debug("Broken pipe on send"); 235 return TELLSTICK_ERROR_BROKEN_PIPE; 236 } 237 238 if(strMessage.compare("N+") == 0 && ((pid() == 0x0C31 && firmwareVersion() < 5) || (pid() == 0x0C30 && firmwareVersion() < 6))){ 234 239 //these firmware versions doesn't implement ack to noop, just check that the noop can be sent correctly 235 if(c){236 return TELLSTICK_SUCCESS;237 }238 else{239 return TELLSTICK_ERROR_COMMUNICATION;240 }241 } 242 243 while( c) {240 return TELLSTICK_SUCCESS; 241 } 242 if(d->ignoreControllerConfirmation){ 243 //wait for TellStick to finish its air-sending 244 msleep(1000); 245 return TELLSTICK_SUCCESS; 246 } 247 248 while(1) { 244 249 ftStatus = FT_Read(d->ftHandle,&in,1,&bytesRead); 245 250 if (ftStatus == FT_OK) { 246 251 if (bytesRead == 1) { 247 252 if (in == '\n') { 248 break; 253 return TELLSTICK_SUCCESS; 254 } else { 255 continue; 249 256 } 250 257 } else { //Timeout 251 c = false;258 return TELLSTICK_ERROR_COMMUNICATION; 252 259 } 253 260 } else { //Error 254 c = false; 255 } 256 } 257 258 if (!c) { 259 return TELLSTICK_ERROR_COMMUNICATION; 260 } 261 return TELLSTICK_SUCCESS; 261 Log::debug("Broken pipe on read"); 262 return TELLSTICK_ERROR_BROKEN_PIPE; 263 } 264 } 262 265 } 263 266
Note: See TracChangeset
for help on using the changeset viewer.
