/****************************************************************************** _SlDrvDeviceEventHandler - handles internally device async events ******************************************************************************/ void _SlDrvDeviceEventHandler(void *pArgs) { _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs; switch(pHdr->GenHeader.Opcode) { case SL_OPCODE_DEVICE_INITCOMPLETE: _sl_HandleAsync_InitComplete(pHdr); break; case SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE: _sl_HandleAsync_Stop(pHdr); break; case SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR: #ifdef sl_GeneralEvtHdlr { _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pHdr); SlDeviceEvent_t devHandler; devHandler.EventData.deviceEvent.status = pMsgArgs->status & 0xFF; devHandler.EventData.deviceEvent.sender = (pMsgArgs->status >> 8) & 0xFF; sl_GeneralEvtHdlr(&devHandler); } #endif break; default: SL_ERROR_TRACE2(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %1", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); VERIFY_PROTOCOL(0); } }
void _SlDrvNetAppEventHandler(void *pArgs) { _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs; SlHttpServerEvent_t httpServerEvent; SlHttpServerResponse_t httpServerResponse; switch(pHdr->GenHeader.Opcode) { case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE: case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6: _sl_HandleAsync_DnsGetHostByName(pArgs); break; case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE: case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6: _sl_HandleAsync_DnsGetHostByService(pArgs); break; case SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE: _sl_HandleAsync_PingResponse(pArgs); break; case SL_OPCODE_NETAPP_HTTPGETTOKENVALUE: { UINT8 *pTokenName; #ifdef sl_HttpServerCallback slHttpServerData_t Token_value; #endif sl_NetAppHttpServerGetToken_t *httpGetToken = (sl_NetAppHttpServerGetToken_t *)_SL_RESP_ARGS_START(pHdr); pTokenName = (UINT8 *)((sl_NetAppHttpServerGetToken_t *)httpGetToken + 1); httpServerResponse.Response = SL_NETAPP_HTTPSETTOKENVALUE; httpServerResponse.ResponseData.token_value.len = MAX_TOKEN_VALUE_LEN; httpServerResponse.ResponseData.token_value.data = (UINT8 *)_SL_RESP_ARGS_START(pHdr) + MAX_TOKEN_NAME_LEN; //Reuse the async buffer for getting the token value response from the user #ifdef sl_HttpServerCallback httpServerEvent.Event = SL_NETAPP_HTTPGETTOKENVALUE; httpServerEvent.EventData.httpTokenName.len = httpGetToken->token_name_len; httpServerEvent.EventData.httpTokenName.data = pTokenName; Token_value.token_name = pTokenName; sl_HttpServerCallback (&httpServerEvent, &httpServerResponse); Token_value.value_len = httpServerResponse.ResponseData.token_value.len; Token_value.name_len = httpServerEvent.EventData.httpTokenName.len; Token_value.token_value = httpServerResponse.ResponseData.token_value.data; sl_NetAppSendTokenValue(&Token_value); #endif } break; case SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE: { UINT8 *pPostParams; sl_NetAppHttpServerPostToken_t *httpPostTokenArgs = (sl_NetAppHttpServerPostToken_t *)_SL_RESP_ARGS_START(pHdr); pPostParams = (UINT8 *)((sl_NetAppHttpServerPostToken_t *)httpPostTokenArgs + 1); httpServerEvent.Event = SL_NETAPP_HTTPPOSTTOKENVALUE; httpServerEvent.EventData.httpPostData.action.len = httpPostTokenArgs->post_action_len; httpServerEvent.EventData.httpPostData.action.data = pPostParams; pPostParams+=httpPostTokenArgs->post_action_len; httpServerEvent.EventData.httpPostData.token_name.len = httpPostTokenArgs->token_name_len; httpServerEvent.EventData.httpPostData.token_name.data = pPostParams; pPostParams+=httpPostTokenArgs->token_name_len; httpServerEvent.EventData.httpPostData.token_value.len = httpPostTokenArgs->token_value_len; httpServerEvent.EventData.httpPostData.token_value.data = pPostParams; httpServerResponse.Response = SL_NETAPP_RESPONSE_NONE; #ifdef sl_HttpServerCallback sl_HttpServerCallback (&httpServerEvent, &httpServerResponse); #endif } break; default: SL_ERROR_TRACE2(MSG_305, "ASSERT: _SlDrvNetAppEventHandler : invalid opcode = 0x%x = %1", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode); VERIFY_PROTOCOL(0); } }