Microchip® Advanced Software Framework

mqtt-example.c File Reference
#include <string.h>
#include "thsq.h"
#include "netstack-aes.h"
#include "dev/button-sensor.h"
#include "rpl/rpl-private.h"
#include "port.h"
#include "asf.h"
#include "mqtt.h"
#include "battery-sensor.h"
#include "sam0_sensors.h"

Macros

#define HOST   "m2m.eclipse.org"
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define PRIORITY   "p0"
 
#define SEND_INTERVAL   (60 * CLOCK_SECOND)
 
#define UUID   "atmeld"
 
#define VERSION   "v1"
 

Functions

static void mqtt_event (struct mqtt_connection *m, mqtt_event_t event, void *data)
 
 PROCESS (mqtt_example_process,"MQTT Example")
 
 PROCESS_THREAD (mqtt_example_process, ev, data)
 

Variables

static char app_buffer [128]
 
static char batt_str [8]
 
static struct sensors_sensorbattery = NULL
 
static uint16_t button_sensor_value =0
 
static char clientid [16]
 
static struct mqtt_connection conn
 
static uip_ipaddr_t google_ipv4_dns_server
 
static process_event_t led_updates_changed_event
 
static char mac_adr_str [18]
 
AUTOSTART_PROCESSESmqtt_example_process
 
static struct mqtt_messagemsg_ptr = 0
 
static uint16_t nodeid
 
static process_event_t reconnect_event
 
static struct etimer reconnect_timer
 
static uint8_t reconnecting = 0
 
static struct etimer sensor_timer
 
char str [48]
 
static char str_topic_led [30]
 
static char str_topic_sensor [30]
 
static char str_topic_state [30]
 
volatile float temp_C
 
float temp_F
 
volatile double temp_res
 
static char temp_str [8]
 

#define HOST   "m2m.eclipse.org"

Referenced by PROCESS_THREAD().

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))
#define PRIORITY   "p0"

Referenced by PROCESS_THREAD().

#define SEND_INTERVAL   (60 * CLOCK_SECOND)
#define UUID   "atmeld"

Referenced by PROCESS_THREAD().

#define VERSION   "v1"

Referenced by PROCESS_THREAD().

PROCESS ( mqtt_example_process  ,
"MQTT Example"   
)

char app_buffer[128]
static

Referenced by PROCESS_THREAD().

char batt_str[8]
static

Referenced by PROCESS_THREAD().

struct sensors_sensor* battery = NULL
static
uint16_t button_sensor_value =0
static

Referenced by PROCESS_THREAD().

char clientid[16]
static

Referenced by PROCESS_THREAD().

uip_ipaddr_t google_ipv4_dns_server
static
Initial value:
= {
.u8 = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff,
0x08, 0x08, 0x08, 0x08,
}
}
process_event_t led_updates_changed_event
static

Referenced by PROCESS_THREAD().

char mac_adr_str[18]
static

Referenced by PROCESS_THREAD().

AUTOSTART_PROCESSES& mqtt_example_process

Referenced by PROCESS_THREAD().

struct mqtt_message* msg_ptr = 0
static
uint16_t nodeid
static

Referenced by PROCESS_THREAD().

process_event_t reconnect_event
static

Referenced by PROCESS_THREAD().

struct etimer reconnect_timer
static

Referenced by PROCESS_THREAD().

uint8_t reconnecting = 0
static

Referenced by PROCESS_THREAD().

struct etimer sensor_timer
static

Referenced by PROCESS_THREAD().

char str_topic_led[30]
static

Referenced by mqtt_event(), and PROCESS_THREAD().

char str_topic_sensor[30]
static

Referenced by PROCESS_THREAD().

char str_topic_state[30]
static

Referenced by PROCESS_THREAD().

volatile float temp_C
float temp_F
volatile double temp_res
char temp_str[8]
static

Referenced by PROCESS_THREAD().