public static DeviceModels GetDeviceModel(string cSerial)
        {
            DeviceNames ds    = GetDeviceName(cSerial);
            string      cName = GetDeviceNameDescription(ds);

            if (cName.Contains("iDBlock"))
            {
                return(DeviceModels.iDBlock);
            }
            else if (cName.Contains("iDBox"))
            {
                return(DeviceModels.iDBox);
            }
            else if (cName.Contains("iDFit"))
            {
                return(DeviceModels.iDFit);
            }
            else if (cName.Contains("iDLight"))
            {
                return(DeviceModels.iDLight);
            }
            else if (cName.Contains("iDAccessProx") || cName.Contains("iDAccess Prox"))
            {
                return(DeviceModels.iDAccessProx);
            }
            else if (cName.Contains("iDFlex"))
            {
                return(DeviceModels.iDFlex);
            }
            else
            {
                return(DeviceModels.iDAccess);
            }
        }
Exemplo n.º 2
0
        public void Initialize(BasicWarehouse warehouse)
        {
            _warehouse = warehouse;
            try
            {
                List <string> devices = DeviceNames.Split('|').ToList();

                if (_segmentList.Count == 0)
                {
                    devices.ForEach(p =>
                    {
                        _warehouse.Segment[p].NotifyVM.Add(new Action <ConveyorBasicInfo>(pp => OnDataChange(pp, p)));
                        _segmentList.Add(_warehouse.Segment[p]);
                        _segmentStatusDict.Add(p, new SegmentStatus());
                    });
                }

                Messenger.Default.Register <MessageAccessLevel>(this, (mc) => { AccessLevel = mc.AccessLevel; });
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, e.Message);
                throw new Exception(string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
Exemplo n.º 3
0
 void GetVideoDevices()
 {
     DeviceNames.Clear();
     //Find system video devices
     DsDevice[] _SystemCameras = DsDevice.GetDevicesOfCat(DirectShowLib.FilterCategory.VideoInputDevice);
     foreach (DsDevice d in _SystemCameras)
     {
         DeviceNames.Add(d.Name);
     }
 }
Exemplo n.º 4
0
        public bool Publish(int port, string appendToName)
        {
            Port = port;
            RegisterService service;

            try
            {
                service = new RegisterService();
            }
            catch (Exception e)
            {
                BonjourInstalled = false;
                log.Error("Unable to register service: " + e.Message);
                ShowBonjourDialog();
                return(false);
            }

            string name;

            try
            {
                name = Environment.MachineName.ToLower();
            }
            catch (Exception e)
            {
                name = "PocketStrafe Companion";
            }

            name += (" - " + appendToName);

            service.Name        = name;
            service.RegType     = "_IAmTheBirdman._udp";
            service.ReplyDomain = "local.";
            service.Port        = (short)port;

            TxtRecord record = null;

            log.Info(String.Format("!! Registering name = '{0}', type = '{1}', domain = '{2}'",
                                   service.Name,
                                   service.RegType,
                                   service.ReplyDomain));

            service.Response += OnRegisterServiceResponse;

            service.Register();

            PublishedServices.Add(service);
            DeviceNames.Add(appendToName);
            DeviceCount = DeviceNames.Count;
            return(true);
        }
        public static string GetDeviceNameDescription(DeviceNames dvm)
        {
            Type                 tp = typeof(DeviceNames);
            FieldInfo            fi = tp.GetField(dvm.ToString());
            DescriptionAttribute da = fi.GetCustomAttribute <DescriptionAttribute>();

            if (da != null)
            {
                return(da.Description);
            }
            else
            {
                return("(não especificado)");
            }
        }
        // Process each found device in the event handler
        void deviceLocator_DeviceAvailable(object sender, DeviceAvailableEventArgs e)
        {
            DeviceNames.Add(e.DiscoveredDevice.DescriptionLocation.ToString());
            //Can retrieve the full device description easily though.

            /*var fullDevice = await e.DiscoveredDevice.GetDeviceInfo();
             * try
             * {
             *  if (fullDevice != null)
             *      DeviceNames.Add(fullDevice.FriendlyName);
             * }
             * catch
             * {
             *  Android.Util.Log.Debug("CommunicationController: searchFordevices method", "Null Error");
             * }*/
            DeviceCount++;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Remove the last service that was published.
        /// </summary>
        public void RemoveLastService()
        {
            // Do not allow removal of primary device
            if (DeviceNames.Count == 1)
            {
                log.Info("Can't remove primary device. Return.");
                return;
            }

            // get last-added device name and remove it
            string name = DeviceNames.Last();

            DeviceNames.Remove(name);
            DeviceCount = DeviceNames.Count;
            log.Info("Removed " + name + " from device list.");

            // unpublish service containing this name
            Unpublish(name);
            ResourceSoundPlayer.TryToPlay(Properties.Resources.beep_bad);
        }