cloud/mqtt_demo/mqtt_demo_common.h

/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#pragma once
#include "gos.h"
#include "mqtt.h"
#include "string.h"
#define MQTT_DEMO_SETTINGS_MAGIC 0xAABBCCDD
#define MIN_BUFFER_SIZE 256
#define MAX_BUFFER_SIZE 65535
// Settings struct for saving to NVM
typedef struct
{
uint32_t magic; // Magic number to verify memory is initialized
gos_mqtt_configuration_t configuration;
gos_mqtt_will_t will;
char will_message[MAX_WILL_MESSAGE_LENGTH];
} mqtt_demo_settings_t;
// Variables for CLI MQTT instance
extern gos_mqtt_handle_t mqtt_handle;
extern gos_mqtt_configuration_t* mqtt_configuration;
extern gos_mqtt_will_t* mqtt_will;
extern mqtt_demo_settings_t* settings;
void default_incoming_message_handler(gos_mqtt_handle_t handle, gos_mqtt_message_t* message);