本文整理汇总了Python中serial_manager.SerialManager.get_hardware_status方法的典型用法代码示例。如果您正苦于以下问题:Python SerialManager.get_hardware_status方法的具体用法?Python SerialManager.get_hardware_status怎么用?Python SerialManager.get_hardware_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serial_manager.SerialManager
的用法示例。
在下文中一共展示了SerialManager.get_hardware_status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_status
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import get_hardware_status [as 别名]
def get_status():
if args.raspberrypi:
powertimer.reset()
status = copy.deepcopy(SerialManager.get_hardware_status())
status['serial_connected'] = SerialManager.is_connected()
print "Connected: %d" % SerialManager.is_connected()
status['lasaurapp_version'] = VERSION
global user_approved
global user_admin
global current_user
if args.disable_rfid:
return json.dumps(status)
card_id = reader.getid()
print "Card ID %s" % card_id
username = ''
global current_cardid
if len(card_id) == 0:
print "No card inserted"
username = 'No card inserted'
user_approved = False
if current_user != '':
logger.log(current_user, 'Card removed')
current_user = ''
elif len(card_id) == 12:
if not card_id in card_data:
print "Card not found"
username = 'Unknown card'
user_approved = False
if card_id != current_cardid:
logger.log(card_id, 'Unknown card')
else:
print "Card found"
data = card_data[card_id]
username = data['name']
if data['approved']:
user_approved = True
else:
user_approved = False
if data['admin']:
user_admin = True
else:
user_admin = False
if current_user == '':
logger.log(username, 'Card inserted')
current_user = username
print "Approved: %s" % user_approved
current_cardid = card_id
else:
print "Bad length: %d" % len(card_id)
status['username'] = username
global shutdown_msg
status['shutdown_msg'] = shutdown_msg
shutdown_msg = ''
return json.dumps(status)
示例2: get_status
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import get_hardware_status [as 别名]
def get_status():
status = copy.deepcopy(SerialManager.get_hardware_status())
status['serial_connected'] = SerialManager.is_connected()
if HARDWARE == 'raspberrypi':
status['power'] = RPiPowerControl.get_power_status()
status['assist_air'] = RPiPowerControl.get_assist_air_status()
RPiPowerControl.set_process_status(status['serial_connected'] and not status['ready'])
else:
status['power'] = 1;
status['assist_air'] = 1;
status['lasaurapp_version'] = VERSION
status['admin'] = admin_check()
status['user'] = accessUser
status['accounts'] = accountsTable
status['statistics'] = statistics
return status
示例3: get_status
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import get_hardware_status [as 别名]
def get_status():
status = copy.deepcopy(SerialManager.get_hardware_status())
status['serial_connected'] = SerialManager.is_connected()
status['lasaurapp_version'] = VERSION
return json.dumps(status)
示例4: get_status
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import get_hardware_status [as 别名]
def get_status():
status = copy.deepcopy(SerialManager.get_hardware_status())
status["serial_connected"] = SerialManager.is_connected()
return json.dumps(status)