[tuxdroid-svn] r5363 - software_suite_v3/smart-core/smart-server/trunk/resources/02_robot
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-09-14 09:27:04
|
Author: remi
Date: 2009-09-14 11:26:41 +0200 (Mon, 14 Sep 2009)
New Revision: 5363
Modified:
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/10_resourceRF.py
Log:
* Added a logger in the RF resource
Modified: software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/10_resourceRF.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/10_resourceRF.py 2009-09-11 14:50:10 UTC (rev 5362)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/10_resourceRF.py 2009-09-14 09:26:41 UTC (rev 5363)
@@ -97,6 +97,16 @@
'avoided_channel' : None,
'avoided_bandwidth' : WIFI_DEFAULT_AVOIDED_BANDWIDTH,
}
+ # Create a logger
+ self.logger = SimpleLogger("rf")
+ self.logger.resetLog()
+ self.logger.setLevel(TDS_CONF_LOG_LEVEL)
+ self.logger.setTarget(TDS_CONF_LOG_TARGET)
+ self.logger.logInfo("-----------------------------------------------")
+ self.logger.logInfo("Smart-core RF")
+ self.logger.logInfo("Licence : GPL")
+ self.logger.logInfo("-----------------------------------------------")
+ # Load configuration
self.configurator.load('resourceRF.conf', defaultConfiguration)
self.statesChecker()
resourceScheduler.createTask_RunEveryX(
@@ -142,7 +152,7 @@
userBandwidth = self.configurator.getConfiguration()['avoided_bandwidth']
if self.__channelIsInUse() == None:
if userChannel != None:
- print "Avoid user selected channel :", userChannel
+ self.logger.logInfo("Manual wifi channel avoidance : ch=%d bw=%d" % (userChannel, userBandwidth))
self.avoidChannel(userChannel, userBandwidth)
self.__setChannelInUse(userChannel)
self.__setConnectionDetected(True)
@@ -164,13 +174,13 @@
# Don't detect internet connection seems to have better results
detectedChannel = self.detectChannel()
if detectedChannel != None:
- print "Avoid auto detected channel :", detectedChannel
+ self.logger.logInfo("Automatic wifi channel avoidance : ch=%d" % detectedChannel)
self.avoidChannel(detectedChannel, WIFI_DEFAULT_AVOIDED_BANDWIDTH)
self.__setChannelInUse(detectedChannel)
self.__setConnectionDetected(True)
def resetStates(self):
- print "Reset wifi channel states"
+ self.logger.logInfo("Reset wifi channel avoidance states")
self.__setChannelInUse(None)
self.__setConnectionDetected(False)
|