![]() |
API
2.2
TSmarT Software Library
|
Functions | |
int | MQTTSerialize_connectLength (MQTTPacket_connectData *options) |
int | MQTTSerialize_connect (char *buf, int buflen, MQTTPacket_connectData *options) |
int | MQTTDeserialize_connack (int *connack_rc, char *buf, int buflen) |
int | MQTTSerialize_disconnect (char *buf, int buflen) |
int | MQTTPacket_checkVersion (MQTTString *protocol, int version) |
int | MQTTDeserialize_connect (MQTTPacket_connectData *data, char *buf, int len) |
int | MQTTSerialize_connack (char *buf, int buflen, int connack_rc) |
int | MQTTDeserialize_publish (int *dup, int *qos, int *retained, int *packetid, MQTTString *topicName, char **payload, int *payloadlen, char *buf, int buflen) |
int | MQTTDeserialize_ack (int *type, int *dup, int *packetid, char *buf, int buflen) |
int | MQTTPacket_encode (char *buf, int length) |
int | MQTTPacket_decode (int(*getcharfn)(char *, int), int *value) |
int | readInt (char **pptr) |
char | readChar (char **pptr) |
void | writeChar (char **pptr, char c) |
void | writeInt (char **pptr, int anInt) |
void | writeCString (char **pptr, char *string) |
int | readMQTTLenString (MQTTString *mqttstring, char **pptr, char *enddata) |
int | MQTTstrlen (MQTTString mqttstring) |
int | MQTTPacket_read (char *buf, int buflen, int(*getfn)(char *, int)) |
int | MQTTSerialize_publishLength (int qos, MQTTString topicName, int payloadlen) |
int | MQTTSerialize_publish (char *buf, int buflen, int dup, int qos, int retained, int packetid, MQTTString topicName, char *payload, int payloadlen) |
int | MQTTSerialize_ack (char *buf, int buflen, int type, int dup, int packetid) |
int | MQTTSerialize_puback (char *buf, int buflen, int packetid) |
int | MQTTSerialize_pubrel (char *buf, int buflen, int dup, int packetid) |
int | MQTTSerialize_pubcomp (char *buf, int buflen, int packetid) |
int | MQTTSerialize_subscribeLength (int count, MQTTString topicFilters[]) |
int | MQTTSerialize_subscribe (char *buf, int buflen, int dup, int packetid, int count, MQTTString topicFilters[], int requestedQoSs[]) |
int | MQTTDeserialize_suback (int *packetid, int maxcount, int *count, int grantedQoSs[], char *buf, int buflen) |
int | MQTTDeserialize_subscribe (int *dup, int *packetid, int maxcount, int *count, MQTTString topicFilters[], int requestedQoSs[], char *buf, int buflen) |
int | MQTTSerialize_suback (char *buf, int buflen, int packetid, int count, int *grantedQoSs) |
int | MQTTSerialize_unsubscribeLength (int count, MQTTString topicFilters[]) |
int | MQTTSerialize_unsubscribe (char *buf, int buflen, int dup, int packetid, int count, MQTTString topicFilters[]) |
int | MQTTDeserialize_unsuback (int *packetid, char *buf, int buflen) |
int | MQTTDeserialize_unsubscribe (int *dup, int *packetid, int maxcount, int *count, MQTTString topicFilters[], char *buf, int len) |
int | MQTTSerialize_unsuback (char *buf, int buflen, int packetid) |
int MQTTDeserialize_ack | ( | int * | type, |
int * | dup, | ||
int * | packetid, | ||
char * | buf, | ||
int | buflen | ||
) |
Deserializes the supplied (wire) buffer into an ack
type | returned integer - the MQTT packet type |
dup | returned integer - the MQTT dup flag |
packetid | returned integer - the MQTT packet identifier |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_connack | ( | int * | connack_rc, |
char * | buf, | ||
int | buflen | ||
) |
Deserializes the supplied (wire) buffer into connack data - return code
connack_rc | returned integer value of the connack return code |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_connect | ( | MQTTPacket_connectData * | data, |
char * | buf, | ||
int | len | ||
) |
Deserializes the supplied (wire) buffer into connect data structure
data | the connect data structure to be filled out |
buf | the raw buffer data, of the correct length determined by the remaining length field |
len | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_publish | ( | int * | dup, |
int * | qos, | ||
int * | retained, | ||
int * | packetid, | ||
MQTTString * | topicName, | ||
char ** | payload, | ||
int * | payloadlen, | ||
char * | buf, | ||
int | buflen | ||
) |
Deserializes the supplied (wire) buffer into publish data
dup | returned integer - the MQTT dup flag |
qos | returned integer - the MQTT QoS value |
retained | returned integer - the MQTT retained flag |
packetid | returned integer - the MQTT packet identifier |
topicName | returned MQTTString - the MQTT topic in the publish |
payload | returned byte buffer - the MQTT publish payload |
payloadlen | returned integer - the length of the MQTT payload |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_suback | ( | int * | packetid, |
int | maxcount, | ||
int * | count, | ||
int | grantedQoSs[], | ||
char * | buf, | ||
int | buflen | ||
) |
Deserializes the supplied (wire) buffer into suback data
packetid | returned integer - the MQTT packet identifier |
maxcount | - the maximum number of members allowed in the grantedQoSs array |
count | returned integer - number of members in the grantedQoSs array |
grantedQoSs | returned array of integers - the granted qualities of service |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_subscribe | ( | int * | dup, |
int * | packetid, | ||
int | maxcount, | ||
int * | count, | ||
MQTTString | topicFilters[], | ||
int | requestedQoSs[], | ||
char * | buf, | ||
int | buflen | ||
) |
Deserializes the supplied (wire) buffer into subscribe data
dup | integer returned - the MQTT dup flag |
packetid | integer returned - the MQTT packet identifier |
maxcount | - the maximum number of members allowed in the topicFilters and requestedQoSs arrays |
count | - number of members in the topicFilters and requestedQoSs arrays |
topicFilters | - array of topic filter names |
requestedQoSs | - array of requested QoS |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_unsuback | ( | int * | packetid, |
char * | buf, | ||
int | buflen | ||
) |
Deserializes the supplied (wire) buffer into unsuback data
packetid | returned integer - the MQTT packet identifier |
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
int MQTTDeserialize_unsubscribe | ( | int * | dup, |
int * | packetid, | ||
int | maxcount, | ||
int * | count, | ||
MQTTString | topicFilters[], | ||
char * | buf, | ||
int | len | ||
) |
Deserializes the supplied (wire) buffer into unsubscribe data
dup | integer returned - the MQTT dup flag |
packetid | integer returned - the MQTT packet identifier |
maxcount | - the maximum number of members allowed in the topicFilters and requestedQoSs arrays |
count | - number of members in the topicFilters and requestedQoSs arrays |
topicFilters | - array of topic filter names |
buf | the raw buffer data, of the correct length determined by the remaining length field |
len | the length in bytes of the data in the supplied buffer |
int MQTTPacket_checkVersion | ( | MQTTString * | protocol, |
int | version | ||
) |
Validates MQTT protocol name and version combinations
protocol | the MQTT protocol name as an MQTTString |
version | the MQTT protocol version number, as in the connect packet |
int MQTTPacket_decode | ( | int(*)(char *, int) | getcharfn, |
int * | value | ||
) |
Decodes the message length according to the MQTT algorithm
getcharfn | pointer to function to read the next character from the data source |
value | the decoded length returned |
int MQTTPacket_encode | ( | char * | buf, |
int | length | ||
) |
Encodes the message length according to the MQTT algorithm
buf | the buffer into which the encoded data is written |
length | the length to be encoded |
int MQTTPacket_read | ( | char * | buf, |
int | buflen, | ||
int(*)(char *, int) | getfn | ||
) |
Helper function to read packet data from some source into a buffer
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
getfn | pointer to a function which will read any number of bytes from the needed source |
int MQTTSerialize_ack | ( | char * | buf, |
int | buflen, | ||
int | type, | ||
int | dup, | ||
int | packetid | ||
) |
Serializes the ack packet into the supplied buffer.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
type | integer - the MQTT packet type |
dup | integer - the MQTT dup flag |
packetid | integer - the MQTT packet identifier |
int MQTTSerialize_connack | ( | char * | buf, |
int | buflen, | ||
int | connack_rc | ||
) |
Serializes the connack packet into the supplied buffer.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
connack_rc | the integer connack return code to be used |
int MQTTSerialize_connect | ( | char * | buf, |
int | buflen, | ||
MQTTPacket_connectData * | options | ||
) |
Serializes the connect options into the buffer.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
options | the options to be used to build the connect packet |
int MQTTSerialize_connectLength | ( | MQTTPacket_connectData * | options | ) |
Determines the length of the MQTT connect packet that would be produced using the supplied connect options.
options | the options to be used to build the connect packet |
int MQTTSerialize_disconnect | ( | char * | buf, |
int | buflen | ||
) |
Serializes a disconnect packet into the supplied buffer, ready for writing to a socket
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer, to avoid overruns |
int MQTTSerialize_puback | ( | char * | buf, |
int | buflen, | ||
int | packetid | ||
) |
Serializes a puback packet into the supplied buffer.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
packetid | integer - the MQTT packet identifier |
int MQTTSerialize_pubcomp | ( | char * | buf, |
int | buflen, | ||
int | packetid | ||
) |
Serializes a pubrel packet into the supplied buffer.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
packetid | integer - the MQTT packet identifier |
int MQTTSerialize_publish | ( | char * | buf, |
int | buflen, | ||
int | dup, | ||
int | qos, | ||
int | retained, | ||
int | packetid, | ||
MQTTString | topicName, | ||
char * | payload, | ||
int | payloadlen | ||
) |
Serializes the supplied publish data into the supplied buffer, ready for sending
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
dup | integer - the MQTT dup flag |
qos | integer - the MQTT QoS value |
retained | integer - the MQTT retained flag |
packetid | integer - the MQTT packet identifier |
topicName | MQTTString - the MQTT topic in the publish |
payload | byte buffer - the MQTT publish payload |
payloadlen | integer - the length of the MQTT payload |
int MQTTSerialize_publishLength | ( | int | qos, |
MQTTString | topicName, | ||
int | payloadlen | ||
) |
Determines the length of the MQTT publish packet that would be produced using the supplied parameters
qos | the MQTT QoS of the publish (packetid is omitted for QoS 0) |
topicName | the topic name to be used in the publish |
payloadlen | the length of the payload to be sent |
int MQTTSerialize_pubrel | ( | char * | buf, |
int | buflen, | ||
int | dup, | ||
int | packetid | ||
) |
Serializes a pubrel packet into the supplied buffer.
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
dup | integer - the MQTT dup flag |
packetid | integer - the MQTT packet identifier |
int MQTTSerialize_suback | ( | char * | buf, |
int | buflen, | ||
int | packetid, | ||
int | count, | ||
int * | grantedQoSs | ||
) |
Serializes the supplied suback data into the supplied buffer, ready for sending
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
packetid | integer - the MQTT packet identifier |
count | - number of members in the grantedQoSs array |
grantedQoSs | - array of granted QoS |
int MQTTSerialize_subscribe | ( | char * | buf, |
int | buflen, | ||
int | dup, | ||
int | packetid, | ||
int | count, | ||
MQTTString | topicFilters[], | ||
int | requestedQoSs[] | ||
) |
Serializes the supplied subscribe data into the supplied buffer, ready for sending
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied bufferr |
dup | integer - the MQTT dup flag |
packetid | integer - the MQTT packet identifier |
count | - number of members in the topicFilters and reqQos arrays |
topicFilters | - array of topic filter names |
requestedQoSs | - array of requested QoS |
int MQTTSerialize_subscribeLength | ( | int | count, |
MQTTString | topicFilters[] | ||
) |
Determines the length of the MQTT subscribe packet that would be produced using the supplied parameters
count | the number of topic filter strings in topicFilters |
topicFilters | the array of topic filter strings to be used in the publish |
int MQTTSerialize_unsuback | ( | char * | buf, |
int | buflen, | ||
int | packetid | ||
) |
Serializes the supplied unsuback data into the supplied buffer, ready for sending
buf | the buffer into which the packet will be serialized |
buflen | the length in bytes of the supplied buffer |
packetid | integer - the MQTT packet identifier |
int MQTTSerialize_unsubscribe | ( | char * | buf, |
int | buflen, | ||
int | dup, | ||
int | packetid, | ||
int | count, | ||
MQTTString | topicFilters[] | ||
) |
Serializes the supplied unsubscribe data into the supplied buffer, ready for sending
buf | the raw buffer data, of the correct length determined by the remaining length field |
buflen | the length in bytes of the data in the supplied buffer |
dup | integer - the MQTT dup flag |
packetid | integer - the MQTT packet identifier |
count | - number of members in the topicFilters array |
topicFilters | - array of topic filter names |
int MQTTSerialize_unsubscribeLength | ( | int | count, |
MQTTString | topicFilters[] | ||
) |
Determines the length of the MQTT unsubscribe packet that would be produced using the supplied parameters
count | the number of topic filter strings in topicFilters |
topicFilters | the array of topic filter strings to be used in the publish |
int MQTTstrlen | ( | MQTTString | mqttstring | ) |
Return the length of the MQTTstring - C string if there is one, otherwise the length delimited string
mqttstring | the string to return the length of |
char readChar | ( | char ** | pptr | ) |
Reads one character from the input buffer.
pptr | pointer to the input buffer - incremented by the number of bytes used & returned |
int readInt | ( | char ** | pptr | ) |
Calculates an integer from two bytes read from the input buffer
pptr | pointer to the input buffer - incremented by the number of bytes used & returned |
int readMQTTLenString | ( | MQTTString * | mqttstring, |
char ** | pptr, | ||
char * | enddata | ||
) |
mqttstring | the MQTTString structure into which the data is to be read |
pptr | pointer to the output buffer - incremented by the number of bytes used & returned |
enddata | pointer to the end of the data: do not read beyond |
void writeChar | ( | char ** | pptr, |
char | c | ||
) |
Writes one character to an output buffer.
pptr | pointer to the output buffer - incremented by the number of bytes used & returned |
c | the character to write |
void writeCString | ( | char ** | pptr, |
char * | string | ||
) |
Writes a "UTF" string to an output buffer. Converts C string to length-delimited.
pptr | pointer to the output buffer - incremented by the number of bytes used & returned |
string | the C string to write |
void writeInt | ( | char ** | pptr, |
int | anInt | ||
) |
Writes an integer as 2 bytes to an output buffer.
pptr | pointer to the output buffer - incremented by the number of bytes used & returned |
anInt | the integer to write |