- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I dynamically change the SSID and write the new value into the DCT so it remains upon reboot?
I need a code snippet that does this. In my use case, it can be done before or after the wiced_network_up().
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something like this. Few bits and pieces of my code cut out.
wiced_result_t result;
platform_dct_wifi_config_t* wifi_config_dct_local = NULL;
char new_ssid[33] = "mynewssid";
/* Read the Wi-Fi config from the DCT */
result = wiced_dct_read_lock( (void**) &wifi_config_dct_local, WICED_TRUE, DCT_WIFI_CONFIG_SECTION, 0, sizeof( platform_dct_wifi_config_t ) );
if ( result != WICED_SUCCESS )
{
return result;
}
memcpy((char*)wifi_config_dct_local->soft_ap_settings.SSID.value, (char*)new_ssid, strlen(new_ssid));
wifi_config_dct_local->soft_ap_settings.SSID.length = strlen(new_ssid);
/* Write the modified config back into the DCT */
result = wiced_dct_write ( (const void*)wifi_config_dct_local, DCT_WIFI_CONFIG_SECTION, 0, sizeof (platform_dct_wifi_config_t) );
wiced_dct_read_unlock( (void*)wifi_config_dct_local, WICED_TRUE );
if ( result != WICED_SUCCESS )
{
printf("Error writing DCT\r\n");
return result;
} else {
printf("Success writing DCT\r\n");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something like this. Few bits and pieces of my code cut out.
wiced_result_t result;
platform_dct_wifi_config_t* wifi_config_dct_local = NULL;
char new_ssid[33] = "mynewssid";
/* Read the Wi-Fi config from the DCT */
result = wiced_dct_read_lock( (void**) &wifi_config_dct_local, WICED_TRUE, DCT_WIFI_CONFIG_SECTION, 0, sizeof( platform_dct_wifi_config_t ) );
if ( result != WICED_SUCCESS )
{
return result;
}
memcpy((char*)wifi_config_dct_local->soft_ap_settings.SSID.value, (char*)new_ssid, strlen(new_ssid));
wifi_config_dct_local->soft_ap_settings.SSID.length = strlen(new_ssid);
/* Write the modified config back into the DCT */
result = wiced_dct_write ( (const void*)wifi_config_dct_local, DCT_WIFI_CONFIG_SECTION, 0, sizeof (platform_dct_wifi_config_t) );
wiced_dct_read_unlock( (void*)wifi_config_dct_local, WICED_TRUE );
if ( result != WICED_SUCCESS )
{
printf("Error writing DCT\r\n");
return result;
} else {
printf("Success writing DCT\r\n");
}