Beispiel #1
0
        /// <summary>
        /// 각 호실 클릭 이벤트
        /// </summary>
        public void Room_Item_Click(object sender, EventArgs e)
        {
            arrIdx = 0;
            UpdateGroupStatusItem();
            RoomInfoVO riVo = sender as RoomInfoVO;

            nvrc = new NVRControll();

            AddEventHistoryItem();

            if ("C".Equals(riVo.roomStatus))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].groupCode.Equals(riVo.groupCode) && list[i].roomCode.Equals(riVo.roomCode))
                    {
                        list.RemoveAt(i);
                    }
                }

                if (list.Count == 0)
                {
                    nvrc.MoveCameraPTZ("2", null, null, "1", null);
                }
            }
            else
            {
                list.Add(riVo);
                nvrc.MoveCameraPTZ("2", null, null, riVo.preset, null);
                aTimer.Stop();
                aTimer.Start();
            }

            Console.WriteLine("=================== size :: " + list.Count);
        }
Beispiel #2
0
        private void Timer_tick(Object source, EventArgs e)
        {
            Console.WriteLine("========================= Timer Interval =========================");

            if (list.Count > 0)
            {
                Console.WriteLine("=================== preset :: " + list[arrIdx].preset);
                nvrc.MoveCameraPTZ("2", null, null, list[arrIdx].preset, null);
                if (arrIdx + 1 == list.Count)
                {
                    arrIdx = 0;
                }
                else
                {
                    arrIdx++;
                }
            }
            else
            {
                aTimer.Stop();
                arrIdx = 0;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 센서 정보 수신
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            if (serialPort1.IsOpen)
            {
                string data = serialPort1.ReadExisting();

                if (data.Trim() != string.Empty)
                {
                    char[] values = data.ToCharArray();
                    int    value  = Convert.ToInt32(values[0]);

                    if (data.Trim() != sensorSignal)
                    {
                        if (!String.IsNullOrEmpty(data.Trim()) && data.Trim().Length == 1)
                        {
                            arrIdx = 0;
                            if (sensorSignal == "")
                            {
                                isOpenFlag = true;
                            }

                            sensorSignal = data.Trim();
                            string status = util.SensorDataToStatusCode(data.Trim());

                            RoomInfoVO riVo = new RoomInfoVO();
                            nvrc = new NVRControll();
                            GroupItemClickEvent(sensorGroupCode);
                            JObject json = UpdateRoomStatusItemBySensor(sensorGroupCode, sensorRoomCode, status);
                            riVo.groupCode      = json["groupCode"].ToString();
                            riVo.groupName      = json["groupName"].ToString();
                            riVo.roomCode       = json["roomCode"].ToString();
                            riVo.roomName       = json["roomName"].ToString();
                            riVo.roomStatusName = json["roomStatusName"].ToString();
                            riVo.roomStatus     = json["roomStatus"].ToString();
                            riVo.preset         = json["preset"].ToString();

                            UpdateGroupStatusItem();
                            AddEventHistoryItem();

                            Console.WriteLine("========================== test ========================");
                            if (data.Trim() == "1")
                            {
                                for (int i = 0; i < list.Count; i++)
                                {
                                    if (list[i].groupCode.Equals(riVo.groupCode) && list[i].roomCode.Equals(riVo.roomCode))
                                    {
                                        list.RemoveAt(i);
                                    }
                                }

                                if (list.Count == 0)
                                {
                                    nvrc.MoveCameraPTZ("2", null, null, "1", null);
                                }
                            }
                            else
                            {
                                list.Add(riVo);
                                nvrc.MoveCameraPTZ("2", null, null, json["preset"].ToString(), null);
                                aTimer.Stop();
                                aTimer.Start();
                            }
                        }
                    }
                }
            }
        }