コード例 #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);
        }
コード例 #2
0
ファイル: GRTwoPressCha.cs プロジェクト: wwkkww1983/bt
        /// <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);
        }
コード例 #3
0
 public override CommResultState ProcessReceived(byte[] data)
 {
     return(GRCommandMaker.CheckReceivedData(Station.Address,
                                             GRDef.DEVICE_TYPE,
                                             GRDef.FC_ANSWER,
                                             data));
 }
コード例 #4
0
ファイル: GRTwoPressCha.cs プロジェクト: wwkkww1983/bt
        /// <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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #7
0
ファイル: GRTwoPressCha.cs プロジェクト: wwkkww1983/bt
        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);
        }
コード例 #8
0
ファイル: GRTwoPressCha.cs プロジェクト: wwkkww1983/bt
        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);
        }