Freaking markdown is so broken on GitLab...

This commit is contained in:
AMRowsell 2018-08-19 06:52:11 +00:00
commit 33cdfa54a9

View file

@ -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;