|
|
@@ -40,25 +40,31 @@ void packRegistParams(uint8_t * pack_data, uint16_t * pack_data_length, struct R
|
|
|
*/
|
|
|
uint8_t analysisRegistData(uint8_t * regist_data, uint16_t regist_data_length, struct Regist_Params_Struct * regist_data_struct)
|
|
|
{
|
|
|
-// Log_Printf_Debug("regist_data: \r\n");
|
|
|
-// Log_SendHex(regist_data, regist_data_length);
|
|
|
-// Log_Printf_Debug("\r\n");
|
|
|
+ Log_Printf_Debug("regist_data: \r\n");
|
|
|
+ Log_SendHex(regist_data, regist_data_length);
|
|
|
+ Log_Printf_Debug("\r\n");
|
|
|
|
|
|
uint8_t result;
|
|
|
utils_aes128_ECB_base64_dec((char *)key,regist_data,regist_data_length);
|
|
|
-// Log_Printf_Debug("½âÃÜÊý¾Ý(%d):%s\r\n", regist_data_length, (char *)regist_data);
|
|
|
+ Log_Printf_Debug("½âÃÜÊý¾Ý(%d):%s\r\n", regist_data_length, (char *)regist_data);
|
|
|
|
|
|
cJSON *json = cJSON_Parse((char *)regist_data);
|
|
|
if(!json)
|
|
|
{
|
|
|
Log_Printf_Debug("json parse error,%s\r\n",cJSON_GetErrorPtr());
|
|
|
result = 0;
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ else if(cJSON_GetObjectItem(json,"deviceSecret")->valueint == 200)
|
|
|
+ {
|
|
|
strcpy(regist_data_struct->deviceSecret, cJSON_GetObjectItem(json,"deviceSecret")->valuestring);
|
|
|
strcpy(regist_data_struct->productKey, cJSON_GetObjectItem(json,"productKey")->valuestring);
|
|
|
strcpy(regist_data_struct->deviceName, cJSON_GetObjectItem(json,"deviceName")->valuestring);
|
|
|
result = 1;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = 0;
|
|
|
+ }
|
|
|
cJSON_Delete(json);
|
|
|
return result;
|
|
|
}
|