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); } }
public static CameraServer GetInstance() { if (instance == null) { lock (objLock) { if (instance == null) { instance = new CameraServer(); } } } return(instance); }
/// <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(); } } }); }