当前位置: 首页>>代码示例>>C++>>正文


C++ IS_IP_ACQUIRED函数代码示例

本文整理汇总了C++中IS_IP_ACQUIRED函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_IP_ACQUIRED函数的具体用法?C++ IS_IP_ACQUIRED怎么用?C++ IS_IP_ACQUIRED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IS_IP_ACQUIRED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WlanConnect

//****************************************************************************
//
//!  \brief Connecting to a WLAN Accesspoint
//!
//!   This function connects to the required AP (SSID_NAME) with Security
//!   parameters specified in te form of macros at the top of this file
//!
//!   \param[in]              None
//!
//!   \return       status value
//!
//!   \warning    If the WLAN connection fails or we don't aquire an IP
//!            address, It will be stuck in this function forever.
//
//****************************************************************************
static long WlanConnect()
{
    SlSecParams_t secParams = {0};
    signed long lretVal = 0;

    secParams.Key = SECURITY_KEY;
    secParams.KeyLen = strlen(SECURITY_KEY);
    secParams.Type = SECURITY_TYPE;

    lretVal = sl_WlanConnect(SSID_NAME, strlen(SSID_NAME), 0, &secParams, 0);
    ASSERT_ON_ERROR(lretVal);

    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    {
        // Wait for WLAN Event
#ifndef SL_PLATFORM_MULTI_THREADED
              _SlNonOsMainLoopTask();
#endif

    }

    UNUSED(lretVal);
    return SUCCESS;

}
开发者ID:moyanming,项目名称:CC3200SDK_1.2.0,代码行数:40,代码来源:main.c

示例2: SmartConfigTask

//*****************************************************************************
//
//! \brief     Starts Smart Configuration
//!
//! \param    none
//!
//! \return void
//! \note
//! \warning
//*****************************************************************************
void SmartConfigTask(void* pValue)
{
    long lRetVal = -1;
    DispatcherUartSendPacket((char*)pucUARTSmartConfigString, 
                             sizeof(pucUARTSmartConfigString));
    
    //Turn off the Network Status LED
    GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
    
    LedTimerConfigNStart();
    
    //Reset the Network Status before Entering Smart Config
    Network_IF_UnsetMCUMachineState(STATUS_BIT_CONNECTION);
    Network_IF_UnsetMCUMachineState(STATUS_BIT_IP_AQUIRED);
    
    lRetVal = SmartConfigConnect();
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }
    //
    // Wait until IP is acquired
    //
    while (!(IS_CONNECTED(Network_IF_CurrentMCUState())) ||
           !(IS_IP_ACQUIRED(Network_IF_CurrentMCUState())));
    
    LedTimerDeinitStop();
    
    // Red LED on
    GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
    
    //Enable GPIO Interrupt
    Button_IF_EnableInterrupt(SW2);
}
开发者ID:oter,项目名称:BSPTools,代码行数:45,代码来源:main.c

示例3: WlanConnect

//****************************************************************************
//
//! \brief Connecting to a WLAN Accesspoint
//!
//!  This function connects to the required AP (SSID_NAME) with Security
//!  parameters specified in te form of macros at the top of this file
//!
//! \param  None
//!
//! \return  0 on success else error code 
//!
//! \warning    If the WLAN connection fails or we don't aquire an IP
//!            address, It will be stuck in this function forever.
//
//****************************************************************************
long WlanConnect()
{
   long lRetVal = -1;
   SlSecParams_t secParams;

   secParams.Key = SECURITY_KEY;
   secParams.KeyLen = strlen(SECURITY_KEY);
   secParams.Type = SECURITY_TYPE;

   lRetVal = sl_WlanConnect(SSID_NAME,strlen(SSID_NAME),0,&secParams,0);
   ASSERT_ON_ERROR(lRetVal);
   
   while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
   {
       // Toggle LEDs to Indicate Connection Progress
       GPIO_IF_LedOff(MCU_IP_ALLOC_IND);
       MAP_UtilsDelay(800000);
       GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
       MAP_UtilsDelay(800000);

   }
   //
   // Red LED on to indicate AP connection
   //
   GPIO_IF_LedOn(MCU_IP_ALLOC_IND);
   return SUCCESS;
}
开发者ID:gale320,项目名称:cc3200,代码行数:42,代码来源:main.c

示例4: wlan_connect

static int wlan_connect(const char *ssid, const char *pass, unsigned char sec_type)
{
    SlSecParams_t secParams = {0};
    long lRetVal = 0;

    secParams.Key = (signed char*)pass;
    secParams.KeyLen = strlen(pass);
    secParams.Type = sec_type;

    lRetVal = sl_WlanConnect((signed char*)ssid, strlen(ssid), 0, &secParams, 0);
    ASSERT_ON_ERROR(lRetVal);

    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
        _SlNonOsMainLoopTask();   

    SlDateTime_t dateTime= {0};
    dateTime.sl_tm_day =   1;          // Day of month (DD format) range 1-13
    dateTime.sl_tm_mon =   1;          // Month (MM format) in the range of 1-12
    dateTime.sl_tm_year =  1970;       // Year (YYYY format)
    dateTime.sl_tm_hour =  0;          // Hours in the range of 0-23
    dateTime.sl_tm_min =   0;          // Minutes in the range of 0-59
    dateTime.sl_tm_sec =   1;          // Seconds in the range of  0-59

    lRetVal = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
              sizeof(SlDateTime_t),(unsigned char *)(&dateTime));
    ASSERT_ON_ERROR(lRetVal);

    return 0;
}
开发者ID:BillTheBest,项目名称:sample-apps,代码行数:29,代码来源:cc32xx_support.c

示例5: StartSerialSock

static int StartSerialSock(unsigned short port, unsigned int slot)
{
    if(!IS_IP_ACQUIRED(wifi_state.status)) {RETURN_ERROR(ERROR_UNKNOWN, "Uninit fail");}
    if(IS_SOCK_STARTED(slot)) {RETURN_ERROR(ERROR_UNKNOWN, "Uninit fail");}

    LOG(LOG_VERBOSE, "Starting socket %d on port %d...", slot, port);

    int retval;

    socket_state[slot].addr_local.sin_family = SL_AF_INET;
    socket_state[slot].addr_local.sin_port = sl_Htons(port);
    socket_state[slot].addr_local.sin_addr.s_addr = 0;

    socket_state[slot].parent_id = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, 0);
    if(socket_state[slot].parent_id < 0) {RETURN_ERROR(socket_state[slot].parent_id, "Socket create fail");}

    retval = sl_Bind(socket_state[slot].parent_id, (SlSockAddr_t*)&(socket_state[slot].addr_local), sizeof(SlSockAddrIn_t));
    if(retval < 0){
        sl_Close(socket_state[slot].parent_id);
        RETURN_ERROR(retval, "Socket bind fail");
    }

    retval = ListenSerialSock(slot);

    LOG(LOG_VERBOSE, "Socket started.");

    socket_state[slot].status = SOCKET_STARTED;
    return RET_SUCCESS;
}
开发者ID:Mindtribe,项目名称:Leash-Debugger,代码行数:29,代码来源:serialsock.c

示例6: 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;
}
开发者ID:Mindtribe,项目名称:Leash-Debugger,代码行数:56,代码来源:wifi.c

示例7: WifiConnectSTA

static int WifiConnectSTA()
{
    LOG(LOG_IMPORTANT ,"Waiting for auto connect...");

    while((!IS_CONNECTED(wifi_state.status)) || (!IS_IP_ACQUIRED(wifi_state.status))) {
#ifndef SL_PLATFORM_MULTI_THREADED
        _SlNonOsMainLoopTask();
#endif
    }

    return RET_SUCCESS;
}
开发者ID:Mindtribe,项目名称:Leash-Debugger,代码行数:12,代码来源:wifi.c

示例8: SmartConfigConnect

//*****************************************************************************
//
//! \brief Connecting to a WLAN Accesspoint using SmartConfig provisioning
//!
//! Enables SmartConfig provisioning for adding a new connection profile
//! to CC3200. Since we have set the connection policy to Auto, once
//! SmartConfig is complete, CC3200 will connect automatically to the new
//! connection profile added by smartConfig.
//!
//! \param[in]                     None
//!
//! \return                        None
//!
//! \note
//!
//! \warning                    If the WLAN connection fails or we don't
//!                             acquire an IP address, We will be stuck in this
//!                             function forever.
//
//*****************************************************************************
int SmartConfigConnect()
{
    unsigned char policyVal;
    long lRetVal = -1;

    // Clear all profiles 
    // This is of course not a must, it is used in this example to make sure
    // we will connect to the new profile added by SmartConfig
    //
    lRetVal = sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES);
    ASSERT_ON_ERROR(lRetVal);

    //set AUTO policy
    lRetVal = sl_WlanPolicySet(  SL_POLICY_CONNECTION,
                      SL_CONNECTION_POLICY(1,0,0,0,1),
                      &policyVal,
                      1 /*PolicyValLen*/);
    ASSERT_ON_ERROR(lRetVal);

    // Start SmartConfig
    // This example uses the unsecured SmartConfig method
    //
    lRetVal = sl_WlanSmartConfigStart(0,                /*groupIdBitmask*/
                           SMART_CONFIG_CIPHER_NONE,    /*cipher*/
                           0,                           /*publicKeyLen*/
                           0,                           /*group1KeyLen*/
                           0,                           /*group2KeyLen */
                           NULL,                        /*publicKey */
                           NULL,                        /*group1Key */
                           NULL);                       /*group2Key*/
    ASSERT_ON_ERROR(lRetVal);

    // Wait for WLAN Event
    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    {
        _SlNonOsMainLoopTask();
    }
     //
     // Turn ON the RED LED to indicate connection success
     //
     GPIO_IF_LedOn(MCU_RED_LED_GPIO);
     //wait for few moments
     MAP_UtilsDelay(80000000);
     //reset to default AUTO policy
     lRetVal = sl_WlanPolicySet(  SL_POLICY_CONNECTION,
                           SL_CONNECTION_POLICY(1,0,0,0,0),
                           &policyVal,
                           1 /*PolicyValLen*/);
     ASSERT_ON_ERROR(lRetVal);

     return SUCCESS;
}
开发者ID:bigcat26,项目名称:cc3200-sdk,代码行数:72,代码来源:main.c

示例9: AP

/*!
    \brief Connecting to a WLAN Access point

    This function connects to the required AP (SSID_NAME).
    The function will return once we are connected and have acquired IP address

    \param[in]  None

    \return     0 on success, negative error-code on error

    \note

    \warning    If the WLAN connection fails or we don't acquire an IP address,
                We will be stuck in this function forever.
*/
static _i32 establishConnectionWithAP()
{
    SlSecParams_t secParams = {0};
    _i32 retVal = 0;

    secParams.Key = "";
    secParams.KeyLen = 0;
    secParams.Type = SL_SEC_TYPE_OPEN;

    retVal = sl_WlanConnect(UNSEC_SSID_NAME, pal_Strlen(UNSEC_SSID_NAME), 0, &secParams, 0);
    ASSERT_ON_ERROR(retVal);

    /* Wait */
    while((!IS_CONNECTED(g_Status)) || (!IS_IP_ACQUIRED(g_Status))) { _SlNonOsMainLoopTask(); }

    return SUCCESS;
}
开发者ID:DavidUser,项目名称:CC3100,代码行数:32,代码来源:main.c

示例10: AP

/*!
    \brief Connecting to a WLAN Access point

    This function connects to the required AP (SSID_NAME).
    The function will return once we are connected and have acquired IP address

    \param[in]  None

    \return     0 on success, negative error-code on error

    \note

    \warning    If the WLAN connection fails or we don't acquire an IP address,
                We will be stuck in this function forever.
*/
_i32 establishConnectionWithAP()
{

  _i32 retVal = 0;
    SlSecParams_t secParams = {0};

    secParams.Key = (_i8 *)PASSKEY;
    secParams.KeyLen = pal_Strlen(PASSKEY);
    secParams.Type = SEC_TYPE;

    retVal = sl_WlanConnect((_i8 *)SSID_NAME, pal_Strlen(SSID_NAME), 0, &secParams, 0);
    ASSERT_ON_ERROR(retVal);

    /* Wait */
    while((!IS_CONNECTED(g_Status)) || (!IS_IP_ACQUIRED(g_Status))) { _SlNonOsMainLoopTask(); }

    return SUCCESS;
}
开发者ID:callalilychen,项目名称:TIOT,代码行数:33,代码来源:connection.c

示例11: WpsConnectPinCode

//*****************************************************************************
//
//!    \brief Connecting to a WLAN Accesspoint
//!    This function connects to the required AP (SSID_NAME).
//!    This code example assumes the AP doesn't use WIFI security.
//!    The function will return only once we are connected 
//!    and have acquired IP address
//!
//!    \param[in] None
//!
//!    \return None
//!
//!    \note 0 on success else error code
//!
//!    \warning    If the WLAN connection fails or we don't aquire an IP address,
//!                We will be stuck in this function forever.
//
//*****************************************************************************
long 
WpsConnectPinCode()
{
    SlSecParams_t secParams;
    long lRetVal = -1;

    secParams.Key = WPS_PIN_CODE;
    secParams.KeyLen = strlen(WPS_PIN_CODE);
    secParams.Type = SL_SEC_TYPE_WPS_PIN;

    lRetVal = sl_WlanConnect(SSID_NAME, strlen(SSID_NAME), 0, &secParams, 0);
    ASSERT_ON_ERROR(lRetVal);

    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    {
        _SlNonOsMainLoopTask();
    }
    return SUCCESS;
}
开发者ID:CaptFrank,项目名称:CC3200-Linux-SDK,代码行数:37,代码来源:main.c

示例12: WlanConnect

//****************************************************************************
//
//!  \brief Connecting to a WLAN Access point
//!
//!   This function connects to the required AP (SSID_NAME) with Security
//!   parameters specified in the form of macros at the top of this file
//!
//!   \param[in]              None
//!
//!   \return                 None
//!
//!   \warning    If the WLAN connection fails or we don't acquire an IP 
//!            address, It will be stuck in this function forever.
//
//****************************************************************************
static long WlanConnect()
{
    SlSecParams_t secParams = {0};
    long lRetVal = 0;

    secParams.Key = (signed char *)P2P_SECURITY_KEY;
    secParams.KeyLen = strlen(P2P_SECURITY_KEY);
    secParams.Type = P2P_SECURITY_TYPE;

    lRetVal = sl_WlanConnect((signed char *)P2P_REMOTE_DEVICE,
                            strlen((const char *)P2P_REMOTE_DEVICE), 0,
                            &secParams, 0);
    ASSERT_ON_ERROR(lRetVal);

    // Wait till Device acquired an IP in P2P mode
    while(! IS_P2P_REQ_RCVD(g_ulStatus))
    { 
        _SlNonOsMainLoopTask();
    }

    // Connect with the device requesting the connection
    lRetVal = sl_WlanConnect((signed char *)g_p2p_dev,
                           strlen((const char *)g_p2p_dev),
                           0, &secParams, 0);
    ASSERT_ON_ERROR(lRetVal);
    
#ifdef P2P_ROLE_TYPE_NEGOTIATE
    while(! IS_IP_ACQUIRED(g_ulStatus))
#else
    while(! IS_IP_LEASED(g_ulStatus))
#endif
    {
        _SlNonOsMainLoopTask();
        if(IS_CONNECT_FAILED(g_ulStatus))
        {
            // Error, connection is failed
            ASSERT_ON_ERROR(NETWORK_CONNECTION_FAILED);
        }
    }

    return SUCCESS;
}
开发者ID:dlugaz,项目名称:All,代码行数:57,代码来源:main.c

示例13: WlanConnect

//****************************************************************************
//
//!  \brief Connecting to a WLAN Access point
//!
//!   This function connects to the required AP (SSID_NAME) with Security
//!   parameters specified in the form of macros at the top of this file
//!
//!   \param[in]              None
//!
//!   \return                 None
//!
//!   \warning    If the WLAN connection fails or we don't acquire an IP 
//!            address, It will be stuck in this function forever.
//
//****************************************************************************
static long WlanConnect()
{
    SlSecParams_t secParams = {0};
    long retVal = 0;

    secParams.Key = SECURITY_KEY;
    secParams.KeyLen = strlen(SECURITY_KEY);
    secParams.Type = SECURITY_TYPE;

    retVal = sl_WlanConnect(P2P_REMOTE_DEVICE, strlen(P2P_REMOTE_DEVICE), 0,
                            &secParams, 0);
    ASSERT_ON_ERROR(__LINE__, retVal);

    // Wait till Device acquired an IP in P2P mode
    while(! IS_P2P_REQ_RCVD(g_ulStatus))
    { 
        _SlNonOsMainLoopTask();
    }

    // Connect with the device requesting the connection
    retVal = sl_WlanConnect(g_p2p_dev, strlen(g_p2p_dev), 0, &secParams, 0);
    ASSERT_ON_ERROR(__LINE__, retVal);
    
#ifdef P2P_ROLE_TYPE_NEGOTIATE
    while(! IS_IP_ACQUIRED(g_ulStatus))
#else
    while(! IS_IP_LEASED(g_ulStatus))
#endif
    {
        _SlNonOsMainLoopTask();
        if(IS_CONNECT_FAILED(g_ulStatus))
        {
            // Error, connection is failed
            UART_PRINT("Connection Failed\r\n");
            return -1;
        }
    }

    return SUCCESS;
}
开发者ID:Balu1991,项目名称:Wifly_Light,代码行数:55,代码来源:main.c

示例14: NetWlanConnect

//****************************************************************************
//
//!  \brief Connecting to a WLAN Accesspoint
//!
//!   This function connects to the required AP (SSID_NAME) with Security
//!   parameters specified in te form of macros at the top of this file
//!
//!   \param[in]              None
//!
//!   \return       status value
//!
//!   \warning    If the WLAN connection fails or we don't aquire an IP
//!            address, It will be stuck in this function forever.
//
//****************************************************************************
long NetWlanConnect(const char *cssid, SlSecParams_t *secParams)
{
    long lRetVal = 0;

    lRetVal = sl_WlanConnect((signed char *)cssid, strlen(cssid), 0, secParams, 0);
    if( lRetVal != 0)
    {
      return lRetVal;
    }

    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    {
        // Wait for WLAN Event
#ifndef SL_PLATFORM_MULTI_THREADED
              _SlNonOsMainLoopTask();
#endif

    }

    return SUCCESS;

}
开发者ID:CaptFrank,项目名称:CC3200-Linux-SDK,代码行数:37,代码来源:net.c

示例15: SmartConfigConnect

/*!
    \brief Connecting to a WLAN Access point using SmartConfig provisioning

    This function enables SmartConfig provisioning for adding a new connection
    profile to CC3100. Since we have set the connection policy to Auto, once
    SmartConfig is complete, CC3100 will connect automatically to the new
    connection profile added by smartConfig.

    \param[in]      None

    \return     0 on success, negative error-code on error

    \note

    \warning        If the WLAN connection fails or we don't acquire an IP
                    address, We will be stuck in this function forever.
*/
static _i32 SmartConfigConnect()
{
    _u8 policyVal = 0;
    _i32 retVal = -1;

    /* Clear all profiles */
    /* This is of course not a must, it is used in this example to make sure
    * we will connect to the new profile added by SmartConfig
    */
    retVal = sl_WlanProfileDel(WLAN_DEL_ALL_PROFILES);
    ASSERT_ON_ERROR(retVal);

    /* set AUTO policy */
    retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION,
                     SL_CONNECTION_POLICY(1, 0, 0, 0, 0),
                     &policyVal,
                     1);    /*PolicyValLen*/
    ASSERT_ON_ERROR(retVal);

    /* Start SmartConfig
     * This example uses the unsecured SmartConfig method
     */
    retVal = sl_WlanSmartConfigStart(0,                          /* groupIdBitmask */
                            SMART_CONFIG_CIPHER_NONE,   /* cipher */
                            0,                          /* publicKeyLen */
                            0,                          /* group1KeyLen */
                            0,                          /* group2KeyLen */
                            (const _u8 *)"",  /* publicKey */
                            (const _u8 *)"",  /* group1Key */
                            (const _u8 *)""); /* group2Key */

    ASSERT_ON_ERROR(retVal);

    /* Wait */
    while((!IS_CONNECTED(g_Status)) || (!IS_IP_ACQUIRED(g_Status))) { _SlNonOsMainLoopTask(); }

    return SUCCESS;
}
开发者ID:DavidUser,项目名称:CC3100,代码行数:55,代码来源:main.c


注:本文中的IS_IP_ACQUIRED函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。