Bluetooth port class. More...
#include <LMXBluetoothPort.h>
Public Member Functions | |
LMXBluetoothPort () | |
Default class constructor. | |
LMXBluetoothPort (const char *portName) | |
Default class constructor. | |
bool | sendCmd (unsigned char cmd, const void *buf1, size_t len1, const void *buf2, size_t len2) |
Send command packet to Bluetooth chip. | |
int | getPkt (unsigned char *type, unsigned char *opcode, void *buf, size_t buflen, int timeOut) |
Get packet from Bluetooth chip. |
Bluetooth port class.
Implements the low-level National LMX-series Bluetooth serial port protocol.
LMXBluetoothPort::LMXBluetoothPort | ( | ) |
Default class constructor.
Initializes the LMX Bluetooth port object.
LMXBluetoothPort::LMXBluetoothPort | ( | const char * | portName | ) |
Default class constructor.
Initializes the LMX Bluetooth port object and opens the specified serial port.
portName | Points to a null-terminated string containing the serial port name. |
int LMXBluetoothPort::getPkt | ( | unsigned char * | type, | |
unsigned char * | opcode, | |||
void * | vbuf, | |||
size_t | buflen, | |||
int | timeOut | |||
) |
Get packet from Bluetooth chip.
Reads a packet from the LMX Bluetooth chip and performs a few validity checks. The call blocks until a packet is received or a timeout expires.
type | Pointer to variable where received packet type will be returned or NULL | |
opcode | Pointer to variable where received packet opcode will be returned or NULL | |
vbuf | Packet data buffer pointer | |
buflen | Length of vbuf buffer | |
timeOut | Timeout to wait for packet in ms |
bool LMXBluetoothPort::sendCmd | ( | unsigned char | cmd, | |
const void * | buf1, | |||
size_t | len1, | |||
const void * | buf2, | |||
size_t | len2 | |||
) |
Send command packet to Bluetooth chip.
Sends the specified command to LMX Bluetooth chip. The interface allows to send 2 buffers of data that will be concatenated. Set buffer pointer to NULL if buffer is not used.
cmd | Command opcode | |
buf1 | Points to the buffer containing the beginning of command data or NULL. | |
len1 | Specifies the length of data in the buffer 1. | |
buf2 | Points to the buffer containing the end of command data or NULL. | |
len2 | Specifies the length of data in the buffer 2. |