#include "MQTTClient/Wrapper/mqtt.h"
#include "driver/include/m2m_wifi.h"
#include "socket/include/socket.h"
#include "string.h"
Macros | |
#define | IPV4_BYTE(val, index) ((val >> (index * 8)) & 0xFF) |
Copyright (C) 2017 Microchip Technology Inc. More... | |
#define | MQTT_RX_POOL_SIZE 256 |
Functions | |
int | ConnectNetwork (Network *n, char *addr, int port, int TLSFlag) |
void | dnsResolveCallback (uint8_t *hostName, uint32_t hostIp) |
static bool | isMQTTSocket (SOCKET sock) |
void | NetworkInit (Network *n) |
void | SysTick_Handler (void) |
void | tcpClientSocketEventHandler (SOCKET sock, uint8_t u8Msg, void *pvMsg) |
void | TimerCountdown (Timer *timer, unsigned int timeout) |
void | TimerCountdownMS (Timer *timer, unsigned int timeout) |
void | TimerInit (Timer *timer) |
char | TimerIsExpired (Timer *timer) |
int | TimerLeftMS (Timer *timer) |
static void | WINC1500_disconnect (Network *n) |
static int | WINC1500_read (Network *n, unsigned char *buffer, int len, int timeout_ms) |
static int | WINC1500_write (Network *n, unsigned char *buffer, int len, int timeout_ms) |
Variables | |
static bool | gbMQTTBrokerConnected =false |
static bool | gbMQTTBrokerIpresolved =false |
static bool | gbMQTTBrokerRecvDone =false |
static bool | gbMQTTBrokerSendDone =false |
static unsigned char | gcMQTTRxFIFO [MQTT_RX_POOL_SIZE] |
static int32_t | gi32MQTTBrokerIp =0 |
static int32_t | gi32MQTTBrokerRxLen =0 |
static char * | gpcHostAddr |
static uint32_t | gu32MQTTRxFIFOLen =0 |
static uint32_t | gu32MQTTRxFIFOPtr =0 |
static unsigned long | MilliTimer =0 |
#define IPV4_BYTE | ( | val, | |
index | |||
) | ((val >> (index * 8)) & 0xFF) |
Copyright (C) 2017 Microchip Technology Inc.
and its subsidiaries (Microchip). All rights reserved.
You are permitted to use the software and its derivatives with Microchip products.
SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL OR EQUITABLE THEORY FOR ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, OR OTHER SIMILAR COSTS. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP AND ITS LICENSORS LIABILITY WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU PAID DIRECTLY TO MICROCHIP TO USE THIS SOFTWARE. MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE TERMS.
THIRD PARTY SOFTWARE: Notwithstanding anything to the contrary, any third party software accompanying this software is subject to the terms and conditions of the third party’s license agreement or open source software license. To the extent required by third party or open source licenses covering such third party software, the terms of such license will apply in lieu of the terms provided herein. To the extent the terms of such third party licenses prohibit any of the restrictions described herein, such restrictions will not apply to such third party software. THIRD PARTY SOFTWARE IS SUBJECT TO THE FOREGOING WARRANTY DISCLAIMER AND LIMIT ON LIABILITY PROVIDED IN THE PARAGRAPH ABOVE.
Referenced by dnsResolveCallback(), and resolve_cb().
#define MQTT_RX_POOL_SIZE 256 |
Referenced by WINC1500_read().
int ConnectNetwork | ( | Network * | n, |
char * | addr, | ||
int | port, | ||
int | TLSFlag | ||
) |
References _htons, addr, AF_INET, close(), connect(), gbMQTTBrokerConnected, gbMQTTBrokerIpresolved, gethostbyname(), gi32MQTTBrokerIp, gpcHostAddr, m2m_wifi_handle_events(), NULL, printf, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, SOCK_ERR_INVALID, SOCK_ERR_NO_ERROR, SOCK_STREAM, and socket().
Referenced by mqtt_connect().
void dnsResolveCallback | ( | uint8_t * | hostName, |
uint32_t | hostIp | ||
) |
References gbMQTTBrokerIpresolved, gi32MQTTBrokerIp, gpcHostAddr, IPV4_BYTE, and printf.
Referenced by mqtt_socket_resolve_handler().
References mqtt_client_pool::mqtt_instance, MQTT_MAX_CLIENTS, mqttClientPool, mqtt_module::network, and NULL.
Referenced by tcpClientSocketEventHandler().
void NetworkInit | ( | Network * | n | ) |
References Network::disconnect, Network::mqttread, Network::mqttwrite, WINC1500_disconnect(), WINC1500_read(), and WINC1500_write().
Referenced by mqtt_init().
void SysTick_Handler | ( | void | ) |
References MilliTimer.
void tcpClientSocketEventHandler | ( | SOCKET | sock, |
uint8_t | u8Msg, | ||
void * | pvMsg | ||
) |
References gbMQTTBrokerConnected, gbMQTTBrokerRecvDone, gbMQTTBrokerSendDone, gi32MQTTBrokerRxLen, isMQTTSocket(), printf, tstrSocketRecvMsg::s16BufferSize, SOCK_ERR_TIMEOUT, SOCKET_MSG_CONNECT, SOCKET_MSG_RECV, SOCKET_MSG_SEND, and tstrSocketRecvMsg::u16RemainingSize.
Referenced by mqtt_socket_event_handler().
void TimerCountdown | ( | Timer * | timer, |
unsigned int | timeout | ||
) |
References Timer::end_time, and MilliTimer.
Referenced by MQTTConnect(), and sendPacket().
void TimerCountdownMS | ( | Timer * | timer, |
unsigned int | timeout | ||
) |
References Timer::end_time, and MilliTimer.
Referenced by keepalive(), MQTTConnect(), MQTTDisconnect(), MQTTPublish(), MQTTRun(), MQTTSubscribe(), MQTTUnsubscribe(), and MQTTYield().
void TimerInit | ( | Timer * | timer | ) |
References Timer::end_time.
Referenced by keepalive(), MQTTClientInit(), MQTTConnect(), MQTTDisconnect(), MQTTPublish(), MQTTRun(), MQTTSubscribe(), MQTTUnsubscribe(), and MQTTYield().
char TimerIsExpired | ( | Timer * | timer | ) |
References Timer::end_time, and MilliTimer.
Referenced by keepalive(), MQTTYield(), sendPacket(), and waitfor().
int TimerLeftMS | ( | Timer * | timer | ) |
References Timer::end_time, and MilliTimer.
Referenced by readPacket(), and sendPacket().
|
static |
References close(), and gbMQTTBrokerConnected.
Referenced by NetworkInit().
|
static |
References gbMQTTBrokerRecvDone, gcMQTTRxFIFO, gi32MQTTBrokerRxLen, gu32MQTTRxFIFOLen, gu32MQTTRxFIFOPtr, i, len, m2m_wifi_handle_events(), MQTT_RX_POOL_SIZE, NULL, printf, recv(), and SOCK_ERR_NO_ERROR.
Referenced by NetworkInit().
|
static |
References gbMQTTBrokerSendDone, i, len, m2m_wifi_handle_events(), NULL, printf, send(), and SOCK_ERR_NO_ERROR.
Referenced by NetworkInit().
Referenced by ConnectNetwork(), tcpClientSocketEventHandler(), and WINC1500_disconnect().
Referenced by ConnectNetwork(), and dnsResolveCallback().
Referenced by tcpClientSocketEventHandler(), and WINC1500_read().
Referenced by tcpClientSocketEventHandler(), and WINC1500_write().
|
static |
Referenced by WINC1500_read().
|
static |
Referenced by ConnectNetwork(), and dnsResolveCallback().
|
static |
Referenced by tcpClientSocketEventHandler(), and WINC1500_read().
|
static |
Referenced by ConnectNetwork(), and dnsResolveCallback().
|
static |
Referenced by WINC1500_read().
|
static |
Referenced by WINC1500_read().
|
static |
Referenced by SysTick_Handler(), TimerCountdown(), TimerCountdownMS(), TimerIsExpired(), and TimerLeftMS().