Send a message to the connected G1 device.
Args:
hex_data (str): Hexadecimal string representation of the message to send.
Can contain spaces, tabs, or other whitespace which will be automatically removed.
Should contain only valid hexadecimal characters (0-9, A-F, a-f).
Examples: "2506", "25 06", "25 06 00 01", "25 06 00 01 04 02"
Returns:
Dict[str, Any]: JSON response with message status including:
- result: "success" or "error"
- message_sent: Boolean indicating if message was sent
- response_received: Boolean indicating if response was received
- response_data: Response data in hex format (if received)
- timeout: Boolean indicating if message timed out
- error: Error message if sending failed
Note:
This sends the hex_data as bytes to the connected G1 device using the
Nordic BLE UART protocol and waits for a response up to 2 seconds.
All messages are treated as commands and will timeout after 2 seconds if no response is received.
Spaces, tabs, and other whitespace in hex_data are automatically removed before processing.
Examples:
- send_g1_message("2506") -> Sends command 0x25 with data 0x06
- send_g1_message("25 06") -> Same as above (spaces removed)
- send_g1_message("25 06 00 01") -> Sends 0x25060001
- send_g1_message("ABCD 1234") -> Sends 0xABCD1234
- send_g1_message("1234567890ABCDEF") -> Sends longer message