Exemple #1
0
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 = '******'
        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 = '******'
            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)
Exemple #2
0
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
Exemple #3
0
def get_status():
    status = copy.deepcopy(SerialManager.get_hardware_status())
    status['serial_connected'] = SerialManager.is_connected()
    return json.dumps(status)
Exemple #4
0
def get_status():
    status = copy.deepcopy(SerialManager.get_hardware_status())
    status['serial_connected'] = SerialManager.is_connected()
    status['lasaurapp_version'] = VERSION
    return json.dumps(status)
Exemple #5
0
def get_status():
    status = copy.deepcopy(SerialManager.get_hardware_status())
    status['serial_connected'] = SerialManager.is_connected()
    status['lasaurapp_version'] = VERSION
    return json.dumps(status)
Exemple #6
0
def get_status():
    status = copy.deepcopy(SerialManager.get_hardware_status())
    status["serial_connected"] = SerialManager.is_connected()
    return json.dumps(status)