Python Bluetooth Link
The Link is a representation of the connection between two bluetooth devices. The Link's interface provides the user the ability to send commands and access Link attributes.
Send a command to the Link.
def sendcommand(self, msg):
The command bytes that will be sent to the link.
Before sending the command, the link has to be authenticated. Commands can only be sent to synchronously.
# Example: Send GetCapabilities command to vehicle through Bluetooth # get the command binary for GetCapabilities constructed_bytes = get_capabilities.GetCapabilities().get_bytearray() if constructed_bytes is not None: if self.hmkit.bluetooth.broadcaster.is_connected() == False: print("---- PY: Device is not connected through Bluetooth. Cannot send commands ----") return False else: # send the constructed binary to the connected vehicle self.hmkit.bluetooth.link.sendcommand(constructed_bytes)
Command Incoming callback.
def cb_command_incoming(self, cmd):
The command bytes received from the link.
Command Incoming Callback is used to notify the user about the incoming command.
Command Response callback.
def cb_command_response(self, cmd):
Bytes: Response/Ack for the command send
Response for the command sent