TI's CC3100. A test demo with very little testing done!
Fork of cc3100_Test_Demo2 by
simplelink/G_functions/fPtr_func.cpp@5:d3b320ebd469, 2015-03-19 (annotated)
- Committer:
- dflet
- Date:
- Thu Mar 19 14:35:32 2015 +0000
- Revision:
- 5:d3b320ebd469
- Child:
- 7:0687d16b9781
Updated to CC3100SDK1.1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dflet | 5:d3b320ebd469 | 1 | /* |
dflet | 5:d3b320ebd469 | 2 | * - CC31xx/CC32xx Host Driver Implementation |
dflet | 5:d3b320ebd469 | 3 | * |
dflet | 5:d3b320ebd469 | 4 | * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ |
dflet | 5:d3b320ebd469 | 5 | * |
dflet | 5:d3b320ebd469 | 6 | * |
dflet | 5:d3b320ebd469 | 7 | * Redistribution and use in source and binary forms, with or without |
dflet | 5:d3b320ebd469 | 8 | * modification, are permitted provided that the following conditions |
dflet | 5:d3b320ebd469 | 9 | * are met: |
dflet | 5:d3b320ebd469 | 10 | * |
dflet | 5:d3b320ebd469 | 11 | * Redistributions of source code must retain the above copyright |
dflet | 5:d3b320ebd469 | 12 | * notice, this list of conditions and the following disclaimer. |
dflet | 5:d3b320ebd469 | 13 | * |
dflet | 5:d3b320ebd469 | 14 | * Redistributions in binary form must reproduce the above copyright |
dflet | 5:d3b320ebd469 | 15 | * notice, this list of conditions and the following disclaimer in the |
dflet | 5:d3b320ebd469 | 16 | * documentation and/or other materials provided with the |
dflet | 5:d3b320ebd469 | 17 | * distribution. |
dflet | 5:d3b320ebd469 | 18 | * |
dflet | 5:d3b320ebd469 | 19 | * Neither the name of Texas Instruments Incorporated nor the names of |
dflet | 5:d3b320ebd469 | 20 | * its contributors may be used to endorse or promote products derived |
dflet | 5:d3b320ebd469 | 21 | * from this software without specific prior written permission. |
dflet | 5:d3b320ebd469 | 22 | * |
dflet | 5:d3b320ebd469 | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
dflet | 5:d3b320ebd469 | 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
dflet | 5:d3b320ebd469 | 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
dflet | 5:d3b320ebd469 | 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
dflet | 5:d3b320ebd469 | 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
dflet | 5:d3b320ebd469 | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
dflet | 5:d3b320ebd469 | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
dflet | 5:d3b320ebd469 | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
dflet | 5:d3b320ebd469 | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
dflet | 5:d3b320ebd469 | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
dflet | 5:d3b320ebd469 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
dflet | 5:d3b320ebd469 | 34 | * |
dflet | 5:d3b320ebd469 | 35 | */ |
dflet | 5:d3b320ebd469 | 36 | |
dflet | 5:d3b320ebd469 | 37 | #include "cc3100_simplelink.h" |
dflet | 5:d3b320ebd469 | 38 | |
dflet | 5:d3b320ebd469 | 39 | #include "cc3100.h" |
dflet | 5:d3b320ebd469 | 40 | #include "cc3100_driver.h" |
dflet | 5:d3b320ebd469 | 41 | #include "fPtr_func.h" |
dflet | 5:d3b320ebd469 | 42 | |
dflet | 5:d3b320ebd469 | 43 | |
dflet | 5:d3b320ebd469 | 44 | using namespace mbed_cc3100; |
dflet | 5:d3b320ebd469 | 45 | |
dflet | 5:d3b320ebd469 | 46 | cc3100_driver *_driver; |
dflet | 5:d3b320ebd469 | 47 | cc3100_nonos *_nonos; |
dflet | 5:d3b320ebd469 | 48 | cc3100_netapp *_netapp; |
dflet | 5:d3b320ebd469 | 49 | cc3100 *_cc3100_; |
dflet | 5:d3b320ebd469 | 50 | |
dflet | 5:d3b320ebd469 | 51 | #ifdef __cplusplus |
dflet | 5:d3b320ebd469 | 52 | extern "C" { |
dflet | 5:d3b320ebd469 | 53 | #endif |
dflet | 5:d3b320ebd469 | 54 | |
dflet | 5:d3b320ebd469 | 55 | /* General Events handling*/ |
dflet | 5:d3b320ebd469 | 56 | #if defined (EXT_LIB_REGISTERED_GENERAL_EVENTS) |
dflet | 5:d3b320ebd469 | 57 | |
dflet | 5:d3b320ebd469 | 58 | typedef _SlEventPropogationStatus_e (*general_callback) (SlDeviceEvent_t *); |
dflet | 5:d3b320ebd469 | 59 | |
dflet | 5:d3b320ebd469 | 60 | static const general_callback general_callbacks[] = |
dflet | 5:d3b320ebd469 | 61 | { |
dflet | 5:d3b320ebd469 | 62 | #ifdef SlExtLib1GeneralEventHandler |
dflet | 5:d3b320ebd469 | 63 | SlExtLib1GeneralEventHandler, |
dflet | 5:d3b320ebd469 | 64 | #endif |
dflet | 5:d3b320ebd469 | 65 | |
dflet | 5:d3b320ebd469 | 66 | #ifdef SlExtLib2GeneralEventHandler |
dflet | 5:d3b320ebd469 | 67 | SlExtLib2GeneralEventHandler, |
dflet | 5:d3b320ebd469 | 68 | #endif |
dflet | 5:d3b320ebd469 | 69 | |
dflet | 5:d3b320ebd469 | 70 | #ifdef SlExtLib3GeneralEventHandler |
dflet | 5:d3b320ebd469 | 71 | SlExtLib3GeneralEventHandler, |
dflet | 5:d3b320ebd469 | 72 | #endif |
dflet | 5:d3b320ebd469 | 73 | |
dflet | 5:d3b320ebd469 | 74 | #ifdef SlExtLib4GeneralEventHandler |
dflet | 5:d3b320ebd469 | 75 | SlExtLib4GeneralEventHandler, |
dflet | 5:d3b320ebd469 | 76 | #endif |
dflet | 5:d3b320ebd469 | 77 | |
dflet | 5:d3b320ebd469 | 78 | #ifdef SlExtLib5GeneralEventHandler |
dflet | 5:d3b320ebd469 | 79 | SlExtLib5GeneralEventHandler, |
dflet | 5:d3b320ebd469 | 80 | #endif |
dflet | 5:d3b320ebd469 | 81 | }; |
dflet | 5:d3b320ebd469 | 82 | |
dflet | 5:d3b320ebd469 | 83 | #undef _SlDrvHandleGeneralEvents |
dflet | 5:d3b320ebd469 | 84 | |
dflet | 5:d3b320ebd469 | 85 | /******************************************************************** |
dflet | 5:d3b320ebd469 | 86 | _SlDrvHandleGeneralEvents |
dflet | 5:d3b320ebd469 | 87 | Iterates through all the general(device) event handlers which are |
dflet | 5:d3b320ebd469 | 88 | registered by the external libs/user application. |
dflet | 5:d3b320ebd469 | 89 | *********************************************************************/ |
dflet | 5:d3b320ebd469 | 90 | void _SlDrvHandleGeneralEvents(SlDeviceEvent_t *slGeneralEvent) |
dflet | 5:d3b320ebd469 | 91 | { |
dflet | 5:d3b320ebd469 | 92 | uint8_t i; |
dflet | 5:d3b320ebd469 | 93 | |
dflet | 5:d3b320ebd469 | 94 | /* Iterate over all the extenal libs handlers */ |
dflet | 5:d3b320ebd469 | 95 | for ( i = 0 ; i < sizeof(general_callbacks)/sizeof(general_callbacks[0]) ; i++ ) |
dflet | 5:d3b320ebd469 | 96 | { |
dflet | 5:d3b320ebd469 | 97 | if (EVENT_PROPAGATION_BLOCK == general_callbacks[i](slGeneralEvent) ) |
dflet | 5:d3b320ebd469 | 98 | { |
dflet | 5:d3b320ebd469 | 99 | /* exit immediately and do not call the user specific handler as well */ |
dflet | 5:d3b320ebd469 | 100 | return; |
dflet | 5:d3b320ebd469 | 101 | } |
dflet | 5:d3b320ebd469 | 102 | } |
dflet | 5:d3b320ebd469 | 103 | |
dflet | 5:d3b320ebd469 | 104 | /* At last call the Application specific handler if registered */ |
dflet | 5:d3b320ebd469 | 105 | #ifdef sl_GeneralEvtHdlr |
dflet | 5:d3b320ebd469 | 106 | sl_GeneralEvtHdlr(slGeneralEvent); |
dflet | 5:d3b320ebd469 | 107 | #endif |
dflet | 5:d3b320ebd469 | 108 | |
dflet | 5:d3b320ebd469 | 109 | } |
dflet | 5:d3b320ebd469 | 110 | #endif |
dflet | 5:d3b320ebd469 | 111 | |
dflet | 5:d3b320ebd469 | 112 | |
dflet | 5:d3b320ebd469 | 113 | |
dflet | 5:d3b320ebd469 | 114 | /* WLAN Events handling*/ |
dflet | 5:d3b320ebd469 | 115 | |
dflet | 5:d3b320ebd469 | 116 | #if defined (EXT_LIB_REGISTERED_WLAN_EVENTS) |
dflet | 5:d3b320ebd469 | 117 | |
dflet | 5:d3b320ebd469 | 118 | typedef _SlEventPropogationStatus_e (*wlan_callback) (SlWlanEvent_t *); |
dflet | 5:d3b320ebd469 | 119 | |
dflet | 5:d3b320ebd469 | 120 | static wlan_callback wlan_callbacks[] = |
dflet | 5:d3b320ebd469 | 121 | { |
dflet | 5:d3b320ebd469 | 122 | #ifdef SlExtLib1WlanEventHandler |
dflet | 5:d3b320ebd469 | 123 | SlExtLib1WlanEventHandler, |
dflet | 5:d3b320ebd469 | 124 | #endif |
dflet | 5:d3b320ebd469 | 125 | |
dflet | 5:d3b320ebd469 | 126 | #ifdef SlExtLib2WlanEventHandler |
dflet | 5:d3b320ebd469 | 127 | SlExtLib2WlanEventHandler, |
dflet | 5:d3b320ebd469 | 128 | #endif |
dflet | 5:d3b320ebd469 | 129 | |
dflet | 5:d3b320ebd469 | 130 | #ifdef SlExtLib3WlanEventHandler |
dflet | 5:d3b320ebd469 | 131 | SlExtLib3WlanEventHandler, |
dflet | 5:d3b320ebd469 | 132 | #endif |
dflet | 5:d3b320ebd469 | 133 | |
dflet | 5:d3b320ebd469 | 134 | #ifdef SlExtLib4WlanEventHandler |
dflet | 5:d3b320ebd469 | 135 | SlExtLib4WlanEventHandler, |
dflet | 5:d3b320ebd469 | 136 | #endif |
dflet | 5:d3b320ebd469 | 137 | |
dflet | 5:d3b320ebd469 | 138 | #ifdef SlExtLib5WlanEventHandler |
dflet | 5:d3b320ebd469 | 139 | SlExtLib5WlanEventHandler, |
dflet | 5:d3b320ebd469 | 140 | #endif |
dflet | 5:d3b320ebd469 | 141 | }; |
dflet | 5:d3b320ebd469 | 142 | |
dflet | 5:d3b320ebd469 | 143 | #undef _SlDrvHandleWlanEvents |
dflet | 5:d3b320ebd469 | 144 | |
dflet | 5:d3b320ebd469 | 145 | /*********************************************************** |
dflet | 5:d3b320ebd469 | 146 | _SlDrvHandleWlanEvents |
dflet | 5:d3b320ebd469 | 147 | Iterates through all the wlan event handlers which are |
dflet | 5:d3b320ebd469 | 148 | registered by the external libs/user application. |
dflet | 5:d3b320ebd469 | 149 | ************************************************************/ |
dflet | 5:d3b320ebd469 | 150 | void _SlDrvHandleWlanEvents(SlWlanEvent_t *slWlanEvent) |
dflet | 5:d3b320ebd469 | 151 | { |
dflet | 5:d3b320ebd469 | 152 | uint8_t i; |
dflet | 5:d3b320ebd469 | 153 | |
dflet | 5:d3b320ebd469 | 154 | /* Iterate over all the extenal libs handlers */ |
dflet | 5:d3b320ebd469 | 155 | for ( i = 0 ; i < sizeof(wlan_callbacks)/sizeof(wlan_callbacks[0]) ; i++ ) |
dflet | 5:d3b320ebd469 | 156 | { |
dflet | 5:d3b320ebd469 | 157 | if ( EVENT_PROPAGATION_BLOCK == wlan_callbacks[i](slWlanEvent) ) |
dflet | 5:d3b320ebd469 | 158 | { |
dflet | 5:d3b320ebd469 | 159 | /* exit immediately and do not call the user specific handler as well */ |
dflet | 5:d3b320ebd469 | 160 | return; |
dflet | 5:d3b320ebd469 | 161 | } |
dflet | 5:d3b320ebd469 | 162 | } |
dflet | 5:d3b320ebd469 | 163 | |
dflet | 5:d3b320ebd469 | 164 | /* At last call the Application specific handler if registered */ |
dflet | 5:d3b320ebd469 | 165 | #ifdef sl_WlanEvtHdlr |
dflet | 5:d3b320ebd469 | 166 | sl_WlanEvtHdlr(slWlanEvent); |
dflet | 5:d3b320ebd469 | 167 | #endif |
dflet | 5:d3b320ebd469 | 168 | |
dflet | 5:d3b320ebd469 | 169 | } |
dflet | 5:d3b320ebd469 | 170 | #endif |
dflet | 5:d3b320ebd469 | 171 | |
dflet | 5:d3b320ebd469 | 172 | |
dflet | 5:d3b320ebd469 | 173 | /* NetApp Events handling */ |
dflet | 5:d3b320ebd469 | 174 | #if defined (EXT_LIB_REGISTERED_NETAPP_EVENTS) |
dflet | 5:d3b320ebd469 | 175 | |
dflet | 5:d3b320ebd469 | 176 | typedef _SlEventPropogationStatus_e (*netApp_callback) (SlNetAppEvent_t *); |
dflet | 5:d3b320ebd469 | 177 | |
dflet | 5:d3b320ebd469 | 178 | static const netApp_callback netApp_callbacks[] = |
dflet | 5:d3b320ebd469 | 179 | { |
dflet | 5:d3b320ebd469 | 180 | #ifdef SlExtLib1NetAppEventHandler |
dflet | 5:d3b320ebd469 | 181 | SlExtLib1NetAppEventHandler, |
dflet | 5:d3b320ebd469 | 182 | #endif |
dflet | 5:d3b320ebd469 | 183 | |
dflet | 5:d3b320ebd469 | 184 | #ifdef SlExtLib2NetAppEventHandler |
dflet | 5:d3b320ebd469 | 185 | SlExtLib2NetAppEventHandler, |
dflet | 5:d3b320ebd469 | 186 | #endif |
dflet | 5:d3b320ebd469 | 187 | |
dflet | 5:d3b320ebd469 | 188 | #ifdef SlExtLib3NetAppEventHandler |
dflet | 5:d3b320ebd469 | 189 | SlExtLib3NetAppEventHandler, |
dflet | 5:d3b320ebd469 | 190 | #endif |
dflet | 5:d3b320ebd469 | 191 | |
dflet | 5:d3b320ebd469 | 192 | #ifdef SlExtLib4NetAppEventHandler |
dflet | 5:d3b320ebd469 | 193 | SlExtLib4NetAppEventHandler, |
dflet | 5:d3b320ebd469 | 194 | #endif |
dflet | 5:d3b320ebd469 | 195 | |
dflet | 5:d3b320ebd469 | 196 | #ifdef SlExtLib5NetAppEventHandler |
dflet | 5:d3b320ebd469 | 197 | SlExtLib5NetAppEventHandler, |
dflet | 5:d3b320ebd469 | 198 | #endif |
dflet | 5:d3b320ebd469 | 199 | }; |
dflet | 5:d3b320ebd469 | 200 | |
dflet | 5:d3b320ebd469 | 201 | #undef _SlDrvHandleNetAppEvents |
dflet | 5:d3b320ebd469 | 202 | |
dflet | 5:d3b320ebd469 | 203 | /************************************************************ |
dflet | 5:d3b320ebd469 | 204 | _SlDrvHandleNetAppEvents |
dflet | 5:d3b320ebd469 | 205 | Iterates through all the net app event handlers which are |
dflet | 5:d3b320ebd469 | 206 | registered by the external libs/user application. |
dflet | 5:d3b320ebd469 | 207 | ************************************************************/ |
dflet | 5:d3b320ebd469 | 208 | void _SlDrvHandleNetAppEvents(SlNetAppEvent_t *slNetAppEvent) |
dflet | 5:d3b320ebd469 | 209 | { |
dflet | 5:d3b320ebd469 | 210 | uint8_t i; |
dflet | 5:d3b320ebd469 | 211 | |
dflet | 5:d3b320ebd469 | 212 | /* Iterate over all the extenal libs handlers */ |
dflet | 5:d3b320ebd469 | 213 | for ( i = 0 ; i < sizeof(netApp_callbacks)/sizeof(netApp_callbacks[0]) ; i++ ) |
dflet | 5:d3b320ebd469 | 214 | { |
dflet | 5:d3b320ebd469 | 215 | if (EVENT_PROPAGATION_BLOCK == netApp_callbacks[i](slNetAppEvent) ) |
dflet | 5:d3b320ebd469 | 216 | { |
dflet | 5:d3b320ebd469 | 217 | /* exit immediately and do not call the user specific handler as well */ |
dflet | 5:d3b320ebd469 | 218 | return; |
dflet | 5:d3b320ebd469 | 219 | } |
dflet | 5:d3b320ebd469 | 220 | } |
dflet | 5:d3b320ebd469 | 221 | |
dflet | 5:d3b320ebd469 | 222 | /* At last call the Application specific handler if registered */ |
dflet | 5:d3b320ebd469 | 223 | #ifdef sl_NetAppEvtHdlr |
dflet | 5:d3b320ebd469 | 224 | sl_NetAppEvtHdlr(slNetAppEvent); |
dflet | 5:d3b320ebd469 | 225 | #endif |
dflet | 5:d3b320ebd469 | 226 | |
dflet | 5:d3b320ebd469 | 227 | } |
dflet | 5:d3b320ebd469 | 228 | #endif |
dflet | 5:d3b320ebd469 | 229 | |
dflet | 5:d3b320ebd469 | 230 | |
dflet | 5:d3b320ebd469 | 231 | /* Http Server Events handling */ |
dflet | 5:d3b320ebd469 | 232 | #if defined (EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS) |
dflet | 5:d3b320ebd469 | 233 | |
dflet | 5:d3b320ebd469 | 234 | typedef _SlEventPropogationStatus_e (*httpServer_callback) (SlHttpServerEvent_t*, SlHttpServerResponse_t*); |
dflet | 5:d3b320ebd469 | 235 | |
dflet | 5:d3b320ebd469 | 236 | static const httpServer_callback httpServer_callbacks[] = |
dflet | 5:d3b320ebd469 | 237 | { |
dflet | 5:d3b320ebd469 | 238 | #ifdef SlExtLib1HttpServerEventHandler |
dflet | 5:d3b320ebd469 | 239 | SlExtLib1HttpServerEventHandler, |
dflet | 5:d3b320ebd469 | 240 | #endif |
dflet | 5:d3b320ebd469 | 241 | |
dflet | 5:d3b320ebd469 | 242 | #ifdef SlExtLib2HttpServerEventHandler |
dflet | 5:d3b320ebd469 | 243 | SlExtLib2HttpServerEventHandler, |
dflet | 5:d3b320ebd469 | 244 | #endif |
dflet | 5:d3b320ebd469 | 245 | |
dflet | 5:d3b320ebd469 | 246 | #ifdef SlExtLib3HttpServerEventHandler |
dflet | 5:d3b320ebd469 | 247 | SlExtLib3HttpServerEventHandler, |
dflet | 5:d3b320ebd469 | 248 | #endif |
dflet | 5:d3b320ebd469 | 249 | |
dflet | 5:d3b320ebd469 | 250 | #ifdef SlExtLib4HttpServerEventHandler |
dflet | 5:d3b320ebd469 | 251 | SlExtLib4HttpServerEventHandler, |
dflet | 5:d3b320ebd469 | 252 | #endif |
dflet | 5:d3b320ebd469 | 253 | |
dflet | 5:d3b320ebd469 | 254 | #ifdef SlExtLib5HttpServerEventHandler |
dflet | 5:d3b320ebd469 | 255 | SlExtLib5HttpServerEventHandler, |
dflet | 5:d3b320ebd469 | 256 | #endif |
dflet | 5:d3b320ebd469 | 257 | }; |
dflet | 5:d3b320ebd469 | 258 | |
dflet | 5:d3b320ebd469 | 259 | #undef _SlDrvHandleHttpServerEvents |
dflet | 5:d3b320ebd469 | 260 | |
dflet | 5:d3b320ebd469 | 261 | /******************************************************************* |
dflet | 5:d3b320ebd469 | 262 | _SlDrvHandleHttpServerEvents |
dflet | 5:d3b320ebd469 | 263 | Iterates through all the http server event handlers which are |
dflet | 5:d3b320ebd469 | 264 | registered by the external libs/user application. |
dflet | 5:d3b320ebd469 | 265 | ********************************************************************/ |
dflet | 5:d3b320ebd469 | 266 | void _SlDrvHandleHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse) |
dflet | 5:d3b320ebd469 | 267 | { |
dflet | 5:d3b320ebd469 | 268 | _u8 i; |
dflet | 5:d3b320ebd469 | 269 | |
dflet | 5:d3b320ebd469 | 270 | /* Iterate over all the external libs handlers */ |
dflet | 5:d3b320ebd469 | 271 | for ( i = 0 ; i < sizeof(httpServer_callbacks)/sizeof(httpServer_callbacks[0]) ; i++ ) |
dflet | 5:d3b320ebd469 | 272 | { |
dflet | 5:d3b320ebd469 | 273 | if ( EVENT_PROPAGATION_BLOCK == httpServer_callbacks[i](slHttpServerEvent, slHttpServerResponse) ) |
dflet | 5:d3b320ebd469 | 274 | { |
dflet | 5:d3b320ebd469 | 275 | /* exit immediately and do not call the user specific handler as well */ |
dflet | 5:d3b320ebd469 | 276 | return; |
dflet | 5:d3b320ebd469 | 277 | } |
dflet | 5:d3b320ebd469 | 278 | } |
dflet | 5:d3b320ebd469 | 279 | |
dflet | 5:d3b320ebd469 | 280 | /* At last call the Application specific handler if registered */ |
dflet | 5:d3b320ebd469 | 281 | #ifdef sl_HttpServerCallback |
dflet | 5:d3b320ebd469 | 282 | sl_HttpServerCallback(slHttpServerEvent, slHttpServerResponse); |
dflet | 5:d3b320ebd469 | 283 | #endif |
dflet | 5:d3b320ebd469 | 284 | |
dflet | 5:d3b320ebd469 | 285 | } |
dflet | 5:d3b320ebd469 | 286 | #endif |
dflet | 5:d3b320ebd469 | 287 | |
dflet | 5:d3b320ebd469 | 288 | |
dflet | 5:d3b320ebd469 | 289 | /* Socket Events */ |
dflet | 5:d3b320ebd469 | 290 | #if defined (EXT_LIB_REGISTERED_SOCK_EVENTS) |
dflet | 5:d3b320ebd469 | 291 | |
dflet | 5:d3b320ebd469 | 292 | typedef _SlEventPropogationStatus_e (*sock_callback) (SlSockEvent_t *); |
dflet | 5:d3b320ebd469 | 293 | |
dflet | 5:d3b320ebd469 | 294 | static const sock_callback sock_callbacks[] = |
dflet | 5:d3b320ebd469 | 295 | { |
dflet | 5:d3b320ebd469 | 296 | #ifdef SlExtLib1SockEventHandler |
dflet | 5:d3b320ebd469 | 297 | SlExtLib1SockEventHandler, |
dflet | 5:d3b320ebd469 | 298 | #endif |
dflet | 5:d3b320ebd469 | 299 | |
dflet | 5:d3b320ebd469 | 300 | #ifdef SlExtLib2SockEventHandler |
dflet | 5:d3b320ebd469 | 301 | SlExtLib2SockEventHandler, |
dflet | 5:d3b320ebd469 | 302 | #endif |
dflet | 5:d3b320ebd469 | 303 | |
dflet | 5:d3b320ebd469 | 304 | #ifdef SlExtLib3SockEventHandler |
dflet | 5:d3b320ebd469 | 305 | SlExtLib3SockEventHandler, |
dflet | 5:d3b320ebd469 | 306 | #endif |
dflet | 5:d3b320ebd469 | 307 | |
dflet | 5:d3b320ebd469 | 308 | #ifdef SlExtLib4SockEventHandler |
dflet | 5:d3b320ebd469 | 309 | SlExtLib4SockEventHandler, |
dflet | 5:d3b320ebd469 | 310 | #endif |
dflet | 5:d3b320ebd469 | 311 | |
dflet | 5:d3b320ebd469 | 312 | #ifdef SlExtLib5SockEventHandler |
dflet | 5:d3b320ebd469 | 313 | SlExtLib5SockEventHandler, |
dflet | 5:d3b320ebd469 | 314 | #endif |
dflet | 5:d3b320ebd469 | 315 | }; |
dflet | 5:d3b320ebd469 | 316 | |
dflet | 5:d3b320ebd469 | 317 | /************************************************************* |
dflet | 5:d3b320ebd469 | 318 | _SlDrvHandleSockEvents |
dflet | 5:d3b320ebd469 | 319 | Iterates through all the socket event handlers which are |
dflet | 5:d3b320ebd469 | 320 | registered by the external libs/user application. |
dflet | 5:d3b320ebd469 | 321 | **************************************************************/ |
dflet | 5:d3b320ebd469 | 322 | void _SlDrvHandleSockEvents(SlSockEvent_t *slSockEvent) |
dflet | 5:d3b320ebd469 | 323 | { |
dflet | 5:d3b320ebd469 | 324 | uint8_t i; |
dflet | 5:d3b320ebd469 | 325 | |
dflet | 5:d3b320ebd469 | 326 | /* Iterate over all the external libs handlers */ |
dflet | 5:d3b320ebd469 | 327 | for ( i = 0 ; i < sizeof(sock_callbacks)/sizeof(sock_callbacks[0]) ; i++ ) |
dflet | 5:d3b320ebd469 | 328 | { |
dflet | 5:d3b320ebd469 | 329 | if ( EVENT_PROPAGATION_BLOCK == sock_callbacks[i](slSockEvent) ) |
dflet | 5:d3b320ebd469 | 330 | { |
dflet | 5:d3b320ebd469 | 331 | /* exit immediately and do not call the user specific handler as well */ |
dflet | 5:d3b320ebd469 | 332 | return; |
dflet | 5:d3b320ebd469 | 333 | } |
dflet | 5:d3b320ebd469 | 334 | } |
dflet | 5:d3b320ebd469 | 335 | |
dflet | 5:d3b320ebd469 | 336 | /* At last call the Application specific handler if registered */ |
dflet | 5:d3b320ebd469 | 337 | #ifdef sl_SockEvtHdlr |
dflet | 5:d3b320ebd469 | 338 | sl_SockEvtHdlr(slSockEvent); |
dflet | 5:d3b320ebd469 | 339 | #endif |
dflet | 5:d3b320ebd469 | 340 | |
dflet | 5:d3b320ebd469 | 341 | } |
dflet | 5:d3b320ebd469 | 342 | |
dflet | 5:d3b320ebd469 | 343 | #endif |
dflet | 5:d3b320ebd469 | 344 | |
dflet | 5:d3b320ebd469 | 345 | /*! |
dflet | 5:d3b320ebd469 | 346 | \brief This function handles ping report events |
dflet | 5:d3b320ebd469 | 347 | |
dflet | 5:d3b320ebd469 | 348 | \param[in] pPingReport holds the ping report statistics |
dflet | 5:d3b320ebd469 | 349 | |
dflet | 5:d3b320ebd469 | 350 | \return None |
dflet | 5:d3b320ebd469 | 351 | |
dflet | 5:d3b320ebd469 | 352 | \note |
dflet | 5:d3b320ebd469 | 353 | |
dflet | 5:d3b320ebd469 | 354 | \warning |
dflet | 5:d3b320ebd469 | 355 | */ |
dflet | 5:d3b320ebd469 | 356 | void SimpleLinkPingReport(SlPingReport_t *pPingReport) |
dflet | 5:d3b320ebd469 | 357 | { |
dflet | 5:d3b320ebd469 | 358 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_PING_DONE); |
dflet | 5:d3b320ebd469 | 359 | |
dflet | 5:d3b320ebd469 | 360 | if(pPingReport == NULL) |
dflet | 5:d3b320ebd469 | 361 | printf(" [PING REPORT] NULL Pointer Error\r\n"); |
dflet | 5:d3b320ebd469 | 362 | |
dflet | 5:d3b320ebd469 | 363 | g_PingPacketsRecv = pPingReport->PacketsReceived; |
dflet | 5:d3b320ebd469 | 364 | } |
dflet | 5:d3b320ebd469 | 365 | |
dflet | 5:d3b320ebd469 | 366 | |
dflet | 5:d3b320ebd469 | 367 | /*******************************************************************************/ |
dflet | 5:d3b320ebd469 | 368 | /* _sl_HandleAsync_Accept */ |
dflet | 5:d3b320ebd469 | 369 | /*******************************************************************************/ |
dflet | 5:d3b320ebd469 | 370 | #ifndef SL_TINY_EXT |
dflet | 5:d3b320ebd469 | 371 | void _sl_HandleAsync_Accept(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 372 | { |
dflet | 5:d3b320ebd469 | 373 | _SocketAddrResponse_u *pMsgArgs = (_SocketAddrResponse_u *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 374 | |
dflet | 5:d3b320ebd469 | 375 | _driver->_SlDrvProtectionObjLockWaitForever(); |
dflet | 5:d3b320ebd469 | 376 | |
dflet | 5:d3b320ebd469 | 377 | VERIFY_PROTOCOL(( pMsgArgs->IpV4.sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS); |
dflet | 5:d3b320ebd469 | 378 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
dflet | 5:d3b320ebd469 | 379 | |
dflet | 5:d3b320ebd469 | 380 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs,sizeof(_SocketAddrResponse_u)); |
dflet | 5:d3b320ebd469 | 381 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 382 | |
dflet | 5:d3b320ebd469 | 383 | _driver->_SlDrvProtectionObjUnLock(); |
dflet | 5:d3b320ebd469 | 384 | return; |
dflet | 5:d3b320ebd469 | 385 | } |
dflet | 5:d3b320ebd469 | 386 | |
dflet | 5:d3b320ebd469 | 387 | /*******************************************************************************/ |
dflet | 5:d3b320ebd469 | 388 | /* _sl_HandleAsync_Connect */ |
dflet | 5:d3b320ebd469 | 389 | /*******************************************************************************/ |
dflet | 5:d3b320ebd469 | 390 | void _sl_HandleAsync_Connect(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 391 | { |
dflet | 5:d3b320ebd469 | 392 | _SocketResponse_t *pMsgArgs = (_SocketResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 393 | |
dflet | 5:d3b320ebd469 | 394 | _driver->_SlDrvProtectionObjLockWaitForever(); |
dflet | 5:d3b320ebd469 | 395 | |
dflet | 5:d3b320ebd469 | 396 | VERIFY_PROTOCOL((pMsgArgs->sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS); |
dflet | 5:d3b320ebd469 | 397 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
dflet | 5:d3b320ebd469 | 398 | |
dflet | 5:d3b320ebd469 | 399 | ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->sd = pMsgArgs->sd; |
dflet | 5:d3b320ebd469 | 400 | ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->statusOrLen = pMsgArgs->statusOrLen; |
dflet | 5:d3b320ebd469 | 401 | |
dflet | 5:d3b320ebd469 | 402 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 403 | _driver->_SlDrvProtectionObjUnLock(); |
dflet | 5:d3b320ebd469 | 404 | return; |
dflet | 5:d3b320ebd469 | 405 | } |
dflet | 5:d3b320ebd469 | 406 | |
dflet | 5:d3b320ebd469 | 407 | /*******************************************************************************/ |
dflet | 5:d3b320ebd469 | 408 | /* _sl_HandleAsync_Select */ |
dflet | 5:d3b320ebd469 | 409 | /*******************************************************************************/ |
dflet | 5:d3b320ebd469 | 410 | void _sl_HandleAsync_Select(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 411 | { |
dflet | 5:d3b320ebd469 | 412 | _SelectAsyncResponse_t *pMsgArgs = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 413 | |
dflet | 5:d3b320ebd469 | 414 | _driver->_SlDrvProtectionObjLockWaitForever(); |
dflet | 5:d3b320ebd469 | 415 | |
dflet | 5:d3b320ebd469 | 416 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
dflet | 5:d3b320ebd469 | 417 | |
dflet | 5:d3b320ebd469 | 418 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t)); |
dflet | 5:d3b320ebd469 | 419 | |
dflet | 5:d3b320ebd469 | 420 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 421 | _driver->_SlDrvProtectionObjUnLock(); |
dflet | 5:d3b320ebd469 | 422 | |
dflet | 5:d3b320ebd469 | 423 | return; |
dflet | 5:d3b320ebd469 | 424 | } |
dflet | 5:d3b320ebd469 | 425 | |
dflet | 5:d3b320ebd469 | 426 | #endif |
dflet | 5:d3b320ebd469 | 427 | |
dflet | 5:d3b320ebd469 | 428 | /******************************************************************************/ |
dflet | 5:d3b320ebd469 | 429 | /* _sl_HandleAsync_DnsGetHostByName */ |
dflet | 5:d3b320ebd469 | 430 | /******************************************************************************/ |
dflet | 5:d3b320ebd469 | 431 | void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 432 | { |
dflet | 5:d3b320ebd469 | 433 | _GetHostByNameIPv4AsyncResponse_t *pMsgArgs = (_GetHostByNameIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 434 | |
dflet | 5:d3b320ebd469 | 435 | _driver->_SlDrvProtectionObjLockWaitForever(); |
dflet | 5:d3b320ebd469 | 436 | |
dflet | 5:d3b320ebd469 | 437 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
dflet | 5:d3b320ebd469 | 438 | |
dflet | 5:d3b320ebd469 | 439 | /*IPv6 */ |
dflet | 5:d3b320ebd469 | 440 | if(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) { |
dflet | 5:d3b320ebd469 | 441 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv6AsyncResponse_t)); |
dflet | 5:d3b320ebd469 | 442 | } |
dflet | 5:d3b320ebd469 | 443 | /*IPv4 */ |
dflet | 5:d3b320ebd469 | 444 | else |
dflet | 5:d3b320ebd469 | 445 | { |
dflet | 5:d3b320ebd469 | 446 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv4AsyncResponse_t)); |
dflet | 5:d3b320ebd469 | 447 | } |
dflet | 5:d3b320ebd469 | 448 | |
dflet | 5:d3b320ebd469 | 449 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 450 | _driver->_SlDrvProtectionObjUnLock(); |
dflet | 5:d3b320ebd469 | 451 | |
dflet | 5:d3b320ebd469 | 452 | return; |
dflet | 5:d3b320ebd469 | 453 | } |
dflet | 5:d3b320ebd469 | 454 | |
dflet | 5:d3b320ebd469 | 455 | /******************************************************************************/ |
dflet | 5:d3b320ebd469 | 456 | |
dflet | 5:d3b320ebd469 | 457 | /****************************************************************************** |
dflet | 5:d3b320ebd469 | 458 | _sl_HandleAsync_DnsGetHostByService |
dflet | 5:d3b320ebd469 | 459 | |
dflet | 5:d3b320ebd469 | 460 | CALLER NWP - Async event on sl_DnsGetHostByService with IPv4 Family |
dflet | 5:d3b320ebd469 | 461 | |
dflet | 5:d3b320ebd469 | 462 | |
dflet | 5:d3b320ebd469 | 463 | DESCRIPTION: |
dflet | 5:d3b320ebd469 | 464 | |
dflet | 5:d3b320ebd469 | 465 | Async event on sl_DnsGetHostByService command with IPv4 Family. |
dflet | 5:d3b320ebd469 | 466 | Return service attributes like IP address, port and text according to service name. |
dflet | 5:d3b320ebd469 | 467 | The user sets a service name Full/Part (see example below), and should get the: |
dflet | 5:d3b320ebd469 | 468 | 1. IP of the service |
dflet | 5:d3b320ebd469 | 469 | 2. The port of service. |
dflet | 5:d3b320ebd469 | 470 | 3. The text of service. |
dflet | 5:d3b320ebd469 | 471 | |
dflet | 5:d3b320ebd469 | 472 | Hence it can make a connection to the specific service and use it. |
dflet | 5:d3b320ebd469 | 473 | It is similar to get host by name method. |
dflet | 5:d3b320ebd469 | 474 | |
dflet | 5:d3b320ebd469 | 475 | It is done by a single shot query with PTR type on the service name. |
dflet | 5:d3b320ebd469 | 476 | |
dflet | 5:d3b320ebd469 | 477 | |
dflet | 5:d3b320ebd469 | 478 | |
dflet | 5:d3b320ebd469 | 479 | Note: |
dflet | 5:d3b320ebd469 | 480 | 1. The return's attributes are belonged to first service that is found. |
dflet | 5:d3b320ebd469 | 481 | It can be other services with the same service name will response to |
dflet | 5:d3b320ebd469 | 482 | the query. The results of these responses are saved in the peer cache of the NWP, and |
dflet | 5:d3b320ebd469 | 483 | should be read by another API. |
dflet | 5:d3b320ebd469 | 484 | |
dflet | 5:d3b320ebd469 | 485 | |
dflet | 5:d3b320ebd469 | 486 | PARAMETERS: |
dflet | 5:d3b320ebd469 | 487 | |
dflet | 5:d3b320ebd469 | 488 | pVoidBuf - is point to opcode of the event. |
dflet | 5:d3b320ebd469 | 489 | it contains the outputs that are given to the user |
dflet | 5:d3b320ebd469 | 490 | |
dflet | 5:d3b320ebd469 | 491 | outputs description: |
dflet | 5:d3b320ebd469 | 492 | |
dflet | 5:d3b320ebd469 | 493 | 1.out_pAddr[] - output: Contain the IP address of the service. |
dflet | 5:d3b320ebd469 | 494 | 2.out_pPort - output: Contain the port of the service. |
dflet | 5:d3b320ebd469 | 495 | 3.inout_TextLen - Input: Contain the max length of the text that the user wants to get. |
dflet | 5:d3b320ebd469 | 496 | it means that if the test of service is bigger that its value than |
dflet | 5:d3b320ebd469 | 497 | the text is cut to inout_TextLen value. |
dflet | 5:d3b320ebd469 | 498 | Output: Contain the length of the text that is returned. Can be full text or part |
dflet | 5:d3b320ebd469 | 499 | of the text (see above). |
dflet | 5:d3b320ebd469 | 500 | |
dflet | 5:d3b320ebd469 | 501 | 4.out_pText - Contain the text of the service (full or part see above- inout_TextLen description). |
dflet | 5:d3b320ebd469 | 502 | |
dflet | 5:d3b320ebd469 | 503 | * |
dflet | 5:d3b320ebd469 | 504 | |
dflet | 5:d3b320ebd469 | 505 | |
dflet | 5:d3b320ebd469 | 506 | RETURNS: success or fail. |
dflet | 5:d3b320ebd469 | 507 | |
dflet | 5:d3b320ebd469 | 508 | ******************************************************************************/ |
dflet | 5:d3b320ebd469 | 509 | #ifndef SL_TINY_EXT |
dflet | 5:d3b320ebd469 | 510 | void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 511 | { |
dflet | 5:d3b320ebd469 | 512 | _GetHostByServiceAsyncResponse_t* Res; |
dflet | 5:d3b320ebd469 | 513 | uint16_t TextLen; |
dflet | 5:d3b320ebd469 | 514 | uint16_t UserTextLen; |
dflet | 5:d3b320ebd469 | 515 | |
dflet | 5:d3b320ebd469 | 516 | /*pVoidBuf - is point to opcode of the event.*/ |
dflet | 5:d3b320ebd469 | 517 | |
dflet | 5:d3b320ebd469 | 518 | /*set pMsgArgs to point to the attribute of the event.*/ |
dflet | 5:d3b320ebd469 | 519 | _GetHostByServiceIPv4AsyncResponse_t *pMsgArgs = (_GetHostByServiceIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 520 | |
dflet | 5:d3b320ebd469 | 521 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
dflet | 5:d3b320ebd469 | 522 | |
dflet | 5:d3b320ebd469 | 523 | /*IPv6*/ |
dflet | 5:d3b320ebd469 | 524 | if(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) { |
dflet | 5:d3b320ebd469 | 525 | return; |
dflet | 5:d3b320ebd469 | 526 | } |
dflet | 5:d3b320ebd469 | 527 | /*IPv4*/ |
dflet | 5:d3b320ebd469 | 528 | else { |
dflet | 5:d3b320ebd469 | 529 | /************************************************************************************************* |
dflet | 5:d3b320ebd469 | 530 | |
dflet | 5:d3b320ebd469 | 531 | 1. Copy the attribute part of the evnt to the attribute part of the response |
dflet | 5:d3b320ebd469 | 532 | memcpy(g_pCB->GetHostByServiceCB.pAsyncRsp, pMsgArgs, sizeof(_GetHostByServiceIPv4AsyncResponse_t)); |
dflet | 5:d3b320ebd469 | 533 | |
dflet | 5:d3b320ebd469 | 534 | set to TextLen the text length of the service.*/ |
dflet | 5:d3b320ebd469 | 535 | TextLen = pMsgArgs->TextLen; |
dflet | 5:d3b320ebd469 | 536 | |
dflet | 5:d3b320ebd469 | 537 | /*Res pointed to mDNS global object struct */ |
dflet | 5:d3b320ebd469 | 538 | Res = (_GetHostByServiceAsyncResponse_t*)g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs; |
dflet | 5:d3b320ebd469 | 539 | |
dflet | 5:d3b320ebd469 | 540 | |
dflet | 5:d3b320ebd469 | 541 | |
dflet | 5:d3b320ebd469 | 542 | /*It is 4 bytes so we avoid from memcpy*/ |
dflet | 5:d3b320ebd469 | 543 | Res->out_pAddr[0] = pMsgArgs->Address; |
dflet | 5:d3b320ebd469 | 544 | Res->out_pPort[0] = pMsgArgs->Port; |
dflet | 5:d3b320ebd469 | 545 | Res->Status = pMsgArgs->Status; |
dflet | 5:d3b320ebd469 | 546 | |
dflet | 5:d3b320ebd469 | 547 | /*set to TextLen the text length of the user (input fromthe user).*/ |
dflet | 5:d3b320ebd469 | 548 | UserTextLen = Res->inout_TextLen[0]; |
dflet | 5:d3b320ebd469 | 549 | |
dflet | 5:d3b320ebd469 | 550 | /*Cut the service text if the user requested for smaller text.*/ |
dflet | 5:d3b320ebd469 | 551 | UserTextLen = (TextLen <= UserTextLen) ? TextLen : UserTextLen; |
dflet | 5:d3b320ebd469 | 552 | Res->inout_TextLen[0] = UserTextLen ; |
dflet | 5:d3b320ebd469 | 553 | |
dflet | 5:d3b320ebd469 | 554 | /************************************************************************************************** |
dflet | 5:d3b320ebd469 | 555 | |
dflet | 5:d3b320ebd469 | 556 | 2. Copy the payload part of the evnt (the text) to the payload part of the response |
dflet | 5:d3b320ebd469 | 557 | the lenght of the copy is according to the text length in the attribute part. */ |
dflet | 5:d3b320ebd469 | 558 | |
dflet | 5:d3b320ebd469 | 559 | |
dflet | 5:d3b320ebd469 | 560 | memcpy(Res->out_pText , |
dflet | 5:d3b320ebd469 | 561 | (int8_t *)(& pMsgArgs[1]), /* & pMsgArgs[1] -> 1st byte after the fixed header = 1st byte of variable text.*/ |
dflet | 5:d3b320ebd469 | 562 | UserTextLen); |
dflet | 5:d3b320ebd469 | 563 | |
dflet | 5:d3b320ebd469 | 564 | |
dflet | 5:d3b320ebd469 | 565 | /**************************************************************************************************/ |
dflet | 5:d3b320ebd469 | 566 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 567 | return; |
dflet | 5:d3b320ebd469 | 568 | } |
dflet | 5:d3b320ebd469 | 569 | } |
dflet | 5:d3b320ebd469 | 570 | #endif |
dflet | 5:d3b320ebd469 | 571 | |
dflet | 5:d3b320ebd469 | 572 | /*****************************************************************************/ |
dflet | 5:d3b320ebd469 | 573 | /* _sl_HandleAsync_PingResponse */ |
dflet | 5:d3b320ebd469 | 574 | /*****************************************************************************/ |
dflet | 5:d3b320ebd469 | 575 | #ifndef SL_TINY_EXT |
dflet | 5:d3b320ebd469 | 576 | void _sl_HandleAsync_PingResponse(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 577 | { |
dflet | 5:d3b320ebd469 | 578 | _PingReportResponse_t *pMsgArgs = (_PingReportResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 579 | SlPingReport_t pingReport; |
dflet | 5:d3b320ebd469 | 580 | |
dflet | 5:d3b320ebd469 | 581 | if(pPingCallBackFunc) { |
dflet | 5:d3b320ebd469 | 582 | _netapp->CopyPingResultsToReport(pMsgArgs,&pingReport); |
dflet | 5:d3b320ebd469 | 583 | pPingCallBackFunc(&pingReport); |
dflet | 5:d3b320ebd469 | 584 | } else { |
dflet | 5:d3b320ebd469 | 585 | |
dflet | 5:d3b320ebd469 | 586 | _driver->_SlDrvProtectionObjLockWaitForever(); |
dflet | 5:d3b320ebd469 | 587 | VERIFY_SOCKET_CB(NULL != g_pCB->PingCB.PingAsync.pAsyncRsp); |
dflet | 5:d3b320ebd469 | 588 | |
dflet | 5:d3b320ebd469 | 589 | if (NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs) { |
dflet | 5:d3b320ebd469 | 590 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_PingReportResponse_t)); |
dflet | 5:d3b320ebd469 | 591 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 592 | } |
dflet | 5:d3b320ebd469 | 593 | _driver->_SlDrvProtectionObjUnLock(); |
dflet | 5:d3b320ebd469 | 594 | } |
dflet | 5:d3b320ebd469 | 595 | return; |
dflet | 5:d3b320ebd469 | 596 | } |
dflet | 5:d3b320ebd469 | 597 | #endif |
dflet | 5:d3b320ebd469 | 598 | |
dflet | 5:d3b320ebd469 | 599 | /* ******************************************************************************/ |
dflet | 5:d3b320ebd469 | 600 | /* _SlDrvMsgReadSpawnCtx */ |
dflet | 5:d3b320ebd469 | 601 | /* ******************************************************************************/ |
dflet | 5:d3b320ebd469 | 602 | _SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue) |
dflet | 5:d3b320ebd469 | 603 | { |
dflet | 5:d3b320ebd469 | 604 | |
dflet | 5:d3b320ebd469 | 605 | #ifdef SL_POLLING_MODE_USED |
dflet | 5:d3b320ebd469 | 606 | int16_t retCode = OSI_OK; |
dflet | 5:d3b320ebd469 | 607 | /* for polling based systems */ |
dflet | 5:d3b320ebd469 | 608 | do { |
dflet | 5:d3b320ebd469 | 609 | retCode = sl_LockObjLock(&g_pCB->GlobalLockObj, 0); |
dflet | 5:d3b320ebd469 | 610 | if ( OSI_OK != retCode ) { |
dflet | 5:d3b320ebd469 | 611 | if (TRUE == g_pCB->IsCmdRespWaited) { |
dflet | 5:d3b320ebd469 | 612 | OSI_RET_OK_CHECK( sl_SyncObjSignal(&g_pCB->CmdSyncObj) ); |
dflet | 5:d3b320ebd469 | 613 | return SL_RET_CODE_OK; |
dflet | 5:d3b320ebd469 | 614 | } |
dflet | 5:d3b320ebd469 | 615 | } |
dflet | 5:d3b320ebd469 | 616 | |
dflet | 5:d3b320ebd469 | 617 | } while (OSI_OK != retCode); |
dflet | 5:d3b320ebd469 | 618 | |
dflet | 5:d3b320ebd469 | 619 | #else |
dflet | 5:d3b320ebd469 | 620 | |
dflet | 5:d3b320ebd469 | 621 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) ); |
dflet | 5:d3b320ebd469 | 622 | |
dflet | 5:d3b320ebd469 | 623 | #endif |
dflet | 5:d3b320ebd469 | 624 | |
dflet | 5:d3b320ebd469 | 625 | g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;/* buffer must be allocated by _SlDrvMsgRead */ |
dflet | 5:d3b320ebd469 | 626 | g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler= NULL; |
dflet | 5:d3b320ebd469 | 627 | g_pCB->FunctionParams.AsyncExt.RxMsgClass = CMD_RESP_CLASS;/* init to illegal value and verify it's overwritten with the valid one */ |
dflet | 5:d3b320ebd469 | 628 | |
dflet | 5:d3b320ebd469 | 629 | /* Messages might have been read by CmdResp context. Therefore after */ |
dflet | 5:d3b320ebd469 | 630 | /* getting LockObj, check again where the Pending Rx Msg is still present. */ |
dflet | 5:d3b320ebd469 | 631 | if(FALSE == (_driver->_SL_PENDING_RX_MSG(g_pCB))) { |
dflet | 5:d3b320ebd469 | 632 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
dflet | 5:d3b320ebd469 | 633 | return SL_RET_CODE_OK; |
dflet | 5:d3b320ebd469 | 634 | } |
dflet | 5:d3b320ebd469 | 635 | |
dflet | 5:d3b320ebd469 | 636 | VERIFY_RET_OK(_driver->_SlDrvMsgRead()); |
dflet | 5:d3b320ebd469 | 637 | |
dflet | 5:d3b320ebd469 | 638 | g_pCB->RxDoneCnt++; |
dflet | 5:d3b320ebd469 | 639 | |
dflet | 5:d3b320ebd469 | 640 | switch(g_pCB->FunctionParams.AsyncExt.RxMsgClass) { |
dflet | 5:d3b320ebd469 | 641 | case ASYNC_EVT_CLASS: |
dflet | 5:d3b320ebd469 | 642 | /* If got here and protected by LockObj a message is waiting */ |
dflet | 5:d3b320ebd469 | 643 | /* to be read */ |
dflet | 5:d3b320ebd469 | 644 | VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.AsyncExt.pAsyncBuf); |
dflet | 5:d3b320ebd469 | 645 | |
dflet | 5:d3b320ebd469 | 646 | _driver->_SlAsyncEventGenericHandler(); |
dflet | 5:d3b320ebd469 | 647 | |
dflet | 5:d3b320ebd469 | 648 | #if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC) |
dflet | 5:d3b320ebd469 | 649 | g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL; |
dflet | 5:d3b320ebd469 | 650 | #else |
dflet | 5:d3b320ebd469 | 651 | free(g_pCB->FunctionParams.AsyncExt.pAsyncBuf); |
dflet | 5:d3b320ebd469 | 652 | #endif |
dflet | 5:d3b320ebd469 | 653 | break; |
dflet | 5:d3b320ebd469 | 654 | case DUMMY_MSG_CLASS: |
dflet | 5:d3b320ebd469 | 655 | case RECV_RESP_CLASS: |
dflet | 5:d3b320ebd469 | 656 | /* These types are legal in this context. Do nothing */ |
dflet | 5:d3b320ebd469 | 657 | break; |
dflet | 5:d3b320ebd469 | 658 | case CMD_RESP_CLASS: |
dflet | 5:d3b320ebd469 | 659 | /* Command response is illegal in this context. */ |
dflet | 5:d3b320ebd469 | 660 | /* No 'break' here: Assert! */ |
dflet | 5:d3b320ebd469 | 661 | default: |
dflet | 5:d3b320ebd469 | 662 | VERIFY_PROTOCOL(0); |
dflet | 5:d3b320ebd469 | 663 | } |
dflet | 5:d3b320ebd469 | 664 | |
dflet | 5:d3b320ebd469 | 665 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
dflet | 5:d3b320ebd469 | 666 | |
dflet | 5:d3b320ebd469 | 667 | return(SL_RET_CODE_OK); |
dflet | 5:d3b320ebd469 | 668 | |
dflet | 5:d3b320ebd469 | 669 | } |
dflet | 5:d3b320ebd469 | 670 | |
dflet | 5:d3b320ebd469 | 671 | /*************************************************************************** |
dflet | 5:d3b320ebd469 | 672 | _sl_HandleAsync_Stop - handles stop signalling to |
dflet | 5:d3b320ebd469 | 673 | a waiting object |
dflet | 5:d3b320ebd469 | 674 | ****************************************************************************/ |
dflet | 5:d3b320ebd469 | 675 | void _sl_HandleAsync_Stop(void *pVoidBuf) |
dflet | 5:d3b320ebd469 | 676 | { |
dflet | 5:d3b320ebd469 | 677 | _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
dflet | 5:d3b320ebd469 | 678 | |
dflet | 5:d3b320ebd469 | 679 | VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp); |
dflet | 5:d3b320ebd469 | 680 | |
dflet | 5:d3b320ebd469 | 681 | _driver->_SlDrvProtectionObjLockWaitForever(); |
dflet | 5:d3b320ebd469 | 682 | |
dflet | 5:d3b320ebd469 | 683 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t)); |
dflet | 5:d3b320ebd469 | 684 | _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj); |
dflet | 5:d3b320ebd469 | 685 | _driver->_SlDrvProtectionObjUnLock(); |
dflet | 5:d3b320ebd469 | 686 | return; |
dflet | 5:d3b320ebd469 | 687 | } |
dflet | 5:d3b320ebd469 | 688 | |
dflet | 5:d3b320ebd469 | 689 | /****************************************************************************** |
dflet | 5:d3b320ebd469 | 690 | _SlDrvDeviceEventHandler - handles internally device async events |
dflet | 5:d3b320ebd469 | 691 | ******************************************************************************/ |
dflet | 5:d3b320ebd469 | 692 | void _SlDrvDeviceEventHandler(void *pArgs) |
dflet | 5:d3b320ebd469 | 693 | { |
dflet | 5:d3b320ebd469 | 694 | _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs; |
dflet | 5:d3b320ebd469 | 695 | |
dflet | 5:d3b320ebd469 | 696 | switch(pHdr->GenHeader.Opcode) { |
dflet | 5:d3b320ebd469 | 697 | case SL_OPCODE_DEVICE_INITCOMPLETE: |
dflet | 5:d3b320ebd469 | 698 | _cc3100_->_sl_HandleAsync_InitComplete(pHdr); |
dflet | 5:d3b320ebd469 | 699 | |
dflet | 5:d3b320ebd469 | 700 | break; |
dflet | 5:d3b320ebd469 | 701 | case SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE: |
dflet | 5:d3b320ebd469 | 702 | _sl_HandleAsync_Stop(pHdr); |
dflet | 5:d3b320ebd469 | 703 | |
dflet | 5:d3b320ebd469 | 704 | break; |
dflet | 5:d3b320ebd469 | 705 | |
dflet | 5:d3b320ebd469 | 706 | |
dflet | 5:d3b320ebd469 | 707 | case SL_OPCODE_DEVICE_ABORT: |
dflet | 5:d3b320ebd469 | 708 | { |
dflet | 5:d3b320ebd469 | 709 | #if defined (sl_GeneralEvtHdlr) || defined(EXT_LIB_REGISTERED_GENERAL_EVENTS) |
dflet | 5:d3b320ebd469 | 710 | SlDeviceEvent_t devHandler; |
dflet | 5:d3b320ebd469 | 711 | devHandler.Event = SL_DEVICE_ABORT_ERROR_EVENT; |
dflet | 5:d3b320ebd469 | 712 | devHandler.EventData.deviceReport.AbortType = *((uint32_t*)pArgs + 2); |
dflet | 5:d3b320ebd469 | 713 | devHandler.EventData.deviceReport.AbortData = *((uint32_t*)pArgs + 3); |
dflet | 5:d3b320ebd469 | 714 | _SlDrvHandleGeneralEvents(&devHandler); |
dflet | 5:d3b320ebd469 | 715 | #endif |
dflet | 5:d3b320ebd469 | 716 | } |
dflet | 5:d3b320ebd469 | 717 | break; |
dflet | 5:d3b320ebd469 | 718 | case SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR: |
dflet | 5:d3b320ebd469 | 719 | #if defined (sl_GeneralEvtHdlr) || defined(EXT_LIB_REGISTERED_GENERAL_EVENTS) |
dflet | 5:d3b320ebd469 | 720 | { |
dflet | 5:d3b320ebd469 | 721 | _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pHdr); |
dflet | 5:d3b320ebd469 | 722 | SlDeviceEvent_t devHandler; |
dflet | 5:d3b320ebd469 | 723 | devHandler.Event = SL_DEVICE_FATAL_ERROR_EVENT; |
dflet | 5:d3b320ebd469 | 724 | devHandler.EventData.deviceEvent.status = pMsgArgs->status & 0xFF; |
dflet | 5:d3b320ebd469 | 725 | devHandler.EventData.deviceEvent.sender = (SlErrorSender_e)((pMsgArgs->status >> 8) & 0xFF); |
dflet | 5:d3b320ebd469 | 726 | _SlDrvHandleGeneralEvents(&devHandler); |
dflet | 5:d3b320ebd469 | 727 | } |
dflet | 5:d3b320ebd469 | 728 | #endif |
dflet | 5:d3b320ebd469 | 729 | break; |
dflet | 5:d3b320ebd469 | 730 | default: |
dflet | 5:d3b320ebd469 | 731 | //SL_ERROR_TRACE2(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); |
dflet | 5:d3b320ebd469 | 732 | printf("ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); |
dflet | 5:d3b320ebd469 | 733 | |
dflet | 5:d3b320ebd469 | 734 | } |
dflet | 5:d3b320ebd469 | 735 | } |
dflet | 5:d3b320ebd469 | 736 | |
dflet | 5:d3b320ebd469 | 737 | /*****************************************************************************/ |
dflet | 5:d3b320ebd469 | 738 | /* _SlDrvNetAppEventHandler */ |
dflet | 5:d3b320ebd469 | 739 | /*****************************************************************************/ |
dflet | 5:d3b320ebd469 | 740 | void _SlDrvNetAppEventHandler(void *pArgs) |
dflet | 5:d3b320ebd469 | 741 | { |
dflet | 5:d3b320ebd469 | 742 | _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs; |
dflet | 5:d3b320ebd469 | 743 | #if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS) |
dflet | 5:d3b320ebd469 | 744 | SlHttpServerEvent_t httpServerEvent; |
dflet | 5:d3b320ebd469 | 745 | SlHttpServerResponse_t httpServerResponse; |
dflet | 5:d3b320ebd469 | 746 | #endif |
dflet | 5:d3b320ebd469 | 747 | switch(pHdr->GenHeader.Opcode) { |
dflet | 5:d3b320ebd469 | 748 | case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE: |
dflet | 5:d3b320ebd469 | 749 | case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6: |
dflet | 5:d3b320ebd469 | 750 | _sl_HandleAsync_DnsGetHostByName(pArgs); |
dflet | 5:d3b320ebd469 | 751 | break; |
dflet | 5:d3b320ebd469 | 752 | #ifndef SL_TINY_EXT |
dflet | 5:d3b320ebd469 | 753 | case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE: |
dflet | 5:d3b320ebd469 | 754 | case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6: |
dflet | 5:d3b320ebd469 | 755 | _sl_HandleAsync_DnsGetHostByService(pArgs); |
dflet | 5:d3b320ebd469 | 756 | break; |
dflet | 5:d3b320ebd469 | 757 | case SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE: |
dflet | 5:d3b320ebd469 | 758 | _sl_HandleAsync_PingResponse(pArgs); |
dflet | 5:d3b320ebd469 | 759 | break; |
dflet | 5:d3b320ebd469 | 760 | #endif |
dflet | 5:d3b320ebd469 | 761 | |
dflet | 5:d3b320ebd469 | 762 | #if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS) |
dflet | 5:d3b320ebd469 | 763 | case SL_OPCODE_NETAPP_HTTPGETTOKENVALUE: { |
dflet | 5:d3b320ebd469 | 764 | |
dflet | 5:d3b320ebd469 | 765 | uint8_t *pTokenName; |
dflet | 5:d3b320ebd469 | 766 | slHttpServerData_t Token_value; |
dflet | 5:d3b320ebd469 | 767 | sl_NetAppHttpServerGetToken_t *httpGetToken = (sl_NetAppHttpServerGetToken_t *)_SL_RESP_ARGS_START(pHdr); |
dflet | 5:d3b320ebd469 | 768 | pTokenName = (uint8_t *)((sl_NetAppHttpServerGetToken_t *)httpGetToken + 1); |
dflet | 5:d3b320ebd469 | 769 | |
dflet | 5:d3b320ebd469 | 770 | httpServerResponse.Response = SL_NETAPP_HTTPSETTOKENVALUE; |
dflet | 5:d3b320ebd469 | 771 | httpServerResponse.ResponseData.token_value.len = MAX_TOKEN_VALUE_LEN; |
dflet | 5:d3b320ebd469 | 772 | |
dflet | 5:d3b320ebd469 | 773 | /* Reuse the async buffer for getting the token value response from the user */ |
dflet | 5:d3b320ebd469 | 774 | httpServerResponse.ResponseData.token_value.data = (uint8_t *)_SL_RESP_ARGS_START(pHdr) + MAX_TOKEN_NAME_LEN; |
dflet | 5:d3b320ebd469 | 775 | httpServerEvent.Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT; |
dflet | 5:d3b320ebd469 | 776 | |
dflet | 5:d3b320ebd469 | 777 | httpServerEvent.EventData.httpTokenName.len = httpGetToken->token_name_len; |
dflet | 5:d3b320ebd469 | 778 | httpServerEvent.EventData.httpTokenName.data = pTokenName; |
dflet | 5:d3b320ebd469 | 779 | |
dflet | 5:d3b320ebd469 | 780 | Token_value.token_name = pTokenName; |
dflet | 5:d3b320ebd469 | 781 | |
dflet | 5:d3b320ebd469 | 782 | _SlDrvHandleHttpServerEvents (&httpServerEvent, &httpServerResponse); |
dflet | 5:d3b320ebd469 | 783 | |
dflet | 5:d3b320ebd469 | 784 | Token_value.value_len = httpServerResponse.ResponseData.token_value.len; |
dflet | 5:d3b320ebd469 | 785 | Token_value.name_len = httpServerEvent.EventData.httpTokenName.len; |
dflet | 5:d3b320ebd469 | 786 | |
dflet | 5:d3b320ebd469 | 787 | Token_value.token_value = httpServerResponse.ResponseData.token_value.data; |
dflet | 5:d3b320ebd469 | 788 | |
dflet | 5:d3b320ebd469 | 789 | |
dflet | 5:d3b320ebd469 | 790 | _netapp->sl_NetAppSendTokenValue(&Token_value); |
dflet | 5:d3b320ebd469 | 791 | #endif |
dflet | 5:d3b320ebd469 | 792 | } |
dflet | 5:d3b320ebd469 | 793 | break; |
dflet | 5:d3b320ebd469 | 794 | |
dflet | 5:d3b320ebd469 | 795 | case SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE: { |
dflet | 5:d3b320ebd469 | 796 | #ifdef sl_HttpServerCallback |
dflet | 5:d3b320ebd469 | 797 | uint8_t *pPostParams; |
dflet | 5:d3b320ebd469 | 798 | |
dflet | 5:d3b320ebd469 | 799 | sl_NetAppHttpServerPostToken_t *httpPostTokenArgs = (sl_NetAppHttpServerPostToken_t *)_SL_RESP_ARGS_START(pHdr); |
dflet | 5:d3b320ebd469 | 800 | pPostParams = (uint8_t *)((sl_NetAppHttpServerPostToken_t *)httpPostTokenArgs + 1); |
dflet | 5:d3b320ebd469 | 801 | |
dflet | 5:d3b320ebd469 | 802 | httpServerEvent.Event = SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT; |
dflet | 5:d3b320ebd469 | 803 | |
dflet | 5:d3b320ebd469 | 804 | httpServerEvent.EventData.httpPostData.action.len = httpPostTokenArgs->post_action_len; |
dflet | 5:d3b320ebd469 | 805 | httpServerEvent.EventData.httpPostData.action.data = pPostParams; |
dflet | 5:d3b320ebd469 | 806 | pPostParams+=httpPostTokenArgs->post_action_len; |
dflet | 5:d3b320ebd469 | 807 | |
dflet | 5:d3b320ebd469 | 808 | httpServerEvent.EventData.httpPostData.token_name.len = httpPostTokenArgs->token_name_len; |
dflet | 5:d3b320ebd469 | 809 | httpServerEvent.EventData.httpPostData.token_name.data = pPostParams; |
dflet | 5:d3b320ebd469 | 810 | pPostParams+=httpPostTokenArgs->token_name_len; |
dflet | 5:d3b320ebd469 | 811 | |
dflet | 5:d3b320ebd469 | 812 | httpServerEvent.EventData.httpPostData.token_value.len = httpPostTokenArgs->token_value_len; |
dflet | 5:d3b320ebd469 | 813 | httpServerEvent.EventData.httpPostData.token_value.data = pPostParams; |
dflet | 5:d3b320ebd469 | 814 | |
dflet | 5:d3b320ebd469 | 815 | httpServerResponse.Response = SL_NETAPP_RESPONSE_NONE; |
dflet | 5:d3b320ebd469 | 816 | |
dflet | 5:d3b320ebd469 | 817 | |
dflet | 5:d3b320ebd469 | 818 | _SlDrvHandleHttpServerEvents (&httpServerEvent, &httpServerResponse); |
dflet | 5:d3b320ebd469 | 819 | } |
dflet | 5:d3b320ebd469 | 820 | break; |
dflet | 5:d3b320ebd469 | 821 | #endif |
dflet | 5:d3b320ebd469 | 822 | default: |
dflet | 5:d3b320ebd469 | 823 | SL_ERROR_TRACE2(MSG_305, "ASSERT: _SlDrvNetAppEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); |
dflet | 5:d3b320ebd469 | 824 | VERIFY_PROTOCOL(0); |
dflet | 5:d3b320ebd469 | 825 | } |
dflet | 5:d3b320ebd469 | 826 | } |
dflet | 5:d3b320ebd469 | 827 | |
dflet | 5:d3b320ebd469 | 828 | /* |
dflet | 5:d3b320ebd469 | 829 | * ASYNCHRONOUS EVENT HANDLERS -- Start |
dflet | 5:d3b320ebd469 | 830 | */ |
dflet | 5:d3b320ebd469 | 831 | |
dflet | 5:d3b320ebd469 | 832 | /*! |
dflet | 5:d3b320ebd469 | 833 | \brief This function handles WLAN events |
dflet | 5:d3b320ebd469 | 834 | |
dflet | 5:d3b320ebd469 | 835 | \param[in] pWlanEvent is the event passed to the handler |
dflet | 5:d3b320ebd469 | 836 | |
dflet | 5:d3b320ebd469 | 837 | \return None |
dflet | 5:d3b320ebd469 | 838 | |
dflet | 5:d3b320ebd469 | 839 | \note |
dflet | 5:d3b320ebd469 | 840 | |
dflet | 5:d3b320ebd469 | 841 | \warning |
dflet | 5:d3b320ebd469 | 842 | */ |
dflet | 5:d3b320ebd469 | 843 | #if (defined(sl_WlanEvtHdlr)) |
dflet | 5:d3b320ebd469 | 844 | void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) |
dflet | 5:d3b320ebd469 | 845 | { |
dflet | 5:d3b320ebd469 | 846 | unsigned char g_ucConnectionSSID[32+1]; //Connection SSID |
dflet | 5:d3b320ebd469 | 847 | unsigned char g_ucConnectionBSSID[6]; //Connection BSSID |
dflet | 5:d3b320ebd469 | 848 | |
dflet | 5:d3b320ebd469 | 849 | if(pWlanEvent == NULL) |
dflet | 5:d3b320ebd469 | 850 | printf(" [WLAN EVENT] NULL Pointer Error \n\r"); |
dflet | 5:d3b320ebd469 | 851 | |
dflet | 5:d3b320ebd469 | 852 | switch(pWlanEvent->Event) { |
dflet | 5:d3b320ebd469 | 853 | case SL_WLAN_CONNECT_EVENT: { |
dflet | 5:d3b320ebd469 | 854 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION); |
dflet | 5:d3b320ebd469 | 855 | |
dflet | 5:d3b320ebd469 | 856 | // Copy new connection SSID and BSSID to global parameters |
dflet | 5:d3b320ebd469 | 857 | memcpy(g_ucConnectionSSID,pWlanEvent->EventData. |
dflet | 5:d3b320ebd469 | 858 | STAandP2PModeWlanConnected.ssid_name, |
dflet | 5:d3b320ebd469 | 859 | pWlanEvent->EventData.STAandP2PModeWlanConnected.ssid_len); |
dflet | 5:d3b320ebd469 | 860 | memcpy(g_ucConnectionBSSID, |
dflet | 5:d3b320ebd469 | 861 | pWlanEvent->EventData.STAandP2PModeWlanConnected.bssid, |
dflet | 5:d3b320ebd469 | 862 | SL_BSSID_LENGTH); |
dflet | 5:d3b320ebd469 | 863 | |
dflet | 5:d3b320ebd469 | 864 | printf("[WLAN EVENT] STA Connected to the AP: %s ," |
dflet | 5:d3b320ebd469 | 865 | "BSSID: %x:%x:%x:%x:%x:%x\n\r", |
dflet | 5:d3b320ebd469 | 866 | g_ucConnectionSSID,g_ucConnectionBSSID[0], |
dflet | 5:d3b320ebd469 | 867 | g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], |
dflet | 5:d3b320ebd469 | 868 | g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], |
dflet | 5:d3b320ebd469 | 869 | g_ucConnectionBSSID[5]); |
dflet | 5:d3b320ebd469 | 870 | /* |
dflet | 5:d3b320ebd469 | 871 | * Information about the connected AP (like name, MAC etc) will be |
dflet | 5:d3b320ebd469 | 872 | * available in 'slWlanConnectAsyncResponse_t' - Applications |
dflet | 5:d3b320ebd469 | 873 | * can use it if required |
dflet | 5:d3b320ebd469 | 874 | * |
dflet | 5:d3b320ebd469 | 875 | * slWlanConnectAsyncResponse_t *pEventData = NULL; |
dflet | 5:d3b320ebd469 | 876 | * pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected; |
dflet | 5:d3b320ebd469 | 877 | * |
dflet | 5:d3b320ebd469 | 878 | */ |
dflet | 5:d3b320ebd469 | 879 | } |
dflet | 5:d3b320ebd469 | 880 | break; |
dflet | 5:d3b320ebd469 | 881 | |
dflet | 5:d3b320ebd469 | 882 | case SL_WLAN_DISCONNECT_EVENT: { |
dflet | 5:d3b320ebd469 | 883 | slWlanConnectAsyncResponse_t* pEventData = NULL; |
dflet | 5:d3b320ebd469 | 884 | |
dflet | 5:d3b320ebd469 | 885 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION); |
dflet | 5:d3b320ebd469 | 886 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED); |
dflet | 5:d3b320ebd469 | 887 | |
dflet | 5:d3b320ebd469 | 888 | pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected; |
dflet | 5:d3b320ebd469 | 889 | |
dflet | 5:d3b320ebd469 | 890 | /* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */ |
dflet | 5:d3b320ebd469 | 891 | if(SL_USER_INITIATED_DISCONNECTION == pEventData->reason_code) { |
dflet | 5:d3b320ebd469 | 892 | printf("[WLAN EVENT]Device disconnected from the AP: %s," |
dflet | 5:d3b320ebd469 | 893 | "BSSID: %x:%x:%x:%x:%x:%x on application's request \n\r", |
dflet | 5:d3b320ebd469 | 894 | g_ucConnectionSSID,g_ucConnectionBSSID[0], |
dflet | 5:d3b320ebd469 | 895 | g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], |
dflet | 5:d3b320ebd469 | 896 | g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], |
dflet | 5:d3b320ebd469 | 897 | g_ucConnectionBSSID[5]); |
dflet | 5:d3b320ebd469 | 898 | } else { |
dflet | 5:d3b320ebd469 | 899 | printf("[WLAN ERROR]Device disconnected from the AP AP: %s," |
dflet | 5:d3b320ebd469 | 900 | "BSSID: %x:%x:%x:%x:%x:%x on an ERROR..!! \n\r", |
dflet | 5:d3b320ebd469 | 901 | g_ucConnectionSSID,g_ucConnectionBSSID[0], |
dflet | 5:d3b320ebd469 | 902 | g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], |
dflet | 5:d3b320ebd469 | 903 | g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], |
dflet | 5:d3b320ebd469 | 904 | g_ucConnectionBSSID[5]); |
dflet | 5:d3b320ebd469 | 905 | } |
dflet | 5:d3b320ebd469 | 906 | memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID)); |
dflet | 5:d3b320ebd469 | 907 | memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID)); |
dflet | 5:d3b320ebd469 | 908 | } |
dflet | 5:d3b320ebd469 | 909 | break; |
dflet | 5:d3b320ebd469 | 910 | |
dflet | 5:d3b320ebd469 | 911 | case SL_WLAN_STA_CONNECTED_EVENT: { |
dflet | 5:d3b320ebd469 | 912 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_STA_CONNECTED); |
dflet | 5:d3b320ebd469 | 913 | } |
dflet | 5:d3b320ebd469 | 914 | break; |
dflet | 5:d3b320ebd469 | 915 | |
dflet | 5:d3b320ebd469 | 916 | case SL_WLAN_STA_DISCONNECTED_EVENT: { |
dflet | 5:d3b320ebd469 | 917 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_STA_CONNECTED); |
dflet | 5:d3b320ebd469 | 918 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_LEASED); |
dflet | 5:d3b320ebd469 | 919 | } |
dflet | 5:d3b320ebd469 | 920 | break; |
dflet | 5:d3b320ebd469 | 921 | |
dflet | 5:d3b320ebd469 | 922 | default: { |
dflet | 5:d3b320ebd469 | 923 | printf("[WLAN EVENT] Unexpected event [0x%x]\n\r",pWlanEvent->Event); |
dflet | 5:d3b320ebd469 | 924 | } |
dflet | 5:d3b320ebd469 | 925 | break; |
dflet | 5:d3b320ebd469 | 926 | } |
dflet | 5:d3b320ebd469 | 927 | } |
dflet | 5:d3b320ebd469 | 928 | #endif |
dflet | 5:d3b320ebd469 | 929 | |
dflet | 5:d3b320ebd469 | 930 | /*! |
dflet | 5:d3b320ebd469 | 931 | \brief This function handles events for IP address acquisition via DHCP |
dflet | 5:d3b320ebd469 | 932 | indication |
dflet | 5:d3b320ebd469 | 933 | |
dflet | 5:d3b320ebd469 | 934 | \param[in] pNetAppEvent is the event passed to the handler |
dflet | 5:d3b320ebd469 | 935 | |
dflet | 5:d3b320ebd469 | 936 | \return None |
dflet | 5:d3b320ebd469 | 937 | |
dflet | 5:d3b320ebd469 | 938 | \note |
dflet | 5:d3b320ebd469 | 939 | |
dflet | 5:d3b320ebd469 | 940 | \warning |
dflet | 5:d3b320ebd469 | 941 | */ |
dflet | 5:d3b320ebd469 | 942 | #if (defined(sl_NetAppEvtHdlr)) |
dflet | 5:d3b320ebd469 | 943 | void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent) |
dflet | 5:d3b320ebd469 | 944 | { |
dflet | 5:d3b320ebd469 | 945 | |
dflet | 5:d3b320ebd469 | 946 | if(pNetAppEvent == NULL){ |
dflet | 5:d3b320ebd469 | 947 | printf(" [NETAPP EVENT] NULL Pointer Error \n\r"); |
dflet | 5:d3b320ebd469 | 948 | } |
dflet | 5:d3b320ebd469 | 949 | |
dflet | 5:d3b320ebd469 | 950 | switch(pNetAppEvent->Event) { |
dflet | 5:d3b320ebd469 | 951 | case SL_NETAPP_IPV4_IPACQUIRED_EVENT: { |
dflet | 5:d3b320ebd469 | 952 | SlIpV4AcquiredAsync_t *pEventData = NULL; |
dflet | 5:d3b320ebd469 | 953 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED); |
dflet | 5:d3b320ebd469 | 954 | pEventData = &pNetAppEvent->EventData.ipAcquiredV4; |
dflet | 5:d3b320ebd469 | 955 | g_GatewayIP = pEventData->gateway; |
dflet | 5:d3b320ebd469 | 956 | |
dflet | 5:d3b320ebd469 | 957 | printf("[NETAPP EVENT] IP Acquired: IP=%d.%d.%d.%d , ""Gateway=%d.%d.%d.%d\n\r", |
dflet | 5:d3b320ebd469 | 958 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,3), |
dflet | 5:d3b320ebd469 | 959 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,2), |
dflet | 5:d3b320ebd469 | 960 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,1), |
dflet | 5:d3b320ebd469 | 961 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,0), |
dflet | 5:d3b320ebd469 | 962 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,3), |
dflet | 5:d3b320ebd469 | 963 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,2), |
dflet | 5:d3b320ebd469 | 964 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,1), |
dflet | 5:d3b320ebd469 | 965 | _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,0)); |
dflet | 5:d3b320ebd469 | 966 | |
dflet | 5:d3b320ebd469 | 967 | } |
dflet | 5:d3b320ebd469 | 968 | break; |
dflet | 5:d3b320ebd469 | 969 | |
dflet | 5:d3b320ebd469 | 970 | case SL_NETAPP_IP_LEASED_EVENT: { |
dflet | 5:d3b320ebd469 | 971 | g_StationIP = pNetAppEvent->EventData.ipLeased.ip_address; |
dflet | 5:d3b320ebd469 | 972 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_IP_LEASED); |
dflet | 5:d3b320ebd469 | 973 | |
dflet | 5:d3b320ebd469 | 974 | } |
dflet | 5:d3b320ebd469 | 975 | break; |
dflet | 5:d3b320ebd469 | 976 | |
dflet | 5:d3b320ebd469 | 977 | default: { |
dflet | 5:d3b320ebd469 | 978 | printf("[NETAPP EVENT] Unexpected event [0x%x] \n\r",pNetAppEvent->Event); |
dflet | 5:d3b320ebd469 | 979 | } |
dflet | 5:d3b320ebd469 | 980 | break; |
dflet | 5:d3b320ebd469 | 981 | } |
dflet | 5:d3b320ebd469 | 982 | } |
dflet | 5:d3b320ebd469 | 983 | #endif |
dflet | 5:d3b320ebd469 | 984 | |
dflet | 5:d3b320ebd469 | 985 | /*! |
dflet | 5:d3b320ebd469 | 986 | \brief This function handles socket events indication |
dflet | 5:d3b320ebd469 | 987 | |
dflet | 5:d3b320ebd469 | 988 | \param[in] pSock is the event passed to the handler |
dflet | 5:d3b320ebd469 | 989 | |
dflet | 5:d3b320ebd469 | 990 | \return None |
dflet | 5:d3b320ebd469 | 991 | */ |
dflet | 5:d3b320ebd469 | 992 | #if (defined(sl_SockEvtHdlr)) |
dflet | 5:d3b320ebd469 | 993 | void SimpleLinkSockEventHandler(SlSockEvent_t *pSock) |
dflet | 5:d3b320ebd469 | 994 | { |
dflet | 5:d3b320ebd469 | 995 | if(pSock == NULL) |
dflet | 5:d3b320ebd469 | 996 | printf(" [SOCK EVENT] NULL Pointer Error \n\r"); |
dflet | 5:d3b320ebd469 | 997 | |
dflet | 5:d3b320ebd469 | 998 | switch( pSock->Event ) |
dflet | 5:d3b320ebd469 | 999 | { |
dflet | 5:d3b320ebd469 | 1000 | case SL_SOCKET_TX_FAILED_EVENT: |
dflet | 5:d3b320ebd469 | 1001 | /* |
dflet | 5:d3b320ebd469 | 1002 | * TX Failed |
dflet | 5:d3b320ebd469 | 1003 | * |
dflet | 5:d3b320ebd469 | 1004 | * Information about the socket descriptor and status will be |
dflet | 5:d3b320ebd469 | 1005 | * available in 'SlSockEventData_t' - Applications can use it if |
dflet | 5:d3b320ebd469 | 1006 | * required |
dflet | 5:d3b320ebd469 | 1007 | * |
dflet | 5:d3b320ebd469 | 1008 | * SlSockEventData_t *pEventData = NULL; |
dflet | 5:d3b320ebd469 | 1009 | * pEventData = & pSock->EventData; |
dflet | 5:d3b320ebd469 | 1010 | */ |
dflet | 5:d3b320ebd469 | 1011 | |
dflet | 5:d3b320ebd469 | 1012 | switch( pSock->socketAsyncEvent.SockTxFailData.status ) |
dflet | 5:d3b320ebd469 | 1013 | { |
dflet | 5:d3b320ebd469 | 1014 | case SL_ECLOSE: |
dflet | 5:d3b320ebd469 | 1015 | printf(" [SOCK EVENT] Close socket operation, failed to transmit all queued packets\n\r"); |
dflet | 5:d3b320ebd469 | 1016 | break; |
dflet | 5:d3b320ebd469 | 1017 | default: |
dflet | 5:d3b320ebd469 | 1018 | printf("[SOCK ERROR] - TX FAILED : socket %d , reason""(%d) \n\n", pSock->socketAsyncEvent.SockTxFailData.sd, pSock->socketAsyncEvent.SockTxFailData.status); |
dflet | 5:d3b320ebd469 | 1019 | break; |
dflet | 5:d3b320ebd469 | 1020 | } |
dflet | 5:d3b320ebd469 | 1021 | break; |
dflet | 5:d3b320ebd469 | 1022 | |
dflet | 5:d3b320ebd469 | 1023 | default: |
dflet | 5:d3b320ebd469 | 1024 | printf("[SOCK EVENT] - Unexpected Event [%x0x]\n\n",pSock->Event); |
dflet | 5:d3b320ebd469 | 1025 | break; |
dflet | 5:d3b320ebd469 | 1026 | } |
dflet | 5:d3b320ebd469 | 1027 | } |
dflet | 5:d3b320ebd469 | 1028 | #endif |
dflet | 5:d3b320ebd469 | 1029 | |
dflet | 5:d3b320ebd469 | 1030 | /*! |
dflet | 5:d3b320ebd469 | 1031 | \brief This function handles callback for the HTTP server events |
dflet | 5:d3b320ebd469 | 1032 | |
dflet | 5:d3b320ebd469 | 1033 | \param[in] pHttpEvent - Contains the relevant event information |
dflet | 5:d3b320ebd469 | 1034 | \param[in] pHttpResponse - Should be filled by the user with the |
dflet | 5:d3b320ebd469 | 1035 | relevant response information |
dflet | 5:d3b320ebd469 | 1036 | |
dflet | 5:d3b320ebd469 | 1037 | \return None |
dflet | 5:d3b320ebd469 | 1038 | |
dflet | 5:d3b320ebd469 | 1039 | \note |
dflet | 5:d3b320ebd469 | 1040 | |
dflet | 5:d3b320ebd469 | 1041 | \warning |
dflet | 5:d3b320ebd469 | 1042 | */ |
dflet | 5:d3b320ebd469 | 1043 | #if (defined(sl_HttpServerCallback)) |
dflet | 5:d3b320ebd469 | 1044 | void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse) |
dflet | 5:d3b320ebd469 | 1045 | { |
dflet | 5:d3b320ebd469 | 1046 | /* |
dflet | 5:d3b320ebd469 | 1047 | * This application doesn't work with HTTP server - Hence these |
dflet | 5:d3b320ebd469 | 1048 | * events are not handled here |
dflet | 5:d3b320ebd469 | 1049 | */ |
dflet | 5:d3b320ebd469 | 1050 | printf(" [HTTP EVENT] Unexpected event \n\r"); |
dflet | 5:d3b320ebd469 | 1051 | } |
dflet | 5:d3b320ebd469 | 1052 | #endif |
dflet | 5:d3b320ebd469 | 1053 | /*! |
dflet | 5:d3b320ebd469 | 1054 | \brief This function handles general error events indication |
dflet | 5:d3b320ebd469 | 1055 | |
dflet | 5:d3b320ebd469 | 1056 | \param[in] pDevEvent is the event passed to the handler |
dflet | 5:d3b320ebd469 | 1057 | |
dflet | 5:d3b320ebd469 | 1058 | \return None |
dflet | 5:d3b320ebd469 | 1059 | */ |
dflet | 5:d3b320ebd469 | 1060 | #if (defined(sl_GeneralEvtHdlr)) |
dflet | 5:d3b320ebd469 | 1061 | void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent) |
dflet | 5:d3b320ebd469 | 1062 | { |
dflet | 5:d3b320ebd469 | 1063 | /* |
dflet | 5:d3b320ebd469 | 1064 | * Most of the general errors are not FATAL are are to be handled |
dflet | 5:d3b320ebd469 | 1065 | * appropriately by the application |
dflet | 5:d3b320ebd469 | 1066 | */ |
dflet | 5:d3b320ebd469 | 1067 | printf("[GENERAL EVENT] - ID=[%d] Sender=[%d]\n\n", pDevEvent->EventData.deviceEvent.status, pDevEvent->EventData.deviceEvent.sender); |
dflet | 5:d3b320ebd469 | 1068 | } |
dflet | 5:d3b320ebd469 | 1069 | #endif |
dflet | 5:d3b320ebd469 | 1070 | |
dflet | 5:d3b320ebd469 | 1071 | #ifdef __cplusplus |
dflet | 5:d3b320ebd469 | 1072 | } |
dflet | 5:d3b320ebd469 | 1073 | #endif /* __cplusplus */ |
dflet | 5:d3b320ebd469 | 1074 | |
dflet | 5:d3b320ebd469 | 1075 | //}//namespace |