예제 #1
0
 public static String createDeployStatus(String LHS_PlateStatus)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "LHS_PlateStatus");
     creator.addKeyPair("LHS_PlateStatus", LHS_PlateStatus);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #2
0
 public static String createSetMode(String s)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "Mode");
     creator.addKeyPair("Mode", s);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #3
0
 /*
 * decodeResponseMessage函数,处理Response命令的函数
 * 虚函数,方法已实现,会自动给出消息的Response答复
 * 如有需要,可在仪器类中重写该函数
 */
 public virtual void decodeResponseMessage(ModbusMessage s)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("Result", "OK");
     string msg = ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.RESPONSE), creator.getDataBytes());
     this.SendMsg(msg);
 }
예제 #4
0
 public static String createWeiZhiConfirmMsg(String LHS_LiquidPosition, String LHS_DischargePosition)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "weiZhiSheZhi");
     creator.addKeyPair("LHS_LiquidPosition", LHS_LiquidPosition);
     creator.addKeyPair("LHS_DischargePosition", LHS_DischargePosition);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #5
0
 public static String createSuDuConfirmMsg(String LHS_LiquidRate, String LHS_DischargeRate)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "suDuSheZhi");
     creator.addKeyPair("LHS_LiquidRate", LHS_LiquidRate);
     creator.addKeyPair("LHS_DischargeRate", LHS_DischargeRate);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #6
0
 public static String createSetMianJiLowAndUpp(String Lower, String Upper)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "MianJiShaiXuan");
     creator.addKeyPair("MianJi_Max", Upper);
     creator.addKeyPair("MianJi_Min", Lower);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #7
0
 public static String createMuBiaoConfirmMsg(String LHS_SuctionPlate, String LHS_TargetPlate, String LHS_Imbitition)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "yiYeWeiZhi");
     creator.addKeyPair("LHS_SuctionPlate", LHS_SuctionPlate);
     creator.addKeyPair("LHS_TargetPlate", LHS_TargetPlate);
     creator.addKeyPair("LHS_Imbitition", LHS_Imbitition);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #8
0
 public static String createJianCeZhiReport(int b, float[] v)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("ReportType", "Value");
     for (int i = 0; i < v.Length; i++)
     {
         creator.addKeyPair("v" + b, v[i].ToString());
         b++;
     }
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.REPORT), creator.getDataBytes());
 }
예제 #9
0
 public static String createSetMieJun(String arg1, String arg2, String arg3, String arg4, String arg5)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "MieJunHeQingXi");
     creator.addKeyPair("JiaReShiJian", arg1);
     creator.addKeyPair("QingXiCiShu", arg2);
     creator.addKeyPair("LengQueShiJian", arg3);
     creator.addKeyPair("QingXiShiJian", arg4);
     creator.addKeyPair("ChouQiShiJian", arg5);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #10
0
 public static String createKongBanReport(bool YouKongBan, String TiaoMaHao)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("ReportType", "YouKongBan");
     String f = "";
     if (YouKongBan) f = "1";
     else f = "0";
     creator.addKeyPair("Flag", f);
     if (YouKongBan)
     {
         creator.addKeyPair("TiaoMaHao", TiaoMaHao);
     }
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.REPORT), creator.getDataBytes());
 }
예제 #11
0
 /*
  * SendModBusMsg函数,以ModBus协议的方式发送数据
  * ModbusMessage.MessageType 有{ CMD, RESPONSE, GET, SET, REPORT }
  * Key 和 Value 分别指的是生成ModBusMessage的键和值
  * 通常来说Key为变量名,Value为该变量的值,示例:SendModBusMsg(ModbusMessage.MessageType.REPORT,"MPF_PlateNum","10");
  * 函数完成的就是将这组Key,Value封装成ModBusMessage然后发送出去
  */
 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);
 }
예제 #12
0
        /*
         * SendModBusMsg函数,以ModBus协议的方式发送数据
         * ModbusMessage.MessageType 有{ CMD, RESPONSE, GET, SET, REPORT }
         * Key 和 Value 分别指的是生成ModBusMessage的键和值
         * 通常来说Key为变量名,Value为该变量的值,示例:SendModBusMsg(ModbusMessage.MessageType.REPORT,"MPF_PlateNum","10");
         * 函数完成的就是将这组Key,Value封装成ModBusMessage然后发送出去
         */
        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);
        }
예제 #13
0
        /*
         * decodeResponseMessage函数,处理Response命令的函数
         * 虚函数,方法已实现,会自动给出消息的Response答复
         * 如有需要,可在仪器类中重写该函数
         */
        public virtual void decodeResponseMessage(ModbusMessage s)
        {
            ModbusMessageDataCreator creator = new ModbusMessageDataCreator();

            creator.addKeyPair("Result", "OK");
            string msg = ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.RESPONSE), creator.getDataBytes());

            this.SendMsg(msg);
        }
예제 #14
0
        /*
         * SendModBusMsg函数,以ModBus协议的方式发送数据
         * ModbusMessage.MessageType 有{ CMD, RESPONSE, GET, SET, REPORT }
         * htable指的是多组的Key和Value,主要用于多个键以及值的数据发送
         * 函数完成的就是将这htable包含的多组Key,Value封装成ModBusMessage然后发送出去
         */
        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);
        }
예제 #15
0
 public static String createSetSystem(String Mode, String Command)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "System");
     creator.addKeyPair("Sys_Mode", Mode);
     creator.addKeyPair("Sys_Command", Command);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #16
0
 public static String createOKResponse()
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("Result", "OK");
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.RESPONSE), creator.getDataBytes());
 }
예제 #17
0
 public static String createSetMotor(String text_speed, String elecspeed, String slope )
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "Motor");
     creator.addKeyPair("Motor_text_speed", text_speed);
     creator.addKeyPair("Motor_elecspeed", elecspeed);
     creator.addKeyPair("Motor_slope", slope);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #18
0
 /*
  * SendModBusMsg函数,以ModBus协议的方式发送数据
  * ModbusMessage.MessageType 有{ CMD, RESPONSE, GET, SET, REPORT }
  * htable指的是多组的Key和Value,主要用于多个键以及值的数据发送
  * 函数完成的就是将这htable包含的多组Key,Value封装成ModBusMessage然后发送出去
  */
 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);
 }
예제 #19
0
 public static String createSetTH_1( String tempset,
                                     String htempchaval,
                                     String ltempchaval,
                                     String syso_change,
                                     String htempalarmval,
                                     String ltempalarmval,
                                     String compressormode,
                                     String compressorsituation )
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "TH_1");
     creator.addKeyPair("TH_htempchaval", htempchaval);
     creator.addKeyPair("TH_tempset", tempset);
     creator.addKeyPair("TH_ltempchaval", ltempchaval );
     creator.addKeyPair("TH_syso_change", syso_change);
     creator.addKeyPair("TH_htempalarmval", htempalarmval );
     creator.addKeyPair("TH_ltempalarmval", ltempalarmval);
     creator.addKeyPair("TH_compressormode", compressormode);
     creator.addKeyPair("TH_compressorsituation", compressorsituation);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #20
0
 public static String createSetTH_2(   String def_interval,
                                       String def_span,
                                       String hottube,
                                       String humi_con_mod,
                                       String humi_con_sit,
                                       String hum_set,
                                       String hum_alarm_val,
                                       String add_hum,
                                       String remo_hum )
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "TH_2");
     creator.addKeyPair("TH_def_interval", def_interval);
     creator.addKeyPair("TH_def_span", def_span);
     creator.addKeyPair("TH_hottube", hottube);
     creator.addKeyPair("TH_humi_con_mod", humi_con_mod);
     creator.addKeyPair("TH_humi_con_sit", humi_con_sit);
     creator.addKeyPair("TH_hum_set", hum_set);
     creator.addKeyPair("TH_hum_alarm_val", hum_alarm_val);
     creator.addKeyPair("TH_add_hum", add_hum);
     creator.addKeyPair("TH_remo_hum", remo_hum);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }
예제 #21
0
 public static String createCmd(String cmd)
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("Cmd", cmd);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.CMD), creator.getDataBytes());
 }
예제 #22
0
 public static String createSetLight(String pwm, String allightText )
 {
     ModbusMessageDataCreator creator = new ModbusMessageDataCreator();
     creator.addKeyPair("SetType", "Light");
     creator.addKeyPair("Light_pwm", pwm);
     creator.addKeyPair("Light_allighText", allightText);
     return ModbusMessageHelper.createModbusMessage(ModbusMessage.messageTypeToByte(ModbusMessage.MessageType.SET), creator.getDataBytes());
 }