/// <summary> /// 扩展服务功能,触发同步设备控制参数 /// </summary> /// <param name="service">扩展服务名</param> /// <param name="msg">附加信息,根据服务定义(不能包含:id,cmd,len,service)</param> public void ExtService(CmdSrvType CmdSrvType, NameValueCollection info) { if (string.IsNullOrEmpty(this.CmdId)) { this.CmdId = Guid.NewGuid().ToString(); } NameValueCollection data = new NameValueCollection(); if (null != info) { foreach (string k in info.AllKeys) { data.Set(k, info[k]); } } //定义扩展 string service = ""; switch (CmdSrvType) { case CmdSrvType.UpdatePmDevice: service = "updateparam"; break; case CmdSrvType.MonitorDevice: service = "monitor"; break; case CmdSrvType.HaltDevice: service = "halt"; break; case CmdSrvType.ReadInfodev: service = "readinfo"; break; case CmdSrvType.ReadWorkerChannel: service = "readwkchannel"; break; case CmdSrvType.ReadWorkerRegion: service = "readwkregion"; break; case CmdSrvType.ReadRegionSum: service = "readregionsum"; break; } data["service"] = service; string[,] vals = { { "id", this.CmdId }, { "cmd", "TransFile.extend" }, { "len", "0" } }; for (int i = 0; i < vals.GetLength(0); i++) { data[vals[i, 0]] = vals[i, 1]; } byte[] fh = SvrFileTrans.ParseInfo(data); this.setCommand(fh); }
/// <summary> /// 扩展服务功能,触发同步设备控制参数 /// </summary> /// <param name="service">扩展服务名</param> /// <param name="msg">附加信息,根据服务定义(不能包含:id,cmd,len,service)</param> public void ExtService(CmdSrvType CmdSrvType, NameValueCollection info) { if (string.IsNullOrEmpty(this.CmdId)) this.CmdId = Guid.NewGuid().ToString(); NameValueCollection data = new NameValueCollection(); if (null != info) { foreach (string k in info.AllKeys) data.Set(k, info[k]); } //定义扩展 string service = ""; switch (CmdSrvType) { case CmdSrvType.UpdatePmDevice: service = "updateparam"; break; case CmdSrvType.MonitorDevice: service = "monitor"; break; case CmdSrvType.HaltDevice: service = "halt"; break; case CmdSrvType.ReadInfodev: service = "readinfo"; break; case CmdSrvType.ReadWorkerChannel: service = "readwkchannel"; break; case CmdSrvType.ReadWorkerRegion: service = "readwkregion"; break; case CmdSrvType.ReadRegionSum: service = "readregionsum"; break; } data["service"] = service; string[,] vals ={ { "id", this.CmdId }, { "cmd", "TransFile.extend" }, { "len", "0" } }; for (int i = 0; i < vals.GetLength(0); i++) data[vals[i, 0]] = vals[i, 1]; byte[] fh = SvrFileTrans.ParseInfo(data); this.setCommand(fh); }