public ThermoFOTAViewer(IDevice ADevice, IReadOnlyList <IService> services) { BleDevice = ADevice; if (BleDevice == null) { return; } driver = new BleDriver(GUID_SERVICE, GUID_CHAR_OTA_VER, GUID_CHAR_OTA_CTRL, GUID_CHAR_OTA_DATA); ota = new OTA(FOTA_SERVER, driver); ota.StatusChanged += Ota_StatusChanged; ota.Progress += Ota_Progress; InitUI(); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.NumberOfTapsRequired = 1; tapGestureRecognizer.Tapped += Summary_Tapped; Summary.GestureRecognizers.Add(tapGestureRecognizer); Summary_Tapped(null, null); Action.Clicked += Action_Clicked; driver.Init(ADevice, services); ota.CheckUpdate(); }
public static DeviceConfig CreateChangeObject(DeviceConfig currentConfig, DeviceConfig newConfig) { var change = new DeviceConfig(); if (currentConfig.Name != newConfig.Name) { change.Name = newConfig.Name; } if (currentConfig.DeviceID != newConfig.DeviceID) { change.Name = newConfig.DeviceID; } if (!currentConfig.WiFi.Equals(newConfig.WiFi)) { change.WiFi = WiFi.CreateChangeObject(currentConfig.WiFi, newConfig.WiFi); } if (!currentConfig.MQTT.Equals(newConfig.MQTT)) { change.MQTT = MQTT.CreateChangeObject(currentConfig.MQTT, newConfig.MQTT); } if (!currentConfig.OTA.Equals(newConfig.OTA)) { change.OTA = OTA.CreateChangeObject(currentConfig.OTA, newConfig.OTA); } change.Settings = CreateChangeSettings(currentConfig.Settings, newConfig.Settings); return(change); }
public static OTA CreateChangeObject(OTA currentOTA, OTA newOTA) { var change = new OTA(); if (currentOTA.Enabled != newOTA.Enabled) { change.Enabled = newOTA.Enabled; } return(change); }
public override int GetHashCode() { return ((Name != null ? Name.GetHashCode() : 0) + (DeviceID != null ? DeviceID.GetHashCode() : 0) + (WiFi != null ? WiFi.GetHashCode() : 0) + (MQTT != null ? MQTT.GetHashCode() : 0) + (OTA != null ? OTA.GetHashCode() : 0) + (Settings != null ? Settings.Select(item => (item.Key.GetHashCode() + item.Value.GetHashCode()).GetHashCode()).Sum(item => (long)item).GetHashCode() : 0)); }
public static bool OnPressurePlateTriggered(OTA.Command.Sender sender, int x, int y) { var ctx = new HookContext(); var args = new HookArgs.PressurePlateTriggered() { Sender = sender, X = x, Y = y }; HookPoints.PressurePlateTriggered.Invoke(ref ctx, ref args); return ctx.Result == HookResult.DEFAULT; }
public void OnListeningForCommands(ref HookContext ctx, ref OTA.Commands.Events.CommandArgs.Listening args) { RunComponent(ComponentEvent.ReadyForCommands); }