Ejemplo n.º 1
0
        // Convert Analog data to send
        private void Marshall()
        {
            short idx = 0;

            // Need 2 bytes for each channel
            _payload = new byte[_numChannels * 2];

            foreach (short ch in _status)
            {
                SerialMessage.SplitWord(ch, ref _payload, idx);
                idx += 2;
            }
        }
Ejemplo n.º 2
0
        public int Marshall(ref byte[] Payload)
        {
            ushort idx = 3;

            // Button Type
            Payload[idx] = (byte)_Type;
            idx         += 1;

            //ushort day=5, month=11, year=2015;
            SerialMessage.SplitWord((ushort)_Expiration.Day, ref Payload, idx);
            idx += 2;

            SerialMessage.SplitWord((ushort)_Expiration.Month, ref Payload, idx);
            idx += 2;

            SerialMessage.SplitWord((ushort)_Expiration.Year, ref Payload, idx);
            idx += 2;

            byte[] ascii = Encoding.ASCII.GetBytes(_LotCode);
            foreach (Byte b in ascii)
            {
                Payload[idx++] = b;
            }

            // idx += (short)Constants.LOT_LEN; // 12

            SerialMessage.SplitWord(MeasureTime, ref Payload, idx);
            idx += 2;

            // target values and ranges

            // Level 1
            SerialMessage.SplitWord(_Pb_Level1_target, ref Payload, idx);
            idx += 2;

            SerialMessage.SplitWord(_Pb_Level1_range, ref Payload, idx);
            idx += 2;

            // Level2
            SerialMessage.SplitWord(_Pb_Level2_target, ref Payload, idx);
            idx += 2;

            SerialMessage.SplitWord(_Pb_Level2_range, ref Payload, idx);
            idx += 2;

            if (_Type == QCType.QC_PB_HGB)
            {
                // Level 1
                SerialMessage.SplitWord(_Hgb_Level1_target, ref Payload, idx);
                idx += 2;

                SerialMessage.SplitWord(_Hgb_Level1_range, ref Payload, idx);
                idx += 2;

                // Level2
                SerialMessage.SplitWord(_Hgb_Level2_target, ref Payload, idx);
                idx += 2;

                SerialMessage.SplitWord(_Hgb_Level2_range, ref Payload, idx);
                idx += 2;

                // Level3
                SerialMessage.SplitWord(_Hgb_Level3_target, ref Payload, idx);
                idx += 2;

                SerialMessage.SplitWord(_Hgb_Level3_range, ref Payload, idx);
                idx += 2;
            }
            return(idx);
        } // Marshall()