Other Parts Discussed in Thread: CC3200
Tool/software: Code Composer Studio
Hi,
I'am working with the CC3200 LaunchpadXL and the httpServer example on SDK. On my webserver i want to enter default values for some sensors. I created user difined tokens for post and get events. Every thing works good except one thing: The default values i would like to read should be shown in the input box on the webpage (like the example of oob). The lenght of data i response to the get token is not correct and the values on page are wrong but the data value i get from the post token is correct!
Here is the code i used in ccs:
char size_of_standard_temperatur = 2; //default setting size of standard temperatur char setting_standard_temperatur[] = "50"; //default setting standard temperatur case SL_NETAPP_HTTPGETTOKENVALUE_EVENT: //user setting standard temperatur if(memcmp(pSlHttpServerEvent->EventData.httpTokenName.data, Setting_Standard_Temperatur, strlen((const char *)Setting_Standard_Temperatur)) == 0) { strcpy((char*)pSlHttpServerResponse->ResponseData.token_value.data,(const char*)setting_standard_temperatur); pSlHttpServerResponse->ResponseData.token_value.len = size_of_standard_temperatur; } case SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT: //setting standard temperature if(memcmp(pSlHttpServerEvent->EventData.httpPostData.token_name.data, POST_token_Standard_Temperatur, strlen((const char *)POST_token_Standard_Temperatur)) == 0) { unsigned char* ptrbuffer= pSlHttpServerEvent->EventData.httpPostData.token_value.data; strcpy((char*)setting_standard_temperatur,(const char*)ptrbuffer); size_of_standard_temperatur=strlen((const char *)ptrbuffer); //used to check wether the correct value is in the post token: if(memcmp(ptrbuffer, "20", 2) == 0) { //GPIO_IF_Set(GPIO_LED3, g_uiLED3Port, g_ucLED3Pin, 1); GPIO_IF_LedOn(MCU_GREEN_LED_GPIO); osi_Sleep(400); GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); } else { GPIO_IF_LedOn(MCU_RED_LED_GPIO); osi_Sleep(400); GPIO_IF_LedOff(MCU_RED_LED_GPIO); } }
html:
<script type="text/javascript"> $(function(){ // assume that webserver will replace all the __SL_G token values with their // appropriate values if they exist var tokens = { "__SL_P_UST" : "__SL_G_US1", //standard temperature post token : setting from get token "__SL_P_UTH" : "__SL_G_US2", "__SL_P_UC1" : "__SL_G_US3", "__SL_P_UC2" : "__SL_G_US4", "__SL_P_UCH" : "__SL_G_US5", "__SL_P_USH" : "__SL_G_US6", "__SL_P_UHH" : "__SL_G_US7", "__SL_P_USB" : "__SL_G_US8", "__SL_P_UBH" : "__SL_G_US9"};
Example of the failed answer from the get token if i am sumbit 20 into the input box:
Can anyone say why the correct post token is shown wrong in the input box ifthe get token response the same data value ?
Any idea to fix the problem ?