Пример #1
0
    async void StartLivX()
    {
        client = await LifxClient.CreateAsync();

        client.DeviceDiscovered += Client_DeviceDiscovered;
        // client.DeviceLost += Client_DeviceLost;
        client.StartDeviceDiscovery();
    }
        public async Task InitAsync(Dictionary <string, string> parameters)
        {
            _client = await LifxClient.CreateAsync();

            _client.DeviceDiscovered += _client_DeviceDiscovered;
            _client.DeviceLost       += _client_DeviceLost;
            _client.StartDeviceDiscovery();

            if (!parameters.TryGetValue("SELECTED_DEVICE", out _initLabel))
            {
                throw new Exception("SELECTED_DEVICE parameter is not defined.");
            }
        }
Пример #3
0
        public void InitialiseBulbs()
        {
            // Wait for bulb task to warm up
            var task = LifxClient.CreateAsync();

            task.Wait();
            client = task.Result;

            // Attach discovery event handlers
            client.DeviceDiscovered += Client_DeviceDiscoveredAsync;
            client.DeviceLost       += Client_DeviceLost;

            // Trigger discovery process
            client.StartDeviceDiscovery();
        }
Пример #4
0
        public async Task <List <LifxData> > Discover(int timeOut)
        {
            if (_client == null)
            {
                return(new List <LifxData>());
            }
            bulbs = new List <LightBulb>();
            _client.DeviceDiscovered += Client_DeviceDiscovered;
            _client.StartDeviceDiscovery();
            LogUtil.Write("Lifx: Discovery started.");
            await Task.Delay(timeOut * 1000);

            LogUtil.Write("Discovery completed.");
            _client.StopDeviceDiscovery();
            return(bulbs.Select(GetBulbInfo).ToList());
        }
Пример #5
0
        public static async Task Init(bool startHTTPListener = true)
        {
            if (startHTTPListener)
            {
                Log.Bulb("Starting BixListens");
                var bixListens = new BixListens();
                bixListens.OnHttpEventReceived += BixListens_OnHttpEventReceived;
            }

            Log.Bulb("Creating LifxClient");
            _client = await LifxClient.CreateAsync();

            _client.DeviceDiscovered += Client_DeviceDiscovered;
            _client.DeviceLost       += Client_DeviceLost;
            Log.Bulb("Start Device Discovery");
            _client.StartDeviceDiscovery();
        }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        var task = LifxClient.CreateAsync();

        task.Wait();
        Client = task.Result;
        Client.DeviceDiscovered += Client_DeviceDiscovered;
        Client.DeviceLost       += Client_DeviceLost;
        Client.StartDeviceDiscovery();

        // Print the label of each device
        Client.Devices.ToList().ForEach(device => Debug.Log(Client.GetDeviceLabelAsync(device)));

        // MIDI IN 4
        OpenMidiDevice(
            Tuple.Create("MIDIIN4 (mio4)", 10)
            );
    }