本文整理匯總了Python中listener.Listener.getNetworkInfo方法的典型用法代碼示例。如果您正苦於以下問題:Python Listener.getNetworkInfo方法的具體用法?Python Listener.getNetworkInfo怎麽用?Python Listener.getNetworkInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類listener.Listener
的用法示例。
在下文中一共展示了Listener.getNetworkInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: open
# 需要導入模塊: from listener import Listener [as 別名]
# 或者: from listener.Listener import getNetworkInfo [as 別名]
# listen for commands via SMS
thread.start_new_thread( listener.listenForCommands, () )
listener.sendSMS("Device is up and listening")
# main loop
while True:
time.sleep(4)
temperatureExternal= listener.getTemperatureExternal()
temperatureInternal = listener.getTemperatureInternal()
gpsInfo, coords, height = listener.getGpsInfo()
networkInfo = listener.getNetworkInfo(sendSMS=False)
listener.logAllRecords(temperatureExternal, temperatureInternal, gpsInfo, coords, height, networkInfo)
time.sleep(240)
except Exception as e:
print e
try:
with open("/root/logs/messages.log", "a") as myfile:
s = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
s += " " + "main-loop" + " " + str(e) + "\n"
myfile.write(s)
except Exception as e:
print "Error while logging, can't be logged ..."
print e