Enki  1.9
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Enki::BluetoothBase Class Reference

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.
 
BluetoothgetAddress (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< BtClientsclients
 List of registered Bluetooth module.
 
std::queue< Connectionsconnectbuffer
 Queue of the connection to be established.
 
std::queue< Connectionsdisconnectbuffer
 Queue of the connection to be closed.
 
std::queue< Transmissionstransmissions
 Queue of the data to be transmitted.
 

Detailed Description

Implementation of a Bluetooth base coordinating the Bluetooth modules.

Member Enumeration Documentation

Bluetooth transmission errors.

Enumerator
BT_NO_ERROR 

No error occured during the last step.

ADDRESS_UNKNOWN 

The address used was unknown.

DISTANCE_EXCEEDED 

The distance between the 2 robots is too great.

TOO_MANY_CONNECTIONS 

No additional connection can be made as the robot is already at maximum.

RECEPTION_BUFFER_FULL 

The reception buffer is full and no additional data can be written.


The documentation for this class was generated from the following files: