本文整理汇总了C++中sl_Stop函数的典型用法代码示例。如果您正苦于以下问题:C++ sl_Stop函数的具体用法?C++ sl_Stop怎么用?C++ sl_Stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sl_Stop函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetSimpleLink
int32_t ResetSimpleLink() {
int32_t i32Mode = -1, i32RetVal = -1;
uint8_t ui8Val = 1;
i32Mode = sl_Start(0, 0, 0);
i32RetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION,
SL_CONNECTION_POLICY(1, 0, 0, 0, 1), NULL, 0);
if (i32RetVal != 0) {
return -1;
}
i32RetVal = sl_WlanProfileDel(0xFF);
if (i32RetVal != 0) {
return -1;
}
if (ROLE_STA != i32Mode) {
if (ROLE_AP == i32Mode) {
while (!STATUS_GET(g_sSLCon.Status, STATUS_BIT_IP_ACQUIRED)) {
}
}
sl_WlanSetMode(ROLE_STA);
sl_Stop(0);
g_sSLCon.Status = 0;
i32RetVal = sl_Start(0, 0, 0);
if (ROLE_STA != i32RetVal) {
return -1;
}
}
i32RetVal = sl_WlanDisconnect();
if (i32RetVal == 0) {
while (STATUS_GET(g_sSLCon.Status, STATUS_BIT_CONNECTED)) {
}
}
sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE, 1, 1, &ui8Val);
sl_WlanPolicySet(SL_POLICY_SCAN, SL_SCAN_POLICY(0), NULL, NULL);
ui8Val = 0;
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,
WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (unsigned char *) &ui8Val);
sl_WlanPolicySet(SL_POLICY_PM, SL_NORMAL_POLICY, NULL, 0);
sl_NetAppMDNSUnRegisterService(0, 0);
sl_Stop(0);
InitVariables();
return 0;
}
示例2: NetStop
void NetStop()
{
unsigned long lRetVal;
//
// Disconnect from the AP
//
lRetVal = sl_WlanDisconnect();
if(0 == lRetVal)
{
// Wait
while(IS_CONNECTED(g_ulStatus))
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();
#endif
}
}
//
// Stop the simplelink host
//
sl_Stop(SL_STOP_TIMEOUT);
//
// Reset all variables
//
g_ulStatus = 0;
g_ulGatewayIP = 0;
g_ucSimplelinkstarted = 0;
g_ulIpAddr = 0;
}
示例3: init
int WiFiClass::beginNetwork(char *ssid, char *passphrase)
{
long retVal = -1;
int i;
if (!_initialized) {
init();
}
// Initialize the AP-mode Connected Device array
WiFiClass::_connectedDeviceCount = 0;
_latestConnect = 0;
for (i = 0; i < MAX_AP_DEVICE_REGISTRY; i++) {
_connectedDevices[i].in_use = false;
memset((uint8_t *)_connectedDevices[i].ipAddress, 0, 4);
memset((uint8_t *)_connectedDevices[i].mac, 0, 6);
}
retVal = sl_WlanSetMode(ROLE_AP);
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid),
(unsigned char *)ssid);
unsigned char val = SL_SEC_TYPE_WPA;
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned char *)&val);
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen(passphrase),
(unsigned char *)passphrase);
/* Restart Network processor */
retVal = sl_Stop(30);
role = ROLE_AP;
return (retVal == 0 ? sl_Start(NULL, NULL, NULL) : retVal);
}
示例4: StartDeviceInP2P
//*****************************************************************************
//
//! Check the device mode and switch to P2P mode
//! restart the NWP to activate P2P mode
//!
//! \param None
//!
//! \return status code - Success:0, Failure:-ve
//
//*****************************************************************************
long StartDeviceInP2P()
{
long lRetVal = -1;
// Reset CC3200 Network State Machine
InitializeAppVariables();
//
// Following function configure the device to default state by cleaning
// the persistent settings stored in NVMEM (viz. connection profiles &
// policies, power policy etc)
//
// Applications may choose to skip this step if the developer is sure
// that the device is in its default state at start of application
//
// Note that all profiles and persistent settings that were done on the
// device will be lost
//
lRetVal = ConfigureSimpleLinkToDefaultState();
if(lRetVal < 0)
{
if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
UART_PRINT("Failed to configure the device in its default state \n\r");
LOOP_FOREVER();
}
UART_PRINT("Device is configured in default state \n\r");
//
// Assumption is that the device is configured in station mode already
// and it is in its default state
//
lRetVal = sl_Start(NULL,NULL,NULL);
ASSERT_ON_ERROR(lRetVal);
if(lRetVal != ROLE_P2P)
{
lRetVal = sl_WlanSetMode(ROLE_P2P);
ASSERT_ON_ERROR(lRetVal);
lRetVal = sl_Stop(0xFF);
// reset the Status bits
CLR_STATUS_BIT_ALL(g_ulStatus);
lRetVal = sl_Start(NULL,NULL,NULL);
if(lRetVal < 0 || lRetVal != ROLE_P2P)
{
ASSERT_ON_ERROR(P2P_MODE_START_FAILED);
}
else
{
UART_PRINT("Started SimpleLink Device: P2P Mode\n\r");
return SUCCESS;
}
}
return SUCCESS;
}
示例5: main
//*****************************************************************************
//
//! Main
//!
//! \param none
//!
//! \return None
//!
//*****************************************************************************
void main()
{
long lRetVal = -1;
//
// Initialize board configuration
//
BoardInit();
PinMuxConfig();
#ifndef NOTERM
InitTerm();
#endif
lRetVal = ssl();
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
}
//
// power off network processor
//
sl_Stop(SL_STOP_TIMEOUT);
LOOP_FOREVER();
}
示例6: ConfigureMode
//****************************************************************************
//
//! Confgiures the mode in which the device will work
//!
//! \param iMode is the current mode of the device
//!
//! This function
//! 1. prompt user for desired configuration and accordingly configure the
//! networking mode(STA or AP).
//! 2. also give the user the option to configure the ssid name in case of
//! AP mode.
//!
//! \return sl_start return value(int).
//
//****************************************************************************
static int ConfigureMode(int iMode)
{
char pcSsidName[33];
long retVal = -1;
UART_PRINT("Enter the AP SSID name: ");
GetSsidName(pcSsidName,33);
retVal = sl_WlanSetMode(ROLE_AP);
ASSERT_ON_ERROR(__LINE__, retVal);
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(pcSsidName),
(unsigned char*)pcSsidName);
ASSERT_ON_ERROR(__LINE__, retVal);
UART_PRINT("Device is configured in AP mode\n\r");
/* Restart Network processor */
retVal = sl_Stop(SL_STOP_TIMEOUT);
ASSERT_ON_ERROR(__LINE__, retVal);
// reset status bits
CLR_STATUS_BIT_ALL(g_ulStatus);
return sl_Start(NULL,NULL,NULL);
}
示例7: init
int WiFiClass::beginNetwork(char *ssid, char *passphrase)
{
long retVal = -1;
if (!_initialized) {
init();
}
retVal = sl_WlanSetMode(ROLE_AP);
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid),
(unsigned char *)ssid);
unsigned char val = SL_SEC_TYPE_WPA;
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned char *)&val);
retVal = sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen(passphrase),
(unsigned char *)passphrase);
/* Restart Network processor */
retVal = sl_Stop(30);
role = ROLE_AP;
return sl_Start(NULL,NULL,NULL);
}
示例8: cc3200helpers_startIn
static unsigned long cc3200helpers_startIn(SlWlanMode_t eWlanMode)
{
int iMode = 0;
unsigned long dwResult = 0;
s_flWLANConnected = 0;
s_flAcquiredIP = 0;
SlWlanMode_t s_eRequestedWlanMode = eWlanMode;
dwResult = cc3200helpers_start(&iMode);
if ( dwResult )
{
return dwResult;
}
if ( eWlanMode == iMode )
{
return cc3200Helpers_OK;
}
if (ROLE_AP == iMode)
{
// If the device is in AP mode, we need to wait for this event
// before doing anything
TRACE("Waiting for AP to initialize\n\r");
while(!s_flAcquiredIP)
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();
#endif
}
s_flAcquiredIP = 0;
TRACE("AP ready\n\r");
}
if ( sl_WlanSetMode(eWlanMode) )
{
return cc3200Helpers_SwitchFailed | cc3200Helpers_SetModeFailed;
}
if ( sl_Stop(0) )
{
return cc3200Helpers_SwitchFailed | cc3200Helpers_StopFailed;
}
dwResult = cc3200helpers_start(&iMode);
if ( dwResult )
{
return cc3200Helpers_SwitchFailed | dwResult;
}
if ( iMode != eWlanMode )
{
return cc3200Helpers_SwitchFailed;
}
return cc3200Helpers_OK;
}
示例9: restart_nwp
static int restart_nwp() {
/* We don't need TI's web server. */
sl_NetAppStop(SL_NET_APP_HTTP_SERVER_ID);
sl_Stop(0);
s_current_role = sl_Start(NULL, NULL, NULL);
sl_restart_cb(&sj_mgr);
return (s_current_role >= 0);
}
示例10: wifi_setup_ap
bool wifi_setup_ap(const char *ssid, const char *pass, int channel) {
uint8_t v;
if (sl_WlanSetMode(ROLE_AP) != 0) {
return false;
}
if (sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid),
(const uint8_t *) ssid) != 0) {
return false;
}
v = strlen(pass) > 0 ? SL_SEC_TYPE_WPA : SL_SEC_TYPE_OPEN;
if (sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, &v) != 0) {
return false;
}
if (v == SL_SEC_TYPE_WPA &&
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen(pass),
(const uint8_t *) pass) != 0) {
return false;
}
v = channel;
if (sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, &v) != 0) {
return false;
}
sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID);
{
SlNetCfgIpV4Args_t ipcfg;
memset(&ipcfg, 0, sizeof(ipcfg));
if (!inet_pton(AF_INET, "192.168.4.1", &ipcfg.ipV4) ||
!inet_pton(AF_INET, "255.255.255.0", &ipcfg.ipV4Mask) ||
/* This means "disable". 0.0.0.0 won't do. */
!inet_pton(AF_INET, "255.255.255.255", &ipcfg.ipV4DnsServer) ||
/* We'd like to disable gateway too, but DHCP server refuses to start.
*/
!inet_pton(AF_INET, "192.168.4.1", &ipcfg.ipV4Gateway) ||
sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE, IPCONFIG_MODE_ENABLE_IPV4,
sizeof(ipcfg), (uint8_t *) &ipcfg) != 0) {
return false;
}
}
{
SlNetAppDhcpServerBasicOpt_t dhcpcfg;
memset(&dhcpcfg, 0, sizeof(dhcpcfg));
dhcpcfg.lease_time = 900;
if (!inet_pton(AF_INET, "192.168.4.20", &dhcpcfg.ipv4_addr_start) ||
!inet_pton(AF_INET, "192.168.4.200", &dhcpcfg.ipv4_addr_last) ||
sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT,
sizeof(dhcpcfg), (uint8_t *) &dhcpcfg) != 0) {
return false;
}
}
sl_Stop(0);
sl_Start(NULL, NULL, NULL);
if (sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID) != 0) {
LOG(LL_ERROR, ("DHCP server failed to start"));
return false;
}
LOG(LL_INFO, ("WiFi: AP %s configured", ssid));
return true;
}
示例11: wlan_stop
void wlan_stop (uint32_t timeout) {
wlan_servers_stop();
#ifdef SL_PLATFORM_MULTI_THREADED
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
#endif
sl_Stop(timeout);
wlan_clear_data();
wlan_obj.mode = -1;
}
示例12: DeInitDriverAP
void
DeInitDriverAP(void)
{
//
// Stop the simplelink host
//
sl_Stop(10);
}
示例13: P2PConfiguration
//*****************************************************************************
//
//! Set all P2P Configuration to device
//!
//! \param None
//!
//! \return status code - Success:0, Failure:-ve
//
//*****************************************************************************
long P2PConfiguration()
{
unsigned char ucP2PParam[4];
long lRetVal = -1;
// Set any p2p option (SL_CONNECTION_POLICY(0,0,0,any_p2p,0)) to connect to
// first available p2p device
lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0);
ASSERT_ON_ERROR(lRetVal);
// Set the negotiation role (SL_P2P_ROLE_NEGOTIATE).
// CC3200 will negotiate with remote device GO/client mode.
// Other valid options are:
// - SL_P2P_ROLE_GROUP_OWNER
// - SL_P2P_ROLE_CLIENT
lRetVal = sl_WlanPolicySet(SL_POLICY_P2P, SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE,
SL_P2P_NEG_INITIATOR_ACTIVE),NULL,0);
ASSERT_ON_ERROR(lRetVal);
// Set P2P Device name
lRetVal = sl_NetAppSet(SL_NET_APP_DEVICE_CONFIG_ID, \
NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN,
strlen(P2P_DEVICE_NAME), (unsigned char *)P2P_DEVICE_NAME);
ASSERT_ON_ERROR(lRetVal);
// Set P2P device type
lRetVal = sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE,
strlen(P2P_CONFIG_VALUE), (unsigned char*)P2P_CONFIG_VALUE);
ASSERT_ON_ERROR(lRetVal);
// setting P2P channel parameters
ucP2PParam[0] = LISENING_CHANNEL;
ucP2PParam[1] = REGULATORY_CLASS;
ucP2PParam[2] = OPERATING_CHANNEL;
ucP2PParam[3] = REGULATORY_CLASS;
// Set P2P Device listen and open channel valid channels are 1/6/11
lRetVal = sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS,
sizeof(ucP2PParam), ucP2PParam);
ASSERT_ON_ERROR(lRetVal);
// Restart as P2P device
lRetVal = sl_Stop(SL_STOP_TIMEOUT);
lRetVal = sl_Start(NULL,NULL,NULL);
if(lRetVal < 0 || lRetVal != ROLE_P2P)
{
ASSERT_ON_ERROR(P2P_CONFIG_FAILED);
}
else
{
UART_PRINT("Connect to %s \n\r",P2P_DEVICE_NAME);
}
return SUCCESS;
}
示例14: Task_WifiAP
void Task_WifiAP(void* params)
{
(void)params; //avoid unused warning
long retval;
LOG(LOG_IMPORTANT, "Starting WiFi AP Mode.");
SetLEDBlink(LED_1, LED_BLINK_PATTERN_WIFI_CONNECTING);
if(WifiDefaultSettings() == RET_FAILURE) {
goto error;
}
if((retval = sl_Start(0,0,0)) < 0) {
goto error;
}
if(retval != ROLE_AP) {
if(WifiSetModeAP() != ROLE_AP) {
sl_Stop(SL_STOP_TIMEOUT);
goto error;
}
}
//Wait for an IP address to be acquired
while(!IS_IP_ACQUIRED(wifi_state.status)) {};
SetLEDBlink(LED_1, LED_BLINK_PATTERN_WIFI_AP);
LOG(LOG_IMPORTANT, "AP Started - Ready for client.");
#ifdef DO_STACK_CHECK
wifi_state.stack_watermark = uxTaskGetStackHighWaterMark(NULL);
#endif
//start socket handler.
xTaskCreate(Task_SocketServer,
"Socket Server",
SOCKET_TASK_STACK_SIZE/sizeof(portSTACK_TYPE),
0,
SOCKET_TASK_PRIORITY,
0);
#ifdef DO_STACK_CHECK
wifi_state.stack_watermark = uxTaskGetStackHighWaterMark(NULL);
#endif
//exit (delete this task)
WifiTaskEndCallback(&Task_WifiAP);
vTaskDelete(NULL);
error:
SetLED(LED_1, LED_BLINK_PATTERN_WIFI_FAILED);
TASK_RETURN_ERROR(ERROR_UNKNOWN, "WIFI AP fail");
return;
return;
}
示例15: UDMAInit
//--tested, working--//
bool WiFiClass::init()
{
//
//only initialize once
//
if (_initialized) {
return true;
}
//
//Initialize the UDMA
//
UDMAInit();
//
//start the SimpleLink driver (no callback)
//
int iRet = sl_Start(NULL, NULL, NULL);
//
//check if sl_start failed
//
if (iRet==ROLE_STA_ERR || iRet==ROLE_AP_ERR || iRet==ROLE_P2P_ERR) {
return false;
}
//
//set the mode to station if it's not already in station mode
//
if (iRet != ROLE_STA) {
sl_WlanSetMode(ROLE_STA);
sl_Stop(0);
sl_Start(NULL, NULL, NULL);
}
//
//Delete all profiles$
//
sl_WlanProfileDel(0xff);
//
//disconnect from anything if for some reason it's connected
//
sl_WlanDisconnect();
sl_NetAppMDNSUnRegisterService(0, 0);
_initialized = true;
//
// Start collecting statistics
//
sl_WlanRxStatStart();
return true;
}