º¸³»´Â ºÎºÐ
void TransmitJSONPoweron(void)
{
usprintf(JsonWorkBuff,"DATA={\x22USC\x22:\x22POWERON\x22}\0");
// UARTSend(2,(unsigned char *)JsonWorkBuff,strlen(JsonWorkBuff));
hc_open(g_sParameters.ulRemoteIP);
}
¹ÞÀº µ¥ÀÌÅÍ Çؼ® ºÎºÐ
void ReceiveJSONProc(char *text)
{
unsigned long i,j,k,l,ulSize;
char *ptr=0;
char out[4];
char cVal;
ulSoftResetTimer=SOFTRSTTIME;
if(strlen(text)==0) return;
// UARTSend(2,(unsigned char *)text,strlen(text));
ptr=ustrstr(text,"MAP");
if(ptr !=NULL){
ptr=ustrstr(ptr,"US1");
if(ptr !=NULL){
HWREGBITW(&g_ulFlags, bJSON_NEW_MAP0)=1;
k=0;
j=0;
l=0;
ptr+=3; //skip us1
aMapSize0[0]=0;
//[[],[],[]]
for(i=0;i<NODE_SIZE;i++){
while(*ptr !=']'){
if((*ptr >=0x30) && (*ptr <=0x39)){
out[j]=*ptr;
j++;
}
if(*ptr ==','){ //string to int
if(j){
out[j]=0;
aMapData0[k]=(char)atoi(out);
j=0;
k++;
l++;
}
}
ptr++;
}
if(j){
out[j]=0;
aMapData0[k]=(char)atoi(out);
if(i==0){
aMapSize0[i+1]=++l;
}
else{
aMapSize0[i+1]=l;
}
aMapSize0[0]++;
}
ptr++;
l=0;
if(*ptr==']'){
break;
}
}
for(i=(int)aMapSize0[0]+1;i<50;i++){
aMapSize0[i]=0;
}
CheckMapUpdate(0);
}
}
else{
sprintf(WorkBuff,"NO MAP\0");
}