예제 #1
0
        private void CreateDeviceWatcher()
        {
            m_Attachment = new AllJoynBusAttachment();
            m_Attachment.Connect();

            m_LampWatcher        = new LampWatcher(m_Attachment);
            m_LampWatcher.Added += Lamp_Added;
            m_LampWatcher.Start();
        }
        private async void Lamp_Added(LampWatcher sender, AllJoynServiceInfo args)
        {
            LampJoinSessionResult joinSessionResult = await LampConsumer.JoinSessionAsync(args, sender);

            if (joinSessionResult.Status == AllJoynStatus.Ok)
            {
                m_Lamps.Add(joinSessionResult.Consumer);
                joinSessionResult.Consumer.SessionLost += Consumer_SessionLost;
            }
        }
        public VoiceCommandHandler()
        {
            m_Lamps = new List <LampConsumer>();

            m_Attachment = new AllJoynBusAttachment();
            m_Attachment.Connect();

            m_Watcher        = new LampWatcher(m_Attachment);
            m_Watcher.Added += Lamp_Added;
        }
예제 #4
0
        private async void Lamp_Added(LampWatcher sender, AllJoynServiceInfo args)
        {
            LampJoinSessionResult joinSessionResult = await LampConsumer.JoinSessionAsync(args, sender);

            if (joinSessionResult.Status == AllJoynStatus.Ok)
            {
                LampConsumer lampConsumer = joinSessionResult.Consumer;

                // Create ViewModel object from LampConsumer and add to the Lamps collection
                // Using args.ObjectPath for the name of the device. One could use args.UniqueId for an
                // Id property for lamps lookup from a dictionary.
                Lamp lamp = new Lamp(args.ObjectPath, lampConsumer);
                Lamps.Add(lamp);

                lamp.SessionLost += Lamp_SessionLost;
            }
        }
예제 #5
0
        public int Start()
        {
            AllJoynBusAttachment busAttachment = new AllJoynBusAttachment();
            busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous);
            var data = busAttachment.AboutData;
            data.DefaultManufacturer = "Protosystem";
            data.DefaultAppName = "LIFX Client";

            LampWatcher lampWatcher = new LampWatcher(busAttachment);
            lampWatcher.Added += LampWatcher_Added;
            lampWatcher.Start();

            //var model = new LampStateViewModel(this);
            //model.Name = "TEst";
            //Lamps.Add(model);

            return 0;
        }