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())
def parse_device(tree): device = Device() device.name = GPX_DEVICE_NAME device.serial_number = GPX_DEVICE_SERIAL return device
def parse_device(tree): device = Device() device.name = tree.DeviceLog.Device.Name.text device.serial_number = tree.DeviceLog.Device.SerialNumber.text return device
def create_device(): device = Device() device.name = GPX_DEVICE_NAME device.serial_number = GPX_DEVICE_SERIAL return device