From bc6d6b77675b8915635aa04ba765ea627ac63cfa Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 17 十二月 2019 09:38:17 +0800
Subject: [PATCH] 2019.12.17
---
ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 390 +++++++++++------------
ZigbeeApp/GateWay.Droid/Assets/Language.ini | 2
.gitignore | 1
ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml | 24
ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs | 8
ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs | 199 ++++++------
ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide | 0
ZigbeeApp/Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs | 8
ZigbeeApp/Shared/R.cs | 2
ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 140 +++-----
ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 134 +++-----
11 files changed, 420 insertions(+), 488 deletions(-)
diff --git a/.gitignore b/.gitignore
index 84279dd..e2bf83d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,3 +199,4 @@
*._
*.ide
ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index cbea63f..080d52c 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -2,17 +2,15 @@
<MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.M7BBB18B19152766" />
<MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.8c0bdb303f25d82c2a42fb8bfca449bfaca00260" />
<MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" />
- <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/UserView/UserPage.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/AC/ACControl.cs">
<Files>
- <File FileName="Shared/R.cs" />
+ <File FileName="Shared/R.cs" Line="955" Column="22" />
<File FileName="GateWay.Droid/Assets/Language.ini" />
- <File FileName="Shared/Phone/Device/Light/DimmableLightControl.cs" Line="410" Column="1" />
- <File FileName="Shared/Phone/Device/Category/Category.cs" Line="366" Column="68" />
- <File FileName="Shared/Phone/Device/AC/ACControl.cs" Line="243" Column="33" />
- <File FileName="Shared/Phone/UserView/UserHomeView.cs" Line="1" Column="1" />
- <File FileName="Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs" Line="44" Column="78" />
- <File FileName="Shared/Common/CommonPage.cs" Line="60" Column="99" />
- <File FileName="Shared/Phone/UserView/UserPage.cs" Line="251" Column="30" />
+ <File FileName="Shared/Phone/Device/Category/Category.cs" />
+ <File FileName="Shared/Phone/Device/AC/ACControl.cs" Line="1" Column="1" />
+ <File FileName="Shared/Phone/UserView/UserHomeView.cs" />
+ <File FileName="Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs" />
+ <File FileName="Shared/Phone/UserView/UserPage.cs" />
</Files>
<Pads>
<Pad Id="ProjectPad">
@@ -27,7 +25,9 @@
<Node name="Common" expanded="True" />
<Node name="Phone" expanded="True">
<Node name="Device" expanded="True">
- <Node name="AC" expanded="True" />
+ <Node name="AC" expanded="True">
+ <Node name="ACControl.cs" selected="True" />
+ </Node>
<Node name="Category" expanded="True" />
<Node name="CommonForm" expanded="True" />
<Node name="DeviceLogic" expanded="True" />
@@ -40,9 +40,7 @@
<Node name="Logic" expanded="True" />
</Node>
</Node>
- <Node name="UserView" expanded="True">
- <Node name="UserPage.cs" selected="True" />
- </Node>
+ <Node name="UserView" expanded="True" />
<Node name="ZigBee" expanded="True">
<Node name="Common" expanded="True" />
<Node name="Device" expanded="True" />
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index 4c3c5b5..b4377f4 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini
index 04240e8..a79635a 100755
--- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini
+++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini
@@ -705,7 +705,7 @@
11031=娣诲姞鎵ц鐩爣
11032=閫夋嫨鍖哄煙
11033=閫夋嫨鍦烘櫙鍥剧墖
-11034=纭畾鍒犻櫎鍚楋紵
+11034=纭畾瑕佺Щ闄よ鍔熻兘锛�
12100=鏈煡璁惧
diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
index a54a1bf..35cf1d8 100644
--- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
@@ -170,120 +170,121 @@
return;
}
deviceUI.CommonDevice.DeviceStatusReport = common.DeviceStatusReport;
- var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
- switch (attriButeList[0].AttributeId)
+ foreach(var attList in attriButeList)
{
- case 0:
- ac.currentLocalTemperature = curTemp;
- ac.LastDateTime = DateTime.Now;
- indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} 鈩�";
- //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} 鈩�";
- break;
+ var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High || attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
+ switch (attList.AttributeId)
+ {
+ case 0:
+ ac.currentLocalTemperature = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} 鈩�";
+ //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} 鈩�";
+ break;
- case 17:
- ac.currentCoolingSetpoint = curTemp;
- if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
- {
- mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
- }
+ case 17:
+ ac.currentCoolingSetpoint = curTemp;
+ if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
+ {
+ mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
+ }
- ac.LastDateTime = DateTime.Now;
- break;
+ ac.LastDateTime = DateTime.Now;
+ break;
- case 18:
- ac.currentHeatingSetpoint = curTemp;
- if (ac.currentSystemMode == 4)
- {
- mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
- }
- ac.LastDateTime = DateTime.Now;
- break;
+ case 18:
+ ac.currentHeatingSetpoint = curTemp;
+ if (ac.currentSystemMode == 4)
+ {
+ mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
+ }
+ ac.LastDateTime = DateTime.Now;
+ break;
- case 4096:
- ac.currentAutoSetpoint = curTemp;
- if (ac.currentSystemMode == 1)
- {
- mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
- }
- ac.LastDateTime = DateTime.Now;
- break;
+ case 4096:
+ ac.currentAutoSetpoint = curTemp;
+ if (ac.currentSystemMode == 1)
+ {
+ mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
+ }
+ ac.LastDateTime = DateTime.Now;
+ break;
- case 28:
- //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡
- //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8
- ac.currentSystemMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- if (ac.currentSystemMode == 0)
- {
- switchBtn.IsSelected = false;
- modeBtn.IsSelected = false;
- modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
- modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
- currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
+ case 28:
+ //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡
+ //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8
+ ac.currentSystemMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ if (ac.currentSystemMode == 0)
+ {
+ switchBtn.IsSelected = false;
+ modeBtn.IsSelected = false;
+ modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
+ modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
+ currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
- mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
+ mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
- fanModeBtn.IsSelected = false;
- FanSwingModeBtn.IsSelected = false;
- }
- else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8)
- {
- switchBtn.IsSelected = true;
- modeBtn.IsSelected = true;
- modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
- modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
- currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
+ fanModeBtn.IsSelected = false;
+ FanSwingModeBtn.IsSelected = false;
+ }
+ else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8)
+ {
+ switchBtn.IsSelected = true;
+ modeBtn.IsSelected = true;
+ modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
+ modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
+ currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
- mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
- fanModeBtn.IsSelected = true;
- FanSwingModeBtn.IsSelected = true;
- }
- break;
+ mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
+ fanModeBtn.IsSelected = true;
+ FanSwingModeBtn.IsSelected = true;
+ }
+ break;
- case 4097:
- //杩囪檻缃戞竻娲楁爣蹇�:42
- ac.CleanStatu = attriButeList[0].AttriButeData == 42;
- cleanStatu.Visible = ac.CleanStatu;
- break;
+ case 4097:
+ //杩囪檻缃戞竻娲楁爣蹇�:42
+ ac.CleanStatu = attList.AttriButeData == 42;
+ cleanStatu.Visible = ac.CleanStatu;
+ break;
- case 4099:
- var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0');
- var modeStr = value.Substring(value.Length - 5, 5);
- for (int j = 0; j < modeStr.Length; j++)
- {
- ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
- }
- break;
-
+ case 4099:
+ var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
+ var modeStr = value.Substring(value.Length - 5, 5);
+ for (int j = 0; j < modeStr.Length; j++)
+ {
+ ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
+ }
+ break;
+ }
}
}
if (common.DeviceStatusReport.CluterID == 514)
{
var attriButeList = common.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
- }
ac.DeviceStatusReport = common.DeviceStatusReport;
- switch (attriButeList[0].AttributeId)
+ foreach(var attList in attriButeList)
{
- case 0:
- //椋庢墖褰撳墠鐨勫伐浣滄ā寮� 1=Low 2=Medium 3=High
- ac.currentFanMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- fanModeBtn.IsSelected = true;
- fanModeBtn.SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode);
- fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode);
- break;
- case 4096:
- //椋庢墖褰撳墠鐨勬壂椋庢ā寮�
- ac.currentFanSwingMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- FanSwingModeBtn.IsSelected = true;
- FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode);
- FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode);
- break;
+ switch (attList.AttributeId)
+ {
+ case 0:
+ //椋庢墖褰撳墠鐨勫伐浣滄ā寮� 1=Low 2=Medium 3=High
+ ac.currentFanMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ fanModeBtn.IsSelected = true;
+ fanModeBtn.SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode);
+ fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode);
+ break;
+ case 4096:
+ //椋庢墖褰撳墠鐨勬壂椋庢ā寮�
+ ac.currentFanSwingMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ FanSwingModeBtn.IsSelected = true;
+ FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode);
+ FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode);
+ break;
+ }
}
}
//***鏂版敼 * **璁惧鐘舵�佷笂鎶ヤ腑锛屽綋CluterID = 3,璇佹槑璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
@@ -560,7 +561,7 @@
currentModeBtn = new Button()
{
- Y = Application.GetRealHeight(599),
+ Y = Application.GetRealHeight(565),
Height = Application.GetRealHeight(80),
Width = Application.GetRealWidth(200),
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
@@ -572,7 +573,7 @@
reduceTemperatureBtn = new Button()
{
X = Application.GetRealWidth(268),
- Y = Application.GetRealHeight(680),
+ Y = Application.GetRealHeight(650),
Width = Application.GetMinRealAverage(80),
Height = Application.GetMinRealAverage(80),
UnSelectedImagePath = "AC/Reduce.png"
@@ -581,8 +582,8 @@
addTemperatureBtn = new Button()
{
- X = Application.GetRealWidth(628),
- Y = Application.GetRealHeight(680),
+ X = Application.GetRealWidth(620),
+ Y = Application.GetRealHeight(650),
Width = Application.GetMinRealAverage(80),
Height = Application.GetMinRealAverage(80),
UnSelectedImagePath = "AC/Add.png"
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index f1eaa77..e52cefb 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -149,6 +149,10 @@
{
try
{
+ if (common.DeviceStatusReport.AttriBute == null || common.DeviceStatusReport.AttriBute.Count == 0)
+ {
+ return;
+ }
for (int i = 0; deviceListScrolView != null && i < deviceListScrolView.ChildrenCount; i++)
{
var rowLayout = deviceListScrolView.GetChildren(i) as RowLayout;
@@ -169,10 +173,6 @@
{
var light = deviceUI.CommonDevice as ToggleLight;
light.DeviceStatusReport = common.DeviceStatusReport;
- if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0)
- {
- continue;
- }
light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData;
var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
row.SetStatu(light.OnOffStatus == 1);
@@ -194,10 +194,6 @@
{
var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
airSwitch.DeviceStatusReport = common.DeviceStatusReport;
- if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0)
- {
- return;
- }
airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
row.SetStatu(airSwitch.OnOffStatus == 1);
@@ -249,57 +245,47 @@
if (common.DeviceStatusReport.CluterID == 513)
{
var attriButeList = common.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
- }
var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
ac.DeviceStatusReport = common.DeviceStatusReport;
-
- var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
- switch (attriButeList[0].AttributeId)
+ foreach(var attList in attriButeList)
{
- case 0:
- ac.currentLocalTemperature = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 17:
- ac.currentCoolingSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 18:
- ac.currentHeatingSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 4096:
- ac.currentAutoSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 28:
- //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡
- ac.currentSystemMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 4099:
- var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0');
- var modeStr = value.Substring(value.Length - 5, 5);
- for (int j = 0; j < modeStr.Length; j++)
- {
- ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
- }
- break;
-
- case 4097:
- //杩囪檻缃戞竻娲楁爣蹇�:42
- ac.CleanStatu = attriButeList[0].AttriButeData == 42;
- break;
+ var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High || attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
+ switch (attList.AttributeId)
+ {
+ case 0:
+ ac.currentLocalTemperature = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 17:
+ ac.currentCoolingSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 18:
+ ac.currentHeatingSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4096:
+ ac.currentAutoSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 28:
+ ac.currentSystemMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4099:
+ var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
+ var modeStr = value.Substring(value.Length - 5, 5);
+ for (int j = 0; j < modeStr.Length; j++)
+ {
+ ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
+ }
+ break;
+ case 4097:
+ //杩囪檻缃戞竻娲楁爣蹇�:42
+ ac.CleanStatu = attList.AttriButeData == 42;
+ break;
+ }
}
-
var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
row.SetStatu(ac.currentSystemMode != 0);
row.SetStatuText(deviceUI.GetDeviceStatu());
@@ -309,21 +295,20 @@
{
var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
var attriButeList = common.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
- }
ac.DeviceStatusReport = common.DeviceStatusReport;
- switch (attriButeList[0].AttributeId)
+ foreach(var attList in attriButeList)
{
- case 0:
- ac.currentFanMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
- case 4096:
- ac.currentFanSwingMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
+ switch (attList.AttributeId)
+ {
+ case 0:
+ ac.currentFanMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4096:
+ ac.currentFanSwingMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ }
}
var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
row.SetStatu(ac.currentSystemMode != 0);
@@ -345,10 +330,6 @@
{
var dimmableLight = deviceUI.CommonDevice as DimmableLight;
dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
- if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- continue;
- }
dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
row.SetStatu(dimmableLight.OnOffStatus == 1);
@@ -359,10 +340,6 @@
{
var dimmableLight = deviceUI.CommonDevice as DimmableLight;
dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
- if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- continue;
- }
dimmableLight.Level = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
row.SetStatu(dimmableLight.OnOffStatus == 1);
@@ -1032,7 +1009,7 @@
delBtn.MouseUpEventHandler += delEvent;
}
}
- else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch)
+ else if (deviceUI.CommonDevice.Type == DeviceType.AirSwitch)
{
//绌烘皵寮�鍏�
var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
@@ -1133,7 +1110,7 @@
}
}
- else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DimmableLight)
+ else if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight)
{
//璋冨厜鐏�
var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
@@ -1233,7 +1210,7 @@
delBtn.MouseUpEventHandler += delEvent;
}
}
- else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat)
+ else if (deviceUI.CommonDevice.Type == DeviceType.Thermostat)
{
//绌鸿皟
var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
@@ -1335,7 +1312,7 @@
acControl.Show(deviceUI, room);
};
}
- else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.WindowCoveringDevice)
+ else if (deviceUI.CommonDevice.Type == DeviceType.WindowCoveringDevice)
{
//鍗峰笜
var rollerShade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
@@ -1422,7 +1399,7 @@
rollerShadeControl.Show(deviceUI, room);
};
}
- else if(deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DoorLock)
+ else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock)
{
var deviceTypeRowLayout = new RowLayout()
{
@@ -1520,7 +1497,6 @@
typeRowLayout.AddChidren(functionTypeIMG);
functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction;
-
if (deviceType == room.DeviceUIList[0].CommonDevice.Type)
{
diff --git a/ZigbeeApp/Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs b/ZigbeeApp/Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs
index 56b3416..e283fca 100644
--- a/ZigbeeApp/Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs
+++ b/ZigbeeApp/Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.cs
@@ -38,10 +38,8 @@
new System.Threading.Thread(() =>
{
SendFanStatuComand(device);
- System.Console.WriteLine("鍙戦�佹椂闂�:" + DateTime.Now.ToString("o"));
- System.Threading.Thread.Sleep(500);
+ System.Threading.Thread.Sleep(300);
SendThermostatStatuComand(device);
- System.Console.WriteLine("鎺ユ敹鏃堕棿:" + DateTime.Now.ToString("o"));
})
{ IsBackground = true }.Start();
}
@@ -89,7 +87,6 @@
{
{ "AttriButeId", (int)AttriButeId.CleanStatu}
}
-
};
var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
jObject.Add("Data", data);
@@ -122,7 +119,7 @@
};
var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
jObject.Add("Data", data);
- device.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
+ device.Gateway?.Send("GetDeviceStatus", jObject.ToString());
}
#endregion
@@ -230,7 +227,6 @@
jObject.Add("Data", data);
device.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
}
-
#endregion
}
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index a26095e..2b2ee9c 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -122,231 +122,211 @@
{
try
{
+ if (common.DeviceStatusReport.AttriBute == null || common.DeviceStatusReport.AttriBute.Count == 0)
+ {
+ return;
+ }
for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
{
var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
- var deviceUI = rowFL.Tag as DeviceUI;
- if (deviceUI.CommonDevice == null || rowFL.ChildrenCount == 0)
+ if (rowFL.ChildrenCount == 0)
{
//璁惧涓虹┖鎴栬�呮帶浠朵负绌�
continue;
}
- if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
- {
- //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
- continue;
- }
- var frameLayout = rowFL.GetChildren(0) as FrameLayout;
- switch (deviceUI.CommonDevice.Type)
- {
- case DeviceType.OnOffOutput:
- //寮�鍏冲姛鑳�
- if (common.DeviceStatusReport.CluterID == 6)
- {
- var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
- onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport;
-
- //璁板綍銆佹洿鏂扮姸鎬�
- if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- continue;
- }
- onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData;
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = onOffOutputLight.OnOffStatus == 1;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
- //璁板綍鍥炲鏃堕棿
- onOffOutputLight.LastDateTime = DateTime.Now;
- }
- break;
+ for (int j=0;j<rowFL.ChildrenCount;j++)
+ {
+ var deviceUI = (rowFL.GetChildren(j) as FunctionMainView).Tag as DeviceUI;
+ if (deviceUI == null || deviceUI.CommonDevice == null)
+ {
+ //璁惧涓虹┖鎴栬�呮帶浠朵负绌�
+ continue;
+ }
+ if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
+ {
+ //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
+ continue;
+ }
- case DeviceType.AirSwitch:
- //寮�鍏冲姛鑳�
- if (common.DeviceStatusReport.CluterID == 6)
- {
- var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
- airSwitch.DeviceStatusReport = common.DeviceStatusReport;
- for (int j = 0; j < frameLayout.ChildrenCount; j++)
- {
- var tempView = frameLayout.GetChildren(j);
- if (tempView.Tag == null)
- {
- continue;
- }
- if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
- {
- //璁板綍銆佹洿鏂扮姸鎬�
- if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0)
+ switch (deviceUI.CommonDevice.Type)
+ {
+ case DeviceType.OnOffOutput:
+ //寮�鍏冲姛鑳�
+ if (common.DeviceStatusReport.CluterID == 6)
+ {
+ var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
+ onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport;
+ onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData;
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = onOffOutputLight.OnOffStatus == 1;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ onOffOutputLight.LastDateTime = DateTime.Now;
+ }
+ break;
+
+ case DeviceType.AirSwitch:
+ //寮�鍏冲姛鑳�
+ if (common.DeviceStatusReport.CluterID == 6)
+ {
+ var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
+ airSwitch.DeviceStatusReport = common.DeviceStatusReport;
+ airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = airSwitch.OnOffStatus == 1;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ airSwitch.LastDateTime = DateTime.Now;
+ }
+ //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
+ if (common.DeviceStatusReport.CluterID == 3)
+ {
+ deviceUI.CommonDevice.IsOnline = 1;
+ deviceUI.CommonDevice.LastDateTime = DateTime.Now;
+ }
+ break;
+
+ case DeviceType.WindowCoveringDevice:
+ if (common.DeviceStatusReport.CluterID == 258)
+ {
+ if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0)
+ {
+ //绐楀笜绫诲瀷
+ var rollerShade = deviceUI.CommonDevice as Rollershade;
+ rollerShade.DeviceStatusReport = common.DeviceStatusReport;
+ rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData;
+ rollerShade.LastDateTime = DateTime.Now;
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ }
+ if (common.DeviceStatusReport.AttriBute[0].AttributeId == 8)
+ {
+ //绐楀笜鐧惧垎姣�
+ var rollerShade = deviceUI.CommonDevice as Rollershade;
+ rollerShade.DeviceStatusReport = common.DeviceStatusReport;
+ rollerShade.WcdCurrentPositionLiftPercentage = common.DeviceStatusReport.AttriBute[0].AttriButeData;
+ rollerShade.LastDateTime = DateTime.Now;
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ }
+ }
+ if (common.DeviceStatusReport.CluterID == 3)
+ {
+ deviceUI.CommonDevice.IsOnline = 1;
+ deviceUI.CommonDevice.LastDateTime = DateTime.Now;
+ }
+ break;
+
+ case DeviceType.Thermostat:
+ //AC鍔熻兘
+ if (common.DeviceStatusReport.CluterID == 513)
+ {
+ var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
+ ac.DeviceStatusReport = common.DeviceStatusReport;
+ var attriButeList = ac.DeviceStatusReport.AttriBute;
+ foreach(var attList in attriButeList)
+ {
+ var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High || attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
+ switch (attList.AttributeId)
{
- return;
+ case 0:
+ //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝
+ ac.currentLocalTemperature = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 17:
+ //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鍐锋俯搴︼紝瀹為檯娓╁害涓衡�淐oolingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
+ ac.currentCoolingSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 18:
+ //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
+ ac.currentHeatingSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4096:
+ //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勮嚜鍔ㄦ俯搴︼紝瀹為檯娓╁害涓衡�淎utoSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
+ ac.currentAutoSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+
+ case 28:
+ //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡
+ ac.currentSystemMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4099:
+ var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
+ var modeStr = value.Substring(value.Length - 5, 5);
+ for (int k = 0; k < modeStr.Length; k++)
+ {
+ ac.listSupportMode[k] = Convert.ToInt32(modeStr[k]) == 49 ? 1 : 0;
+ }
+ break;
}
- airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = airSwitch.OnOffStatus == 1;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
- //璁板綍鍥炲鏃堕棿
- airSwitch.LastDateTime = DateTime.Now;
- }
- }
- }
- //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if (common.DeviceStatusReport.CluterID == 3)
- {
- deviceUI.CommonDevice.IsOnline = 1;
- deviceUI.CommonDevice.LastDateTime = DateTime.Now;
- }
- break;
-
- case DeviceType.WindowCoveringDevice:
- if (common.DeviceStatusReport.CluterID == 258)
- {
- if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0)
- {
- //绐楀笜绫诲瀷
- var rollerShade = deviceUI.CommonDevice as Rollershade;
- rollerShade.DeviceStatusReport = common.DeviceStatusReport;
- rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData;
- rollerShade.LastDateTime = DateTime.Now;
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ }
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = ac.currentSystemMode != 0;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
}
- }
- if (common.DeviceStatusReport.CluterID == 3)
- {
- deviceUI.CommonDevice.IsOnline = 1;
- deviceUI.CommonDevice.LastDateTime = DateTime.Now;
- }
- break;
-
- case DeviceType.Thermostat:
- //AC鍔熻兘
- if (common.DeviceStatusReport.CluterID == 513)
- {
- var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
- ac.DeviceStatusReport = common.DeviceStatusReport;
- var attriButeList = ac.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
+ if (common.DeviceStatusReport.CluterID == 514)
{
- continue;
- }
-
- var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
- switch (attriButeList[0].AttributeId)
- {
- case 0:
- //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝
- ac.currentLocalTemperature = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 17:
- //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鍐锋俯搴︼紝瀹為檯娓╁害涓衡�淐oolingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
- ac.currentCoolingSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 18:
- //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
- ac.currentHeatingSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 4096:
- //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勮嚜鍔ㄦ俯搴︼紝瀹為檯娓╁害涓衡�淎utoSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆�
- ac.currentAutoSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 28:
- //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡
- ac.currentSystemMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 4099:
- var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0');
- var modeStr = value.Substring(value.Length - 5, 5);
- for (int j = 0; j < modeStr.Length; j++)
+ var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
+ var attriButeList = common.DeviceStatusReport.AttriBute;
+ ac.DeviceStatusReport = common.DeviceStatusReport;
+ foreach(var attList in attriButeList)
+ {
+ switch (attList.AttributeId)
{
- ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
+ case 0:
+ ac.currentFanMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4096:
+ ac.currentFanSwingMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
}
- break;
+ }
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = ac.currentSystemMode != 0;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
}
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = ac.currentSystemMode != 0;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
- }
- if (common.DeviceStatusReport.CluterID == 514)
- {
- var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
- var attriButeList = common.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
+ //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
+ if (common.DeviceStatusReport.CluterID == 3)
{
- return;
+ var ac = deviceUI.CommonDevice as AC;
+ ac.IsOnline = 1;
+ ac.LastDateTime = DateTime.Now;
}
- ac.DeviceStatusReport = common.DeviceStatusReport;
- switch (attriButeList[0].AttributeId)
- {
- case 0:
- ac.currentFanMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
- case 4096:
- ac.currentFanSwingMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
- }
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = ac.currentSystemMode != 0;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
- }
- //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- if (common.DeviceStatusReport.CluterID == 3)
- {
- var ac = deviceUI.CommonDevice as AC;
- ac.IsOnline = 1;
- ac.LastDateTime = DateTime.Now;
- }
- break;
+ break;
- case DeviceType.DimmableLight:
- //璋冨厜鐏姛鑳�
- //寮�鍏冲姛鑳�
- if (common.DeviceStatusReport.CluterID == 6)
- {
- var dimmableLight = deviceUI.CommonDevice as DimmableLight;
- dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
- if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
+ case DeviceType.DimmableLight:
+ //璋冨厜鐏姛鑳�
+ if (common.DeviceStatusReport.CluterID == 6)
{
- return;
+ var dimmableLight = deviceUI.CommonDevice as DimmableLight;
+ dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
+ dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = dimmableLight.OnOffStatus == 1;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ dimmableLight.LastDateTime = DateTime.Now;
}
- dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = dimmableLight.OnOffStatus == 1;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
- //璁板綍鍥炲鏃堕棿
- dimmableLight.LastDateTime = DateTime.Now;
- }
- //浜害
- if (common.DeviceStatusReport.CluterID == 8)
- {
- var dimmableLight = deviceUI.CommonDevice as DimmableLight;
- dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
- var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
+ //浜害
+ if (common.DeviceStatusReport.CluterID == 8)
{
- continue;
+ var dimmableLight = deviceUI.CommonDevice as DimmableLight;
+ dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
+ var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
+ switch (attriButeList[0].AttributeId)
+ {
+ case 0:
+ //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴�
+ dimmableLight.Level = attriButeList[0].AttriButeData;
+ dimmableLight.LastDateTime = DateTime.Now;
+ (rowFL.GetChildren(j) as FunctionMainView).IsSelected = true;
+ (rowFL.GetChildren(j) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
+ break;
+ }
}
- switch (attriButeList[0].AttributeId)
- {
- case 0:
- //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴�
- dimmableLight.Level = attriButeList[0].AttriButeData;
- dimmableLight.LastDateTime = DateTime.Now;
- (rowFL.GetChildren(0) as FunctionMainView).IsSelected = true;
- (rowFL.GetChildren(0) as FunctionMainView).StatuButton.Text = deviceUI.GetDeviceStatu();
- break;
- }
- }
- break;
+ break;
+ }
}
}
}
@@ -963,7 +943,6 @@
itemView = new FrameLayout()
{
Height = Application.GetRealHeight(14 + 348),
- Tag = device
};
deviceVerticalScrolViewLayout.AddChidren(itemView);
}
@@ -1013,6 +992,7 @@
}
}
var lightView = new FunctionMainView(xx, yy);
+ lightView.Tag = device;
itemView.AddChidren(lightView);
lightView.Init();
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
@@ -1121,6 +1101,7 @@
var lightView = new FunctionMainView(xx, yy);
itemView.AddChidren(lightView);
lightView.Init();
+ lightView.Tag = device;
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
lightView.SetStatuText(device.GetDeviceStatu());
lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
@@ -1255,6 +1236,7 @@
var lightView = new FunctionMainView(xx, yy);
itemView.AddChidren(lightView);
lightView.Init();
+ lightView.Tag = device;
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
lightView.SetStatuText(device.GetDeviceStatu());
lightView.SetDeviceName(airSwitch.DeviceEpointName);
@@ -1360,6 +1342,7 @@
var lightView = new FunctionMainView(xx, yy);
itemView.AddChidren(lightView);
lightView.Init();
+ lightView.Tag = device;
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
lightView.SetStatuText(device.GetDeviceStatu());
lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
@@ -1464,6 +1447,7 @@
var lightView = new FunctionMainView(xx, yy);
itemView.AddChidren(lightView);
lightView.Init();
+ lightView.Tag = device;
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
lightView.SetStatuText(device.GetDeviceStatu());
lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
@@ -1562,6 +1546,7 @@
var lightView = new FunctionMainView(xx, yy);
itemView.AddChidren(lightView);
lightView.Init();
+ lightView.Tag = device;
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
lightView.SetStatuText(device.GetDeviceStatu());
lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
@@ -1593,6 +1578,7 @@
var lightView = new FunctionMainView(xx, yy);
itemView.AddChidren(lightView);
lightView.Init();
+ lightView.Tag = device;
lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
lightView.SetStatuText(device.GetDeviceStatu());
lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
index 4bb15b0..efeac10 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
@@ -79,6 +79,10 @@
{
try
{
+ if (common.DeviceStatusReport.AttriBute == null || common.DeviceStatusReport.AttriBute.Count == 0)
+ {
+ return;
+ }
switch (myDevice.Type)
{
case DeviceType.OnOffOutput:
@@ -87,11 +91,6 @@
{
var onOffOutputLight = (ToggleLight)myDevice;
onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
- if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- return;
- }
onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData;
onOffOutputLight.LastDateTime = DateTime.Now;
}
@@ -109,13 +108,8 @@
{
var airSwitch = (AirSwitch)myDevice;
airSwitch.DeviceStatusReport = common.DeviceStatusReport;
- if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0)
- {
- return;
- }
airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
airSwitch.LastDateTime = DateTime.Now;
-
}
//褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
if (common.DeviceStatusReport.CluterID == 3)
@@ -131,10 +125,6 @@
var rollershade = (Rollershade)myDevice;
rollershade.DeviceStatusReport = common.DeviceStatusReport;
var attriButeList = rollershade.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
- }
switch (attriButeList[0].AttributeId)
{
case 0:
@@ -157,72 +147,65 @@
var ac = (AC)myDevice;
ac.DeviceStatusReport = common.DeviceStatusReport;
var attriButeList = ac.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
+ foreach(var attList in attriButeList)
+ {
+ //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝
+ var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High || attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
+ switch (attList.AttributeId)
+ {
+ case 0:
+ ac.currentLocalTemperature = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 17:
+ ac.currentCoolingSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 18:
+ ac.currentHeatingSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4096:
+ ac.currentAutoSetpoint = curTemp;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 28:
+ ac.currentSystemMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4099:
+ var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
+ var modeStr = value.Substring(value.Length - 5, 5);
+ for (int j = 0; j < modeStr.Length; j++)
+ {
+ ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
+ }
+ break;
+ case 4097:
+ ac.CleanStatu = attList.AttriButeData == 42;
+ break;
+ }
}
- //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝
- var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
- switch (attriButeList[0].AttributeId)
- {
- case 0:
- ac.currentLocalTemperature = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 17:
- ac.currentCoolingSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 18:
- ac.currentHeatingSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 4096:
- ac.currentAutoSetpoint = curTemp;
- ac.LastDateTime = DateTime.Now;
- break;
-
- case 28:
- ac.currentSystemMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
- case 4099:
- var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0');
- var modeStr = value.Substring(value.Length - 5, 5);
- for (int j = 0; j < modeStr.Length; j++)
- {
- ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
- }
- break;
-
- case 4097:
- ac.CleanStatu = attriButeList[0].AttriButeData == 42;
- break;
- }
}
if (common.DeviceStatusReport.CluterID == 514)
{
var ac = (AC)myDevice;
var attriButeList = common.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
- }
ac.DeviceStatusReport = common.DeviceStatusReport;
- switch (attriButeList[0].AttributeId)
+ foreach(var attList in attriButeList)
{
- case 0:
- ac.currentFanMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
- case 4096:
- ac.currentFanSwingMode = attriButeList[0].AttriButeData;
- ac.LastDateTime = DateTime.Now;
- break;
+ switch (attList.AttributeId)
+ {
+ case 0:
+ ac.currentFanMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ case 4096:
+ ac.currentFanSwingMode = attList.AttriButeData;
+ ac.LastDateTime = DateTime.Now;
+ break;
+ }
}
}
@@ -241,11 +224,6 @@
{
var dimmableLight = (DimmableLight)myDevice;
dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
- if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
- {
- return;
- }
dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
dimmableLight.LastDateTime = DateTime.Now;
}
@@ -255,10 +233,6 @@
var dimmableLight = (DimmableLight)myDevice;
dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
- if (attriButeList == null || attriButeList.Count == 0)
- {
- return;
- }
switch (attriButeList[0].AttributeId)
{
case 0:
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
index cdd3872..19924dc 100644
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -22,10 +22,10 @@
#if DEBUG
if (flage == true)
{
- if (msg.Contains("DeviceStatusReport") == false)
- {
- System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
- }
+ //if (msg.Contains("DeviceStatusReport") == false)
+ //{
+ System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
+ //}
}
#endif
}
diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs
index 640f080..fcc97de 100644
--- a/ZigbeeApp/Shared/R.cs
+++ b/ZigbeeApp/Shared/R.cs
@@ -952,7 +952,7 @@
/// </summary>
public const int SelectScenePic = 11033;
/// <summary>
- /// 纭畾鍒犻櫎鍚楋紵
+ /// 纭畾瑕佺Щ闄よ鍔熻兘锛�
/// </summary>
public const int DeleteFunction = 11034;
--
Gitblit v1.8.0