def get_device_id(): """\ Retrieves the Device ID from the Digi device. """ value = "" query_base = '<rci_request version="1.1"><%s><%s/>' \ '</%s></rci_request>' try: query = query_base % ('query_setting', 'mgmtglobal', 'query_setting') raw_data = process_rci_request(query) setting_tree = ElementTree().parsestring(raw_data) device_id = setting_tree.find('deviceId') value = device_id.text except AttributeError: # PLATFORM: this might be an x2e query = query_base % ('query_state', 'device_info', 'query_state') raw_data = process_rci_request(query) setting_tree = ElementTree().parsestring(raw_data) device_id = setting_tree.find('deviceid') value = device_id.text # normalize to the old NDS format if not value.startswith('0x'): value = ''.join(('0x', value)) value = value.replace('-', '') except: _tracer.error("get_device_id(): Unable to retrieve Device ID") raise return value
def get_address(self): """\ Retrieves the current iDigi SMS phone number from the Digi device. """ phnum = "" try: query = '<rci_request version="1.1"><query_setting><idigisms/>' \ '</query_setting></rci_request>' raw_data = process_rci_request(query) setting_tree = ElementTree().parsestring(raw_data) phnum = setting_tree.find("phnum") phnum = phnum.text except Exception, e: self.__tracer.error(e) pass
def get_address(self): """\ Retrieves the current SMS phone number from the Digi device. """ phnum = "" try: query = '<rci_request version="1.1"><query_setting><idigisms/>' \ '</query_setting></rci_request>' raw_data = process_rci_request(query) setting_tree = ElementTree().parsestring(raw_data) phnum = setting_tree.find("phnum") phnum = phnum.text except Exception, e: sms_idigi_client_tracer.error(e) pass
def get_device_id(): """\ Retrieves the Device ID from the Digi device. """ value = "" try: query = '<rci_request version="1.1"><query_setting><mgmtglobal/>' \ '</query_setting></rci_request>' raw_data = process_rci_request(query) setting_tree = ElementTree().parsestring(raw_data) device_id = setting_tree.find("deviceId") value = device_id.text except: _tracer.error("get_device_id(): Unable to retrieve Device ID") raise return value