コード例 #1
0
ファイル: Program.cs プロジェクト: XiaLiuMa/XiaLM.RobotWork
        static void Main(string[] args)
        {
            Console.WriteLine("程序已启动,输入Q/q退出程序!");
            CameraServer.GetInstance().Init(12368);
            string txt = string.Empty;

            while (!(txt = Console.ReadLine()).ToUpper().Equals("Q"))
            {
                Console.WriteLine(txt);
            }
        }
コード例 #2
0
 public static CameraServer GetInstance()
 {
     if (instance == null)
     {
         lock (objLock)
         {
             if (instance == null)
             {
                 instance = new CameraServer();
             }
         }
     }
     return(instance);
 }
コード例 #3
0
        /// <summary>
        /// 发送报警信息
        /// </summary>
        public void SendAlarm()
        {
            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Thread.Sleep(TimeSpan.FromSeconds(5));
                    if (temperature <= 5)
                    {
                        BaseAlarmInfo baseAlarmInfo = new BaseAlarmInfo()
                        {
                            xpoint      = (ushort)12,
                            ypoint      = (ushort)24,
                            temperature = (short)-3
                        };
                        string objStr = SerializeHelper.SerializeObjectToJson(baseAlarmInfo);
                        byte[] body   = Encoding.UTF8.GetBytes(objStr);

                        CameraServer.GetInstance().ServerBroadcast(CODE_ALARM, body).Employ();
                    }
                }
            });
        }