Esempio n. 1
0
        public override CommResultState ProcessReceived(byte[] data)
        {
            CommResultState r = GRCommandMaker.CheckReceivedData(Station.Address,
                                                                 GRDef.DEVICE_TYPE,
                                                                 GRDef.FC_READ_SETTINGS,
                                                                 data);

            if (r == CommResultState.Correct)
            {
                byte[] innerDatas = GRCommandMaker.GetReceivedInnerData(data);
                System.Diagnostics.Debug.Assert(innerDatas != null &&
                                                innerDatas.Length == 13);

                if (innerDatas[0] == GRDef.MC_TEMPERATURE_ALARM)
                {
                    _oneGiveTempLoSetV = BitConverter.ToSingle(innerDatas, 0 * 4 + 1);
                    _twoGiveTempHiSetV = BitConverter.ToSingle(innerDatas, 1 * 4 + 1);
                    _wlLoSetV          = BitConverter.ToSingle(innerDatas, 2 * 4 + 1);
                }
                else
                {
                    return(CommResultState.DataError);
                }
            }
            return(r);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public override CommResultState ProcessReceived(byte[] data)
        {
            CommResultState r = GRCommandMaker.CheckReceivedData(this.Station.Address,
                                                                 GRDef.DEVICE_TYPE,
                                                                 GRDef.FC_READ_SETTINGS,
                                                                 data);

            if (r == CommResultState.Correct)
            {
                byte[] ids = GRCommandMaker.GetReceivedInnerData(data);
                if (ids != null && ids.Length == 4)
                {
                    if (ids[0] == GRDef.MC_OPENDEGREE)
                    {
                        this._minod = ids[1];
                        this._maxod = ids[2];
                    }
                    else
                    {
                        return(CommResultState.DataError);
                    }
                }
            }
            return(r);
        }
Esempio n. 3
0
 public override CommResultState ProcessReceived(byte[] data)
 {
     return(GRCommandMaker.CheckReceivedData(Station.Address,
                                             GRDef.DEVICE_TYPE,
                                             GRDef.FC_ANSWER,
                                             data));
 }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public override CommResultState ProcessReceived(byte[] data)
        {
            CommResultState r = GRCommandMaker.CheckReceivedData(Station.Address,
                                                                 GRDef.DEVICE_TYPE, GRDef.FC_READ_SETTINGS,
                                                                 data);

            if (r == CommResultState.Correct)
            {
                byte[] inner = GRCommandMaker.GetReceivedInnerData(data);
                if (inner.Length < 10)
                {
                    return(CommResultState.LengthError);
                }

                if (inner[0] == GRDef.MC_RE_PRESS)
                {
//					byte mode = inner[1];
                    _mode       = (RePumpMode)inner[1];
                    _rePressSet = BitConverter.ToSingle(inner, 2);
                }
                else
                {
                    return(CommResultState.DataError);
                }
            }
            return(r);
        }
Esempio n. 5
0
        //
        static public CommResultState ProcessAutoReport(byte[] datas, out GRAlarmData alarmData)
        {
            //if ( datas == null )
            //    return CommResultState.NullData;
            //if ( datas.Length != 11 )
            //    return CommResultState.LengthError;
            CommResultState result = GRCommandMaker.CheckReceivedData(0xA0, 0x20, datas);

            if (result != CommResultState.Correct)
            {
                alarmData = null;
            }
            else
            {
                int addr = datas[GRDef.ADDRESS_POS];
                alarmData = Parse(GRCommandMaker.GetReceivedInnerData(datas), addr);
            }
            return(result);
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public override CommResultState ProcessReceived(byte[] data)
        {
            CommResultState r = GRCommandMaker.CheckReceivedData(Station.Address,
                                                                 GRDef.DEVICE_TYPE, GRDef.FC_READ_SETTINGS, data);

            if (r == CommResultState.Correct)
            {
                byte[] innerDatas = GRCommandMaker.GetReceivedInnerData(data);

                byte mc = innerDatas[0];
                if (mc == GRDef.MC_TEMPERATURE_LINE)
                {
                    _tl = TemperatureLine.Parse(innerDatas, 1);
                    this._timetempline = TimeTempLine.Parse(innerDatas, 1 + 16);
                }
                else
                {
                    return(CommResultState.DataError);
                }
            }
            return(r);
        }
Esempio n. 7
0
        public override CommResultState ProcessReceived(byte[] data)
        {
            CommResultState r = GRCommandMaker.CheckReceivedData(this.Station.Address,
                                                                 GRDef.DEVICE_TYPE,
                                                                 GRDef.FC_READ_SETTINGS,
                                                                 data);

            if (r == CommResultState.Correct)
            {
                byte[] ids = GRCommandMaker.GetReceivedInnerData(data);
                if (ids != null && ids.Length == 19)
                {
                    _b   = BitConverter.ToSingle(ids, 15);
                    _k   = BitConverter.ToSingle(ids, 11);
                    _ids = ids;
                }
                else
                {
                    return(CommResultState.LengthError);
                }
            }
            return(r);
        }
Esempio n. 8
0
        public override CommResultState ProcessReceived(byte[] data)
        {
            CommResultState r = GRCommandMaker.CheckReceivedData(Station.Address,
                                                                 GRDef.DEVICE_TYPE,
                                                                 GRDef.FC_READ_SETTINGS,
                                                                 data);

            if (r == CommResultState.Correct)
            {
                byte[] innerDatas = GRCommandMaker.GetReceivedInnerData(data);

//                System.Diagnostics.Debug.Assert ( innerDatas != null &&
//                    innerDatas.Length == 10 );
                if (innerDatas.Length < 10)
                {
                    return(CommResultState.LengthError);
                }

                if (innerDatas [0] == GRDef.MC_TWOPRESS_CHA)
                {
                    _cycPumpCtrlMode = (CyclePumpMode)innerDatas[1];
                    //                    byte[] pressChaSetValue = new byte[ 4 ];
                    //                    byte[] backPressSetValue = new byte[ 4 ];
                    //                    Array.Copy( innerDatas,2, pressChaSetValue, 0, 4 );
                    //                    Array.Copy( innerDatas,6, backPressSetValue, 0, 4 );

                    _pressChaSetValue  = BitConverter.ToSingle(innerDatas, 2);
                    _backPressSetValue = BitConverter.ToSingle(innerDatas, 6);
                }
                else
                {
                    return(CommResultState.DataError);
                }
            }

            return(r);
        }