Esempio n. 1
0
        private void PollAttribute(string deviceId, ICharacteristicInfo attribute)
        {
            var poller = new ActiveDevicePollerFactory().Create(attribute);

            if (poller.TryPollDevice(deviceId, out object value))
            {
                string formatedValue = value.ToString();

                Console.WriteLine($"  {attribute.Service.Name}.{attribute.Name}: {formatedValue}");
            }
            else
            {
                Console.WriteLine($"  Failed to poll {attribute.Service.Name}.{attribute.Name}");
            }
        }
 public IActiveDevicePoller Create(ICharacteristicInfo characteristic)
 {
     return(new SimpleDevicePoller(characteristic.Service.Uuid, characteristic.Uuid, characteristic.PresentationFormat));
 }
Esempio n. 3
0
        private void Dump(ICharacteristicInfo attribute)
        {
            var formatedProperties = attribute.Properties.ToString();

            Console.WriteLine($"  {attribute.Service.Name}.{attribute.Name} [{formatedProperties}]");
        }