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)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn