Exemplo n.º 1
0
        /// <summary>
        /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点
        /// </summary>
        /// <returns></returns>
        public static RobotDevice GetInstance()
        {
            if (m_UniqueRobot == null)
            {
                lock (m_Locker)
                {
                    if (m_UniqueRobot == null)
                    {
                        m_UniqueRobot = new RobotDevice();
                    }
                }
            }

            return(m_UniqueRobot);
        }
Exemplo n.º 2
0
        public void InitWorkstatiionAndStart()
        {
            //检查共享文件夹是否存在,存在则直接存储文件,不存在则创建共享文件夹
            if (!Directory.Exists(NsfTrayModule.m_FileFolder))
            {
                //Directory.CreateDirectory(NsfTrayModule.m_FileFolder);
                //m_NetShare.CallShareBatFile(m_CreateShare);
                Global.MessageBoxShow(Global.StrCreateShareFolder);
            }

            //Robot
            m_Robot = RobotDevice.GetInstance();
            bool Re = m_Robot.InitRobot();

            if (!Re)
            {
                DataStruct.SysStat.RobotOk = false;
                m_SysAlarm.SetAlarm(SysAlarm.Type.Robot, true);
                Global.MessageBoxShow(Global.StrRobotInitError);
            }
            else
            {
                DataStruct.SysStat.RobotOk = true;
                m_Robot.ServoOn();
                //m_Robot.RunSelectedProgram(1);
                m_Robot.m_PointList = m_Robot.GetGlobalPointData();
            }

            //RFID
            m_RFID = RFID.GetInstance();
            Re     = m_RFID.Connect(Profile.m_Config.RfidIp);
            if (!Re)
            {
                DataStruct.SysStat.RfidOk = false;
                m_SysAlarm.SetAlarm(SysAlarm.Type.RFID, true);
            }
            else
            {
                m_RFID.m_CurCh = Profile.m_Config.RfidCh;
                m_RFID.Init(m_RFID.m_CurCh);
                m_RFID.Enable(m_RFID.m_CurCh);

                DataStruct.SysStat.RfidOk = true;
                m_SysAlarm.SetAlarm(SysAlarm.Type.RFID, false);
            }

            //二维码
            m_QRCode = QRCode.GetInstance();
            string Port     = Profile.m_Config.QRCodePort;
            string BandRate = Profile.m_Config.QRCodeBandRate;

            m_QRCode.QRCodeCommunParamInit(Port, BandRate);
            Re = m_QRCode.QRCodeInit();
            if (!Re)
            {
                DataStruct.SysStat.QRCodeOk = false;
                m_SysAlarm.SetAlarm(SysAlarm.Type.QRCode, true);
            }
            else
            {
                DataStruct.SysStat.QRCodeOk = true;
                m_SysAlarm.SetAlarm(SysAlarm.Type.QRCode, false);
            }
        }