RoverPahoMQTT contains member functions to use rover as a client and to publish / subscribe to Eclipse Paho MQTT server topics.
More...
#include <rover_pahomqtt.hpp>
|
| void | createClient (void) |
| | Create the MQTT client object. More...
|
| |
| void | destroyClient (void) |
| | Destroy the MQTT client object. More...
|
| |
| void | flushFlags (void) |
| | Private member function to flush the connection flags for new operation. More...
|
| |
| void | constructAddress (void) |
| | Used for constructing the connection address by writing to private attribute my_address. More...
|
| |
| void | onConnect (MQTTAsync_successData *response) |
| | Member callback function for onPublisherConnect actions. More...
|
| |
| void | onPublisherSend (MQTTAsync_successData *response) |
| | Member callback function for onPublisherSend actions. More...
|
| |
| int | onSubscriberMessageArrived (char *topicName, int topicLen, MQTTAsync_message *message) |
| | Member callback function for onSubscriberMessageArrived actions. More...
|
| |
| void | onSubscribe (MQTTAsync_successData *response) |
| | Member callback function for onSubscribe actions. More...
|
| |
| void | onSubscribeFailure (MQTTAsync_failureData *response) |
| | Member callback function for onSubscribeFailure actions. More...
|
| |
| void | onConnectFailure (MQTTAsync_failureData *response) |
| | Member callback function for onConnectFailure actions. More...
|
| |
| void | onConnectionLost (char *cause) |
| | Member callback function for onConnectionLost actions. More...
|
| |
| void | onDisconnect (MQTTAsync_successData *response) |
| | Member callback function for onDisconnect actions. More...
|
| |
|
| static void | onConnect_Redirect (void *context, MQTTAsync_successData *response) |
| | Static function responsible for calling RoverPahoMQTT::onPublisherConnect in a given RoverPahoMQTT context. More...
|
| |
| static void | onPublisherSend_Redirect (void *context, MQTTAsync_successData *response) |
| | Static function responsible for calling RoverPahoMQTT::onPublisherSend in a given RoverPahoMQTT context. More...
|
| |
| static int | onSubscriberMessageArrived_Redirect (void *context, char *topicName, int topicLen, MQTTAsync_message *message) |
| | Static function responsible for calling RoverPahoMQTT::onSubscriberMessageArrived in a given RoverPahoMQTT context. More...
|
| |
| static void | onSubscribe_Redirect (void *context, MQTTAsync_successData *response) |
| | Static function responsible for calling RoverPahoMQTT::onSubscribe in a given RoverPahoMQTT context. More...
|
| |
| static void | onSubscribeFailure_Redirect (void *context, MQTTAsync_failureData *response) |
| | Static function responsible for calling RoverPahoMQTT::onSubscribeFailure in a given RoverPahoMQTT context. More...
|
| |
| static void | onConnectFailure_Redirect (void *context, MQTTAsync_failureData *response) |
| | Static function responsible for calling RoverPahoMQTT::onConnectFailure in a given RoverPahoMQTT context. More...
|
| |
| static void | onConnectionLost_Redirect (void *context, char *cause) |
| | Static function responsible for calling RoverPahoMQTT::onConnectionLost in a given RoverPahoMQTT context. More...
|
| |
| static void | onDisconnect_Redirect (void *context, MQTTAsync_successData *response) |
| | Static function responsible for calling RoverPahoMQTT::onDisconnect in a given RoverPahoMQTT context. More...
|
| |
RoverPahoMQTT contains member functions to use rover as a client and to publish / subscribe to Eclipse Paho MQTT server topics.
- Warning
- For oncreate examples please go to: https://github.com/app4mc-rover/rover-app/tree/master/src/examples
| rover::RoverPahoMQTT::~RoverPahoMQTT |
( |
| ) |
|
| rover::RoverPahoMQTT::RoverPahoMQTT |
( |
| ) |
|
| int rover::RoverPahoMQTT::connect |
( |
void |
| ) |
|
Used for connecting to MQTT broker asynchronously.
- Returns
- Return code 0-> success; others-> fail return codes
1: Connection refused: Unacceptable protocol version
2: Connection refused: Identifier rejected
3: Connection refused: Server unavailable
4: Connection refused: Bad user name or password
5: Connection refused: Not authorized
6-255: Reserved for future use
Reference: [paho.mqtt.c] Asynchronous MQTT Client Documentation
| void rover::RoverPahoMQTT::constructAddress |
( |
void |
| ) |
|
|
protected |
Used for constructing the connection address by writing to private attribute my_address.
- Returns
- void
| void rover::RoverPahoMQTT::createClient |
( |
void |
| ) |
|
|
protected |
Create the MQTT client object.
| void rover::RoverPahoMQTT::destroyClient |
( |
void |
| ) |
|
|
protected |
Destroy the MQTT client object.
| void rover::RoverPahoMQTT::flushFlags |
( |
void |
| ) |
|
|
protected |
Private member function to flush the connection flags for new operation.
- Returns
- void
| int rover::RoverPahoMQTT::getConnected |
( |
void |
| ) |
|
Returns connected flag.
- Returns
- connected flag 1:connected 0: not connected
| int rover::RoverPahoMQTT::isDataReady |
( |
void |
| ) |
|
Public member function checking if the subscribed data is ready. 0-> data ready -1-> data not ready.
| void rover::RoverPahoMQTT::onConnect |
( |
MQTTAsync_successData * |
response | ) |
|
|
protected |
Member callback function for onPublisherConnect actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onConnect_Redirect |
( |
void * |
context, |
|
|
MQTTAsync_successData * |
response |
|
) |
| |
|
staticprotected |
Static function responsible for calling RoverPahoMQTT::onPublisherConnect in a given RoverPahoMQTT context.
- Parameters
-
| context | Given context for RoverPahoMQTT. Internal use: this |
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onConnectFailure |
( |
MQTTAsync_failureData * |
response | ) |
|
|
protected |
Member callback function for onConnectFailure actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onConnectFailure_Redirect |
( |
void * |
context, |
|
|
MQTTAsync_failureData * |
response |
|
) |
| |
|
staticprotected |
| void rover::RoverPahoMQTT::onConnectionLost |
( |
char * |
cause | ) |
|
|
protected |
Member callback function for onConnectionLost actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onConnectionLost_Redirect |
( |
void * |
context, |
|
|
char * |
cause |
|
) |
| |
|
staticprotected |
| void rover::RoverPahoMQTT::onDisconnect |
( |
MQTTAsync_successData * |
response | ) |
|
|
protected |
Member callback function for onDisconnect actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onDisconnect_Redirect |
( |
void * |
context, |
|
|
MQTTAsync_successData * |
response |
|
) |
| |
|
staticprotected |
| void rover::RoverPahoMQTT::onPublisherSend |
( |
MQTTAsync_successData * |
response | ) |
|
|
protected |
Member callback function for onPublisherSend actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onPublisherSend_Redirect |
( |
void * |
context, |
|
|
MQTTAsync_successData * |
response |
|
) |
| |
|
staticprotected |
| void rover::RoverPahoMQTT::onSubscribe |
( |
MQTTAsync_successData * |
response | ) |
|
|
protected |
Member callback function for onSubscribe actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onSubscribe_Redirect |
( |
void * |
context, |
|
|
MQTTAsync_successData * |
response |
|
) |
| |
|
staticprotected |
| void rover::RoverPahoMQTT::onSubscribeFailure |
( |
MQTTAsync_failureData * |
response | ) |
|
|
protected |
Member callback function for onSubscribeFailure actions.
- Parameters
-
| response | Response data from MQTTAsync instance |
- Returns
- void
| void rover::RoverPahoMQTT::onSubscribeFailure_Redirect |
( |
void * |
context, |
|
|
MQTTAsync_failureData * |
response |
|
) |
| |
|
staticprotected |
| int rover::RoverPahoMQTT::onSubscriberMessageArrived |
( |
char * |
topicName, |
|
|
int |
topicLen, |
|
|
MQTTAsync_message * |
message |
|
) |
| |
|
protected |
Member callback function for onSubscriberMessageArrived actions.
- Parameters
-
| topicName | received topic name |
| topicLen | received topic name length |
| message | received message |
- Returns
- int
| int rover::RoverPahoMQTT::onSubscriberMessageArrived_Redirect |
( |
void * |
context, |
|
|
char * |
topicName, |
|
|
int |
topicLen, |
|
|
MQTTAsync_message * |
message |
|
) |
| |
|
staticprotected |
| int rover::RoverPahoMQTT::publish |
( |
void |
| ) |
|
Used for publishing to a topic in an MQTT-broker using asynchronous method.
- Returns
- Return code 0-> success; others-> fail return codes
1: Connection refused: Unacceptable protocol version
2: Connection refused: Identifier rejected
3: Connection refused: Server unavailable
4: Connection refused: Bad user name or password
5: Connection refused: Not authorized
6-255: Reserved for future use
Reference: [paho.mqtt.c] Asynchronous MQTT Client Documentation
| int rover::RoverPahoMQTT::read |
( |
char * |
data | ) |
|
Public member function for reading subscribed data. This function requires the RoverPahoMQTT to be subscribed first.
- Parameters
-
| data | char* Data pointer that will be modified. |
- Returns
- status: 0-> Successful read, 1-> No data available
| void rover::RoverPahoMQTT::setHostName |
( |
char * |
host_name | ) |
|
|
virtual |
| void rover::RoverPahoMQTT::setPayload |
( |
const char * |
payload, |
|
|
int |
payloadLen |
|
) |
| |
Sets payload.
- Parameters
-
| payload | Payload |
| payloadLen | Payload length |
| void rover::RoverPahoMQTT::setPort |
( |
const int |
port | ) |
|
|
virtual |
| void rover::RoverPahoMQTT::setTopic |
( |
char * |
topic | ) |
|
Sets topic name.
- Parameters
-
| int rover::RoverPahoMQTT::subscribe |
( |
void |
| ) |
|
Used for subscribing to a topic in an MQTT-broker. To unsubscribe use: RoverPahoMQTT::unsubscribe()
- Returns
- Return code 0-> success; others-> fail return codes 1: Connection refused: Unacceptable protocol version
2: Connection refused: Identifier rejected
3: Connection refused: Server unavailable
4: Connection refused: Bad user name or password
5: Connection refused: Not authorized
6-255: Reserved for future use
Reference: [paho.mqtt.c] Asynchronous MQTT Client Documentation
| int rover::RoverPahoMQTT::unsubscribe |
( |
void |
| ) |
|
Used for unsubscribing and disconnecting from a subscription to a topic in an MQTT-broker.
- Returns
- Return code 0-> success; others-> fail sreturn codes 1: Connection refused: Unacceptable protocol version
2: Connection refused: Identifier rejected
3: Connection refused: Server unavailable
4: Connection refused: Bad user name or password
5: Connection refused: Not authorized
6-255: Reserved for future use
Reference: [paho.mqtt.c] Asynchronous MQTT Client Documentation
| MQTTAsync rover::RoverPahoMQTT::client = NULL |
|
protected |
Client object from MQTTAsync.
| MQTTClient rover::RoverPahoMQTT::client2 |
|
protected |
Client object from MQTTClient.
| MQTTAsync_connectOptions rover::RoverPahoMQTT::conn_opts |
|
protected |
| int rover::RoverPahoMQTT::connected = 0 |
|
private |
Member attribute for return codes.
Member attribute for configuration data.
Member attribute for flags.
Member attribute for subscribed data.
| volatile MQTTAsync_token rover::RoverPahoMQTT::deliveredtoken |
|
protected |
| MQTTAsync_disconnectOptions rover::RoverPahoMQTT::disc_opts |
|
protected |
| char* rover::RoverPahoMQTT::HOST_NAME |
|
protected |
Host name used for connecting to the Eclipse Paho MQTT server.
| char rover::RoverPahoMQTT::my_address[100] = {} |
|
private |
| char* rover::RoverPahoMQTT::payload = {} |
|
private |
Payload pointer to manage memory.
| int rover::RoverPahoMQTT::PORT |
|
protected |
Port used for connecting to the Eclipse Paho MQTT server.
The documentation for this class was generated from the following files: