From 38ca58ae790dc71e50070b54345455988a4a64a3 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 27 八月 2021 11:24:52 +0800
Subject: [PATCH] 2021-8-27-01
---
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs | 71 +++++++++++++++++++++++------------
1 files changed, 46 insertions(+), 25 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
index 96c3425..6f4b31f 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -12,8 +12,20 @@
public class PirSend
{
-
- public static string pirId = "1367032976869658625";
+ /// <summary>
+ /// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID)
+ /// </summary>
+ public static string GatewayId
+ {
+ get
+ {
+ if (Entity.DB_ResidenceData.Instance.HomeGateway == null)
+ {
+ return DriverLayer.Control.Ins.GatewayId;
+ }
+ return Entity.DB_ResidenceData.Instance.HomeGateway.gatewayId;
+ }
+ }
/// <summary>
/// 浣忓畢ID
/// </summary>
@@ -21,9 +33,16 @@
{
get
{
- return Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID;
+ return Entity.DB_ResidenceData.Instance.CurrentRegion.id;
}
}
+
+
+ /// <summary>
+ /// 涔愭subAccessToken
+ /// </summary>
+ public static string LcSubAccessToken = "";
+
/// <summary>
/// 鏄惁涓哄叾浠栦富鐢ㄦ埛鍒嗕韩杩囨潵鐨勪綇瀹�
/// </summary>
@@ -31,7 +50,7 @@
{
get
{
- return Entity.DB_ResidenceData.Instance.CurrentRegion.IsOthreShare;
+ return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
}
}
/// <summary>
@@ -67,9 +86,9 @@
/// <summary>
/// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
/// </summary>
- public static ResponsePackNew ControlList(Pir pir)
+ public static ResponsePackNew ControlList(string deviceId)
{
- var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } };
+ var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId} };
var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List);
return responsePackNew;
}
@@ -138,15 +157,8 @@
/// 绾㈠鐮佸涔�
/// </summary>
/// <returns></returns>
- public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action)
+ public static void CodeStudy(Control control, AttributesStatus buttonObj, Action<Cloud> action)
{
- //var whichDayJson = jay["whichDay"].ToString();
- //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson);
- //for (int b = 0; b < whichDayAry.Count; b++)
- //{
- // var days = whichDayAry[b].ToString();
- // timer.whichDay.Add(int.Parse(days));
- //}
var job = new JObject { };
job.Add("key", buttonObj.key);
job.Add("data_type", "string");
@@ -156,21 +168,32 @@
var jArray = new JArray { };
jArray.Add(job);
var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } };
- ResponsePackNew responsePackNew = null;
+ Cloud cloud = null;
new System.Threading.Thread(() =>
{
try
{
//鍙戦�佺孩澶栫爜瀛︿範鍛戒护
- responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy);
+ var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy);
+ if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+ {
+ PirMethod method = new PirMethod();
+ PirMethod.buttondata = "";
+ cloud = method.MqttDate("鎸夐敭", control.sid, 25);
+ }
+ else
+ {
+ PirMethod method = new PirMethod();
+ method.ErrorShow(responsePackNew, "");
+ }
}
catch { }
finally
{
Application.RunOnMainThread(() =>
{
- action(responsePackNew);
+ action(cloud);
});
}
@@ -181,7 +204,7 @@
/// 鑷鎸夐敭鍒犻櫎
/// </summary>
/// <returns></returns>
- public static ResponsePackNew CodeRemove(AttributesStatus buttonObj)
+ public static ResponsePackNew CodeRemove(AttributesStatus buttonObj,string deviceId)
{
var job = new JObject { };
job.Add("key", buttonObj.key);
@@ -191,11 +214,10 @@
job.Add("value", valuejArray);
var jArray = new JArray { };
jArray.Add(job);
- var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } };
+ var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } };
var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove);
return responsePackNew;
}
-
/// <summary>
/// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄�
/// </summary>
@@ -207,12 +229,12 @@
return responsePackNew;
}
/// <summary>
- /// 淇敼绾㈠瀹濆悕绉�
+ /// 淇敼绾㈠瀹�/璁惧鍚嶇О
/// </summary>
/// <returns></returns>
- public static ResponsePackNew DeviceRename(Pir pir)
+ public static ResponsePackNew DeviceRename(string deviceId,string name)
{
- var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } };
+ var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "name", name} };
var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename);
return responsePackNew;
}
@@ -248,7 +270,7 @@
url = "/smart-footstone/app/ir/code/list";
jObject.Add("brandId", id);
}
- responsePackNew = RequestServerhomeId(jObject, url);
+ responsePackNew = RequestServerhomeId(jObject, url,5);
}
catch { }
finally
@@ -263,7 +285,6 @@
{ IsBackground = true }.Start();
}
-
/// <summary>
///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛�
/// </summary>
--
Gitblit v1.8.0