| | |
| | | conditionArray.Add(conditionJOb); |
| | | } |
| | | inputTypeJOb.Add("condition",conditionArray); |
| | | if (dictionary.condition_type=="8") { |
| | | ///地理围栏 |
| | | var geo_fencejob = new JObject(); |
| | | geo_fencejob.Add("longitude", dictionary.geo_fence.longitude); |
| | | geo_fencejob.Add("latitude", dictionary.geo_fence.latitude); |
| | | geo_fencejob.Add("radius", dictionary.geo_fence.radius); |
| | | inputTypeJOb.Add("geo_fence", geo_fencejob); |
| | | } |
| | | inputArray.Add(inputTypeJOb); |
| | | } |
| | | |
| | |
| | | conditionJOb.Add("data_type", dic["data_type"]); |
| | | conditionJOb.Add("value", dic["value"]); |
| | | conditionArray.Add(conditionJOb); |
| | | if (dictionary.condition_type == "8") |
| | | { |
| | | ///地理围栏 |
| | | var geo_fencejob = new JObject(); |
| | | geo_fencejob.Add("longitude", dictionary.geo_fence.longitude); |
| | | geo_fencejob.Add("latitude", dictionary.geo_fence.latitude); |
| | | geo_fencejob.Add("radius", dictionary.geo_fence.radius); |
| | | inputTypeJOb.Add("geo_fence", geo_fencejob); |
| | | } |
| | | } |
| | | inputTypeJOb.Add("condition", conditionArray); |
| | | inputArray.Add(inputTypeJOb); |
| | |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 自动化地理围栏状态上报 |
| | | /// </summary> |
| | | /// <param name="userLogicId">自动化云端id<备注:logicSid与userLogicId 不能同时为空></param> |
| | | /// <param name="logicSid">自动化sid<备注:logicSid与userLogicId 不能同时为空></param> |
| | | /// <param name="direction">arrive:到达(进入) leave:离开</param> |
| | | /// <returns></returns> |
| | | public static bool GeoFenceStateReport(string userLogicId, string logicSid, string direction) |
| | | { |
| | | var jObject = new JObject(); |
| | | jObject.Add("homeId", LogicMethod.CurrLogicMethod.HomeId); |
| | | jObject.Add("userLogicId", userLogicId); |
| | | jObject.Add("sid", logicSid); |
| | | jObject.Add("direction", direction); |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_GeoFenceStateReport); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | GeoFenceStateReport(userLogicId, logicSid, direction); |
| | | } |
| | | if (responsePackNew.Code == "0") |
| | | { |
| | | //成功 |
| | | return true; |
| | | } |
| | | //失败 |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | | /// </summary> |