"gasFlow":1.1 // 气体流量 范围0-50, 0:焊接时气体流量按电流调节, 大于0: 焊接时气体流量固定到这个值
}
}
+
+//锁机/解锁
+{
+ "action": "lockDevice",
+ "timeStamp":1716445485381, // 6.25新增
+ "data":{
+ "mac":"00:06:00:3B:30:33", // 6.25新增
+ "deviceNo":"C0201240508000025" // 6.25新增
+ }
+}
+{
+ "action": "unlockDevice",
+ "timeStamp":1716445485381, // 6.25新增
+ "data":{
+ "mac":"00:06:00:3B:30:33", // 6.25新增
+ "deviceNo":"C0201240508000025" // 6.25新增
+ }
+}
+//OTA 升级
+{
+ "action": "update",
+ "timeStamp":1716445485381, // 6.25新增
+ "data": {
+ "version": "V1.2",
+ "downloadUrl": "http://xxxxxxx",
+ "mac":"00:06:00:3B:30:33", // 6.25新增
+ "deviceNo":"C0201240508000025" // 6.25新增
+ }
+}
//设备回应,原包返回
#endif
if(action && cJSON_IsString( action ) ){
//lock/unlock 设备响应数据暂定如下: op代表操作数据 lock代表当前机器锁机状态 0锁机 1正常
//{cmd:"op", mac:"", lock:"0"
- if( strcmp( action->valuestring, "lockDevice" )== 0 ){
- debug_printf( "lockdevice %d->1\n", g_dev.cfg.remote_locked );
- g_dev.cfg.remote_locked = 1;
- dev_cfg_store( &g_dev.cfg );
- act = 1;
+ if( strcmp( action->valuestring, "lockDevice" )== 0 || strcmp( action->valuestring, "unlockDevice" )== 0){
+ data = cJSON_GetObjectItem( root, "data" );
+ if(data){
+ mac = cJSON_GetObjectItem( data, "mac" );
+ if( mac && strcasecmp( mac->valuestring, g_mac_str ) == 0 ){
+ g_dev.cfg.remote_locked = (strcmp( action->valuestring, "lockDevice" )== 0)?1:0;
+ debug_printf( "unlockdevice %d->0\n", g_dev.cfg.remote_locked );
+ dev_cfg_store( &g_dev.cfg );
+ act = 4; //原包回发。
+ }
+ }
}else if( strcmp( action->valuestring, "updateSolarTermFactor" )== 0 ){
data = cJSON_GetObjectItem( root, "data" );
if(data){
}
}
}
- }else if( strcmp( action->valuestring, "unlockDevice" )== 0 ){
- debug_printf( "unlockdevice %d->0\n", g_dev.cfg.remote_locked );
- g_dev.cfg.remote_locked = 0;
- dev_cfg_store( &g_dev.cfg );
- act = 2;
}else if( strcmp( action->valuestring, "update" )== 0 ){
//ota;
data = cJSON_GetObjectItem( root, "data" );
debug_printf( "-----ota----- " );
if(data){
- ver = cJSON_GetObjectItem( data, "version" );
- url = cJSON_GetObjectItem( data, "downloadUrl" );
- if( ver ) debug_printf( "--version:[%s]", ver->valuestring );
- if( url ) debug_printf( "--url:[%s]", url->valuestring );
- if( ver &&url ){
- if(link==0){
- wifi_ota_start( url->valuestring, ver->valuestring );
- }else if(link==1){
- eth_ota_start( url->valuestring, ver->valuestring );
- }else if(link== 2){
- cat1_ota_start( url->valuestring, ver->valuestring );
- }
- act = 3;
+ mac = cJSON_GetObjectItem( data, "mac" );
+ if( mac && strcasecmp( mac->valuestring, g_mac_str ) == 0 ){
+ ver = cJSON_GetObjectItem( data, "version" );
+ url = cJSON_GetObjectItem( data, "downloadUrl" );
+ if( ver ) debug_printf( "--version:[%s]", ver->valuestring );
+ if( url ) debug_printf( "--url:[%s]", url->valuestring );
+ if( ver &&url ){
+ if(link==0){
+ wifi_ota_start( url->valuestring, ver->valuestring );
+ }else if(link==1){
+ eth_ota_start( url->valuestring, ver->valuestring );
+ }else if(link== 2){
+ cat1_ota_start( url->valuestring, ver->valuestring );
+ }
+ act = 3;
+ act = 4; //原包回发。
+ }
+
}
}
debug_printf( "\n" );