示例#1
0
def PollRequest(device_id):
    db = session()
    tree = cut_namespace_request()
    
    # create or update parameters for device
    device = db.query(Device).get(device_id)
    if device == None:
        device = Device()
        device.id = device_id
        db.add(device)
        
    device.management_system = tree.lookup('ManagementSystem/Name')
    device.management_version = tree.lookup('ManagementSystem/Version')
    device.name = tree.lookup('Identification/DeviceName')
    device.username = tree.lookup('Identification/UserName')
    device.platform = tree.lookup('Identification/Platform')
    device.processor = tree.lookup('Identification/Processor')
    device.ip_address = tree.lookup('Identification/NetworkAdapter/IPAddress')
    device.ip_subnet = tree.lookup('Identification/NetworkAdapter/IPSubnet')
    device.codepage = tree.lookup('Identification/CodePage')
    device.default_locale_id = tree.lookup('Identification/SystemDefaultLCID')    
    device.last_poll_update()
    db.commit()

    # send current parameters back to device    
    return render_template('poll_response.xml', device = device, server = Server())
示例#2
0
def parse_device(tree):
    device = Device()
    device.name = GPX_DEVICE_NAME
    device.serial_number = GPX_DEVICE_SERIAL
    return device
示例#3
0
def parse_device(tree):
    device = Device()
    device.name = tree.DeviceLog.Device.Name.text
    device.serial_number = tree.DeviceLog.Device.SerialNumber.text
    return device
示例#4
0
def create_device():
    device = Device()
    device.name = GPX_DEVICE_NAME
    device.serial_number = GPX_DEVICE_SERIAL
    return device
示例#5
0
def create_device():
    device = Device()
    device.name = GPX_DEVICE_NAME
    device.serial_number = GPX_DEVICE_SERIAL
    return device
示例#6
0
def parse_device(tree):
    device = Device()
    device.name = tree.DeviceLog.Device.Name.text
    device.serial_number = tree.DeviceLog.Device.SerialNumber.text
    return device