Changeset b84e8b
- Timestamp:
- 01/12/12 11:39:04 (4 months ago)
- Branches:
- ('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
- Children:
- c527223bc420b18a6de5b3037befd935a288597f
- Parents:
- 69059b935b81ae1ab0b06c99638a1b837619e05c
- git-author:
- Stefan Persson <stefan.persson@telldus.se>2012-01-12 11:39:04+01:00
- git-committer:
- Stefan Persson <stefan.persson@telldus.se>2012-01-12 11:39:04+01:00
- Location:
- telldus-core
- Files:
-
- 8 edited
-
client/Client.cpp (modified) (1 diff)
-
client/telldus-core.cpp (modified) (3 diffs)
-
client/telldus-core.h (modified) (1 diff)
-
service/ClientCommunicationHandler.cpp (modified) (1 diff)
-
service/ControllerManager.cpp (modified) (1 diff)
-
service/DeviceManager.cpp (modified) (2 diffs)
-
service/TellStick_libftdi.cpp (modified) (3 diffs)
-
service/TelldusMain.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
telldus-core/client/Client.cpp
rb0f092 rb84e8b 307 307 continue; //retry 308 308 } 309 readData = s.read( 10000); //TODO changed to 10000 from 5000, how much does this do...?309 readData = s.read(8000); //TODO changed to 10000 from 5000, how much does this do...? 310 310 if(readData == L""){ 311 311 printf("Readdata nothing\n\r"); -
telldus-core/client/telldus-core.cpp
r265daf rb84e8b 57 57 * @def TELLSTICK_SUCCESS 58 58 * Error code. Returned when the command succeeded. 59 * 60 * @def TELLSTICK_ERROR_BROKEN_PIPE 61 * Error code. Pipe broken during communication. 59 62 * 60 63 * @def TELLSTICK_ERROR_NOT_FOUND … … 488 491 * @sa TELLSTICK_ERROR_UNKNOWN_RESPONSE 489 492 * @sa TELLSTICK_ERROR_SYNTAX 493 * @sa TELLSTICK_ERROR_BROKEN_PIPE 490 494 * @sa TELLSTICK_ERROR_UNKNOWN 491 495 */ 492 496 char * WINAPI tdGetErrorString(int intErrorNo) { 493 const int numResponses = 9;497 const int numResponses = 10; 494 498 const char *responses[numResponses] = { 495 499 "Success", … … 501 505 "Could not connect to the Telldus Service", 502 506 "Received an unknown response", 503 "Syntax error" 507 "Syntax error", 508 "Broken pipe" 504 509 }; 505 510 std::string strReturn; -
telldus-core/client/telldus-core.h
r554601 rb84e8b 117 117 #define TELLSTICK_ERROR_UNKNOWN_RESPONSE -7 118 118 #define TELLSTICK_ERROR_SYNTAX -8 119 #define TELLSTICK_ERROR_BROKEN_PIPE -9 119 120 #define TELLSTICK_ERROR_UNKNOWN -99 120 121 -
telldus-core/service/ClientCommunicationHandler.cpp
rd7cce5 rb84e8b 2 2 #include "Message.h" 3 3 #include "Strings.h" 4 #include "Log.h" //Debug5 4 6 5 #include <stdlib.h> -
telldus-core/service/ControllerManager.cpp
r8d22ef rb84e8b 141 141 for(std::list<TellStick *>::iterator it = tellStickControllers.begin(); it != tellStickControllers.end(); ++it) { 142 142 int success = (*it)->send(noop); 143 if(success == TELLSTICK_ERROR_ COMMUNICATION){143 if(success == TELLSTICK_ERROR_BROKEN_PIPE){ 144 144 Log::warning("TellStick query: Error in communication with TellStick, resetting USB"); 145 145 resetController(*it); 146 146 } 147 if(success == TELLSTICK_ERROR_ COMMUNICATION|| success == TELLSTICK_ERROR_NOT_FOUND){147 if(success == TELLSTICK_ERROR_BROKEN_PIPE || success == TELLSTICK_ERROR_NOT_FOUND){ 148 148 reloadControllers = true; 149 149 } -
telldus-core/service/DeviceManager.cpp
r8d22ef rb84e8b 442 442 if(controller){ 443 443 retval = device->doAction(action, data, controller); 444 if(retval == TELLSTICK_ERROR_ COMMUNICATION){444 if(retval == TELLSTICK_ERROR_BROKEN_PIPE){ 445 445 Log::warning("Error in communication with TellStick when executing action. Resetting USB"); 446 446 d->controllerManager->resetController(controller); 447 447 } 448 if(retval == TELLSTICK_ERROR_ COMMUNICATION|| retval == TELLSTICK_ERROR_NOT_FOUND){448 if(retval == TELLSTICK_ERROR_BROKEN_PIPE || retval == TELLSTICK_ERROR_NOT_FOUND){ 449 449 Log::warning("Rescanning USB ports"); 450 450 d->controllerManager->loadControllers(); … … 752 752 if(controller){ 753 753 retval = controller->send(TelldusCore::wideToString(command)); 754 if(retval == TELLSTICK_ERROR_ COMMUNICATION){754 if(retval == TELLSTICK_ERROR_BROKEN_PIPE){ 755 755 d->controllerManager->resetController(controller); 756 756 } 757 if(retval == TELLSTICK_ERROR_ COMMUNICATION|| retval == TELLSTICK_ERROR_NOT_FOUND){757 if(retval == TELLSTICK_ERROR_BROKEN_PIPE || retval == TELLSTICK_ERROR_NOT_FOUND){ 758 758 d->controllerManager->loadControllers(); 759 759 controller = d->controllerManager->getBestControllerById(-1); -
telldus-core/service/TellStick_libftdi.cpp
r69059b rb84e8b 218 218 delete[] tempMessage; 219 219 Log::notice("Message: %s", strMessage.c_str()); 220 Log::notice("FWVersion: %d", firmwareVersion()); 221 Log::notice("Pid: %X", pid()); 222 223 if(!c){ 224 Log::debug("Broken pipe on send"); 225 return TELLSTICK_ERROR_BROKEN_PIPE; 226 } 227 220 228 if(d->ignoreControllerConfirmation || (strMessage == "N+" && ((pid() == 0x0C31 && firmwareVersion() < 5) || (pid() == 0x0C30 && firmwareVersion() < 6)))){ 221 229 //these firmware versions doesn't implement ack to noop, just check that the noop can be sent correctly 222 Log::notice("Too old firmware, accepting this"); 223 if(c){ 224 Log::notice("Success"); 225 return TELLSTICK_SUCCESS; 226 } 227 else{ 228 Log::notice("Fail"); 229 return TELLSTICK_ERROR_COMMUNICATION; 230 } 230 Log::notice("Too old firmware, accepting this, just return success"); 231 return TELLSTICK_SUCCESS; 231 232 } 232 233 Log::warning("Continuing"); … … 234 235 int retrycnt = 250; 235 236 unsigned char in; 236 while( c &&--retrycnt) {237 while(--retrycnt) { 237 238 ret = ftdi_read_data( &d->ftHandle, &in, 1); 238 239 if (ret > 0) { 239 Log:: notice("Returned%c", in);240 Log::warning("%c", in); 240 241 if (in == '\n') { 241 Log:: notice("BREAK");242 Log::warning("Received an end"); 242 243 break; 243 244 } … … 245 246 usleep(100); 246 247 } else { //Error 247 c = false; 248 } 249 } 248 Log::debug("Broken pipe on read"); 249 return TELLSTICK_ERROR_BROKEN_PIPE; 250 } 251 } 252 Log::warning("Retry ready"); 250 253 if (!retrycnt) { 251 c = false; 252 } 253 if (!c) { 254 Log::warning("Error in communication, retrycount ended"); 254 255 return TELLSTICK_ERROR_COMMUNICATION; 255 256 } 257 Log::warning("Success"); 256 258 return TELLSTICK_SUCCESS; 257 259 } -
telldus-core/service/TelldusMain.cpp
r8d22ef rb84e8b 44 44 EventRef janitor = d->eventHandler.addEvent(); //Used for regular cleanups 45 45 Timer supervisor(janitor); //Tells the janitor to go back to work 46 supervisor.setInterval( 10); //TODOOnce every minute46 supervisor.setInterval(60); //Once every minute 47 47 supervisor.start(); 48 48
Note: See TracChangeset
for help on using the changeset viewer.
