| | |
| | | /// <returns></returns>
|
| | | public async Task<bool> CommitCurtainLimitPoint(Rollershade rollershade, Rollershade.CurtainPrivateInstalledLimi limiType, int upLimit, int downLimit)
|
| | | {
|
| | | var result = await rollershade.SetCurtainInstalledLimitAsync(limiType);
|
| | | CommonDevice.SetWritableValueResponAllData result = null;
|
| | | if (upLimit == -1 && upLimit == -1)
|
| | | {
|
| | | //这个是卷帘
|
| | | result = await rollershade.SetCurtainInstalledLimitAsync(limiType);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (upLimit < 0) { upLimit = 0; }
|
| | | if (downLimit < 0) { downLimit = 100; }
|
| | |
|
| | | //这个是开合帘 "2,0x00ff,0x00ff"格式
|
| | | string convertData = "\"2,0x" + Convert.ToString(upLimit, 16).PadLeft(4, '0');
|
| | | convertData += ",0x" + Convert.ToString(downLimit, 16).PadLeft(4, '0') + "\"";
|
| | | //然后将它们转为ASK码数值,然后再转为16进制
|
| | | //总计长度为17(这里是16进制)
|
| | | string sendData = "11";
|
| | | foreach (char c in convertData)
|
| | | {
|
| | | sendData += Convert.ToString((int)c, 16).PadLeft(2, '0');
|
| | | }
|
| | | result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(rollershade, 258, 24, 65, sendData);
|
| | | }
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|