Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
G_functions/fPtr_func.cpp@0:e89ba455dbcf, 2015-02-10 (annotated)
- Committer:
- dflet
- Date:
- Tue Feb 10 12:09:29 2015 +0000
- Revision:
- 0:e89ba455dbcf
- Child:
- 1:c73566c6788a
For test only! Not much has been tested, but the 2 demo apps run ok. Alot more work needs to be done!
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dflet | 0:e89ba455dbcf | 1 | /* |
| dflet | 0:e89ba455dbcf | 2 | * - CC31xx/CC32xx Host Driver Implementation |
| dflet | 0:e89ba455dbcf | 3 | * |
| dflet | 0:e89ba455dbcf | 4 | * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ |
| dflet | 0:e89ba455dbcf | 5 | * |
| dflet | 0:e89ba455dbcf | 6 | * |
| dflet | 0:e89ba455dbcf | 7 | * Redistribution and use in source and binary forms, with or without |
| dflet | 0:e89ba455dbcf | 8 | * modification, are permitted provided that the following conditions |
| dflet | 0:e89ba455dbcf | 9 | * are met: |
| dflet | 0:e89ba455dbcf | 10 | * |
| dflet | 0:e89ba455dbcf | 11 | * Redistributions of source code must retain the above copyright |
| dflet | 0:e89ba455dbcf | 12 | * notice, this list of conditions and the following disclaimer. |
| dflet | 0:e89ba455dbcf | 13 | * |
| dflet | 0:e89ba455dbcf | 14 | * Redistributions in binary form must reproduce the above copyright |
| dflet | 0:e89ba455dbcf | 15 | * notice, this list of conditions and the following disclaimer in the |
| dflet | 0:e89ba455dbcf | 16 | * documentation and/or other materials provided with the |
| dflet | 0:e89ba455dbcf | 17 | * distribution. |
| dflet | 0:e89ba455dbcf | 18 | * |
| dflet | 0:e89ba455dbcf | 19 | * Neither the name of Texas Instruments Incorporated nor the names of |
| dflet | 0:e89ba455dbcf | 20 | * its contributors may be used to endorse or promote products derived |
| dflet | 0:e89ba455dbcf | 21 | * from this software without specific prior written permission. |
| dflet | 0:e89ba455dbcf | 22 | * |
| dflet | 0:e89ba455dbcf | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| dflet | 0:e89ba455dbcf | 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| dflet | 0:e89ba455dbcf | 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| dflet | 0:e89ba455dbcf | 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| dflet | 0:e89ba455dbcf | 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| dflet | 0:e89ba455dbcf | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| dflet | 0:e89ba455dbcf | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| dflet | 0:e89ba455dbcf | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| dflet | 0:e89ba455dbcf | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| dflet | 0:e89ba455dbcf | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| dflet | 0:e89ba455dbcf | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| dflet | 0:e89ba455dbcf | 34 | * |
| dflet | 0:e89ba455dbcf | 35 | */ |
| dflet | 0:e89ba455dbcf | 36 | //#include "mbed.h" |
| dflet | 0:e89ba455dbcf | 37 | #include "cc3100_simplelink.h" |
| dflet | 0:e89ba455dbcf | 38 | //#include "cc3100_sl_common.h" |
| dflet | 0:e89ba455dbcf | 39 | //#include "cc3100_protocol.h" |
| dflet | 0:e89ba455dbcf | 40 | |
| dflet | 0:e89ba455dbcf | 41 | //#include "cc3100_driver.h" |
| dflet | 0:e89ba455dbcf | 42 | //#include "cc3100_nonos.h" |
| dflet | 0:e89ba455dbcf | 43 | //#include "cc3100_netapp.h" |
| dflet | 0:e89ba455dbcf | 44 | #include "cc3100.h" |
| dflet | 0:e89ba455dbcf | 45 | #include "fPtr_func.h" |
| dflet | 0:e89ba455dbcf | 46 | |
| dflet | 0:e89ba455dbcf | 47 | |
| dflet | 0:e89ba455dbcf | 48 | using namespace mbed_cc3100; |
| dflet | 0:e89ba455dbcf | 49 | |
| dflet | 0:e89ba455dbcf | 50 | cc3100_driver *_driver; |
| dflet | 0:e89ba455dbcf | 51 | cc3100_nonos *_nonos; |
| dflet | 0:e89ba455dbcf | 52 | cc3100_netapp *_netapp; |
| dflet | 0:e89ba455dbcf | 53 | cc3100 *_cc3100_; |
| dflet | 0:e89ba455dbcf | 54 | |
| dflet | 0:e89ba455dbcf | 55 | #ifdef __cplusplus |
| dflet | 0:e89ba455dbcf | 56 | extern "C" { |
| dflet | 0:e89ba455dbcf | 57 | #endif |
| dflet | 0:e89ba455dbcf | 58 | |
| dflet | 0:e89ba455dbcf | 59 | /*! |
| dflet | 0:e89ba455dbcf | 60 | \brief This function handles ping report events |
| dflet | 0:e89ba455dbcf | 61 | |
| dflet | 0:e89ba455dbcf | 62 | \param[in] pPingReport holds the ping report statistics |
| dflet | 0:e89ba455dbcf | 63 | |
| dflet | 0:e89ba455dbcf | 64 | \return None |
| dflet | 0:e89ba455dbcf | 65 | |
| dflet | 0:e89ba455dbcf | 66 | \note |
| dflet | 0:e89ba455dbcf | 67 | |
| dflet | 0:e89ba455dbcf | 68 | \warning |
| dflet | 0:e89ba455dbcf | 69 | */ |
| dflet | 0:e89ba455dbcf | 70 | void SimpleLinkPingReport(SlPingReport_t *pPingReport) |
| dflet | 0:e89ba455dbcf | 71 | { |
| dflet | 0:e89ba455dbcf | 72 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_PING_DONE); |
| dflet | 0:e89ba455dbcf | 73 | |
| dflet | 0:e89ba455dbcf | 74 | if(pPingReport == NULL) |
| dflet | 0:e89ba455dbcf | 75 | printf(" [PING REPORT] NULL Pointer Error\r\n"); |
| dflet | 0:e89ba455dbcf | 76 | |
| dflet | 0:e89ba455dbcf | 77 | g_PingPacketsRecv = pPingReport->PacketsReceived; |
| dflet | 0:e89ba455dbcf | 78 | } |
| dflet | 0:e89ba455dbcf | 79 | |
| dflet | 0:e89ba455dbcf | 80 | |
| dflet | 0:e89ba455dbcf | 81 | /*******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 82 | /* _sl_HandleAsync_Accept */ |
| dflet | 0:e89ba455dbcf | 83 | /*******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 84 | void _sl_HandleAsync_Accept(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 85 | { |
| dflet | 0:e89ba455dbcf | 86 | //printf("_sl_HandleAsync_Accept\r\n"); |
| dflet | 0:e89ba455dbcf | 87 | _SocketAddrResponse_u *pMsgArgs = (_SocketAddrResponse_u *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 88 | |
| dflet | 0:e89ba455dbcf | 89 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER)); |
| dflet | 0:e89ba455dbcf | 90 | |
| dflet | 0:e89ba455dbcf | 91 | VERIFY_PROTOCOL(( pMsgArgs->IpV4.sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS); |
| dflet | 0:e89ba455dbcf | 92 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
| dflet | 0:e89ba455dbcf | 93 | |
| dflet | 0:e89ba455dbcf | 94 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs,sizeof(_SocketAddrResponse_u)); |
| dflet | 0:e89ba455dbcf | 95 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 96 | |
| dflet | 0:e89ba455dbcf | 97 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 98 | return; |
| dflet | 0:e89ba455dbcf | 99 | } |
| dflet | 0:e89ba455dbcf | 100 | |
| dflet | 0:e89ba455dbcf | 101 | /*******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 102 | /* _sl_HandleAsync_Connect */ |
| dflet | 0:e89ba455dbcf | 103 | /*******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 104 | void _sl_HandleAsync_Connect(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 105 | { |
| dflet | 0:e89ba455dbcf | 106 | //printf("_sl_HandleAsync_Connect\r\n"); |
| dflet | 0:e89ba455dbcf | 107 | _SocketResponse_t *pMsgArgs = (_SocketResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 108 | |
| dflet | 0:e89ba455dbcf | 109 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER)); |
| dflet | 0:e89ba455dbcf | 110 | |
| dflet | 0:e89ba455dbcf | 111 | VERIFY_PROTOCOL((pMsgArgs->sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS); |
| dflet | 0:e89ba455dbcf | 112 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
| dflet | 0:e89ba455dbcf | 113 | |
| dflet | 0:e89ba455dbcf | 114 | ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->sd = pMsgArgs->sd; |
| dflet | 0:e89ba455dbcf | 115 | ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->statusOrLen = pMsgArgs->statusOrLen; |
| dflet | 0:e89ba455dbcf | 116 | |
| dflet | 0:e89ba455dbcf | 117 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 118 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 119 | return; |
| dflet | 0:e89ba455dbcf | 120 | } |
| dflet | 0:e89ba455dbcf | 121 | |
| dflet | 0:e89ba455dbcf | 122 | /*******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 123 | /* _sl_HandleAsync_Select */ |
| dflet | 0:e89ba455dbcf | 124 | /*******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 125 | void _sl_HandleAsync_Select(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 126 | { |
| dflet | 0:e89ba455dbcf | 127 | //printf("_sl_HandleAsync_Select\r\n"); |
| dflet | 0:e89ba455dbcf | 128 | _SelectAsyncResponse_t *pMsgArgs = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 129 | |
| dflet | 0:e89ba455dbcf | 130 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER)); |
| dflet | 0:e89ba455dbcf | 131 | |
| dflet | 0:e89ba455dbcf | 132 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
| dflet | 0:e89ba455dbcf | 133 | |
| dflet | 0:e89ba455dbcf | 134 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t)); |
| dflet | 0:e89ba455dbcf | 135 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 136 | |
| dflet | 0:e89ba455dbcf | 137 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 138 | return; |
| dflet | 0:e89ba455dbcf | 139 | } |
| dflet | 0:e89ba455dbcf | 140 | |
| dflet | 0:e89ba455dbcf | 141 | /******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 142 | /* _sl_HandleAsync_DnsGetHostByName */ |
| dflet | 0:e89ba455dbcf | 143 | /******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 144 | void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 145 | { |
| dflet | 0:e89ba455dbcf | 146 | //printf("_sl_HandleAsync_DnsGetHostByName\r\n"); |
| dflet | 0:e89ba455dbcf | 147 | _GetHostByNameIPv4AsyncResponse_t *pMsgArgs = (_GetHostByNameIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 148 | |
| dflet | 0:e89ba455dbcf | 149 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER)); |
| dflet | 0:e89ba455dbcf | 150 | |
| dflet | 0:e89ba455dbcf | 151 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
| dflet | 0:e89ba455dbcf | 152 | |
| dflet | 0:e89ba455dbcf | 153 | /*IPv6 */ |
| dflet | 0:e89ba455dbcf | 154 | if(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) { |
| dflet | 0:e89ba455dbcf | 155 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv6AsyncResponse_t)); |
| dflet | 0:e89ba455dbcf | 156 | } |
| dflet | 0:e89ba455dbcf | 157 | /*IPv4 */ |
| dflet | 0:e89ba455dbcf | 158 | else { |
| dflet | 0:e89ba455dbcf | 159 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv4AsyncResponse_t)); |
| dflet | 0:e89ba455dbcf | 160 | } |
| dflet | 0:e89ba455dbcf | 161 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 162 | |
| dflet | 0:e89ba455dbcf | 163 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 164 | return; |
| dflet | 0:e89ba455dbcf | 165 | } |
| dflet | 0:e89ba455dbcf | 166 | |
| dflet | 0:e89ba455dbcf | 167 | /******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 168 | |
| dflet | 0:e89ba455dbcf | 169 | /****************************************************************************** |
| dflet | 0:e89ba455dbcf | 170 | _sl_HandleAsync_DnsGetHostByService |
| dflet | 0:e89ba455dbcf | 171 | |
| dflet | 0:e89ba455dbcf | 172 | CALLER NWP - Async event on sl_DnsGetHostByService with IPv4 Family |
| dflet | 0:e89ba455dbcf | 173 | |
| dflet | 0:e89ba455dbcf | 174 | |
| dflet | 0:e89ba455dbcf | 175 | DESCRIPTION: |
| dflet | 0:e89ba455dbcf | 176 | |
| dflet | 0:e89ba455dbcf | 177 | Async event on sl_DnsGetHostByService command with IPv4 Family. |
| dflet | 0:e89ba455dbcf | 178 | Return service attributes like IP address, port and text according to service name. |
| dflet | 0:e89ba455dbcf | 179 | The user sets a service name Full/Part (see example below), and should get the: |
| dflet | 0:e89ba455dbcf | 180 | 1. IP of the service |
| dflet | 0:e89ba455dbcf | 181 | 2. The port of service. |
| dflet | 0:e89ba455dbcf | 182 | 3. The text of service. |
| dflet | 0:e89ba455dbcf | 183 | |
| dflet | 0:e89ba455dbcf | 184 | Hence it can make a connection to the specific service and use it. |
| dflet | 0:e89ba455dbcf | 185 | It is similar to get host by name method. |
| dflet | 0:e89ba455dbcf | 186 | |
| dflet | 0:e89ba455dbcf | 187 | It is done by a single shot query with PTR type on the service name. |
| dflet | 0:e89ba455dbcf | 188 | |
| dflet | 0:e89ba455dbcf | 189 | |
| dflet | 0:e89ba455dbcf | 190 | |
| dflet | 0:e89ba455dbcf | 191 | Note: |
| dflet | 0:e89ba455dbcf | 192 | 1. The return's attributes are belonged to first service that is found. |
| dflet | 0:e89ba455dbcf | 193 | It can be other services with the same service name will response to |
| dflet | 0:e89ba455dbcf | 194 | the query. The results of these responses are saved in the peer cache of the NWP, and |
| dflet | 0:e89ba455dbcf | 195 | should be read by another API. |
| dflet | 0:e89ba455dbcf | 196 | |
| dflet | 0:e89ba455dbcf | 197 | |
| dflet | 0:e89ba455dbcf | 198 | PARAMETERS: |
| dflet | 0:e89ba455dbcf | 199 | |
| dflet | 0:e89ba455dbcf | 200 | pVoidBuf - is point to opcode of the event. |
| dflet | 0:e89ba455dbcf | 201 | it contains the outputs that are given to the user |
| dflet | 0:e89ba455dbcf | 202 | |
| dflet | 0:e89ba455dbcf | 203 | outputs description: |
| dflet | 0:e89ba455dbcf | 204 | |
| dflet | 0:e89ba455dbcf | 205 | 1.out_pAddr[] - output: Contain the IP address of the service. |
| dflet | 0:e89ba455dbcf | 206 | 2.out_pPort - output: Contain the port of the service. |
| dflet | 0:e89ba455dbcf | 207 | 3.inout_TextLen - Input: Contain the max length of the text that the user wants to get. |
| dflet | 0:e89ba455dbcf | 208 | it means that if the test of service is bigger that its value than |
| dflet | 0:e89ba455dbcf | 209 | the text is cut to inout_TextLen value. |
| dflet | 0:e89ba455dbcf | 210 | Output: Contain the length of the text that is returned. Can be full text or part |
| dflet | 0:e89ba455dbcf | 211 | of the text (see above). |
| dflet | 0:e89ba455dbcf | 212 | |
| dflet | 0:e89ba455dbcf | 213 | 4.out_pText - Contain the text of the service (full or part see above- inout_TextLen description). |
| dflet | 0:e89ba455dbcf | 214 | |
| dflet | 0:e89ba455dbcf | 215 | * |
| dflet | 0:e89ba455dbcf | 216 | |
| dflet | 0:e89ba455dbcf | 217 | |
| dflet | 0:e89ba455dbcf | 218 | RETURNS: success or fail. |
| dflet | 0:e89ba455dbcf | 219 | |
| dflet | 0:e89ba455dbcf | 220 | ******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 221 | void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 222 | { |
| dflet | 0:e89ba455dbcf | 223 | //printf("_sl_HandleAsync_DnsGetHostByService\r\n"); |
| dflet | 0:e89ba455dbcf | 224 | _GetHostByServiceAsyncResponse_t* Res; |
| dflet | 0:e89ba455dbcf | 225 | uint16_t TextLen; |
| dflet | 0:e89ba455dbcf | 226 | uint16_t UserTextLen; |
| dflet | 0:e89ba455dbcf | 227 | |
| dflet | 0:e89ba455dbcf | 228 | /*pVoidBuf - is point to opcode of the event.*/ |
| dflet | 0:e89ba455dbcf | 229 | |
| dflet | 0:e89ba455dbcf | 230 | /*set pMsgArgs to point to the attribute of the event.*/ |
| dflet | 0:e89ba455dbcf | 231 | _GetHostByServiceIPv4AsyncResponse_t *pMsgArgs = (_GetHostByServiceIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 232 | |
| dflet | 0:e89ba455dbcf | 233 | VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs); |
| dflet | 0:e89ba455dbcf | 234 | |
| dflet | 0:e89ba455dbcf | 235 | /*IPv6*/ |
| dflet | 0:e89ba455dbcf | 236 | if(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) { |
| dflet | 0:e89ba455dbcf | 237 | return; |
| dflet | 0:e89ba455dbcf | 238 | } |
| dflet | 0:e89ba455dbcf | 239 | /*IPv4*/ |
| dflet | 0:e89ba455dbcf | 240 | else { |
| dflet | 0:e89ba455dbcf | 241 | /************************************************************************************************* |
| dflet | 0:e89ba455dbcf | 242 | |
| dflet | 0:e89ba455dbcf | 243 | 1. Copy the attribute part of the evnt to the attribute part of the response |
| dflet | 0:e89ba455dbcf | 244 | memcpy(g_pCB->GetHostByServiceCB.pAsyncRsp, pMsgArgs, sizeof(_GetHostByServiceIPv4AsyncResponse_t)); |
| dflet | 0:e89ba455dbcf | 245 | |
| dflet | 0:e89ba455dbcf | 246 | set to TextLen the text length of the service.*/ |
| dflet | 0:e89ba455dbcf | 247 | TextLen = pMsgArgs->TextLen; |
| dflet | 0:e89ba455dbcf | 248 | |
| dflet | 0:e89ba455dbcf | 249 | /*Res pointed to mDNS global object struct */ |
| dflet | 0:e89ba455dbcf | 250 | Res = (_GetHostByServiceAsyncResponse_t*)g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs; |
| dflet | 0:e89ba455dbcf | 251 | |
| dflet | 0:e89ba455dbcf | 252 | |
| dflet | 0:e89ba455dbcf | 253 | |
| dflet | 0:e89ba455dbcf | 254 | /*It is 4 bytes so we avoid from memcpy*/ |
| dflet | 0:e89ba455dbcf | 255 | Res->out_pAddr[0] = pMsgArgs->Address; |
| dflet | 0:e89ba455dbcf | 256 | Res->out_pPort[0] = pMsgArgs->Port; |
| dflet | 0:e89ba455dbcf | 257 | Res->Status = pMsgArgs->Status; |
| dflet | 0:e89ba455dbcf | 258 | |
| dflet | 0:e89ba455dbcf | 259 | /*set to TextLen the text length of the user (input fromthe user).*/ |
| dflet | 0:e89ba455dbcf | 260 | UserTextLen = Res->inout_TextLen[0]; |
| dflet | 0:e89ba455dbcf | 261 | |
| dflet | 0:e89ba455dbcf | 262 | /*Cut the service text if the user requested for smaller text.*/ |
| dflet | 0:e89ba455dbcf | 263 | UserTextLen = (TextLen <= UserTextLen) ? TextLen : UserTextLen; |
| dflet | 0:e89ba455dbcf | 264 | Res->inout_TextLen[0] = UserTextLen ; |
| dflet | 0:e89ba455dbcf | 265 | |
| dflet | 0:e89ba455dbcf | 266 | /************************************************************************************************** |
| dflet | 0:e89ba455dbcf | 267 | |
| dflet | 0:e89ba455dbcf | 268 | 2. Copy the payload part of the evnt (the text) to the payload part of the response |
| dflet | 0:e89ba455dbcf | 269 | the lenght of the copy is according to the text length in the attribute part. */ |
| dflet | 0:e89ba455dbcf | 270 | |
| dflet | 0:e89ba455dbcf | 271 | |
| dflet | 0:e89ba455dbcf | 272 | memcpy(Res->out_pText , |
| dflet | 0:e89ba455dbcf | 273 | (int8_t *)(& pMsgArgs[1]), /* & pMsgArgs[1] -> 1st byte after the fixed header = 1st byte of variable text.*/ |
| dflet | 0:e89ba455dbcf | 274 | UserTextLen); |
| dflet | 0:e89ba455dbcf | 275 | |
| dflet | 0:e89ba455dbcf | 276 | |
| dflet | 0:e89ba455dbcf | 277 | /**************************************************************************************************/ |
| dflet | 0:e89ba455dbcf | 278 | |
| dflet | 0:e89ba455dbcf | 279 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 280 | return; |
| dflet | 0:e89ba455dbcf | 281 | } |
| dflet | 0:e89ba455dbcf | 282 | } |
| dflet | 0:e89ba455dbcf | 283 | |
| dflet | 0:e89ba455dbcf | 284 | /*****************************************************************************/ |
| dflet | 0:e89ba455dbcf | 285 | /* _sl_HandleAsync_PingResponse */ |
| dflet | 0:e89ba455dbcf | 286 | /*****************************************************************************/ |
| dflet | 0:e89ba455dbcf | 287 | void _sl_HandleAsync_PingResponse(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 288 | { |
| dflet | 0:e89ba455dbcf | 289 | //printf("_sl_HandleAsync_PingResponse\r\n"); |
| dflet | 0:e89ba455dbcf | 290 | _PingReportResponse_t *pMsgArgs = (_PingReportResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 291 | SlPingReport_t pingReport; |
| dflet | 0:e89ba455dbcf | 292 | |
| dflet | 0:e89ba455dbcf | 293 | if(pPingCallBackFunc) { |
| dflet | 0:e89ba455dbcf | 294 | _netapp->CopyPingResultsToReport(pMsgArgs,&pingReport); |
| dflet | 0:e89ba455dbcf | 295 | pPingCallBackFunc(&pingReport); |
| dflet | 0:e89ba455dbcf | 296 | } else { |
| dflet | 0:e89ba455dbcf | 297 | |
| dflet | 0:e89ba455dbcf | 298 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER)); |
| dflet | 0:e89ba455dbcf | 299 | VERIFY_SOCKET_CB(NULL != g_pCB->PingCB.PingAsync.pAsyncRsp); |
| dflet | 0:e89ba455dbcf | 300 | |
| dflet | 0:e89ba455dbcf | 301 | if (NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs) { |
| dflet | 0:e89ba455dbcf | 302 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_PingReportResponse_t)); |
| dflet | 0:e89ba455dbcf | 303 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 304 | } |
| dflet | 0:e89ba455dbcf | 305 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 306 | } |
| dflet | 0:e89ba455dbcf | 307 | return; |
| dflet | 0:e89ba455dbcf | 308 | } |
| dflet | 0:e89ba455dbcf | 309 | |
| dflet | 0:e89ba455dbcf | 310 | /* ******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 311 | /* _SlDrvMsgReadSpawnCtx */ |
| dflet | 0:e89ba455dbcf | 312 | /* ******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 313 | _SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue) |
| dflet | 0:e89ba455dbcf | 314 | { |
| dflet | 0:e89ba455dbcf | 315 | //printf("_SlDrvMsgReadSpawnCtx\r\n"); |
| dflet | 0:e89ba455dbcf | 316 | |
| dflet | 0:e89ba455dbcf | 317 | #ifdef SL_POLLING_MODE_USED |
| dflet | 0:e89ba455dbcf | 318 | int16_t retCode = OSI_OK; |
| dflet | 0:e89ba455dbcf | 319 | /* for polling based systems */ |
| dflet | 0:e89ba455dbcf | 320 | do { |
| dflet | 0:e89ba455dbcf | 321 | retCode = sl_LockObjLock(&g_pCB->GlobalLockObj, 0); |
| dflet | 0:e89ba455dbcf | 322 | if ( OSI_OK != retCode ) { |
| dflet | 0:e89ba455dbcf | 323 | if (TRUE == g_pCB->IsCmdRespWaited) { |
| dflet | 0:e89ba455dbcf | 324 | OSI_RET_OK_CHECK( sl_SyncObjSignal(&g_pCB->CmdSyncObj) ); |
| dflet | 0:e89ba455dbcf | 325 | return SL_RET_CODE_OK; |
| dflet | 0:e89ba455dbcf | 326 | //return; |
| dflet | 0:e89ba455dbcf | 327 | } |
| dflet | 0:e89ba455dbcf | 328 | } |
| dflet | 0:e89ba455dbcf | 329 | |
| dflet | 0:e89ba455dbcf | 330 | } while (OSI_OK != retCode); |
| dflet | 0:e89ba455dbcf | 331 | |
| dflet | 0:e89ba455dbcf | 332 | #else |
| dflet | 0:e89ba455dbcf | 333 | |
| dflet | 0:e89ba455dbcf | 334 | 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 | 0:e89ba455dbcf | 335 | |
| dflet | 0:e89ba455dbcf | 336 | #endif |
| dflet | 0:e89ba455dbcf | 337 | |
| dflet | 0:e89ba455dbcf | 338 | g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;/* buffer must be allocated by _SlDrvMsgRead */ |
| dflet | 0:e89ba455dbcf | 339 | g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler= NULL; |
| dflet | 0:e89ba455dbcf | 340 | g_pCB->FunctionParams.AsyncExt.RxMsgClass = CMD_RESP_CLASS;/* init to illegal value and verify it's overwritten with the valid one */ |
| dflet | 0:e89ba455dbcf | 341 | |
| dflet | 0:e89ba455dbcf | 342 | /* Messages might have been read by CmdResp context. Therefore after */ |
| dflet | 0:e89ba455dbcf | 343 | /* getting LockObj, check again where the Pending Rx Msg is still present. */ |
| dflet | 0:e89ba455dbcf | 344 | if(FALSE == (_driver->_SL_PENDING_RX_MSG(g_pCB))) { |
| dflet | 0:e89ba455dbcf | 345 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 346 | return SL_RET_CODE_OK; |
| dflet | 0:e89ba455dbcf | 347 | //return; |
| dflet | 0:e89ba455dbcf | 348 | } |
| dflet | 0:e89ba455dbcf | 349 | |
| dflet | 0:e89ba455dbcf | 350 | VERIFY_RET_OK(_driver->_SlDrvMsgRead()); |
| dflet | 0:e89ba455dbcf | 351 | |
| dflet | 0:e89ba455dbcf | 352 | g_pCB->RxDoneCnt++; |
| dflet | 0:e89ba455dbcf | 353 | |
| dflet | 0:e89ba455dbcf | 354 | switch(g_pCB->FunctionParams.AsyncExt.RxMsgClass) { |
| dflet | 0:e89ba455dbcf | 355 | case ASYNC_EVT_CLASS: |
| dflet | 0:e89ba455dbcf | 356 | /* If got here and protected by LockObj a message is waiting */ |
| dflet | 0:e89ba455dbcf | 357 | /* to be read */ |
| dflet | 0:e89ba455dbcf | 358 | VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.AsyncExt.pAsyncBuf); |
| dflet | 0:e89ba455dbcf | 359 | |
| dflet | 0:e89ba455dbcf | 360 | _driver->_SlAsyncEventGenericHandler(); |
| dflet | 0:e89ba455dbcf | 361 | |
| dflet | 0:e89ba455dbcf | 362 | #if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC) |
| dflet | 0:e89ba455dbcf | 363 | g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL; |
| dflet | 0:e89ba455dbcf | 364 | #else |
| dflet | 0:e89ba455dbcf | 365 | free(g_pCB->FunctionParams.AsyncExt.pAsyncBuf); |
| dflet | 0:e89ba455dbcf | 366 | #endif |
| dflet | 0:e89ba455dbcf | 367 | break; |
| dflet | 0:e89ba455dbcf | 368 | case DUMMY_MSG_CLASS: |
| dflet | 0:e89ba455dbcf | 369 | case RECV_RESP_CLASS: |
| dflet | 0:e89ba455dbcf | 370 | /* These types are legal in this context. Do nothing */ |
| dflet | 0:e89ba455dbcf | 371 | break; |
| dflet | 0:e89ba455dbcf | 372 | case CMD_RESP_CLASS: |
| dflet | 0:e89ba455dbcf | 373 | /* Command response is illegal in this context. */ |
| dflet | 0:e89ba455dbcf | 374 | /* No 'break' here: Assert! */ |
| dflet | 0:e89ba455dbcf | 375 | default: |
| dflet | 0:e89ba455dbcf | 376 | VERIFY_PROTOCOL(0); |
| dflet | 0:e89ba455dbcf | 377 | } |
| dflet | 0:e89ba455dbcf | 378 | |
| dflet | 0:e89ba455dbcf | 379 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 380 | |
| dflet | 0:e89ba455dbcf | 381 | return(SL_RET_CODE_OK); |
| dflet | 0:e89ba455dbcf | 382 | //return; |
| dflet | 0:e89ba455dbcf | 383 | } |
| dflet | 0:e89ba455dbcf | 384 | |
| dflet | 0:e89ba455dbcf | 385 | /*************************************************************************** |
| dflet | 0:e89ba455dbcf | 386 | _sl_HandleAsync_Stop - handles stop signalling to |
| dflet | 0:e89ba455dbcf | 387 | a waiting object |
| dflet | 0:e89ba455dbcf | 388 | ****************************************************************************/ |
| dflet | 0:e89ba455dbcf | 389 | void _sl_HandleAsync_Stop(void *pVoidBuf) |
| dflet | 0:e89ba455dbcf | 390 | { |
| dflet | 0:e89ba455dbcf | 391 | //printf("_SlDrvNetAppEventHandler\r\n"); |
| dflet | 0:e89ba455dbcf | 392 | _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pVoidBuf); |
| dflet | 0:e89ba455dbcf | 393 | |
| dflet | 0:e89ba455dbcf | 394 | VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp); |
| dflet | 0:e89ba455dbcf | 395 | |
| dflet | 0:e89ba455dbcf | 396 | OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER)); |
| dflet | 0:e89ba455dbcf | 397 | |
| dflet | 0:e89ba455dbcf | 398 | memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t)); |
| dflet | 0:e89ba455dbcf | 399 | OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE)); |
| dflet | 0:e89ba455dbcf | 400 | OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE)); |
| dflet | 0:e89ba455dbcf | 401 | return; |
| dflet | 0:e89ba455dbcf | 402 | } |
| dflet | 0:e89ba455dbcf | 403 | |
| dflet | 0:e89ba455dbcf | 404 | /****************************************************************************** |
| dflet | 0:e89ba455dbcf | 405 | _SlDrvDeviceEventHandler - handles internally device async events |
| dflet | 0:e89ba455dbcf | 406 | ******************************************************************************/ |
| dflet | 0:e89ba455dbcf | 407 | void _SlDrvDeviceEventHandler(void *pArgs) |
| dflet | 0:e89ba455dbcf | 408 | { |
| dflet | 0:e89ba455dbcf | 409 | //printf("_SlDrvDeviceEventHandler\r\n"); |
| dflet | 0:e89ba455dbcf | 410 | _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs; |
| dflet | 0:e89ba455dbcf | 411 | //printf("Debug pHdr->GenHeader.Opcode 0x%X\r\n",pHdr->GenHeader.Opcode); |
| dflet | 0:e89ba455dbcf | 412 | switch(pHdr->GenHeader.Opcode) { |
| dflet | 0:e89ba455dbcf | 413 | case SL_OPCODE_DEVICE_INITCOMPLETE: |
| dflet | 0:e89ba455dbcf | 414 | _cc3100_->_sl_HandleAsync_InitComplete(pHdr); |
| dflet | 0:e89ba455dbcf | 415 | //printf("_SlDrvDeviceEventHandler 2\r\n"); |
| dflet | 0:e89ba455dbcf | 416 | break; |
| dflet | 0:e89ba455dbcf | 417 | case SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE: |
| dflet | 0:e89ba455dbcf | 418 | _sl_HandleAsync_Stop(pHdr); |
| dflet | 0:e89ba455dbcf | 419 | //printf("_SlDrvDeviceEventHandler 3\r\n"); |
| dflet | 0:e89ba455dbcf | 420 | break; |
| dflet | 0:e89ba455dbcf | 421 | case SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR: |
| dflet | 0:e89ba455dbcf | 422 | #ifdef sl_GeneralEvtHdlr |
| dflet | 0:e89ba455dbcf | 423 | { |
| dflet | 0:e89ba455dbcf | 424 | _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pHdr); |
| dflet | 0:e89ba455dbcf | 425 | SlDeviceEvent_t devHandler; |
| dflet | 0:e89ba455dbcf | 426 | devHandler.Event = SL_DEVICE_FATAL_ERROR_EVENT; |
| dflet | 0:e89ba455dbcf | 427 | devHandler.EventData.deviceEvent.status = pMsgArgs->status & 0xFF; |
| dflet | 0:e89ba455dbcf | 428 | devHandler.EventData.deviceEvent.sender = (SlErrorSender_e)((pMsgArgs->status >> 8) & 0xFF); |
| dflet | 0:e89ba455dbcf | 429 | SimpleLinkGeneralEventHandler(&devHandler); |
| dflet | 0:e89ba455dbcf | 430 | //printf("_SlDrvDeviceEventHandler 4\r\n"); |
| dflet | 0:e89ba455dbcf | 431 | } |
| dflet | 0:e89ba455dbcf | 432 | #endif |
| dflet | 0:e89ba455dbcf | 433 | break; |
| dflet | 0:e89ba455dbcf | 434 | default: |
| dflet | 0:e89ba455dbcf | 435 | //SL_ERROR_TRACE2(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); |
| dflet | 0:e89ba455dbcf | 436 | printf("ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); |
| dflet | 0:e89ba455dbcf | 437 | VERIFY_PROTOCOL(0); |
| dflet | 0:e89ba455dbcf | 438 | } |
| dflet | 0:e89ba455dbcf | 439 | } |
| dflet | 0:e89ba455dbcf | 440 | |
| dflet | 0:e89ba455dbcf | 441 | /*****************************************************************************/ |
| dflet | 0:e89ba455dbcf | 442 | /* _SlDrvNetAppEventHandler */ |
| dflet | 0:e89ba455dbcf | 443 | /*****************************************************************************/ |
| dflet | 0:e89ba455dbcf | 444 | void _SlDrvNetAppEventHandler(void *pArgs) |
| dflet | 0:e89ba455dbcf | 445 | { |
| dflet | 0:e89ba455dbcf | 446 | //printf("_SlDrvNetAppEventHandler\r\n"); |
| dflet | 0:e89ba455dbcf | 447 | _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs; |
| dflet | 0:e89ba455dbcf | 448 | #ifdef sl_HttpServerCallback |
| dflet | 0:e89ba455dbcf | 449 | SlHttpServerEvent_t httpServerEvent; |
| dflet | 0:e89ba455dbcf | 450 | SlHttpServerResponse_t httpServerResponse; |
| dflet | 0:e89ba455dbcf | 451 | #endif |
| dflet | 0:e89ba455dbcf | 452 | switch(pHdr->GenHeader.Opcode) { |
| dflet | 0:e89ba455dbcf | 453 | case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE: |
| dflet | 0:e89ba455dbcf | 454 | case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6: |
| dflet | 0:e89ba455dbcf | 455 | _sl_HandleAsync_DnsGetHostByName(pArgs); |
| dflet | 0:e89ba455dbcf | 456 | break; |
| dflet | 0:e89ba455dbcf | 457 | case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE: |
| dflet | 0:e89ba455dbcf | 458 | case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6: |
| dflet | 0:e89ba455dbcf | 459 | _sl_HandleAsync_DnsGetHostByService(pArgs); |
| dflet | 0:e89ba455dbcf | 460 | break; |
| dflet | 0:e89ba455dbcf | 461 | case SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE: |
| dflet | 0:e89ba455dbcf | 462 | _sl_HandleAsync_PingResponse(pArgs); |
| dflet | 0:e89ba455dbcf | 463 | break; |
| dflet | 0:e89ba455dbcf | 464 | case SL_OPCODE_NETAPP_HTTPGETTOKENVALUE: { |
| dflet | 0:e89ba455dbcf | 465 | #ifdef sl_HttpServerCallback |
| dflet | 0:e89ba455dbcf | 466 | uint8_t *pTokenName; |
| dflet | 0:e89ba455dbcf | 467 | slHttpServerData_t Token_value; |
| dflet | 0:e89ba455dbcf | 468 | sl_NetAppHttpServerGetToken_t *httpGetToken = (sl_NetAppHttpServerGetToken_t *)_SL_RESP_ARGS_START(pHdr); |
| dflet | 0:e89ba455dbcf | 469 | pTokenName = (uint8_t *)((sl_NetAppHttpServerGetToken_t *)httpGetToken + 1); |
| dflet | 0:e89ba455dbcf | 470 | |
| dflet | 0:e89ba455dbcf | 471 | httpServerResponse.Response = SL_NETAPP_HTTPSETTOKENVALUE; |
| dflet | 0:e89ba455dbcf | 472 | httpServerResponse.ResponseData.token_value.len = MAX_TOKEN_VALUE_LEN; |
| dflet | 0:e89ba455dbcf | 473 | httpServerResponse.ResponseData.token_value.data = (uint8_t *)_SL_RESP_ARGS_START(pHdr) + MAX_TOKEN_NAME_LEN; //Reuse the async buffer for getting the token value response from the user |
| dflet | 0:e89ba455dbcf | 474 | |
| dflet | 0:e89ba455dbcf | 475 | httpServerEvent.Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT; |
| dflet | 0:e89ba455dbcf | 476 | httpServerEvent.EventData.httpTokenName.len = httpGetToken->token_name_len; |
| dflet | 0:e89ba455dbcf | 477 | httpServerEvent.EventData.httpTokenName.data = pTokenName; |
| dflet | 0:e89ba455dbcf | 478 | |
| dflet | 0:e89ba455dbcf | 479 | Token_value.token_name = pTokenName; |
| dflet | 0:e89ba455dbcf | 480 | |
| dflet | 0:e89ba455dbcf | 481 | SimpleLinkHttpServerCallback(&httpServerEvent, &httpServerResponse); |
| dflet | 0:e89ba455dbcf | 482 | |
| dflet | 0:e89ba455dbcf | 483 | Token_value.value_len = httpServerResponse.ResponseData.token_value.len; |
| dflet | 0:e89ba455dbcf | 484 | Token_value.name_len = httpServerEvent.EventData.httpTokenName.len; |
| dflet | 0:e89ba455dbcf | 485 | |
| dflet | 0:e89ba455dbcf | 486 | Token_value.token_value = httpServerResponse.ResponseData.token_value.data; |
| dflet | 0:e89ba455dbcf | 487 | |
| dflet | 0:e89ba455dbcf | 488 | |
| dflet | 0:e89ba455dbcf | 489 | _netapp->sl_NetAppSendTokenValue(&Token_value); |
| dflet | 0:e89ba455dbcf | 490 | #endif |
| dflet | 0:e89ba455dbcf | 491 | } |
| dflet | 0:e89ba455dbcf | 492 | break; |
| dflet | 0:e89ba455dbcf | 493 | |
| dflet | 0:e89ba455dbcf | 494 | case SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE: { |
| dflet | 0:e89ba455dbcf | 495 | #ifdef sl_HttpServerCallback |
| dflet | 0:e89ba455dbcf | 496 | uint8_t *pPostParams; |
| dflet | 0:e89ba455dbcf | 497 | |
| dflet | 0:e89ba455dbcf | 498 | sl_NetAppHttpServerPostToken_t *httpPostTokenArgs = (sl_NetAppHttpServerPostToken_t *)_SL_RESP_ARGS_START(pHdr); |
| dflet | 0:e89ba455dbcf | 499 | pPostParams = (uint8_t *)((sl_NetAppHttpServerPostToken_t *)httpPostTokenArgs + 1); |
| dflet | 0:e89ba455dbcf | 500 | |
| dflet | 0:e89ba455dbcf | 501 | httpServerEvent.Event = SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT; |
| dflet | 0:e89ba455dbcf | 502 | |
| dflet | 0:e89ba455dbcf | 503 | httpServerEvent.EventData.httpPostData.action.len = httpPostTokenArgs->post_action_len; |
| dflet | 0:e89ba455dbcf | 504 | httpServerEvent.EventData.httpPostData.action.data = pPostParams; |
| dflet | 0:e89ba455dbcf | 505 | pPostParams+=httpPostTokenArgs->post_action_len; |
| dflet | 0:e89ba455dbcf | 506 | |
| dflet | 0:e89ba455dbcf | 507 | httpServerEvent.EventData.httpPostData.token_name.len = httpPostTokenArgs->token_name_len; |
| dflet | 0:e89ba455dbcf | 508 | httpServerEvent.EventData.httpPostData.token_name.data = pPostParams; |
| dflet | 0:e89ba455dbcf | 509 | pPostParams+=httpPostTokenArgs->token_name_len; |
| dflet | 0:e89ba455dbcf | 510 | |
| dflet | 0:e89ba455dbcf | 511 | httpServerEvent.EventData.httpPostData.token_value.len = httpPostTokenArgs->token_value_len; |
| dflet | 0:e89ba455dbcf | 512 | httpServerEvent.EventData.httpPostData.token_value.data = pPostParams; |
| dflet | 0:e89ba455dbcf | 513 | |
| dflet | 0:e89ba455dbcf | 514 | httpServerResponse.Response = SL_NETAPP_RESPONSE_NONE; |
| dflet | 0:e89ba455dbcf | 515 | |
| dflet | 0:e89ba455dbcf | 516 | |
| dflet | 0:e89ba455dbcf | 517 | SimpleLinkHttpServerCallback(&httpServerEvent, &httpServerResponse); |
| dflet | 0:e89ba455dbcf | 518 | #endif |
| dflet | 0:e89ba455dbcf | 519 | } |
| dflet | 0:e89ba455dbcf | 520 | break; |
| dflet | 0:e89ba455dbcf | 521 | default: |
| dflet | 0:e89ba455dbcf | 522 | SL_ERROR_TRACE2(MSG_305, "ASSERT: _SlDrvNetAppEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); |
| dflet | 0:e89ba455dbcf | 523 | VERIFY_PROTOCOL(0); |
| dflet | 0:e89ba455dbcf | 524 | } |
| dflet | 0:e89ba455dbcf | 525 | } |
| dflet | 0:e89ba455dbcf | 526 | |
| dflet | 0:e89ba455dbcf | 527 | /* |
| dflet | 0:e89ba455dbcf | 528 | * ASYNCHRONOUS EVENT HANDLERS -- Start |
| dflet | 0:e89ba455dbcf | 529 | */ |
| dflet | 0:e89ba455dbcf | 530 | |
| dflet | 0:e89ba455dbcf | 531 | /*! |
| dflet | 0:e89ba455dbcf | 532 | \brief This function handles WLAN events |
| dflet | 0:e89ba455dbcf | 533 | |
| dflet | 0:e89ba455dbcf | 534 | \param[in] pWlanEvent is the event passed to the handler |
| dflet | 0:e89ba455dbcf | 535 | |
| dflet | 0:e89ba455dbcf | 536 | \return None |
| dflet | 0:e89ba455dbcf | 537 | |
| dflet | 0:e89ba455dbcf | 538 | \note |
| dflet | 0:e89ba455dbcf | 539 | |
| dflet | 0:e89ba455dbcf | 540 | \warning |
| dflet | 0:e89ba455dbcf | 541 | */ |
| dflet | 0:e89ba455dbcf | 542 | #if (defined(sl_WlanEvtHdlr)) |
| dflet | 0:e89ba455dbcf | 543 | void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) |
| dflet | 0:e89ba455dbcf | 544 | { |
| dflet | 0:e89ba455dbcf | 545 | |
| dflet | 0:e89ba455dbcf | 546 | //printf("Debug SimpleLinkWlanEventHandler\r\n"); |
| dflet | 0:e89ba455dbcf | 547 | if(pWlanEvent == NULL) |
| dflet | 0:e89ba455dbcf | 548 | printf(" [WLAN EVENT] NULL Pointer Error \n\r"); |
| dflet | 0:e89ba455dbcf | 549 | |
| dflet | 0:e89ba455dbcf | 550 | switch(pWlanEvent->Event) { |
| dflet | 0:e89ba455dbcf | 551 | case SL_WLAN_CONNECT_EVENT: { |
| dflet | 0:e89ba455dbcf | 552 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION); |
| dflet | 0:e89ba455dbcf | 553 | |
| dflet | 0:e89ba455dbcf | 554 | /* |
| dflet | 0:e89ba455dbcf | 555 | * Information about the connected AP (like name, MAC etc) will be |
| dflet | 0:e89ba455dbcf | 556 | * available in 'slWlanConnectAsyncResponse_t' - Applications |
| dflet | 0:e89ba455dbcf | 557 | * can use it if required |
| dflet | 0:e89ba455dbcf | 558 | * |
| dflet | 0:e89ba455dbcf | 559 | * slWlanConnectAsyncResponse_t *pEventData = NULL; |
| dflet | 0:e89ba455dbcf | 560 | * pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected; |
| dflet | 0:e89ba455dbcf | 561 | * |
| dflet | 0:e89ba455dbcf | 562 | */ |
| dflet | 0:e89ba455dbcf | 563 | } |
| dflet | 0:e89ba455dbcf | 564 | break; |
| dflet | 0:e89ba455dbcf | 565 | |
| dflet | 0:e89ba455dbcf | 566 | case SL_WLAN_DISCONNECT_EVENT: { |
| dflet | 0:e89ba455dbcf | 567 | slWlanConnectAsyncResponse_t* pEventData = NULL; |
| dflet | 0:e89ba455dbcf | 568 | |
| dflet | 0:e89ba455dbcf | 569 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION); |
| dflet | 0:e89ba455dbcf | 570 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED); |
| dflet | 0:e89ba455dbcf | 571 | |
| dflet | 0:e89ba455dbcf | 572 | pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected; |
| dflet | 0:e89ba455dbcf | 573 | |
| dflet | 0:e89ba455dbcf | 574 | /* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */ |
| dflet | 0:e89ba455dbcf | 575 | if(SL_USER_INITIATED_DISCONNECTION == pEventData->reason_code) { |
| dflet | 0:e89ba455dbcf | 576 | printf(" Device disconnected from the AP on application's request \n\r"); |
| dflet | 0:e89ba455dbcf | 577 | } else { |
| dflet | 0:e89ba455dbcf | 578 | printf(" Device disconnected from the AP on an ERROR..!! \n\r"); |
| dflet | 0:e89ba455dbcf | 579 | } |
| dflet | 0:e89ba455dbcf | 580 | } |
| dflet | 0:e89ba455dbcf | 581 | break; |
| dflet | 0:e89ba455dbcf | 582 | |
| dflet | 0:e89ba455dbcf | 583 | case SL_WLAN_STA_CONNECTED_EVENT: { |
| dflet | 0:e89ba455dbcf | 584 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_STA_CONNECTED); |
| dflet | 0:e89ba455dbcf | 585 | } |
| dflet | 0:e89ba455dbcf | 586 | break; |
| dflet | 0:e89ba455dbcf | 587 | |
| dflet | 0:e89ba455dbcf | 588 | case SL_WLAN_STA_DISCONNECTED_EVENT: { |
| dflet | 0:e89ba455dbcf | 589 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_STA_CONNECTED); |
| dflet | 0:e89ba455dbcf | 590 | _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_LEASED); |
| dflet | 0:e89ba455dbcf | 591 | } |
| dflet | 0:e89ba455dbcf | 592 | break; |
| dflet | 0:e89ba455dbcf | 593 | |
| dflet | 0:e89ba455dbcf | 594 | default: { |
| dflet | 0:e89ba455dbcf | 595 | printf(" [WLAN EVENT] Unexpected event \n\r"); |
| dflet | 0:e89ba455dbcf | 596 | } |
| dflet | 0:e89ba455dbcf | 597 | break; |
| dflet | 0:e89ba455dbcf | 598 | } |
| dflet | 0:e89ba455dbcf | 599 | } |
| dflet | 0:e89ba455dbcf | 600 | #endif |
| dflet | 0:e89ba455dbcf | 601 | |
| dflet | 0:e89ba455dbcf | 602 | /*! |
| dflet | 0:e89ba455dbcf | 603 | \brief This function handles events for IP address acquisition via DHCP |
| dflet | 0:e89ba455dbcf | 604 | indication |
| dflet | 0:e89ba455dbcf | 605 | |
| dflet | 0:e89ba455dbcf | 606 | \param[in] pNetAppEvent is the event passed to the handler |
| dflet | 0:e89ba455dbcf | 607 | |
| dflet | 0:e89ba455dbcf | 608 | \return None |
| dflet | 0:e89ba455dbcf | 609 | |
| dflet | 0:e89ba455dbcf | 610 | \note |
| dflet | 0:e89ba455dbcf | 611 | |
| dflet | 0:e89ba455dbcf | 612 | \warning |
| dflet | 0:e89ba455dbcf | 613 | */ |
| dflet | 0:e89ba455dbcf | 614 | #if (defined(sl_NetAppEvtHdlr)) |
| dflet | 0:e89ba455dbcf | 615 | void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent) |
| dflet | 0:e89ba455dbcf | 616 | { |
| dflet | 0:e89ba455dbcf | 617 | |
| dflet | 0:e89ba455dbcf | 618 | if(pNetAppEvent == NULL){ |
| dflet | 0:e89ba455dbcf | 619 | printf(" [NETAPP EVENT] NULL Pointer Error \n\r"); |
| dflet | 0:e89ba455dbcf | 620 | } |
| dflet | 0:e89ba455dbcf | 621 | |
| dflet | 0:e89ba455dbcf | 622 | switch(pNetAppEvent->Event) { |
| dflet | 0:e89ba455dbcf | 623 | case SL_NETAPP_IPV4_IPACQUIRED_EVENT: { |
| dflet | 0:e89ba455dbcf | 624 | |
| dflet | 0:e89ba455dbcf | 625 | //printf("SL_NETAPP_IPV4_IPACQUIRED_EVENT \n\r"); |
| dflet | 0:e89ba455dbcf | 626 | SlIpV4AcquiredAsync_t *pEventData = NULL; |
| dflet | 0:e89ba455dbcf | 627 | //printf("g_Status 2 = 0x%X\r\n",_cc3100_->g_Status); |
| dflet | 0:e89ba455dbcf | 628 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED); |
| dflet | 0:e89ba455dbcf | 629 | //printf("g_Status 2 = 0x%X\r\n",_cc3100_->g_Status); |
| dflet | 0:e89ba455dbcf | 630 | |
| dflet | 0:e89ba455dbcf | 631 | pEventData = &pNetAppEvent->EventData.ipAcquiredV4; |
| dflet | 0:e89ba455dbcf | 632 | |
| dflet | 0:e89ba455dbcf | 633 | g_GatewayIP = pEventData->gateway; |
| dflet | 0:e89ba455dbcf | 634 | //printf("g_GatewayIP = = 0x%X\r\n",pEventData->gateway); |
| dflet | 0:e89ba455dbcf | 635 | //printf("Debug 4 SL_NETAPP_IPV4_IPACQUIRED_EVENT \n\r"); |
| dflet | 0:e89ba455dbcf | 636 | } |
| dflet | 0:e89ba455dbcf | 637 | break; |
| dflet | 0:e89ba455dbcf | 638 | |
| dflet | 0:e89ba455dbcf | 639 | case SL_NETAPP_IP_LEASED_EVENT: { |
| dflet | 0:e89ba455dbcf | 640 | //printf("SL_NETAPP_IP_LEASED_EVENT \n\r"); |
| dflet | 0:e89ba455dbcf | 641 | g_StationIP = pNetAppEvent->EventData.ipLeased.ip_address; |
| dflet | 0:e89ba455dbcf | 642 | //_cc3100_->g_Status = 0; |
| dflet | 0:e89ba455dbcf | 643 | _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_IP_LEASED); |
| dflet | 0:e89ba455dbcf | 644 | //printf("g_Status 3 = 0x%X\r\n",_cc3100_->g_Status); |
| dflet | 0:e89ba455dbcf | 645 | |
| dflet | 0:e89ba455dbcf | 646 | } |
| dflet | 0:e89ba455dbcf | 647 | break; |
| dflet | 0:e89ba455dbcf | 648 | |
| dflet | 0:e89ba455dbcf | 649 | default: { |
| dflet | 0:e89ba455dbcf | 650 | printf(" [NETAPP EVENT] Unexpected event \n\r"); |
| dflet | 0:e89ba455dbcf | 651 | } |
| dflet | 0:e89ba455dbcf | 652 | break; |
| dflet | 0:e89ba455dbcf | 653 | } |
| dflet | 0:e89ba455dbcf | 654 | } |
| dflet | 0:e89ba455dbcf | 655 | #endif |
| dflet | 0:e89ba455dbcf | 656 | |
| dflet | 0:e89ba455dbcf | 657 | /*! |
| dflet | 0:e89ba455dbcf | 658 | \brief This function handles socket events indication |
| dflet | 0:e89ba455dbcf | 659 | |
| dflet | 0:e89ba455dbcf | 660 | \param[in] pSock is the event passed to the handler |
| dflet | 0:e89ba455dbcf | 661 | |
| dflet | 0:e89ba455dbcf | 662 | \return None |
| dflet | 0:e89ba455dbcf | 663 | */ |
| dflet | 0:e89ba455dbcf | 664 | #if (defined(sl_SockEvtHdlr)) |
| dflet | 0:e89ba455dbcf | 665 | void SimpleLinkSockEventHandler(SlSockEvent_t *pSock) |
| dflet | 0:e89ba455dbcf | 666 | { |
| dflet | 0:e89ba455dbcf | 667 | if(pSock == NULL) |
| dflet | 0:e89ba455dbcf | 668 | printf(" [SOCK EVENT] NULL Pointer Error \n\r"); |
| dflet | 0:e89ba455dbcf | 669 | |
| dflet | 0:e89ba455dbcf | 670 | switch( pSock->Event ) |
| dflet | 0:e89ba455dbcf | 671 | { |
| dflet | 0:e89ba455dbcf | 672 | case SL_SOCKET_TX_FAILED_EVENT: |
| dflet | 0:e89ba455dbcf | 673 | /* |
| dflet | 0:e89ba455dbcf | 674 | * TX Failed |
| dflet | 0:e89ba455dbcf | 675 | * |
| dflet | 0:e89ba455dbcf | 676 | * Information about the socket descriptor and status will be |
| dflet | 0:e89ba455dbcf | 677 | * available in 'SlSockEventData_t' - Applications can use it if |
| dflet | 0:e89ba455dbcf | 678 | * required |
| dflet | 0:e89ba455dbcf | 679 | * |
| dflet | 0:e89ba455dbcf | 680 | * SlSockEventData_t *pEventData = NULL; |
| dflet | 0:e89ba455dbcf | 681 | * pEventData = & pSock->EventData; |
| dflet | 0:e89ba455dbcf | 682 | */ |
| dflet | 0:e89ba455dbcf | 683 | switch( pSock->EventData.status ) |
| dflet | 0:e89ba455dbcf | 684 | { |
| dflet | 0:e89ba455dbcf | 685 | case SL_ECLOSE: |
| dflet | 0:e89ba455dbcf | 686 | printf(" [SOCK EVENT] Close socket operation, failed to transmit all queued packets\n\r"); |
| dflet | 0:e89ba455dbcf | 687 | break; |
| dflet | 0:e89ba455dbcf | 688 | default: |
| dflet | 0:e89ba455dbcf | 689 | printf(" [SOCK EVENT] Unexpected event \n\r"); |
| dflet | 0:e89ba455dbcf | 690 | break; |
| dflet | 0:e89ba455dbcf | 691 | } |
| dflet | 0:e89ba455dbcf | 692 | break; |
| dflet | 0:e89ba455dbcf | 693 | |
| dflet | 0:e89ba455dbcf | 694 | default: |
| dflet | 0:e89ba455dbcf | 695 | printf(" [SOCK EVENT] Unexpected event \n\r"); |
| dflet | 0:e89ba455dbcf | 696 | break; |
| dflet | 0:e89ba455dbcf | 697 | } |
| dflet | 0:e89ba455dbcf | 698 | } |
| dflet | 0:e89ba455dbcf | 699 | #endif |
| dflet | 0:e89ba455dbcf | 700 | |
| dflet | 0:e89ba455dbcf | 701 | /*! |
| dflet | 0:e89ba455dbcf | 702 | \brief This function handles callback for the HTTP server events |
| dflet | 0:e89ba455dbcf | 703 | |
| dflet | 0:e89ba455dbcf | 704 | \param[in] pHttpEvent - Contains the relevant event information |
| dflet | 0:e89ba455dbcf | 705 | \param[in] pHttpResponse - Should be filled by the user with the |
| dflet | 0:e89ba455dbcf | 706 | relevant response information |
| dflet | 0:e89ba455dbcf | 707 | |
| dflet | 0:e89ba455dbcf | 708 | \return None |
| dflet | 0:e89ba455dbcf | 709 | |
| dflet | 0:e89ba455dbcf | 710 | \note |
| dflet | 0:e89ba455dbcf | 711 | |
| dflet | 0:e89ba455dbcf | 712 | \warning |
| dflet | 0:e89ba455dbcf | 713 | */ |
| dflet | 0:e89ba455dbcf | 714 | #if (defined(sl_HttpServerCallback)) |
| dflet | 0:e89ba455dbcf | 715 | void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse) |
| dflet | 0:e89ba455dbcf | 716 | { |
| dflet | 0:e89ba455dbcf | 717 | /* |
| dflet | 0:e89ba455dbcf | 718 | * This application doesn't work with HTTP server - Hence these |
| dflet | 0:e89ba455dbcf | 719 | * events are not handled here |
| dflet | 0:e89ba455dbcf | 720 | */ |
| dflet | 0:e89ba455dbcf | 721 | printf(" [HTTP EVENT] Unexpected event \n\r"); |
| dflet | 0:e89ba455dbcf | 722 | } |
| dflet | 0:e89ba455dbcf | 723 | #endif |
| dflet | 0:e89ba455dbcf | 724 | /*! |
| dflet | 0:e89ba455dbcf | 725 | \brief This function handles general error events indication |
| dflet | 0:e89ba455dbcf | 726 | |
| dflet | 0:e89ba455dbcf | 727 | \param[in] pDevEvent is the event passed to the handler |
| dflet | 0:e89ba455dbcf | 728 | |
| dflet | 0:e89ba455dbcf | 729 | \return None |
| dflet | 0:e89ba455dbcf | 730 | */ |
| dflet | 0:e89ba455dbcf | 731 | #if (defined(sl_GeneralEvtHdlr)) |
| dflet | 0:e89ba455dbcf | 732 | void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent) |
| dflet | 0:e89ba455dbcf | 733 | { |
| dflet | 0:e89ba455dbcf | 734 | /* |
| dflet | 0:e89ba455dbcf | 735 | * Most of the general errors are not FATAL are are to be handled |
| dflet | 0:e89ba455dbcf | 736 | * appropriately by the application |
| dflet | 0:e89ba455dbcf | 737 | */ |
| dflet | 0:e89ba455dbcf | 738 | printf(" [GENERAL EVENT] \n\r"); |
| dflet | 0:e89ba455dbcf | 739 | } |
| dflet | 0:e89ba455dbcf | 740 | #endif |
| dflet | 0:e89ba455dbcf | 741 | |
| dflet | 0:e89ba455dbcf | 742 | #ifdef __cplusplus |
| dflet | 0:e89ba455dbcf | 743 | } |
| dflet | 0:e89ba455dbcf | 744 | #endif /* __cplusplus */ |
| dflet | 0:e89ba455dbcf | 745 | |
| dflet | 0:e89ba455dbcf | 746 | //}//namespace |