public byte[] SetCounter(int address, string specialName, List <string> counters) { int _serviceCount = counters.Count(); byte[] _data = new byte[] { (byte)_serviceCount }; byte[] _temp; foreach (var s in counters) { _temp = new byte[_data.Length + s.Length * 4 + 1]; Array.Copy(_data, _temp, _data.Length); var _d = MRW_Convert.ConvertStringToByte(s, true); Buffer.BlockCopy(_d, 0, _temp, _data.Length, _d.Length); _data = _temp; } _temp = new byte[_data.Length + specialName.Length * 4 + 1]; var _dSpecial = MRW_Convert.ConvertStringToByte(specialName, true); Buffer.BlockCopy(_data, 0, _temp, _dSpecial.Length, _data.Length); Buffer.BlockCopy(_dSpecial, 0, _temp, 0, _dSpecial.Length); return(_modBus.Build(deviceID, address, (int)RecivedCommand.SetCounter, _temp)); }
public byte[] SetService(int address, List <string> services) { int _serviceCount = services.Count(); byte[] _data = new byte[] { (byte)_serviceCount }; byte[] _temp; foreach (var s in services) { _temp = new byte[_data.Length + s.Length * 4 + 1]; Array.Copy(_data, _temp, _data.Length); var _d = MRW_Convert.ConvertStringToByte(s, true); Buffer.BlockCopy(_d, 0, _temp, _data.Length, _d.Length); _data = _temp; } return(_modBus.Build(deviceID, address, (int)RecivedCommand.SetService, _data)); }
private string ConvertObjectToJson(ObjectSend objSend) { return((objSend == null) ? "" : MRW_Convert.ConvertObjectToJson(objSend)); }
private string GenRandomString() { return(MRW_Convert.RandomString(ActionTicket.LENGH_RANDOM)); }