예제 #1
0
        void ExecuteLoadItemsCommand()
        {
            RegisteredDevices.Add(new RegisteredDevice
            {
                Id           = "1",
                Description  = "Smatt Sung's Phone is connected",
                Text         = "OnePlus",
                deviceType   = "Phone",
                device       = "OnePlus 5.0".ToUpper(),
                deviceName   = "OnePlus 5",
                manufacturer = "OnePlus",
                version      = "5.0",
                platform     = "Android",
                idiom        = "Phone",
                Flash        = "Flash",
                Sound        = "Sound",
                Vibration    = "Vibration",
                Distance     = "34",
                Measurement  = "ft"
            });
            RegisteredDevices.Add(new RegisteredDevice
            {
                Id           = "1",
                Description  = "Micheal Smith's watch is Connected",
                Text         = "Samsung Watch",
                deviceType   = "Wear",
                device       = "Galaxy Watch".ToUpper(),
                deviceName   = "LRS",
                manufacturer = "Samsung",
                version      = "10.0",
                platform     = "Android",
                idiom        = "Watch",
                Flash        = "Flash",
                Sound        = "Sound",
                Vibration    = "Vibration",
                Distance     = "43",
                Measurement  = "ft"
            });

            RegisteredDevices.Add(new RegisteredDevice
            {
                Id           = "1", Description = "Jonh Doe's Watch is connected",
                Text         = "Moto Watch", deviceType = "Wear",
                device       = "LRS 365".ToUpper(), deviceName = "LRS",
                manufacturer = "Motorola", version = "7.0",
                platform     = "Android", idiom = "Watch",
                Flash        = "Flash",
                Sound        = "Sound",
                Vibration    = "Vibration",
                Distance     = "25",
                Measurement  = "ft"
            });
        }
예제 #2
0
 public void RemoveRegisteredDevice(IDevice device)
 {
     if (device != null)
     {
         RegisteredDevices.Remove(device);
         SaveDeviceCollection();
     }
     else
     {
         throw new NoDeviceException();
     }
 }
예제 #3
0
        internal bool IgnoreMessage(SsdpMessageEventArgs args, bool isMulticast)
        {
            string usn;

            if (args.Headers.TryGetValue("USN", out usn))
            {
                // USN=uuid:b67df29b5c379445fde78c3774ab518d::urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1
                if (RegisteredDevices.Any(i => string.Equals(i.USN, usn, StringComparison.OrdinalIgnoreCase)))
                {
                    //var headerTexts = args.Headers.Select(i => string.Format("{0}={1}", i.Key, i.Value));
                    //var headerText = string.Join(",", headerTexts.ToArray());

                    //var protocol = isMulticast ? "Multicast" : "Unicast";
                    //var localEndPointString = args.LocalEndPoint == null ? "null" : args.LocalEndPoint.ToString();
                    //_logger.Debug("IGNORING {0} message received from {1} on {3}. Protocol: {4} Headers: {2}", args.Method, args.EndPoint, headerText, localEndPointString, protocol);

                    return(true);
                }
            }

            string serverId;

            if (args.Headers.TryGetValue("X-EMBY-SERVERID", out serverId))
            {
                if (string.Equals(serverId, _appHost.SystemId, StringComparison.OrdinalIgnoreCase))
                {
                    //var headerTexts = args.Headers.Select(i => string.Format("{0}={1}", i.Key, i.Value));
                    //var headerText = string.Join(",", headerTexts.ToArray());

                    //var protocol = isMulticast ? "Multicast" : "Unicast";
                    //var localEndPointString = args.LocalEndPoint == null ? "null" : args.LocalEndPoint.ToString();
                    //_logger.Debug("IGNORING {0} message received from {1} on {3}. Protocol: {4} Headers: {2}", args.Method, args.EndPoint, headerText, localEndPointString, protocol);

                    return(true);
                }
            }

            return(false);
        }
예제 #4
0
    public void LoadDeviceCollection()
    {
        RegisteredDevices.Clear();                      // just for safety but it's not even neccesary, because LoadDeviceCollection() gets only called when the app starts or when the registeredDevice array is already empty

        DeviceCollectionData deviceCollectionData = SaveAndLoadSystem.LoadDeviceCollection();

        if (deviceCollectionData != null)
        {
            if (deviceCollectionData.DeviceDataList != null)
            {
                for (int i = 0; i < deviceCollectionData.DeviceDataList.Length; i++)
                {
                    DeviceData deviceData = (DeviceData)deviceCollectionData.DeviceDataList[i];
                    IDevice    device     = null;

                    Debug.Log("device type name: " + deviceData.GetType().Name);

                    switch (deviceData.GetType().Name)
                    {
                    case "LampData":
                        device = new Lamp(deviceData.DeviceName, deviceData.Id, deviceData.Name);
                        break;

                    default:
                        Debug.LogError("Unknown Device Data Type");
                        break;
                    }

                    if (device != null)
                    {
                        device.LoadDevice(deviceData);
                        RegisteredDevices.Add(device);
                    }
                }
            }

            AllDevicesOff = deviceCollectionData.AllDevicesOff;
        }
    }
예제 #5
0
 public DeviceTokensController(RegisteredDevices registry)
 {
     this.registry = registry;
 }