Changeset 673daf
- Timestamp:
- 01/10/12 16:00:14 (4 months ago)
- Branches:
- ('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
- Children:
- 0c8de249d4250159c0b215c5d806d15d28de3bae
- Parents:
- dfae48ef33f9c218e80c5ec9ec1d96a1ae5fa625
- git-author:
- Stefan Persson <stefan.persson@telldus.se>2012-01-10 16:00:14+01:00
- git-committer:
- Stefan Persson <stefan.persson@telldus.se>2012-01-10 16:00:14+01:00
- Location:
- telldus-core
- Files:
-
- 5 edited
-
common/Socket_unix.cpp (modified) (1 diff)
-
service/ControllerManager.cpp (modified) (4 diffs)
-
service/ControllerManager.h (modified) (1 diff)
-
service/TellStick_libftdi.cpp (modified) (1 diff)
-
service/TelldusMain.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
telldus-core/common/Socket_unix.cpp
re35877 r673daf 115 115 TelldusCore::MutexLocker locker(&d->mutex); 116 116 d->connected = false; 117 //TODO somehow signal the socket here? 117 118 } 118 119 -
telldus-core/service/ControllerManager.cpp
r06ac02 r673daf 4 4 #include "TellStick.h" 5 5 #include "Log.h" 6 #include "../client/telldus-core.h" 6 7 7 8 #include <map> … … 100 101 ControllerMap::const_iterator cit = d->controllers.begin(); 101 102 for(; cit != d->controllers.end(); ++cit) { 102 Log::notice("Something in second theloop");103 Log::notice("Something in the second loop"); 103 104 TellStick *tellstick = reinterpret_cast<TellStick*>(cit->second); 104 105 if (!tellstick) { … … 129 130 } 130 131 132 void ControllerManager::queryControllerStatus(){ 133 134 std::list<TellStick *> tellStickControllers; 135 136 { 137 TelldusCore::MutexLocker locker(&d->mutex); 138 for(ControllerMap::iterator it = d->controllers.begin(); it != d->controllers.end(); ++it) { 139 Log::notice("found a controller"); 140 TellStick *tellstick = reinterpret_cast<TellStick*>(it->second); 141 if (tellstick) { 142 Log::notice("found a tellstick"); 143 tellStickControllers.push_back(tellstick); 144 } 145 } 146 } 147 148 bool reloadControllers = false; 149 std::string noop = "noop"; 150 for(std::list<TellStick *>::iterator it = tellStickControllers.begin(); it != tellStickControllers.end(); ++it) { 151 int success = (*it)->send(noop); 152 if(success == TELLSTICK_ERROR_COMMUNICATION){ 153 Log::warning("TellStick query: Error in communication with TellStick, resetting USB"); 154 resetController(*it); 155 Log::notice("has reset"); 156 } 157 if(success == TELLSTICK_ERROR_COMMUNICATION || success == TELLSTICK_ERROR_NOT_FOUND){ 158 reloadControllers = true; 159 Log::notice("Set reload"); 160 } 161 } 162 163 if(!tellStickControllers.size() || reloadControllers){ 164 //no tellstick at all found, or controller was reset 165 Log::warning("TellStick query: Rescanning USB ports"); 166 loadControllers(); 167 } 168 } 169 131 170 int ControllerManager::resetController(Controller *controller) { 132 171 TellStick *tellstick = reinterpret_cast<TellStick*>(controller); … … 135 174 } 136 175 Log::notice("resettingController"); 137 int success = controller->reset(); //ehh, här är väl controllern borttagen förresten?176 int success = controller->reset(); 138 177 Log::notice("Remove device"); 139 178 deviceInsertedOrRemoved(tellstick->vid(), tellstick->pid(), tellstick->serial(), false); //remove from list and delete -
telldus-core/service/ControllerManager.h
r06ac02 r673daf 16 16 Controller *getBestControllerById(int id); 17 17 void loadControllers(); 18 void queryControllerStatus(); 18 19 int resetController(Controller *controller); 19 20 -
telldus-core/service/TellStick_libftdi.cpp
r06ac02 r673daf 216 216 217 217 delete[] tempMessage; 218 if(strMessage == "noop"){ 219 if(c){ 220 return TELLSTICK_SUCCESS; 221 } 222 else{ 223 return TELLSTICK_ERROR_COMMUNICATION; 224 } 225 } 218 226 219 227 int retrycnt = 500; -
telldus-core/service/TelldusMain.cpp
r542d17a r673daf 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( 60*5); //Every 5 minutes46 supervisor.setInterval(10); //Every 5 minutes TODO how often? 60*5 47 47 supervisor.start(); 48 48 … … 114 114 } 115 115 Log::debug("Do Janitor cleanup"); 116 controllerManager.queryControllerStatus(); 116 117 } 117 118 }
Note: See TracChangeset
for help on using the changeset viewer.
