def __get_acl_conn_handle(sock, addr): hci_fd = sock.fileno() reqstr = struct.pack( "6sB17s", bt.str2ba(addr), bt.ACL_LINK, "\0" * 17) request = array.array( "c", reqstr ) fcntl.ioctl( hci_fd, bt.HCIGETCONNINFO, request, 1 ) handle = struct.unpack("8xH14x", request.tostring())[0] return handle
def _get_acl_conn_handle(hci_sock, addr): hci_fd = hci_sock.fileno() reqstr = struct.pack("6sB17s", _bt.str2ba(addr), _bt.ACL_LINK, "\0" * 17) request = array.array("c", reqstr) try: fcntl.ioctl(hci_fd, _bt.HCIGETCONNINFO, request, 1) except IOError, e: raise BluetoothError("There is no ACL connection to %s" % addr)
def get_acl_conn_handle(hci_sock, addr): hci_fd = hci_sock.fileno() reqstr = struct.pack("6sB17s", _bt.str2ba(addr), _bt.ACL_LINK, b"\0" * 17) request = array.array("b", reqstr) try: fcntl.ioctl(hci_fd, _bt.HCIGETCONNINFO, request, 1) except IOError: raise BluetoothError("There is no ACL connection to %s" % addr) # XXX should this be "<8xH14x"? handle = struct.unpack("8xH14x", request.tostring())[0] return handle
def _send_next_name_req(self): assert len(self.names_to_find) > 0 address = self.names_to_find.keys()[0] device_class, psrm, pspm, clockoff = self.names_to_find[address] bdaddr = _bt.str2ba(address) cmd_pkt = "%s%s\0%s" % (bdaddr, psrm, clockoff) try: _bt.hci_send_cmd(self.sock, _bt.OGF_LINK_CTL, _bt.OCF_REMOTE_NAME_REQ, cmd_pkt) except Exception, e: raise BluetoothError("error request name of %s - %s" % (address, str(e)))
def _get_acl_conn_handle (hci_sock, addr): hci_fd = hci_sock.fileno () reqstr = struct.pack ("6sB17s", _bt.str2ba (addr), _bt.ACL_LINK, "\0" * 17) request = array.array ("c", reqstr) try: fcntl.ioctl (hci_fd, _bt.HCIGETCONNINFO, request, 1) except IOError: raise BluetoothError ("There is no ACL connection to %s" % addr) # XXX should this be "<8xH14x"? handle = struct.unpack ("8xH14x", request.tostring ())[0] return handle
def _send_next_name_req(self): assert len(self.names_to_find) > 0 address = self.names_to_find.keys()[0] device_class, psrm, pspm, clockoff = self.names_to_find[address] bdaddr = _bt.str2ba(address) cmd_pkt = "%s%s\0%s" % (bdaddr, psrm, clockoff) try: _bt.hci_send_cmd (self.sock, _bt.OGF_LINK_CTL, \ _bt.OCF_REMOTE_NAME_REQ, cmd_pkt) except Exception, e: raise BluetoothError("error request name of %s - %s" % (address, str(e)))
def _send_next_name_req(self): assert len(self.names_to_find) > 0 address = list(self.names_to_find.keys())[0] device_class, rssi, psrm, pspm, clockoff = self.names_to_find[address] bdaddr = _bt.str2ba(address) #TODO not supported in python3 cmd_pkt = "%s%s\0%s" % (bdaddr, psrm, clockoff) try: _bt.hci_send_cmd (self.sock, _bt.OGF_LINK_CTL, \ _bt.OCF_REMOTE_NAME_REQ, cmd_pkt) except _bt.error as e: raise BluetoothError( e.args[0], "error request name of %s - %s:" % (address, e.args[1]))