cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

New Contributor II

I've been unable to modify the wifi config section of the DCT.

The modification appears to be successful. The failure occurs when I make the wiced_network_up() call following the DCT modification. The board fails to connect three times and then returns the 1024 error code.

I'm using the dct_read_write snip as a starting point.

Below is a stripped down version of the dct_read_write snip that modifies the network name & password before connecting to the network.

static const char* network_name  = "___";

static const char* network_password  = "___";

void application_start( )

{

    platform_dct_wifi_config_t* dct_wifi_config = NULL;

    wiced_init( );

    print_wifi_config_dct();

    wiced_dct_read_lock( (void**) &dct_wifi_config, WICED_TRUE, DCT_WIFI_CONFIG_SECTION, 0, sizeof( *dct_wifi_config ) );

    strcpy( dct_wifi_config->stored_ap_list[0].details.SSID.value, network_name );

    strcpy( dct_wifi_config->stored_ap_list[0].security_key, network_password );

    wiced_dct_write( (const void*) dct_wifi_config, DCT_WIFI_CONFIG_SECTION, 0, sizeof(platform_dct_wifi_config_t) );

    wiced_dct_read_unlock( dct_wifi_config, WICED_TRUE );

    print_wifi_config_dct();

    wiced_network_up( WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL );

    WPRINT_APP_INFO( ( "DONE\r\n" ) );

}

I'm not sure if I'm supposed to use the strcpy() function to modify the dct_wifi_config->stored_ap_list[0].details.SSID.value & dct_wifi_config->stored_ap_list[0].security_key variables. I saw this line ( strcpy( app_dct->string_var, modified_string_var ); )  in the dct_read_write snip, and was hoping they all work the same way.

Thanks for any thoughts.

- Bradley

0 Likes
Reply
1 Solution
New Contributor II

I replaced the strcpy() functions with the following:

dct_wifi_config->stored_ap_list[0].details.SSID.length = strlen( network_name );

strncpy((char*)dct_wifi_config->stored_ap_list[0].details.SSID.value, network_name, strlen( network_name ));

memcpy((char*)dct_wifi_config->stored_ap_list[0].security_key, network_password, strlen( network_password ));

dct_wifi_config->stored_ap_list[0].security_key_length = strlen( network_password );

I should credit this post: Re: Is there a way to dynamically add AP's to the DCT?

View solution in original post

2 Replies
New Contributor II

Additionally, I found the wiced_network_set_hostname( const char* name ) call in the wiced_network_common.c file.

That call doesn't seem to do anything. Maybe I'm using it wrong.

0 Likes
Reply
New Contributor II

I replaced the strcpy() functions with the following:

dct_wifi_config->stored_ap_list[0].details.SSID.length = strlen( network_name );

strncpy((char*)dct_wifi_config->stored_ap_list[0].details.SSID.value, network_name, strlen( network_name ));

memcpy((char*)dct_wifi_config->stored_ap_list[0].security_key, network_password, strlen( network_password ));

dct_wifi_config->stored_ap_list[0].security_key_length = strlen( network_password );

I should credit this post: Re: Is there a way to dynamically add AP's to the DCT?

View solution in original post