Example #1
0
 public void MessageReceived(LCM.LCM.LCM lcm, string channel, LCMDataInputStream data_stream)
 {
     if (channel == Channels.discovery_res_channel)
     {
         discovery_response_t response = new discovery_response_t(data_stream);
         Notification.Instance.GetEvent <DiscoveryResponseReceivedEvent>().Publish(response);
     }
 }
Example #2
0
        private void OnGetDiscoveryResponse(discovery_response_t res)
        {
            foreach (CameraInfo item in camList)
            {
                item.stopUpdatePTZ();
            }
            camList.Clear();
            IP2CameraInfo.Clear();
            List <string> temp = new List <string>();

            foreach (string ip in res.ip_addresses)
            {
                if (!temp.Contains(ip))
                {
                    temp.Add(ip);
                    CameraInfo cam;
                    if (ip2CameraName.ContainsKey(ip))
                    {
                        cam = new CameraInfo(ip, ip2CameraName[ip], 0, 0, 1);
                        foreach (CameraNameWrapper item in cameraNameList)
                        {
                            if (item.AssociatedIP == ip)
                            {
                                cam.UserName = item.username;
                                cam.Password = item.password;
                            }
                        }
                    }
                    else
                    {
                        cam = new CameraInfo(ip, null, 0, 0, 1);
                    }

                    camList.Add(cam);
                    IP2CameraInfo[ip] = cam;
                }
            }

            _ea.GetEvent <StatusUpdateEvent>().Publish("Camera discovery finished");
            _ea.GetEvent <CameraDiscoveredEvent>().Publish(camList);
        }