LMXBluetoothPort Class Reference

Bluetooth port class. More...

#include <LMXBluetoothPort.h>

Inheritance diagram for LMXBluetoothPort:
SerialPort SerialPortInterface

List of all members.

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.

Detailed Description

Bluetooth port class.

Implements the low-level National LMX-series Bluetooth serial port protocol.


Constructor & Destructor Documentation

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.

Parameters:
portName Points to a null-terminated string containing the serial port name.

Member Function Documentation

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.

Parameters:
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
Returns:
Returns 0 if a valid packet was received. Returns -1 if there was no packet received and timeout expired. Returns a negative integer less than -1 on error.
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.

Parameters:
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.
Returns:
Returns 0 if the packet was sent successfully. Returns a negative integer on error.

The documentation for this class was generated from the following files:
Generated on Wed Oct 20 11:13:44 2010 for libspatha by  doxygen 1.6.3