using System;
using System.Collections.Generic;
namespace Shared.SimpleControl.Phone
{
public class ScenePhoneMethod
{
bool showTip = true;
///
/// 添加或者修改房间场景
///
/// 房间路径
/// 场景路径
/// 更新场景数据
/// 更新房间数据
public void AddOrUpdataSceneBaseMassage (string roomFilePath, string sceneFilePath = null, Action action = null,Action actionRefreshRoom = null)
{
Room room = null;
if (roomFilePath == Scene.GlobalSceneFilePath) {
//GlobalScene
} else {
room = Room.GetRoomByFilePath (roomFilePath);
if (room == null)
return;
}
var scene = Scene.GetSceneByFilePath (sceneFilePath);
if (null == scene) {
scene = new Scene ();
}
#region Load
Dialog dialog = new Dialog ();
FrameLayout dialogBodyView = new FrameLayout () {
BackgroundColor = SkinStyle.Current.DialogColor,
Width = Application.GetRealWidth (520),
Height = Application.GetRealHeight (740),
Gravity = Gravity.Center,
Radius = 5,
BorderWidth = 0,
BorderColor = SkinStyle.Current.Transparent
};
dialog.AddChidren (dialogBodyView);
Button btnDialgoTitle = new Button () {
Width = Application.GetRealWidth (520),
Height = Application.GetRealHeight (70),
BackgroundColor = SkinStyle.Current.DialogTitle,
TextID = R.MyInternationalizationString.AddNewRoom,
TextAlignment = TextAlignment.Center,
Gravity = Gravity.CenterHorizontal,
};
dialogBodyView.AddChidren (btnDialgoTitle);
Button lblSceneText = new Button () {
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight (80),
Width = Application.GetRealWidth (450),
Height = Application.GetRealHeight (50),
TextID = R.MyInternationalizationString.RoomName,
TextAlignment = TextAlignment.CenterLeft,
TextColor = SkinStyle.Current.TextColor,
};
dialogBodyView.AddChidren (lblSceneText);
EditText sceneTextBox = new EditText () {
Gravity = Gravity.CenterHorizontal,
Y = lblSceneText.Bottom + Application.GetRealHeight (10),
Width = Application.GetRealWidth (450),
Height = Application.GetRealHeight (60),
TextAlignment = TextAlignment.CenterLeft,
TextColor = SkinStyle.Current.TextColor,
Text = scene.Name,
Radius = 2,
BorderColor = SkinStyle.Current.DialogTitle,
BorderWidth = 1,
};
dialogBodyView.AddChidren (sceneTextBox);
sceneTextBox.EditorEnterAction += (obj) => {
Application.HideSoftInput ();
};
Button lblIcon = new Button () {
Gravity = Gravity.CenterHorizontal,
Y = sceneTextBox.Bottom + Application.GetRealHeight (10),
Width = Application.GetRealWidth (450),
Height = btnDialgoTitle.Height,
TextID = R.MyInternationalizationString.Backgroud,
TextAlignment = TextAlignment.CenterLeft,
TextColor = SkinStyle.Current.TextColor,
};
dialogBodyView.AddChidren (lblIcon);
VerticalScrolViewLayout verIconLayout = new VerticalScrolViewLayout () {
Gravity = Gravity.CenterHorizontal,
Y = lblIcon.Bottom,
Width = sceneTextBox.Width,
Height = Application.GetRealHeight (200),
};
dialogBodyView.AddChidren (verIconLayout);
FrameLayout inVerFramelayout = new FrameLayout () {
Width = lblIcon.Width,
Height = Application.GetRealHeight (200),
};
verIconLayout.AddChidren (inVerFramelayout);
var systempictureLayout = new FrameLayout {
Height = Application.GetRealHeight (160),
Y = Application.GetRealHeight (480),
};
dialogBodyView.AddChidren (systempictureLayout);
Button btnBG = new Button () {
Width = Application.GetRealWidth (270),
Height = LayoutParams.MatchParent,
UnSelectedImagePath = scene.BackgroundImagePath,
};
inVerFramelayout.AddChidren (btnBG);
Button btnTakePictrue = new Button () {
Width = inVerFramelayout.Width - btnBG.Width,
Height = inVerFramelayout.Height / 2,
TextID = R.MyInternationalizationString.TakePhoto,
TextColor = SkinStyle.Current.TextColor1,
BackgroundColor = SkinStyle.Current.ButtonColor,
X = btnBG.Right,
};
inVerFramelayout.AddChidren (btnTakePictrue);
var pid = Guid.NewGuid ();
btnTakePictrue.MouseUpEventHandler += (sender, e) => {
systempictureLayout.RemoveAll ();
pid = Guid.NewGuid ();
Camera.TakePicture ((obj) => {
if (obj != null) {
btnBG.UnSelectedImagePath = pid.ToString ();
}
}, pid.ToString ());
};
Button btnLineP = new Button () {
Width = btnTakePictrue.Width,
Height = 1,
BackgroundColor = SkinStyle.Current.Black50Transparent,
X = btnBG.Right,
Y = btnTakePictrue.Bottom,
};
inVerFramelayout.AddChidren (btnLineP);
Button btnSelectPictrue = new Button () {
Width = btnTakePictrue.Width,
Height = btnTakePictrue.Height,
TextColor = SkinStyle.Current.TextColor1,
TextID = R.MyInternationalizationString.SelectPicture,
BackgroundColor = SkinStyle.Current.ButtonColor,
X = btnBG.Right,
Y = btnLineP.Bottom,
};
inVerFramelayout.AddChidren (btnSelectPictrue);
btnSelectPictrue.MouseUpEventHandler += (sender, e) => {
systempictureLayout.RemoveAll ();
pid = Guid.NewGuid ();
Camera.SelectPicture ((obj) => {
if (obj != null) {
btnBG.UnSelectedImagePath = pid.ToString ();
}
}, pid.ToString ());
};
HorizontalScrolViewLayout horizontalScrolViewLayout = new HorizontalScrolViewLayout () {
Width = Application.GetRealWidth (450),
Gravity = Gravity.CenterHorizontal,
};
systempictureLayout.AddChidren (horizontalScrolViewLayout);
for (int i = 0; i < 10; i++) {
Button butscene = new Button () {
Width = Application.GetRealWidth (200),
Height = LayoutParams.MatchParent,
};
butscene.MouseUpEventHandler += (sender, e) => {
btnBG.UnSelectedImagePath = butscene.UnSelectedImagePath;
};
butscene.UnSelectedImagePath = "Scene/s" + (i).ToString () + ".png";
horizontalScrolViewLayout.AddChidren (butscene);
}
FrameLayout BottomView = new FrameLayout () {
Y = dialogBodyView.Height - Application.GetRealHeight (90),
Height = Application.GetRealHeight (90),
BackgroundColor = SkinStyle.Current.DialogTitle,
};
dialogBodyView.AddChidren (BottomView);
Button btnBack = new Button () {
Width = Application.GetRealWidth (119),
UnSelectedImagePath = "Item/PositioningDialogBack.png",
SelectedImagePath = "Item/PositioningDialogBack.png",
};
BottomView.AddChidren (btnBack);
btnBack.MouseUpEventHandler += (sender1, e1) => {
dialog.Close ();
};
Button btnLineH = new Button () {
Width = 1,
Height = LayoutParams.MatchParent,
BackgroundColor = SkinStyle.Current.White20Transparent,
X = btnBack.Right,
};
BottomView.AddChidren (btnLineH);
Button btnSave = new Button () {
Width = Application.GetRealWidth (400),
X = btnLineH.Right,
TextID = R.MyInternationalizationString.SAVE,
TextAlignment = TextAlignment.Center,
Radius = 1,
};
BottomView.AddChidren (btnSave);
#endregion
btnDialgoTitle.TextID = R.MyInternationalizationString.AddNewScenes;
lblSceneText.TextID = R.MyInternationalizationString.SceneName;
if (roomFilePath == Scene.GlobalSceneFilePath) {
var sceneFileList = Newtonsoft.Json.JsonConvert.DeserializeObject> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (Scene.GlobalSceneFilePath)));
if (!string.IsNullOrEmpty (sceneFilePath))
btnDialgoTitle.TextID = R.MyInternationalizationString.ChangeInformation;
//增加或者修改场景
btnSave.MouseUpEventHandler += (sender, e) => {
string newScenFilePath = "GlobalScene_" + sceneTextBox.Text.Trim ()+"_"+DateTime.Now.Ticks;
if (string.IsNullOrEmpty (sceneTextBox.Text.Trim ())) {
new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseEnterSceneName), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
return;
}
//更改过场景图
if (btnBG.UnSelectedImagePath == "SecenPicture") {//将选择或拍摄的背景更改对应的名称保存下来
IO.FileUtils.ReNameFile (btnBG.UnSelectedImagePath, "Image_" + newScenFilePath);
btnBG.UnSelectedImagePath = "Image_" + newScenFilePath;
}
scene.BackgroundImagePath = btnBG.UnSelectedImagePath;
scene.Name = sceneTextBox.Text.Trim ();
//新加场景
if (sceneFilePath == null) {
if (IO.FileUtils.Exists (newScenFilePath)) {
new Alert ("", Language.StringByID (R.MyInternationalizationString.HaveTheSame), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
return;
}
sceneFileList.Add (newScenFilePath);
} else {
//更改的场景名称已经存在
if (!sceneFileList.Contains (newScenFilePath) && IO.FileUtils.Exists (newScenFilePath)) {
new Alert ("", Language.StringByID (R.MyInternationalizationString.HaveTheSame), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
return;
}
//场景名更改
if (sceneFilePath != newScenFilePath) {
//如果是场景更改,那原文件名也需要更新
IO.FileUtils.ReNameFile (sceneFilePath, newScenFilePath);
for (int i = 0; i < sceneFileList.Count; i++) {
if (sceneFileList [i] == sceneFilePath) {
sceneFileList [i] = newScenFilePath;
}
}
}
}
// 更新修改后的数据
IO.FileUtils.WriteFileByBytes (newScenFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
IO.FileUtils.WriteFileByBytes (Scene.GlobalSceneFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (sceneFileList)));
if (action != null) {
action (newScenFilePath);
}
dialog.Close ();
};
} else {
if (!string.IsNullOrEmpty (sceneFilePath))
btnDialgoTitle.TextID = R.MyInternationalizationString.ChangeInformation;
btnSave.Width = Application.GetRealWidth (400);
//增加或者修改场景
btnSave.MouseUpEventHandler += (sender, e) => {
string newScenFilePath = "RoomScene_" + room.Name + "_" + sceneTextBox.Text.Trim () + "_" + DateTime.Now.Ticks;
if (string.IsNullOrEmpty (sceneTextBox.Text.Trim ())) {
new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseEnterSceneName), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
return;
}
//更改过场景图
if (btnBG.UnSelectedImagePath == "SecenPicture") {//将选择或拍摄的背景更改对应的名称保存下来
IO.FileUtils.ReNameFile (btnBG.UnSelectedImagePath, "Image_" + newScenFilePath);
btnBG.UnSelectedImagePath = "Image_" + newScenFilePath;
IO.FileUtils.WriteFileByBytes (sceneFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
}
scene.BackgroundImagePath = btnBG.UnSelectedImagePath;
scene.Name = sceneTextBox.Text.Trim ();
//新加场景
if (sceneFilePath == null) {
if (IO.FileUtils.Exists (newScenFilePath)) {
new Alert ("", Language.StringByID (R.MyInternationalizationString.HaveTheSame), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
return;
}
room.SceneFilePathList.Add (newScenFilePath);
} else {
//更改的场景名称已经存在
if (!room.SceneFilePathList.Contains (newScenFilePath) && IO.FileUtils.Exists (newScenFilePath)) {
new Alert ("", Language.StringByID (R.MyInternationalizationString.HaveTheSame), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
return;
}
//场景名更改
if (sceneFilePath != newScenFilePath) {
//如果是场景更改,那原文件名也需要更新
IO.FileUtils.ReNameFile (sceneFilePath, newScenFilePath);
for (int i = 0; i < room.SceneFilePathList.Count; i++) {
if (room.SceneFilePathList [i] == sceneFilePath) {
room.SceneFilePathList [i] = newScenFilePath;
}
}
}
}
// 更新修改后的数据
IO.FileUtils.WriteFileByBytes (newScenFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
room.Save (roomFilePath);
Room.UpdateMemorry (roomFilePath);
//刷新当前房间的数据
action?.Invoke (newScenFilePath);
actionRefreshRoom?.Invoke ();
dialog.Close ();
};
}
dialog.Show ();
}
public void ControlScene (string sceneFilePath)
{
var tempScene = Scene.GetSceneByFilePath (sceneFilePath);
if (tempScene == null)
return;
showTip = true;
System.Threading.Tasks.Task.Run (() => {
int sceneDeviceCount = tempScene.DeviceFilePathList.Count;
int controlDeviceIndex = 0;
byte [] replyBytes = null;
if (!tempScene.busScene) {
foreach (var deviceFilePath in tempScene.DeviceFilePathList) {
controlDeviceIndex++;
var common = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (common.Type == DeviceType.LightDimming) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, device.CurrentBrightness, device.DelayTimeHeight, device.DelayTimeLow });
} else if (common.Type == DeviceType.LightEnergySocket) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, device.CurrentBrightness, device.DelayTimeHeight, device.DelayTimeLow });
} else if (common.Type == DeviceType.LightEnergySwitch) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, device.CurrentBrightness, device.DelayTimeHeight, device.DelayTimeLow });
} else if (common.Type == DeviceType.LightRGB) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device != null) {
replyBytes = Control.ControlBytesSendHasReturn (Command.SetLogicLoopColor, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, device.CurrentBrightness, 254, device.DelayTimeHeigh,device.DelayTimeLow,
3,device.RStatus,device.GStatus,device.BStatus,0,0});
}
} else if (common.Type == DeviceType.LightSwitch ) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, device.CurrentBrightness, device.DelayTimeHeight, device.DelayTimeLow });
} else if (common.Type == DeviceType.CurtainModel) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.UpdataCurtainModelStutas, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, (byte)device.Status });
} else if (common.Type == DeviceType.CurtainRoller) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.UpdataCurtainModelStutas, device.SubnetID, device.DeviceID, new byte [] { 1, (byte)device.Status });
} else if (common.Type == DeviceType.CurtainTrietex) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.UpdataCurtainModelStutas, device.SubnetID, device.DeviceID, new byte [] { 1, (byte)device.Status });
} else if (common.Type == DeviceType.HVAC || common.Type == DeviceType.ACInfrared) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetACMode, device.SubnetID, device.DeviceID, new byte [] {
device.LoopID,
device.TemperatureMode,
device.IndoorTemperature,
device.CoolTemperature,
device.HeatTemperature,
device.AutoTemperature,
device.ChuShiTemperature,
device.RealModeAndFanSpeed,
device.Power,
device.SetMode,
device.SetFanSpeed,
device.SetTemperature,
device.ShaoFanMode});
} else if (common.Type == DeviceType.FoolHeat) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetFoolHeat, device.SubnetID, device.DeviceID,
new byte [] { device.LoopID, (byte)(device.Status + device.WorkingMode * 16), 0,device.WorkingMode,device.NormalTemperature, device.DayTemperature,
device.NightTemperature, device.AwayTemperature , 0, 0 });
} else if (common.Type == DeviceType.FanModule) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.LoopID, (byte)device.WindSpeed });
} else if (common.Type == DeviceType.LogicModule) {
var device = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (deviceFilePath)));
if (device == null) {
continue;
}
replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, device.SubnetID, device.DeviceID, new byte [] {
device.AreaID,device.AreaSceneID});
}
Application.RunOnMainThread (() => {
try {
if (showTip) {
if (replyBytes == null) {
string tipString = Language.StringByID (R.MyInternationalizationString.ControlFailure);
var btnTip = new Button () {
Height = Application.GetRealHeight (140),
Text = common.Name + tipString + "..." + controlDeviceIndex.ToString () + @"/" + sceneDeviceCount.ToString (),
BackgroundColor = SkinStyle.Current.TitileView,
};
MainPage.MainFrameLayout.AddChidren (btnTip);
btnTip.MouseUpEventHandler += (sender, e) => {
btnTip.RemoveFromParent ();
//MainPage.MainFrameLayout.Remove (btnTip);
};
System.Threading.Tasks.Task.Run (() => {
System.Threading.Thread.Sleep (3000);
Application.RunOnMainThread (() => {
btnTip.RemoveFromParent ();
//MainPage.MainFrameLayout.Remove (btnTip);
showTip = false;
});
});
}
}
} catch { }
});
System.Threading.Thread.Sleep (50);
}
} else {
foreach (var common in tempScene.GlobalSceneDeviceList) {
switch (common.obj1) {
case 0://0 无效 Invalid
break;
case 85://0x55 场景 Scene ||0x0002
replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 86://0x56 序列 Sequence ||0x001A
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSeries, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 88://0x58 通用开关 Universal Switch ||0xe01c
replyBytes = Control.ControlBytesSendHasReturn (Command.SetCommonSwitch, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 89: //0x59 单路调节 Single Channel Lighting Control 0031
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 92://0x5c 窗帘开关 Curtain Switch e3e0
replyBytes = Control.ControlBytesSendHasReturn (Command.UpdataCurtainModelStutas, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 94://0x5e GPRS控制 GPRS Control E3D4
replyBytes = Control.ControlBytesSendHasReturn (Command.GPRSControl, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 95://0x5f 面板控制 Panel Control e3d8
replyBytes = Control.ControlBytesSendHasReturn (Command.InstructionPanelKey, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 100://0x64 广播场景 Broadcast Scene ||0x0002
replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 101://0x65 广播回路 Broadcast Channel 0031
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 102://0x66 消防模块 Security Module 011E
replyBytes = Control.ControlBytesSendHasReturn (Command.SecurityModule, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 103://0x67 音乐播放 Music Control 0218
replyBytes = Control.ControlBytesSendHasReturn (Command.MusicControl, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
//104 通用控制 Universal Control
//105 连接页 Link Page
//107 RGB调节 RGB Control
//108 红外控制 Infrared Control
//case 109://109 逻辑灯调节 Logic Light Adjust || 0xE45E
// replyBytes = Control.ControlBytesSendHasReturn (Command.LogicLightAdjust, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
// break;
//}
//110 逻辑场景 Logic Scene
//112 LCD & LED休眠 LCD & LED Sleep
//113 服务器控制 Server control
}
System.Threading.Thread.Sleep (50);
}
}
});
}
public void ControlBusSceneDevice (Common common)
{
byte [] replyBytes = null;
switch (common.obj1) {
case 0://0 无效 Invalid
break;
case 85://0x55 场景 Scene ||0x0002
replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 86://0x56 序列 Sequence ||0x001A
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSeries, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 88://0x58 通用开关 Universal Switch ||0xe01c
replyBytes = Control.ControlBytesSendHasReturn (Command.SetCommonSwitch, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 89: //0x59 单路调节 Single Channel Lighting Control 0031
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 92://0x5c 窗帘开关 Curtain Switch e3e0
replyBytes = Control.ControlBytesSendHasReturn (Command.UpdataCurtainModelStutas, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 94://0x5e GPRS控制 GPRS Control E3D4
replyBytes = Control.ControlBytesSendHasReturn (Command.GPRSControl, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 95://0x5f 面板控制 Panel Control e3d8
replyBytes = Control.ControlBytesSendHasReturn (Command.InstructionPanelKey, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 100://0x64 广播场景 Broadcast Scene ||0x0002
replyBytes = Control.ControlBytesSendHasReturn (Command.SetScene, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 101://0x65 广播回路 Broadcast Channel 0031
replyBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 102://0x66 消防模块 Security Module 011E
replyBytes = Control.ControlBytesSendHasReturn (Command.SecurityModule, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
case 103://0x67 音乐播放 Music Control 0218
replyBytes = Control.ControlBytesSendHasReturn (Command.MusicControl, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
break;
//104 通用控制 Universal Control
//105 连接页 Link Page
//107 RGB调节 RGB Control
//108 红外控制 Infrared Control
//case 109://109 逻辑灯调节 Logic Light Adjust || 0xE45E
// replyBytes = Control.ControlBytesSendHasReturn (Command.LogicLightAdjust, common.SubnetID, common.DeviceID, new byte [] { common.obj2, common.obj3, common.obj4, common.obj5 });
// break;
//}
//110 逻辑场景 Logic Scene
//112 LCD & LED休眠 LCD & LED Sleep
//113 服务器控制 Server control
}
}
}
}