From 33cdfa54a95f02b10e25c4b43b81d8668fb2ad12 Mon Sep 17 00:00:00 2001 From: AMRowsell Date: Sun, 19 Aug 2018 06:52:11 +0000 Subject: [PATCH] Freaking markdown is so broken on GitLab... --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 247d294..a8a2036 100644 --- a/README.md +++ b/README.md @@ -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;