This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

请问怎样才可以存下第一次Smart Config的密码,让板子启动自动读取呢?

Other Parts Discussed in Thread: CC3200

我想在用安卓端配置一次之后,存下输出并识别的wifi密码,让板子以后可以自己读取连入,不知道现在的cc3200 Lunchpad能不能做到呢?还有,密码在Smart Config例子里面哪里可以找到识别出来的密码?有没有具体的变量名称?...新手很多东西不懂,请大家帮下忙解答下。感激不尽。

  • Launchpad可以做到。

    你可以通过add profile的方式,将SmartConfig以后获得的AP信息添加到Profile里面,最多可以添加7个AP的信息,并且可以设置不同的优先级。

    //Add Profile
    /* user needs to change SSID_NAME = "<Secured AP>"
    SECURITY_TYPE = SL_SEC_TYPE_WPA
    SECURITY_KEY = "<password>"
    and set the priority as per requirement
    to connect with a secured AP */
    SlSecParams_t secParams;
    secParams.Key = SECURITY_KEY;
    secParams.KeyLen = strlen(SECURITY_KEY);
    secParams.Type = SECURITY_TYPE;
    sl_WlanProfileAdd(SSID_NAME,strlen(SSID_NAME),0,&secParams,0,1,0);

    //set AUTO policy
    sl_WlanPolicySet(SL_POLICY_CONNECTION,
    SL_CONNECTION_POLICY(1,0,0,0,0),
    &policyVal, 1 /*PolicyValLen*/);
    //wait until IP is acquired

  • 我会试试的。谢谢你。

  • 我还是找不到输入的密码在哪个数据类型里面,您上面提到的是AP的SSID吧......还请指点。

  • 为了安全起见,smartconfig设置之后的密码MCU端是读不到的,只能读到SSID。 这是为了保护终端用户的隐私,即便是MCU开发者也不能拿到。

  • 那我怎么才能让板子自己按第一次连上的密码连上ap啊?我已经试过注释掉delete profile的那行了,但烧写进板子后还是不能在连上重启后自动连接。麻烦您了。

  • 我也有同样的问题,每次启动都要重新smart config一下密码实在是件痛苦的事情,如果能报已经获得的密码保存在flash中,下次启动自动连接,那就省却了很多麻烦。

  • 可以啊,你不要每次启动都运行smart config, 配置好下次不要再运行就好了。

  • 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;
    }

    Ti工程师 pan  ,你好。

    这代码(是Ti官方SmartConfig demo 注掉了profile_del() )每次都需要APP配置后才连到AP, 需要怎么改后可以达到你说的 ‘配置好’?

    盼回复!