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.

CC3220SF Wi-Fi direct,利用network terminal例程,无法修改Device Name



开发板型号:C3220SF

利用例程Network Terminal,其它地方没有进行修改,只改动了mainthread如下:

void * mainThread(void *arg)
{
    int32_t             RetVal ;
    pthread_attr_t      pAttrs_spawn;
    struct sched_param  priParam;
    struct timespec     ts = {0};

    /* Initializes the SPI interface to the Network 
       Processor and peripheral SPI (if defined in the board file) */
    SPI_init();
    GPIO_init();

    /* Init Application variables */
    RetVal = initAppVariables();

    /* Init Terminal UART */
    InitTerm();

    /* initialize the realtime clock */
    clock_settime(CLOCK_REALTIME, &ts);

    /* Switch off all LEDs on boards */
    GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_OFF);
    GPIO_write(CONFIG_GPIO_LED_1, CONFIG_GPIO_LED_OFF);
    GPIO_write(CONFIG_GPIO_LED_2, CONFIG_GPIO_LED_OFF);

    /* Create the sl_Task internal spawn thread */
    pthread_attr_init(&pAttrs_spawn);
    priParam.sched_priority = SPAWN_TASK_PRIORITY;
    RetVal = pthread_attr_setschedparam(&pAttrs_spawn, &priParam);
    RetVal |= pthread_attr_setstacksize(&pAttrs_spawn, TASK_STACK_SIZE);

    /* The SimpleLink host driver architecture mandate spawn 
       thread to be created prior to calling Sl_start (turning the NWP on). */
    /* The purpose of this thread is to handle
       asynchronous events sent from the NWP.
     * Every event is classified and later handled 
       by the Host driver event handlers. */
    RetVal = pthread_create(&gSpawn_thread, &pAttrs_spawn, sl_Task, NULL);
    if(RetVal != 0)
    {
        /* Handle Error */
        UART_PRINT("Network Terminal - Unable to create spawn thread \n");
        return(NULL);
    }

    /* Before turning on the NWP on,
       reset any previously configured parameters */
    /*
         IMPORTANT NOTE - This is an example reset function,
         user must update this function to match the application settings.
     */
    RetVal = sl_WifiConfig();
    if(RetVal < 0)
    {
         Handle Error
        UART_PRINT("Network Terminal - Couldn't configure Network Processor - %d\n",RetVal);
        return(NULL);
    }

    /* Turn NWP on */
    RetVal = sl_Start(NULL, NULL, NULL);
    if(RetVal < 0)
    {
        /* Handle Error */
        UART_PRINT("sl_start failed - %d\n",RetVal);
        return(NULL);
    }

    /*Set Mode*/
    _i16 Role;
    _i16 Status;

    Status = sl_WlanSetMode(ROLE_P2P);
    if(Status)
    {
        UART_PRINT("sl_WlanSetMode failed\n");
        return(NULL);
    }
    Status = sl_Stop(0);
    Role = sl_Start(NULL, NULL, NULL);
    if(ROLE_P2P != Role)
    {
        UART_PRINT("ROLE_P2P != Role\n");
        return(NULL);
    }

    /*Set Network Configuration*/
    SlNetCfgIpV4Args_t ipV4;
    ipV4.Ip          = (_u32)SL_IPV4_VAL(192, 168, 0, 108);
    ipV4.IpMask      = (_u32)SL_IPV4_VAL(255, 255, 255, 0);
    ipV4.IpGateway   = (_u32)SL_IPV4_VAL(192, 168, 0, 1);
    ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(192, 168, 0, 1);
    Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,
                          SL_NETCFG_ADDR_STATIC, sizeof(SlNetCfgIpV4Args_t), (_u8*)&ipV4);
    if(Status)
    {
        UART_PRINT("sl_NetCfgSet failed\n");
        return(NULL);
    }

    /*Set Device Name*/
    _u8 device_name[] = "Simple_WiFi_Direct";
    Status = sl_NetAppSet(SL_NETAPP_DEVICE_ID, SL_NETAPP_DEVICE_URN, strlen(device_name), (_u8*)device_name);
    if(Status)
    {
        UART_PRINT("sl_NetAppSet failed\n");
        return(NULL);
    }


    UART_PRINT("Success!");
    return(0);
}

但是最后串口那里输出 sl_NetAppSet failed。即没有成功修改device name。

这是怎么回事。