public static BLE_PropertiesUpdateDataModel CreatePropertiesUpdateData(this DeviceInformationUpdate updateInfo)
        {
            BLE_PropertiesUpdateDataModel dm = new BLE_PropertiesUpdateDataModel()
            {
                Id = updateInfo.Id,
                ServiceProperties = CreatePropertiesDictionary(updateInfo.Properties),
            };

            return(dm);
        }
Ejemplo n.º 2
0
        /// <summary>Fired when the device is changed</summary>
        /// <param name="sender"></param>
        /// <param name="updateInfo"></param>
        private void DevWatcher_Updated(DeviceWatcher sender, DeviceInformationUpdate updateInfo)
        {
            this.log.Info("DevWatcher_Updated", "------------------------------ START -----------------------------------------------------");
            this.log.Info("DevWatcher_Updated", () => string.Format("***** {0}", updateInfo.Id));
            WrapErr.ToErrReport(9999, () => {
                BLE_PropertiesUpdateDataModel dm = updateInfo.CreatePropertiesUpdateData();
                this.DeviceUpdated?.Invoke(this, dm);

                //this.devic

                //if (updateInfo.Properties != null) {
                //    foreach (var p in updateInfo.Properties) {
                //        string value = "Unhandled";
                //        switch (p.Key) {
                //            case "System.Devices.Aep.ContainerId":
                //            case "Id":
                //            case "System.ItemNameDisplay": // *
                //            case "System.Devices.Icon":
                //            case "System.Devices.GlyphIcon":
                //                value = (string)p.Value;
                //                break;
                //            case "System.Devices.Aep.IsPaired": // *
                //            case "System.Devices.Aep.IsConnected":
                //            case "System.Devices.Aep.IsConnectable":
                //            case "System.Devices.Aep.CanPair": // *
                //                value = string.Format("{0}", (bool)p.Value);
                //                break;
                //                // "System.Devices.Icon"
                //                // "System.Devices.GlyphIcon"

                //        }
                //        this.log.Info("DevWatcher_Updated", () => string.Format("    Property:{0}  Value:{1}", p.Key, value));
                //    }
                //}
            });
            this.log.Info("DevWatcher_Updated", "------------------------------ END -----------------------------------------------------");
        }