def ble_gatt_discover_all_characteristics(self, session_id): """Function defined in GattInterface.""" link_id = self._ble_sessions_get_link_id_from_session_id(session_id) if link_id is not None: command = 'BLE_GET_CHAR' args = ['{:X}'.format(link_id)] if self._execute(command, args) is BC127_RESULT_SUCCESS: regex = r"BLE_CHAR (\d4) (\w+) ([0-9A-F|\-]+) ([0-9A-F]{4}) ([0-9A-F]{2})" \ + BC127_EOL responses = self._serial.serial_search_regex_all(regex) return [ BleInterface.GattCharacteristic(resp[2], int(resp[3], 16), int(resp[4], 16)) for resp in responses ] return None
def ble_gatt_discover_all_characteristics(self, session_id): """Function defined in GattInterface. """ if not self._enable_bluetooth(): return None command = '+SRBLEDISCCHAR' args = [session_id] if self._write(command, args) is EUL_RESULT_SUCCESS: regex = r"\+SRBLEDISCCHAR: (%d),\"([0-9a-f|\-]+)\",(\d+),(\d+)" % ( session_id) responses = self._serial.serial_search_regex_all(regex) res = [] for resp in responses: res.append( BleInterface.GattCharacteristic(resp[1].upper(), int(resp[3]), int(resp[2]))) return res return None