Exemplo n.º 1
0
        //private void SynTime()
        //{
        //    while (m_SynTimeFlag)
        //    {
        //        uint dwYear = (uint)System.DateTime.Now.Year;
        //        uint dwMonth = (uint)System.DateTime.Now.Month;
        //        uint dwDay = (uint)System.DateTime.Now.Day;
        //        uint dwHour = (uint)System.DateTime.Now.Hour;
        //        uint dwMinute = (uint)System.DateTime.Now.Minute;
        //        uint dwSecond = (uint)System.DateTime.Now.Second;
        //        int reVal = 0;
        //        m_VideoRecord.SDK_SetupDeviceTime(m_VideoHandle, dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond, ref reVal);
        //        for (int i = 0; i < 60*10 ; i++)
        //        {
        //            if (m_SynTimeFlag)
        //                break;
        //            System.Threading.Thread.Sleep(1000);
        //        }
        //    }
        //}
        /// <summary>
        /// ���������Ҫ���豸ͨѶ�߳�
        /// </summary>
        public void StartUse()
        {
            //���ʱ��ͬ���߳�
            //if (m_VideoHandle > 0)
            //{
            //    m_SynTimeFlag = true;
            //    m_SynTimeThread = new Thread(new ThreadStart(SynTime));
            //    m_SynTimeThread.Start();
            //}

            int i = 0;//��10�Σ���ʱ�DZ�һ�λ�򲻿�
            if (UseMeter)
            {
                m_CoolSerialForMeter = new CoolSerial(METERPARA);
                m_CoolSerialForMeter.DeviceType = METERTYPE;//�DZ����ͣ�������δ�������
                m_CoolSerialForMeter.DeviceName = POINTNAME;
                while (m_CoolSerialForMeter.StateInfo != "open" && i < 10)
                {
                    m_CoolSerialForMeter.Open();
                    m_CoolSerialForMeter.StartUse();
                    i++;
                }

            }

            if (UseLED)
            {
                m_CoolSerialForLed = new CoolSerial(LEDPARA);
                m_CoolSerialForLed.DeviceType = LEDTYPE;//LED���ͣ�������δ�������
                m_CoolSerialForLed.DeviceName = POINTNAME;
                if (m_CoolSerialForLed.Open())
                {
                    //add code here
                }
            }

            if (UseReader)
            {
                m_CoolReader = new CoolReader(READERPARA);
                m_CoolReader.DeviceType = READERTYPE;//���������ͣ�������δ�������
                m_CoolReader.DeviceName = POINTNAME;
                if (m_CoolReader.Open())
                {
                    m_CoolReader.StartUse();
                }
            }

            if (UseDisplay)
            {
                m_CoolDisplay = new CoolDisplay(DISPLAYPARA);
                m_CoolDisplay.DeviceType = DISPLAYTYPE;//Һ�������ͣ�������δ�������
                m_CoolDisplay.DeviceName = POINTNAME;
                m_CoolDisplay.Open();
            }

            if (UseRtu)
            {
                m_CoolRtu = new CoolRtu(RTUIP, Int32.Parse(RTUPORT));
                m_CoolRtu.DeviceName = POINTNAME;
                if (m_CoolRtu.Connect2Server())
                {
                    m_CoolRtu.StartUse();
                }

                m_CoolRtuForCommand = new CoolRtu(RTUIP, Int32.Parse(RTUPORT));
                m_CoolRtuForCommand.DeviceName = POINTNAME;
                if (m_CoolRtuForCommand.Connect2Server())
                {
                }

            }

            m_bRunning = true;
            m_hThread = new System.Threading.Thread(new System.Threading.ThreadStart(DataCollectThread));
            m_hThread.Start();
        }
Exemplo n.º 2
0
        //private void SynTime()
        //{
        //    while (m_SynTimeFlag)
        //    {
        //        uint dwYear = (uint)System.DateTime.Now.Year;
        //        uint dwMonth = (uint)System.DateTime.Now.Month;
        //        uint dwDay = (uint)System.DateTime.Now.Day;
        //        uint dwHour = (uint)System.DateTime.Now.Hour;
        //        uint dwMinute = (uint)System.DateTime.Now.Minute;
        //        uint dwSecond = (uint)System.DateTime.Now.Second;
        //        int reVal = 0;

        //        m_VideoRecord.SDK_SetupDeviceTime(m_VideoHandle, dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond, ref reVal);

        //        for (int i = 0; i < 60*10 ; i++)
        //        {
        //            if (m_SynTimeFlag)
        //                break;
        //            System.Threading.Thread.Sleep(1000);
        //        }
        //    }
        //}

        /// <summary>
        /// 启动所有需要的设备通讯线程
        /// </summary>
        public void StartUse()
        {
            //启动时间同步线程
            //if (m_VideoHandle > 0)
            //{
            //    m_SynTimeFlag = true;
            //    m_SynTimeThread = new Thread(new ThreadStart(SynTime));
            //    m_SynTimeThread.Start();
            //}

            int i = 0;//打开10次,有时仪表一次会打不开

            if (UseMeter)
            {
                m_CoolSerialForMeter            = new CoolSerial(METERPARA);
                m_CoolSerialForMeter.DeviceType = METERTYPE;//仪表类型,决定如何处理事务
                m_CoolSerialForMeter.DeviceName = POINTNAME;
                while (m_CoolSerialForMeter.StateInfo != "open" && i < 10)
                {
                    m_CoolSerialForMeter.Open();
                    m_CoolSerialForMeter.StartUse();
                    i++;
                }
            }

            if (UseLED)
            {
                m_CoolSerialForLed            = new CoolSerial(LEDPARA);
                m_CoolSerialForLed.DeviceType = LEDTYPE;//LED类型,决定如何处理事务
                m_CoolSerialForLed.DeviceName = POINTNAME;
                if (m_CoolSerialForLed.Open())
                {
                    //add code here
                }
            }

            if (UseReader)
            {
                m_CoolReader            = new CoolReader(READERPARA);
                m_CoolReader.DeviceType = READERTYPE;//读卡器类型,决定如何处理事务
                m_CoolReader.DeviceName = POINTNAME;
                if (m_CoolReader.Open())
                {
                    m_CoolReader.StartUse();
                }
            }

            if (UseDisplay)
            {
                m_CoolDisplay            = new CoolDisplay(DISPLAYPARA);
                m_CoolDisplay.DeviceType = DISPLAYTYPE;//液晶屏类型,决定如何处理事务
                m_CoolDisplay.DeviceName = POINTNAME;
                m_CoolDisplay.Open();
            }

            if (UseRtu)
            {
                m_CoolRtu            = new CoolRtu(RTUIP, Int32.Parse(RTUPORT));
                m_CoolRtu.DeviceName = POINTNAME;
                if (m_CoolRtu.Connect2Server())
                {
                    m_CoolRtu.StartUse();
                }

                m_CoolRtuForCommand            = new CoolRtu(RTUIP, Int32.Parse(RTUPORT));
                m_CoolRtuForCommand.DeviceName = POINTNAME;
                if (m_CoolRtuForCommand.Connect2Server())
                {
                }
            }

            m_bRunning = true;
            m_hThread  = new System.Threading.Thread(new System.Threading.ThreadStart(DataCollectThread));
            m_hThread.Start();
        }
Exemplo n.º 3
0
        private decimal m_ZEROVALUE; //��λֵ

        #endregion Fields

        #region Constructors

        public PoundRoom()
        {
            m_POINTID = "";//���������
            m_POINTNAME = "";//����������
            m_POINTTYPE = "";//�������������

            m_VIEDOIP = "";//Ӳ��¼���IP
            m_VIEDOPORT = "";//Ӳ��¼����˿�
            m_VIEDOUSER = "";//Ӳ��¼����û���
            m_VIEDOPWD = "";//Ӳ��¼�������

            m_MOXAIP = "";//MOXA��IP

            m_METERTYPE = "";//�DZ�����
            m_METERPARA = "";//�DZ����
            m_MOXAPORT = "";//�����DZ�MOXA���˿�
            m_MeterPreData = 0;//�DZ�ǰһ������
            m_nMeterStabTimes = 0;//�DZ��ȶ�����

            m_RTUIP = "";//RTUIP
            m_RTUPORT = "";//RTU�˿�

            m_PRINTERIP = "";//��ӡ������IP
            m_PRINTERNAME = "";//��ӡ������
            m_PRINTTYPECODE = "";//��ӡ�����ʹ���
            m_USEDPAPER = 0;//����ֽ����
            m_TOTALPAPAR = 0;//��ӡֽ������
            m_STATUS = "";//������״̬
            m_ACCEPTTERMINAL = "";//�ӹܵ��ն�IP

            m_LEDPORT = "";//������MOXA���˿�
            m_LEDPARA = "";//������MOXA������
            m_LEDTYPE = "";//����������

            m_READERPORT = "";//������MOXA���˿�
            m_READERPARA = "";//������MOXA������
            m_READERTYPE = "";//����������

            m_DISPLAYPORT = "";//Һ����MOXA���˿�
            m_DISPLAYPARA = "";//Һ����MOXA������
            m_DISPLAYTYPE = "";//Һ��������

            m_CLEARVALUE = 0;//�����ȶ�ֵ

            //ʹ�ú����豸��־
            m_bUseMeter = false;//�ɼ��DZ�����
            m_bUseLED = false;//ʹ��LED
            m_bUseReader = false;//ʹ�ö�����
            m_bUseDisplay = false;//ʹ��Һ����
            m_bUseRtu = false;//ʹ��rtu

            //MOXA
            m_CoolSerialForMeter = null;//�DZ�
            m_CoolReader = null;//������
            m_CoolSerialForLed = null;//LED
            m_CoolDisplay = null;//Һ����

            //rtu
            m_CoolRtu = null;//rtu data collect
            m_CoolRtuForCommand = null;//rtu command send

            //�߳�
            m_hThread = null;//�߳�
            m_bRunning = false;//�߳����п���

            //����
            m_szMeterData = "";//�DZ�ɼ�����
            m_szReaderGUID = "";//������ȫ��Ψһ��
            m_szReaderCardNo = "";//����������
            m_szRtuData = null;//rtu data

            //�ӹ�
            m_bSigned = false;

            //��������
            m_SoundPlayer = null;

            //Ӳ��¼���
               // m_VideoRecord = null;
            m_VideoHandle = 0;
            m_Channel1 = 0;//ͨ��1���
            m_Channel2 = 0;//ͨ��2���
            m_Channel3 = 0;//ͨ��3���
            m_Channel4 = 0;//ͨ��4���
            m_Channel5 = 0;//ͨ��5���
            m_Channel6 = 0;//ͨ��6���
            m_Channel7 = 0;//ͨ��7���
            m_Channel8 = 0;//ͨ��8���
            m_bTalk = false;//�Ƿ����ڶԽ�
            m_TalkID = 0;//�Խ����
            m_AudioNum = 1; //��ʹ����Ƶ��
            m_IsFirstSend = true; //��δ���Ź�����

            m_PointState = ""; //������״̬
        }
Exemplo n.º 4
0
        private string m_PointState; //计量点状态

        #endregion


        #region constructor

        public PoundRoom()
        {
            m_POINTID   = "";       //计量点编码
            m_POINTNAME = "";       //计量点名称
            m_POINTTYPE = "";       //计量点称重类型

            m_VIEDOIP   = "";       //硬盘录像机IP
            m_VIEDOPORT = "";       //硬盘录像机端口
            m_VIEDOUSER = "";       //硬盘录像机用户名
            m_VIEDOPWD  = "";       //硬盘录像机密码

            m_MOXAIP = "";          //MOXA卡IP

            m_METERTYPE       = ""; //仪表类型
            m_METERPARA       = ""; //仪表参数
            m_MOXAPORT        = ""; //计量仪表MOXA卡端口
            m_MeterPreData    = 0;  //仪表前一次重量
            m_nMeterStabTimes = 0;  //仪表稳定次数

            m_RTUIP   = "";         //RTUIP
            m_RTUPORT = "";         //RTU端口

            m_PRINTERIP      = "";  //打印服务器IP
            m_PRINTERNAME    = "";  //打印机名称
            m_PRINTTYPECODE  = "";  //打印机类型代码
            m_USEDPAPER      = 0;   //已用纸张量
            m_TOTALPAPAR     = 0;   //打印纸总数量
            m_STATUS         = "";  //计量点状态
            m_ACCEPTTERMINAL = "";  //接管的终端IP

            m_LEDPORT = "";         //电子屏MOXA卡端口
            m_LEDPARA = "";         //电子屏MOXA卡参数
            m_LEDTYPE = "";         //电子屏类型

            m_READERPORT = "";      //读卡器MOXA卡端口
            m_READERPARA = "";      //读卡器MOXA卡参数
            m_READERTYPE = "";      //读卡器类型

            m_DISPLAYPORT = "";     //液晶屏MOXA卡端口
            m_DISPLAYPARA = "";     //液晶屏MOXA卡参数
            m_DISPLAYTYPE = "";     //液晶屏类型

            m_CLEARVALUE = 0;       //重量稳定值

            //使用何种设备标志
            m_bUseMeter   = false; //采集仪表数据
            m_bUseLED     = false; //使用LED
            m_bUseReader  = false; //使用读卡器
            m_bUseDisplay = false; //使用液晶屏
            m_bUseRtu     = false; //使用rtu

            //MOXA
            m_CoolSerialForMeter = null; //仪表
            m_CoolReader         = null; //读卡器
            m_CoolSerialForLed   = null; //LED
            m_CoolDisplay        = null; //液晶屏

            //rtu
            m_CoolRtu           = null; //rtu data collect
            m_CoolRtuForCommand = null; //rtu command send

            //线程
            m_hThread  = null;  //线程
            m_bRunning = false; //线程运行开关

            //数据
            m_szMeterData    = "";   //仪表采集数据
            m_szReaderGUID   = "";   //读卡器全球唯一号
            m_szReaderCardNo = "";   //读卡器卡号
            m_szRtuData      = null; //rtu data

            //接管
            m_bSigned = false;

            //播放声音
            m_SoundPlayer = null;

            //硬盘录像机
            // m_VideoRecord = null;
            m_VideoHandle = 0;
            m_Channel1    = 0;     //通道1句柄
            m_Channel2    = 0;     //通道2句柄
            m_Channel3    = 0;     //通道3句柄
            m_Channel4    = 0;     //通道4句柄
            m_Channel5    = 0;     //通道5句柄
            m_Channel6    = 0;     //通道6句柄
            m_Channel7    = 0;     //通道7句柄
            m_Channel8    = 0;     //通道8句柄
            m_bTalk       = false; //是否正在对讲
            m_TalkID      = 0;     //对讲句柄
            m_AudioNum    = 1;     //可使用音频数
            m_IsFirstSend = true;  //还未播放过语音


            m_PointState = ""; //计量点状态
        }