int sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,unsigned char family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback) { _SlCmdCtrl_t CmdCtrl = {0, sizeof(_PingStartCommand_t), sizeof(_BasicResponse_t)}; _SlPingStartMsg_u Msg; _PingReportResponse_t PingRsp; UINT8 pObjIdx = MAX_CONCURRENT_ACTIONS; if( 0 == pPingParams->Ip ) // stop any ongoing ping { return _SlDrvBasicCmd(SL_OPCODE_NETAPP_PINGSTOP); } if(SL_AF_INET == family) { CmdCtrl.Opcode = SL_OPCODE_NETAPP_PINGSTART; memcpy(&Msg.Cmd.ip0, &pPingParams->Ip, SL_IPV4_ADDRESS_SIZE); } else { CmdCtrl.Opcode = SL_OPCODE_NETAPP_PINGSTART_V6; memcpy(&Msg.Cmd.ip0, &pPingParams->Ip, SL_IPV6_ADDRESS_SIZE); } Msg.Cmd.pingIntervalTime = pPingParams->PingIntervalTime; Msg.Cmd.PingSize = pPingParams->PingSize; Msg.Cmd.pingRequestTimeout = pPingParams->PingRequestTimeout; Msg.Cmd.totalNumberOfAttempts = pPingParams->TotalNumberOfAttempts; Msg.Cmd.flags = pPingParams->Flags; if( pPingCallback ) { pPingCallBackFunc = pPingCallback; } else { /*Use Obj to issue the command, if not available try later */ pObjIdx = _SlDrvWaitForPoolObj(PING_ID,SL_MAX_SOCKETS); if (MAX_CONCURRENT_ACTIONS == pObjIdx) { return SL_POOL_IS_EMPTY; } OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER)); /* async response handler for non callback mode */ g_pCB->ObjPool[pObjIdx].pRespArgs = (UINT8 *)&PingRsp; pPingCallBackFunc = NULL; OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj)); } VERIFY_RET_OK(_SlDrvCmdOp(&CmdCtrl, &Msg, NULL)); /*send the command*/ if(CMD_PING_TEST_RUNNING == (int)Msg.Rsp.status || CMD_PING_TEST_STOPPED == (int)Msg.Rsp.status ) { /* block waiting for results if no callback function is used */ if( NULL == pPingCallback ) { OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[pObjIdx].SyncObj, SL_OS_WAIT_FOREVER)); if( SL_OS_RET_CODE_OK == (int)PingRsp.status ) { CopyPingResultsToReport(&PingRsp,pReport); } _SlDrvReleasePoolObj(pObjIdx); } } else { /* ping failure, no async response */ if( NULL == pPingCallback ) { _SlDrvReleasePoolObj(pObjIdx); } } return Msg.Rsp.status; }
int sl_WlanRxStatStop(void) { return _SlDrvBasicCmd(SL_OPCODE_WLAN_STOPRXSTATCOMMAND); }
int sl_WlanSmartConfigStop(void) { return _SlDrvBasicCmd(SL_OPCODE_WLAN_SMART_CONFIG_STOP_COMMAND); }
int sl_WlanDisconnect(void) { return _SlDrvBasicCmd(SL_OPCODE_WLAN_WLANDISCONNECTCOMMAND); }