Freaking markdown is so broken on GitLab...
This commit is contained in:
parent
dd332ba337
commit
33cdfa54a9
1 changed files with 4 additions and 2 deletions
|
@ -36,7 +36,8 @@ This is the main structure that contains all the information about the connectio
|
|||
|
||||
This is the only function that needs to be called by the user. You pass the `mqtt_session_t` that you have created with all the fields filled in, you pass `*data` if you are publishing (NULL otherwise), len which is the length of `*data` (again, only if publishing, 0 otherwise), and then the message type you want to send, which is one of these enums:
|
||||
|
||||
```typedef enum mqtt_message_enum
|
||||
```
|
||||
typedef enum mqtt_message_enum
|
||||
{
|
||||
MQTT_MSG_TYPE_CONNECT = 1,
|
||||
MQTT_MSG_TYPE_CONNACK = 2,
|
||||
|
@ -59,7 +60,8 @@ Obviously, the user will only be choosing CONNECT, PUBLISH, SUBSCRIBE, UNSUBSCRI
|
|||
|
||||
Due to a strange bug with the way pointers to strings are passed between functions, all the fields in the `mqtt_session_t` need to be allocated and have their contents memcpy'd. They also need to be in hex format. This is a pain in the butt, so there is an included Python 3 script to create the arrays for you. Running it is as simple as the following:
|
||||
|
||||
```$ chmod +x strtoarr.py
|
||||
```
|
||||
$ chmod +x strtoarr.py
|
||||
$ ./strtoarr.py MyUsername username
|
||||
static const char username[10] = { 0x4d, 0x79, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65 };
|
||||
static const uint8_t username_len = 10;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue