Exemplo n.º 1
0
        public void DpWritePressurePointToDevice(float tempUnderTest, byte TempN, float extPressure, byte PreesureN)
        {
            byte[] TargetTempArray = new byte[SIZE_OF_FLOAT];
            TargetTempArray = BitConverter.GetBytes(tempUnderTest);

            byte[] extPressArray = new byte[SIZE_OF_FLOAT];
            extPressArray = BitConverter.GetBytes(extPressure);

            byte[] data = new byte[API_MSG_DP_BASIC_MASSEGE_LENGTH + 10];
            data[0] = API_MSG_PREAMBLE;
            data[1] = (byte)data.Count();
            data[2] = API_MSG_DP_SEND_PRESSURE_TO_DP; //opcode

            data[3] = TargetTempArray[0];             // byte 1 from the float temp value
            data[4] = TargetTempArray[1];             // byte 2 from the float temp value
            data[5] = TargetTempArray[2];             // byte 3 from the float temp value
            data[6] = TargetTempArray[3];             // byte 4 from the float temp value
            data[7] = TempN;

            data[8]  = extPressArray[0];   // byte 1 from the float pressure value
            data[9]  = extPressArray[1];   // byte 2 from the float pressure value
            data[10] = extPressArray[2];   // byte 3 from the float pressure value
            data[11] = extPressArray[3];   // byte 4 from the float pressure value
            data[12] = PreesureN;

            data[data.Count() - 1] = CheckCum(data, data.Count());

            SerialPortInstanse.Send(data, data.Count());
        }
Exemplo n.º 2
0
        public void ConnectDpDevice(byte DpId)
        {
            byte[] data = new byte[API_MSG_MAG_BASIC_MASSEGE_LENGTH + 1];
            data[0] = API_MSG_PREAMBLE;
            data[1] = (byte)data.Count();
            data[2] = API_MSG_CONNECT_CH;//opcode
            data[3] = DpId;
            data[data.Count() - 1] = CheckCum(data, data.Count());

            SerialPortInstanse.Send(data, data.Count());

            ConnectedChanel = (ChaneleNum)DpId;
        }