Пример #1
0
        public Converse(IUtilityLog log, IConverseCheckSum16 calculations, int sendGap = 1200)
        {
            LastSendTime = DateTime.Today;
            SendGap = sendGap;
            UtilityLog = log;
            Conversations = new List<Conversation>();
            Variables = new List<Variable>();
            DeviceStream = null;
            NoTimeout = false;
            if (calculations == null)
            {
                Calculations = (IConverseCheckSum16)new ConverseCalculations();
                // LogMessage("Converse", "Using standard Calculations: " + Calculations.GetType().ToString(), LogEntryType.DetailTrace);
            }
            else
            {
                Calculations = calculations;
                LogMessage("Converse", "Using custom Calculations: " + Calculations.GetType().ToString(), LogEntryType.DetailTrace);
            }

            EndianConverter16Bit = new EndianConverter16Bit(EndianConverter.BigEndian16Bit);
            EndianConverter32Bit = new EndianConverter32Bit(EndianConverter.BigEndian32Bit);
            CheckSumEndianConverter16Bit = EndianConverter16Bit;
        }
Пример #2
0
 public void SetCheckSum16Endian(bool isLittleEndian = false)
 {
     if (isLittleEndian)
         CheckSumEndianConverter16Bit = new EndianConverter16Bit(EndianConverter.LittleEndian16Bit);
     else
         CheckSumEndianConverter16Bit = new EndianConverter16Bit(EndianConverter.BigEndian16Bit);
 }
Пример #3
0
        private void LoadConverse()
        {
            if (ProtocolSettings.Endian16Bit == "Little")
                EndianConverter16Bit = new EndianConverter16Bit(EndianConverter.LittleEndian16Bit);
            else
                EndianConverter16Bit = new EndianConverter16Bit(EndianConverter.BigEndian16Bit);
            if (ProtocolSettings.Endian32Bit == "Little")
                EndianConverter32Bit = new EndianConverter32Bit(EndianConverter.LittleEndian32Bit);
            else if (ProtocolSettings.Endian32Bit == "BigLittle")
                EndianConverter32Bit = new EndianConverter32Bit(EndianConverter.BigLittleEndian32Bit);
            else
                EndianConverter32Bit = new EndianConverter32Bit(EndianConverter.BigEndian32Bit);

            if (ProtocolSettings.CheckSumEndian16Bit == ProtocolSettings.Endian16Bit)
                CheckSumEndianConverter16Bit = EndianConverter16Bit;
            else if (ProtocolSettings.CheckSumEndian16Bit == "Little")
                CheckSumEndianConverter16Bit = new EndianConverter16Bit(EndianConverter.LittleEndian16Bit);
            else
                CheckSumEndianConverter16Bit = new EndianConverter16Bit(EndianConverter.BigEndian16Bit);

            foreach (ConversationSettings settings in ProtocolSettings.Conversations)
                LoadConversation(settings);
        }