|
Enki
1.9
|
Implementation of a Bluetooth base coordinating the Bluetooth modules. More...
#include <BluetoothBase.h>
Classes | |
| struct | BtClients |
| Structure associating a pointer to a bluetooth module to its address. More... | |
| struct | Connections |
| Information needed to establish a connection or a disconnection. More... | |
| struct | Transmissions |
| Information needed to send data along an established connection. More... | |
Public Types | |
| enum | Errors { BT_NO_ERROR = 0, ADDRESS_UNKNOWN = 1, DISTANCE_EXCEEDED = 2, TOO_MANY_CONNECTIONS = 3, RECEPTION_BUFFER_FULL = 4 } |
| Bluetooth transmission errors. More... | |
Public Member Functions | |
| BluetoothBase () | |
| Constructor. | |
| virtual | ~BluetoothBase () |
| Destructor. | |
| bool | registerClient (Bluetooth *owner, unsigned address) |
| Register a module Bluetooth with its associated address. | |
| bool | removeClient (Bluetooth *owner) |
| Remove a previously registered Bluetooth module. | |
| void | sendDataTo (Bluetooth *source, unsigned address, char *data, unsigned size) |
| Schedule a transmission of data to be sent during the next step. | |
| void | connectTo (Bluetooth *source, unsigned address) |
| Schedule a connection to another Bluetooth module. | |
| void | closeConnection (Bluetooth *source, unsigned address) |
| Schedule a disconnection between two Bluetooth Module. | |
| virtual void | step (double dt, World *w) |
| Execute the previously scheduled operations. | |
Protected Member Functions | |
| bool | bbSendDataTo (Bluetooth *source, unsigned address, char *data, unsigned size) |
| Execute the previously scheduled transfer of data. | |
| bool | bbConnectTo (Bluetooth *source, unsigned address) |
| Execute the previously scheduled connections. | |
| bool | bbCloseConnection (Bluetooth *source, unsigned address) |
| Execute the previously scheduled disconnections. | |
| Bluetooth * | getAddress (unsigned address) |
| Return the pointer of the Bluetooth module associated with "address". | |
| bool | checkDistance (Bluetooth *source, Bluetooth *destination) |
| Check if the distance between the two modules is small enough for communication. | |
Protected Attributes | |
| std::list< BtClients > | clients |
| List of registered Bluetooth module. | |
| std::queue< Connections > | connectbuffer |
| Queue of the connection to be established. | |
| std::queue< Connections > | disconnectbuffer |
| Queue of the connection to be closed. | |
| std::queue< Transmissions > | transmissions |
| Queue of the data to be transmitted. | |
Bluetooth transmission errors.
1.8.11