| | |
| | | return logicId; |
| | | } |
| | | /// <summary> |
| | | /// 生成逻辑sid方法 |
| | | /// </summary> |
| | | //public static string NewSid() |
| | | //{ |
| | | // String sLogicid = ""; |
| | | // try |
| | | // { |
| | | // String sOidBeginsWith = "000101";//厂商 + 通讯方式 |
| | | |
| | | // //生成4个byte时间戳 |
| | | // DateTime dt = DateTime.Now; |
| | | // long sTimeSp = GateWay.ConvertDateTimeLong(dt); |
| | | // string sTimeSpan = ""; |
| | | // GateWay.ConvertIntToByteArray(sTimeSp, ref sTimeSpan); |
| | | // if (sTimeSpan.Length != 8) return sLogicid; |
| | | |
| | | // //间隔10毫秒 错开时间戳 |
| | | // HDLUDP.TimeBetwnNext(10); |
| | | |
| | | // sLogicid = sOidBeginsWith + sTimeSpan; |
| | | |
| | | // //1501 物模型为自动化, 0001 表示 1 号自动化功能 |
| | | // sLogicid += "15"; |
| | | // sLogicid += "1501"; |
| | | |
| | | |
| | | // //自动化号自增 |
| | | // int iTopSceneId = 1; |
| | | // if (myGateway.LogicResponse != null) |
| | | // { |
| | | // if (myGateway.LogicResponse.objects != null) |
| | | // { |
| | | // for (int i = 0; i < myGateway.LogicResponse.objects.Count; i++) |
| | | // { |
| | | // string ccc = myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4); |
| | | // int iThisSceneId = Convert.ToInt16(myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4), 16); |
| | | // if (iThisSceneId >= iTopSceneId) |
| | | // iTopSceneId = iThisSceneId + 1; |
| | | // } |
| | | // } |
| | | // } |
| | | // sLogicid += iTopSceneId.ToString("X4");//场景号 两个byte |
| | | // //大类小类没有用到 固定为0 |
| | | // sLogicid += "0000"; |
| | | // return sLogicid; |
| | | // } |
| | | // catch |
| | | // { |
| | | // return sLogicid; |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 封装Dictionary对象 |
| | | /// </summary> |
| | | /// <param name="dic">Dictionary类</param> |