Update revision to use TI's mqtt and Freertos.

Dependencies:   mbed client server

Fork of cc3100_Test_mqtt_CM3 by David Fletcher

Committer:
dflet
Date:
Thu Sep 03 14:02:37 2015 +0000
Revision:
3:a8c249046181
SPI Mode change 1 to 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 3:a8c249046181 1 /*
dflet 3:a8c249046181 2 * - CC31xx/CC32xx Host Driver Implementation
dflet 3:a8c249046181 3 *
dflet 3:a8c249046181 4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 3:a8c249046181 5 *
dflet 3:a8c249046181 6 *
dflet 3:a8c249046181 7 * Redistribution and use in source and binary forms, with or without
dflet 3:a8c249046181 8 * modification, are permitted provided that the following conditions
dflet 3:a8c249046181 9 * are met:
dflet 3:a8c249046181 10 *
dflet 3:a8c249046181 11 * Redistributions of source code must retain the above copyright
dflet 3:a8c249046181 12 * notice, this list of conditions and the following disclaimer.
dflet 3:a8c249046181 13 *
dflet 3:a8c249046181 14 * Redistributions in binary form must reproduce the above copyright
dflet 3:a8c249046181 15 * notice, this list of conditions and the following disclaimer in the
dflet 3:a8c249046181 16 * documentation and/or other materials provided with the
dflet 3:a8c249046181 17 * distribution.
dflet 3:a8c249046181 18 *
dflet 3:a8c249046181 19 * Neither the name of Texas Instruments Incorporated nor the names of
dflet 3:a8c249046181 20 * its contributors may be used to endorse or promote products derived
dflet 3:a8c249046181 21 * from this software without specific prior written permission.
dflet 3:a8c249046181 22 *
dflet 3:a8c249046181 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 3:a8c249046181 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 3:a8c249046181 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 3:a8c249046181 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 3:a8c249046181 27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 3:a8c249046181 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 3:a8c249046181 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 3:a8c249046181 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 3:a8c249046181 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 3:a8c249046181 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 3:a8c249046181 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 3:a8c249046181 34 *
dflet 3:a8c249046181 35 */
dflet 3:a8c249046181 36
dflet 3:a8c249046181 37 #ifndef fPtr_func_h
dflet 3:a8c249046181 38 #define fPtr_func_h
dflet 3:a8c249046181 39
dflet 3:a8c249046181 40 #include "simplelink_V2/cc3100_simplelink.h"
dflet 3:a8c249046181 41
dflet 3:a8c249046181 42
dflet 3:a8c249046181 43 /* Note. C function pointers point to the functions below. */
dflet 3:a8c249046181 44 /* C++ member function pointers not used ? */
dflet 3:a8c249046181 45
dflet 3:a8c249046181 46 namespace mbed_cc3100 {
dflet 3:a8c249046181 47
dflet 3:a8c249046181 48
dflet 3:a8c249046181 49 extern uint32_t g_PingPacketsRecv;
dflet 3:a8c249046181 50 extern uint32_t g_GatewayIP;
dflet 3:a8c249046181 51 extern uint32_t g_StationIP;
dflet 3:a8c249046181 52 extern uint32_t g_DestinationIP;
dflet 3:a8c249046181 53 extern uint32_t g_BytesReceived; // variable to store the file size
dflet 3:a8c249046181 54 extern uint32_t g_Status;
dflet 3:a8c249046181 55 extern uint8_t g_buff[MAX_BUFF_SIZE+1];
dflet 3:a8c249046181 56 extern int32_t g_SockID;
dflet 3:a8c249046181 57
dflet 3:a8c249046181 58 }//namespace mbed_cc3100
dflet 3:a8c249046181 59
dflet 3:a8c249046181 60 using namespace mbed_cc3100;
dflet 3:a8c249046181 61
dflet 3:a8c249046181 62 #ifdef __cplusplus
dflet 3:a8c249046181 63 extern "C" {
dflet 3:a8c249046181 64 #endif
dflet 3:a8c249046181 65
dflet 3:a8c249046181 66
dflet 3:a8c249046181 67 void SimpleLinkPingReport(SlPingReport_t *pPingReport);
dflet 3:a8c249046181 68
dflet 3:a8c249046181 69 /*!
dflet 3:a8c249046181 70 \brief WLAN Async event handler
dflet 3:a8c249046181 71
dflet 3:a8c249046181 72 \param[out] pSlWlanEvent pointer to SlWlanEvent_t data
dflet 3:a8c249046181 73
dflet 3:a8c249046181 74 \par
dflet 3:a8c249046181 75 Parameters:
dflet 3:a8c249046181 76
dflet 3:a8c249046181 77 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECT_EVENT </b>, STA or P2P client connection indication event
dflet 3:a8c249046181 78 - pSlWlanEvent->EventData.STAandP2PModeWlanConnected main fields:
dflet 3:a8c249046181 79 - ssid_name
dflet 3:a8c249046181 80 - ssid_len
dflet 3:a8c249046181 81 - bssid
dflet 3:a8c249046181 82 - go_peer_device_name
dflet 3:a8c249046181 83 - go_peer_device_name_len
dflet 3:a8c249046181 84
dflet 3:a8c249046181 85 - <b>pSlWlanEvent->Event = SL_WLAN_DISCONNECT_EVENT </b>, STA or P2P client disconnection event
dflet 3:a8c249046181 86 - pSlWlanEvent->EventData.STAandP2PModeDisconnected main fields:
dflet 3:a8c249046181 87 - ssid_name
dflet 3:a8c249046181 88 - ssid_len
dflet 3:a8c249046181 89 - reason_code
dflet 3:a8c249046181 90
dflet 3:a8c249046181 91 - <b>pSlWlanEvent->Event = SL_WLAN_STA_CONNECTED_EVENT </b>, AP/P2P(Go) connected STA/P2P(Client)
dflet 3:a8c249046181 92 - pSlWlanEvent->EventData.APModeStaConnected fields:
dflet 3:a8c249046181 93 - go_peer_device_name
dflet 3:a8c249046181 94 - mac
dflet 3:a8c249046181 95 - go_peer_device_name_len
dflet 3:a8c249046181 96 - wps_dev_password_id
dflet 3:a8c249046181 97 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 98 - own_ssid_len: relevant for event sta-connected only
dflet 3:a8c249046181 99
dflet 3:a8c249046181 100 - <b>pSlWlanEvent->Event = SL_WLAN_STA_DISCONNECTED_EVENT </b>, AP/P2P(Go) disconnected STA/P2P(Client)
dflet 3:a8c249046181 101 - pSlWlanEvent->EventData.APModestaDisconnected fields:
dflet 3:a8c249046181 102 - go_peer_device_name
dflet 3:a8c249046181 103 - mac
dflet 3:a8c249046181 104 - go_peer_device_name_len
dflet 3:a8c249046181 105 - wps_dev_password_id
dflet 3:a8c249046181 106 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 107 - own_ssid_len: relevant for event sta-connected only
dflet 3:a8c249046181 108
dflet 3:a8c249046181 109 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT </b>
dflet 3:a8c249046181 110 - pSlWlanEvent->EventData.smartConfigStartResponse fields:
dflet 3:a8c249046181 111 - status
dflet 3:a8c249046181 112 - ssid_len
dflet 3:a8c249046181 113 - ssid
dflet 3:a8c249046181 114 - private_token_len
dflet 3:a8c249046181 115 - private_token
dflet 3:a8c249046181 116
dflet 3:a8c249046181 117 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_STOP_EVENT </b>
dflet 3:a8c249046181 118 - pSlWlanEvent->EventData.smartConfigStopResponse fields:
dflet 3:a8c249046181 119 - status
dflet 3:a8c249046181 120
dflet 3:a8c249046181 121 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_DEV_FOUND_EVENT </b>
dflet 3:a8c249046181 122 - pSlWlanEvent->EventData.P2PModeDevFound fields:
dflet 3:a8c249046181 123 - go_peer_device_name
dflet 3:a8c249046181 124 - mac
dflet 3:a8c249046181 125 - go_peer_device_name_len
dflet 3:a8c249046181 126 - wps_dev_password_id
dflet 3:a8c249046181 127 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 128 - own_ssid_len: relevant for event sta-connected only
dflet 3:a8c249046181 129
dflet 3:a8c249046181 130 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT </b>
dflet 3:a8c249046181 131 - pSlWlanEvent->EventData.P2PModeNegReqReceived fields
dflet 3:a8c249046181 132 - go_peer_device_name
dflet 3:a8c249046181 133 - mac
dflet 3:a8c249046181 134 - go_peer_device_name_len
dflet 3:a8c249046181 135 - wps_dev_password_id
dflet 3:a8c249046181 136 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 137
dflet 3:a8c249046181 138 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECTION_FAILED_EVENT </b>, P2P only
dflet 3:a8c249046181 139 - pSlWlanEvent->EventData.P2PModewlanConnectionFailure fields:
dflet 3:a8c249046181 140 - status
dflet 3:a8c249046181 141 */
dflet 3:a8c249046181 142 #if (defined(sl_WlanEvtHdlr))
dflet 3:a8c249046181 143 void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent);
dflet 3:a8c249046181 144 #endif
dflet 3:a8c249046181 145
dflet 3:a8c249046181 146 /*!
dflet 3:a8c249046181 147 \brief NETAPP Async event handler
dflet 3:a8c249046181 148
dflet 3:a8c249046181 149 \param[out] pSlNetApp pointer to SlNetAppEvent_t data
dflet 3:a8c249046181 150
dflet 3:a8c249046181 151 \par
dflet 3:a8c249046181 152 Parameters:
dflet 3:a8c249046181 153 - <b>pSlWlanEvent->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
dflet 3:a8c249046181 154 - pSlWlanEvent->EventData.ipAcquiredV4 fields:
dflet 3:a8c249046181 155 - ip
dflet 3:a8c249046181 156 - gateway
dflet 3:a8c249046181 157 - dns
dflet 3:a8c249046181 158
dflet 3:a8c249046181 159 - <b>pSlWlanEvent->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event
dflet 3:a8c249046181 160 - pSlWlanEvent->EventData.ipLeased fields:
dflet 3:a8c249046181 161 - ip_address
dflet 3:a8c249046181 162 - lease_time
dflet 3:a8c249046181 163 - mac
dflet 3:a8c249046181 164
dflet 3:a8c249046181 165 - <b>pSlWlanEvent->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event
dflet 3:a8c249046181 166 - pSlWlanEvent->EventData.ipReleased fields
dflet 3:a8c249046181 167 - ip_address
dflet 3:a8c249046181 168 - mac
dflet 3:a8c249046181 169 - reason
dflet 3:a8c249046181 170
dflet 3:a8c249046181 171 */
dflet 3:a8c249046181 172 #if (defined(sl_NetAppEvtHdlr))
dflet 3:a8c249046181 173 void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent);
dflet 3:a8c249046181 174 #endif
dflet 3:a8c249046181 175
dflet 3:a8c249046181 176 /*!
dflet 3:a8c249046181 177 \brief Socket Async event handler
dflet 3:a8c249046181 178
dflet 3:a8c249046181 179 \param[out] pSlSockEvent pointer to SlSockEvent_t data
dflet 3:a8c249046181 180
dflet 3:a8c249046181 181 \par
dflet 3:a8c249046181 182 Parameters:\n
dflet 3:a8c249046181 183 - <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b>
dflet 3:a8c249046181 184 - pSlSockEvent->EventData fields:
dflet 3:a8c249046181 185 - sd
dflet 3:a8c249046181 186 - status
dflet 3:a8c249046181 187 - <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b>
dflet 3:a8c249046181 188 - pSlSockEvent->EventData fields:
dflet 3:a8c249046181 189 - sd
dflet 3:a8c249046181 190 - type: SSL_ACCEPT or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED
dflet 3:a8c249046181 191 - val
dflet 3:a8c249046181 192
dflet 3:a8c249046181 193 */
dflet 3:a8c249046181 194 #if (defined(sl_SockEvtHdlr))
dflet 3:a8c249046181 195 void SimpleLinkSockEventHandler(SlSockEvent_t *pSock);
dflet 3:a8c249046181 196 #endif
dflet 3:a8c249046181 197
dflet 3:a8c249046181 198 void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent);
dflet 3:a8c249046181 199
dflet 3:a8c249046181 200 void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse);
dflet 3:a8c249046181 201 #ifndef SL_TINY_EXT
dflet 3:a8c249046181 202 void _sl_HandleAsync_Accept(void *pVoidBuf);
dflet 3:a8c249046181 203
dflet 3:a8c249046181 204 void _sl_HandleAsync_Select(void *pVoidBuf);
dflet 3:a8c249046181 205
dflet 3:a8c249046181 206 void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf);
dflet 3:a8c249046181 207
dflet 3:a8c249046181 208 void _sl_HandleAsync_PingResponse(void *pVoidBuf);
dflet 3:a8c249046181 209 #endif
dflet 3:a8c249046181 210 void _sl_HandleAsync_Connect(void *pVoidBuf);
dflet 3:a8c249046181 211
dflet 3:a8c249046181 212 void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf);
dflet 3:a8c249046181 213
dflet 3:a8c249046181 214 void _sl_HandleAsync_Stop(void *pVoidBuf);
dflet 3:a8c249046181 215
dflet 3:a8c249046181 216 _SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue);
dflet 3:a8c249046181 217
dflet 3:a8c249046181 218 void _SlDrvDeviceEventHandler(void *pArgs);
dflet 3:a8c249046181 219
dflet 3:a8c249046181 220 void _SlDrvNetAppEventHandler(void *pArgs);
dflet 3:a8c249046181 221
dflet 3:a8c249046181 222 void _SlDrvHandleHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse);
dflet 3:a8c249046181 223 void _SlDrvHandleSockEvents(SlSockEvent_t *slSockEvent);
dflet 3:a8c249046181 224 void _SlDrvHandleNetAppEvents(SlNetAppEvent_t *slNetAppEvent);
dflet 3:a8c249046181 225 void _SlDrvHandleWlanEvents(SlWlanEvent_t *slWlanEvent);
dflet 3:a8c249046181 226 void _SlDrvHandleGeneralEvents(SlDeviceEvent_t *slGeneralEvent);
dflet 3:a8c249046181 227
dflet 3:a8c249046181 228 #ifdef __cplusplus
dflet 3:a8c249046181 229 }
dflet 3:a8c249046181 230 #endif /* __cplusplus */
dflet 3:a8c249046181 231
dflet 3:a8c249046181 232 //}//namespace mbed_cc3100
dflet 3:a8c249046181 233
dflet 3:a8c249046181 234 #endif//fPtr_func_h
dflet 3:a8c249046181 235
dflet 3:a8c249046181 236
dflet 3:a8c249046181 237
dflet 3:a8c249046181 238
dflet 3:a8c249046181 239
dflet 3:a8c249046181 240
dflet 3:a8c249046181 241