LMX Bluetooth module class. More...
#include <LMXBluetoothModule.h>
Public Member Functions | |
LMXBluetoothModule (const char *portName) | |
Class constructor. | |
virtual | ~LMXBluetoothModule () |
Class destructor. | |
virtual bool | shutdown () |
Shut down Bluetooth subsystem (static). | |
virtual std::string | getLocalMac () |
Get MAC address. | |
virtual std::string | getVersion () |
virtual void | setEnabled (bool enabled) |
Enable or disable the module Enables or disables the LMX Bluetooth module. | |
virtual bool | powerStateChange (PowerState oldState, PowerState newState) |
Change module power state Changes the module power state, if power management is enabled. | |
Static Public Member Functions | |
static bool | initialize () |
Initialize Bluetooth subsystem (static). | |
Protected Member Functions | |
virtual bool | sendSPPData (int connid, const void *data, size_t len) |
Send SPP data over the bluetooth connection. | |
virtual bool | addSDPRecord (int localPort, void *data, size_t len) |
Stores a new service record in local SDP database Stores a new service record in Service Discovery Database. | |
virtual bool | connectSPP (int idConn, unsigned char *dstAddr, unsigned char dstPort) |
Initiate a SPP connection. | |
virtual bool | listenSPP (int idConn) |
Puts the device into listening mode Puts the device into listening mode, activates the proper SDP record. | |
virtual bool | disconnectSPP (int idConn) |
Request a SPP connection disconnect. |
LMX Bluetooth module class.
Implements the National LMX-series Bluetooth module functionality.
LMXBluetoothModule::LMXBluetoothModule | ( | const char * | portName | ) |
Class constructor.
Initializes the LMX Bluetooth module object.
portName | Points to a null-terminated string containing the name of the serial port the LMX module is connected to. |
LMXBluetoothModule::~LMXBluetoothModule | ( | ) | [virtual] |
Class destructor.
Terminates the LMX Bluetooth module object.
bool LMXBluetoothModule::addSDPRecord | ( | int | localPort, | |
void * | data, | |||
size_t | len | |||
) | [protected, virtual] |
Stores a new service record in local SDP database Stores a new service record in Service Discovery Database.
localPort | Local port used by the service | |
data | Pointer to the data to be used | |
len | Data length |
Implements BluetoothModule.
bool LMXBluetoothModule::connectSPP | ( | int | idConn, | |
unsigned char * | dstAddr, | |||
unsigned char | dstPort | |||
) | [protected, virtual] |
Initiate a SPP connection.
Initiates a SPP connection process for a connection id.
idConn | Connection ID (=local port), returned from connection object registration. | |
dstAddr | Destination MAC address | |
dstPort | Destination port |
Implements BluetoothModule.
bool LMXBluetoothModule::disconnectSPP | ( | int | idConn | ) | [protected, virtual] |
Request a SPP connection disconnect.
Initiates a SPP disconnect process
idConn | Connection ID |
Implements BluetoothModule.
std::string LMXBluetoothModule::getLocalMac | ( | ) | [virtual] |
Get MAC address.
Retrieves the hardware MAC address of the LMX Bluetooth module.
Implements BluetoothModule.
virtual std::string LMXBluetoothModule::getVersion | ( | ) | [inline, virtual] |
Reader implementation should override this function to implement method for retrieving reader's bluetooth protocol version.
Implements BluetoothModule.
bool LMXBluetoothModule::initialize | ( | ) | [static] |
Initialize Bluetooth subsystem (static).
Creates the LMX Bluetooth Module object, performs an initial handshake procedure with the LMX Bluetooth module, starts BT thread
bool LMXBluetoothModule::listenSPP | ( | int | idConn | ) | [protected, virtual] |
Puts the device into listening mode Puts the device into listening mode, activates the proper SDP record.
idConn | Connection ID that should be used for listening incoming packets |
Implements BluetoothModule.
bool LMXBluetoothModule::powerStateChange | ( | PowerState | oldState, | |
PowerState | newState | |||
) | [virtual] |
Change module power state Changes the module power state, if power management is enabled.
oldState | Current power state of the module | |
newState | The power state the module should be put into |
Implements PowerEventListener.
bool LMXBluetoothModule::sendSPPData | ( | int | connid, | |
const void * | data, | |||
size_t | len | |||
) | [protected, virtual] |
Send SPP data over the bluetooth connection.
connid | Connection ID, returned on SPP connection registration | |
data | Data to be sent over SPP link | |
len | Data length |
Data buffer given by *data parameter will be sent out over Bluetooth.
Implements BluetoothModule.
void LMXBluetoothModule::setEnabled | ( | bool | enabled | ) | [virtual] |
Enable or disable the module Enables or disables the LMX Bluetooth module.
enabled | Set to true to enable the module, false to disable it |
Implements BluetoothModule.
bool LMXBluetoothModule::shutdown | ( | ) | [virtual] |
Shut down Bluetooth subsystem (static).
Disconnects all Bluetooth connections, stops BT thread. You should delete all connection objects before shutting down LMXBluetoothModule!
Implements BluetoothModule.