Beispiel #1
0
        /// <summary>
        /// 读取上传的电流或振动启停的数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="refValue"></param>
        private void Read_RS_Par(byte[] Data, ref object oPars)
        {
            //标志位
            switch (Data[7])
            {
            case 0x01:
                sign = "电流启动";
                break;

            case 0x02:
                sign = "电流停止";
                break;

            case 0x03:
                sign = "振动启动";
                break;

            case 0x04:
                sign = "振动停止";
                break;
            }
            //当前日期时间
            string RunDate = "20" + Data[10].ToString("x2") + "-" + Data[9].ToString("x") + "-" + Data[8].ToString("x");
            string RunTime = Data[13].ToString("x") + ":" + Data[12].ToString("x2") + ":" + Data[11].ToString("x2");

            datetime = RunDate + " " + RunTime;
            //当前总用水量
            string strUsedWater = "";

            for (int i = 14; i < 18; i++)//14,15,16,17
            {
                strUsedWater += Data[i].ToString("x2");
            }
            tuWater = Convert.ToInt32(strUsedWater, 16);
            //当前剩余水量
            string strReWater = "";

            for (int i = 18; i < 22; i++)//18,19,20,21
            {
                strReWater += Data[i].ToString("x2");
            }
            reWater = Convert.ToInt32(strReWater, 16);
            oPars   = new Pump_RS(address, sign, datetime, tuWater, reWater);
        }
Beispiel #2
0
 /// <summary>
 /// ��ȡ�ϴ��ĵ���������ͣ������
 /// </summary>
 /// <param name="data"></param>
 /// <param name="refValue"></param>
 private void Read_RS_Par(byte[] Data, ref object oPars)
 {
     //��־λ
     switch (Data[7])
     {
         case 0x01:
             sign = "�������";
             break;
         case 0x02:
             sign = "����ֹͣ";
             break;
         case 0x03:
             sign = "�����";
             break;
         case 0x04:
             sign = "��ֹͣ";
             break;
     }
     //��ǰ����ʱ��
     string RunDate = "20" + Data[10].ToString("x2") + "-" + Data[9].ToString("x") + "-" + Data[8].ToString("x");
     string RunTime = Data[13].ToString("x") + ":" + Data[12].ToString("x2") + ":" + Data[11].ToString("x2");
     datetime = RunDate + " " + RunTime;
     //��ǰ����ˮ��
     string strUsedWater = "";
     for (int i = 14; i < 18; i++)//14,15,16,17
     {
         strUsedWater += Data[i].ToString("x2");
     }
     tuWater = Convert.ToInt32(strUsedWater, 16);
     //��ǰʣ��ˮ��
     string strReWater = "";
     for (int i = 18; i < 22; i++)//18,19,20,21
     {
         strReWater += Data[i].ToString("x2");
     }
     reWater = Convert.ToInt32(strReWater, 16);
     oPars = new Pump_RS(address, sign, datetime, tuWater, reWater);
 }