1 Reply Latest reply on May 6, 2016 11:16 AM by lorded

    How do I dynamically change the SSID and write the new value into the DCT so it remains upon reboot?

    david_epperly_2098041

      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().

        • 1. Re: How do I dynamically change the SSID and write the new value into the DCT so it remains upon reboot?
          lorded

          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");

               }