Esempio n. 1
0
 def ble_get_all_sessions(self):
     """Function defined in BleInterface."""
     # use virtual sessions since Melody does not have sessions.
     return [
         BleInterface.BleSession(s.session_id, s.bdaddr)
         for s in self._ble_sessions
     ]
Esempio n. 2
0
 def ble_create_session(self, bdaddr):
     """Function defined in BleInterface. """
     command = '+SRBLECFG'
     args = ['"' + bdaddr.addr + '"']
     if self._write(command, args) is EDD_RESULT_SUCCESS:
         regex = r"\+SRBLECFG: (\d+),([0|1]),\"([\w|:]{17})\"(,(\d),(\d+))?"
         response = self._serial.serial_search_regex(regex)
         return BleInterface.BleSession(
             int(response[0]),
             BleInterface.Bdaddr(response[2], bdaddr.addr_type))
     return None
Esempio n. 3
0
 def ble_get_all_sessions(self):
     """Function defined in BleInterface. """
     command = '+SRBLECFG'
     if self._query(command) is EDD_RESULT_SUCCESS:
         regex = r"\+SRBLECFG: (\d+),([0|1]),\"([\w|:]{17})\"(,(\d),(\d+))?"
         responses = self._serial.serial_search_regex_all(regex)
         sessions = []
         for resp in responses:
             sessions.append(
                 BleInterface.BleSession(
                     int(resp[0]),
                     BleInterface.Bdaddr(
                         resp[2], BleInterface.LE_BDADDR_TYPE_UNKNOWN)))
         return sessions
     return None
Esempio n. 4
0
 def ble_create_session(self, bdaddr):
     """Function defined in BleInterface. """
     if not self._enable_bluetooth():
         return None
     command = '+SRBLECFG'
     args = ['"' + bdaddr.addr + '"']
     if self._write(command, args) is EUL_RESULT_SUCCESS:
         regex = r"\+SRBLECFG: (\d+),([0|1]),\"(%s)\",(\d+)" % (
             Euler._convert_standard_address_to_euler(bdaddr.addr))
         response = self._serial.serial_search_regex(regex)
         return BleInterface.BleSession(
             int(response[0]),
             BleInterface.Bdaddr(
                 Euler._convert_euler_address_to_standard(response[2]),
                 bdaddr.addr_type))
     return None
Esempio n. 5
0
 def ble_get_all_sessions(self):
     """Function defined in BleInterface. """
     if not self._enable_bluetooth():
         return None
     command = '+SRBLECFG'
     if self._query(command) is EUL_RESULT_SUCCESS:
         regex = r"\+SRBLECFG: (\d+),([0|1]),\"([\w|:]{17})\",(\d+)"
         sessions = []
         responses = self._serial.serial_search_regex_all(regex)
         for resp in responses:
             sessions.append(
                 BleInterface.BleSession(
                     int(resp[0]),
                     BleInterface.Bdaddr(
                         Euler._convert_euler_address_to_standard(resp[2]),
                         BleInterface.LE_BDADDR_TYPE_UNKNOWN)))
         return sessions
     return None