34 #ifndef __ENKI_BLUETOOTH_H 35 #define __ENKI_BLUETOOTH_H 37 #include "../PhysicalEngine.h" 38 #include "../Interaction.h" 128 Bluetooth(
Robot*
owner,
double range,
unsigned maxConnections,
unsigned rxbuffersize,
unsigned txbuffersize,
unsigned address);
157 bool sendDataTo(
unsigned dest,
char* data,
unsigned size);
unsigned getMaxConnections()
Return the maximum number of simultaneous connections supported by this module.
Definition: Bluetooth.cpp:130
unsigned getRxBufferSize()
Return the size of the reception buffers.
Definition: Bluetooth.cpp:284
void cancelTxBuffer()
Deallocate the memory dedicated for the transmission buffer.
Definition: Bluetooth.cpp:77
bool sendDataTo(unsigned dest, char *data, unsigned size)
Send data to the module of address "dest".
Definition: Bluetooth.cpp:239
const char * getRxBuffer(unsigned source)
Return the reception buffer associated with another module of address "source".
Definition: Bluetooth.cpp:178
Implementation of a Bluetooth base coordinating the Bluetooth modules.
Definition: BluetoothBase.h:54
bool closeConnection(unsigned index)
Close an established connection with another module.
Definition: Bluetooth.cpp:220
char ** rxBuffer
Reception buffers for data coming from other connected modules.
Definition: Bluetooth.h:68
The distance between the 2 robots is too great.
Definition: Bluetooth.h:119
double range
Range of the interaction.
Definition: Bluetooth.h:58
unsigned getAddress()
Return the address of the module.
Definition: Bluetooth.cpp:135
void connectTo(unsigned address)
Initiate a connection with another module.
Definition: Bluetooth.cpp:214
void cancelAllData()
Deallocate all the memory.
Definition: Bluetooth.cpp:84
unsigned * transmissionError
Flags indicating transmission errors.
Definition: Bluetooth.h:95
unsigned getDisconnectionError()
Return the status of the disconnection error flag.
Definition: Bluetooth.cpp:361
void setAddress(unsigned address)
Change the address of the module.
Definition: Bluetooth.cpp:123
unsigned * sizeToSend
Size of the data to send.
Definition: Bluetooth.h:80
unsigned rxBufferSize
Size of each buffer for the reception of data.
Definition: Bluetooth.h:72
std::queue< unsigned > connectToRobot
Queue containing request for connection to other modules.
Definition: Bluetooth.h:90
Enki is the namespace of the Enki simulator. All Enki functions and classes excepted the math one are...
Definition: BluetoothBase.cpp:44
No additional connection can be made as the robot is already at maximum.
Definition: Bluetooth.h:121
void cancelRxBuffer()
Deallocate the memory dedicated for the reception buffer.
Definition: Bluetooth.cpp:70
void changeTxBufferSize(unsigned size)
Modify the size of the transmission buffers.
Definition: Bluetooth.cpp:303
unsigned * sizeReceived
Size of the data received.
Definition: Bluetooth.h:82
bool isThereTxError()
Indicate if an error of transmission occured during the last step.
Definition: Bluetooth.cpp:266
unsigned getConnectionError()
Return the status of the connection error flag.
Definition: Bluetooth.cpp:356
No error occured during the last step.
Definition: Bluetooth.h:115
unsigned maxConnections
Maximum number of simultaneous connections supported.
Definition: Bluetooth.h:63
Bluetooth(Robot *owner, double range, unsigned maxConnections, unsigned rxbuffersize, unsigned txbuffersize, unsigned address)
Constructor e.g.
Definition: Bluetooth.cpp:46
bool * getReceptionFlags()
Return the reception flags indicating from which module data was received.
Definition: Bluetooth.cpp:173
Errors
Error that bluetooth communication can produce.
Definition: Bluetooth.h:112
char ** txBuffer
Transmission buffers for data sent to other connected modules.
Definition: Bluetooth.h:70
unsigned nbConnections
Number of connections currently established.
Definition: Bluetooth.h:61
char disconnectionError
Flag indicating an error involving the disconnection from another robot.
Definition: Bluetooth.h:99
bool randomAddress
Flag indicating that the current address has been assigned randomly.
Definition: Bluetooth.h:87
bool * receptionFlags
Flags signalling the reception of data.
Definition: Bluetooth.h:76
bool updateAddress
Flag indicating a change in the address of the module.
Definition: Bluetooth.h:85
unsigned getSizeReceived(unsigned source)
Return the amount of data received from another module of address "source" during the last step...
Definition: Bluetooth.cpp:196
The world is the container of all objects and robots.
Definition: PhysicalEngine.h:411
std::queue< unsigned > closeConnectionToRobot
Queue containing request for closing the connection with other modules.
Definition: Bluetooth.h:92
Interacts with the whole world.
Definition: Interaction.h:93
unsigned address
Address of the Bluetooth module.
Definition: Bluetooth.h:65
virtual ~Bluetooth()
Destructor.
Definition: Bluetooth.cpp:65
Implementation of an onboard Bluetooth module.
Definition: Bluetooth.h:52
Robot * owner
The physical object that owns the interaction.
Definition: Interaction.h:97
void initAllData()
Initialise all the data structure requires by the module.
Definition: Bluetooth.cpp:102
virtual void step(double dt, World *w)
On every timestep, send the commands recorded to the bluetooth Base to be executed.
Definition: Bluetooth.cpp:314
void changeMaxConnections(unsigned size)
Change the maximum number of simultaneous connections supported by this module.
Definition: Bluetooth.cpp:276
unsigned * destAddress
Addresses of the connected modules.
Definition: Bluetooth.h:78
unsigned getTxBufferSize()
Return the size of the transmission buffers.
Definition: Bluetooth.cpp:298
unsigned txBufferSize
Size of each buffer for the transmission of data.
Definition: Bluetooth.h:74
char connectionError
Flag indicating an error involving the connection toward another robot.
Definition: Bluetooth.h:97
bool didIReceive()
Indicate if data was received during the last step.
Definition: Bluetooth.cpp:150
unsigned * getTransmissionError()
Return the flags indicating on which connection a transmission error occured.
Definition: Bluetooth.cpp:261
void changeRxBufferSize(unsigned size)
Modify the size of the reception buffers.
Definition: Bluetooth.cpp:289
unsigned getNbConnections()
Return the number of established connections to other modules.
Definition: Bluetooth.cpp:140
The address used was unknown.
Definition: Bluetooth.h:117
unsigned * getConnectedAddresses()
Return the addresses of the other connected modules.
Definition: Bluetooth.cpp:145
The reception buffer is full and no additional data can be written.
Definition: Bluetooth.h:123
A robot is a PhysicalObject that has additional interactions and a controller.
Definition: PhysicalEngine.h:379