/*加入新的数据接口函数*/ public void SendModBusMsg(ModbusMessage.MessageType type, String key, Object value) { ModbusMessageDataCreator creator = new ModbusMessageDataCreator(); creator.addKeyPair(key, (String)value); string msg = ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(type), creator.getDataBytes()); this.SendMsg(msg); }
public void SendModBusMsg(ModbusMessage.MessageType type, Hashtable htable) { ModbusMessageDataCreator creator = new ModbusMessageDataCreator(); foreach (DictionaryEntry de in htable) { creator.addKeyPair((string)de.Key, (string)de.Value); } string msg = ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(type), creator.getDataBytes()); this.SendMsg(msg); }