public ChooseDeviceTypeViewModel(DeviceSetupService deviceSetupService, DeviceProvisioningRestService deviceProvisioningRestService, IOnboardingRestService onboardingRestService, IWifiService wifiService) : base(deviceSetupService, deviceProvisioningRestService, onboardingRestService, wifiService) { }
public RegisterDeviceViewModel( DeviceSetupService deviceSetupService, IDeviceRestService deviceRestService, IWifiService wifiService, IOnboardingRestService onboardingRestService, DeviceProvisioningRestService deviceProvisioningRestService ) : base(deviceSetupService, deviceProvisioningRestService, onboardingRestService, wifiService) { this.deviceRestService = deviceRestService; }
private void WifiService_CheckingConnectionStatusUpdated(object sender, Common.WiFi.CheckingConnectionStatusUpdatedEventArgs e) { if (e.IsConnected && DeviceSetupService.SSIDIsEdisonDevice(deviceSetupService.CurrentDeviceHotspotNetwork.SSID)) { refreshAvailableNetworksTimer = new System.Timers.Timer(5000); refreshAvailableNetworksTimer.Elapsed += HandleRefreshTimerElapsed; refreshAvailableNetworksTimer.Start(); } }
public DeviceSetupBaseViewModel(DeviceSetupService deviceSetupService, DeviceProvisioningRestService deviceProvisioningRestService, IOnboardingRestService onboardingRestService, IWifiService wifiService) { this.deviceSetupService = deviceSetupService; this.deviceProvisioningRestService = deviceProvisioningRestService; this.onboardingRestService = onboardingRestService; this.wifiService = wifiService; }
public MainViewModel(DeviceSetupService deviceSetupService, IDeviceRestService deviceRestService, AuthService authService, DeviceProvisioningRestService deviceProvisioningRestService, IOnboardingRestService onboardingRestService, IWifiService wifiService ) : base(deviceSetupService, deviceProvisioningRestService, onboardingRestService, wifiService) { this.deviceRestService = deviceRestService; this.authService = authService; }
public SelectWifiViewModel( IOnboardingRestService onboardingRestService, DeviceSetupService deviceSetupService, IWifiService wifiService, DeviceProvisioningRestService deviceProvisioningRestService ) : base(deviceSetupService, deviceProvisioningRestService, onboardingRestService, wifiService) { this.onboardingRestService.SetBasicAuthentication(deviceSetupService.PortalPassword); this.wifiService.CheckingConnectionStatusUpdated += WifiService_CheckingConnectionStatusUpdated; }
public ManageDeviceViewModel( DeviceSetupService deviceSetupService, ILocationService locationService, IDeviceRestService deviceRestService, DeviceProvisioningRestService deviceProvisioningRestService, IOnboardingRestService onboardingRestService, IWifiService wifiService ) : base(deviceSetupService, deviceProvisioningRestService, onboardingRestService, wifiService) { this.locationService = locationService; this.deviceRestService = deviceRestService; }
public async Task UpdateDevice() { var network = await wifiService.GetCurrentlyConnectedWifiNetwork(); if (DeviceSetupService.SSIDIsEdisonDevice(network.SSID)) { await wifiService.ConnectToWifiNetwork(deviceSetupService.OriginalSSID); } else { await CompleteUpdate(); } }
public async Task GetDeviceNetworkInfo() { originalWifiNetwork = await wifiService.GetCurrentlyConnectedWifiNetwork(); if (!DeviceSetupService.SSIDIsEdisonDevice(originalWifiNetwork.SSID)) { deviceSetupService.OriginalSSID = originalWifiNetwork.SSID; await wifiService.ConnectToWifiNetwork(deviceSetupService.CurrentDeviceHotspotNetwork.SSID, deviceSetupService.WiFiPassword); } else { // wifi should already be defined CheckingConnectionStatusUpdated?.Invoke(this, new CheckingConnectionStatusUpdatedEventArgs(this.deviceSetupService.ConnectedWifiSSID)); } }
private void WifiService_CheckingConnectionStatusUpdated(object sender, Common.WiFi.CheckingConnectionStatusUpdatedEventArgs e) { if (e.IsConnected) { if (DeviceSetupService.SSIDIsEdisonDevice(e.SSID)) { onboardingRestService.SetBasicAuthentication(deviceSetupService.PortalPassword); Task.Run(async() => { var networks = await this.onboardingRestService.GetAvailableWifiNetworks(); if (networks != default(IEnumerable <Models.AvailableNetwork>)) { var connectedNetwork = networks.FirstOrDefault(i => i.AlreadyConnected); if (connectedNetwork != default(Models.AvailableNetwork)) { this.wifiService.CheckingConnectionStatusUpdated -= WifiService_CheckingConnectionStatusUpdated; this.deviceSetupService.ConnectedWifiSSID = connectedNetwork.SSID; CheckingConnectionStatusUpdated?.Invoke(this, new CheckingConnectionStatusUpdatedEventArgs(connectedNetwork.SSID)); } else { this.wifiService.CheckingConnectionStatusUpdated -= WifiService_CheckingConnectionStatusUpdated; CheckingConnectionStatusUpdated?.Invoke(this, new CheckingConnectionStatusUpdatedEventArgs("Device Not Using WiFi")); } } else { this.wifiService.CheckingConnectionStatusUpdated -= WifiService_CheckingConnectionStatusUpdated; CheckingConnectionStatusUpdated?.Invoke(this, new CheckingConnectionStatusUpdatedEventArgs("Device Not Connected To a Network")); } await wifiService.DisconnectFromWifiNetwork(new WifiNetwork() { SSID = e.SSID }); }); } else { Task.Run(async() => { await CompleteUpdate(); }); } } }
public override async void ViewAppearing() { base.ViewAppearing(); var currentlyConnectedWifiNetwork = await wifiService.GetCurrentlyConnectedWifiNetwork(); if (!DeviceSetupService.SSIDIsEdisonDevice(currentlyConnectedWifiNetwork.SSID)) { await wifiService.ConnectToWifiNetwork(deviceSetupService.CurrentDeviceHotspotNetwork.SSID); } else { refreshAvailableNetworksTimer = new System.Timers.Timer(5000); refreshAvailableNetworksTimer.Elapsed += HandleRefreshTimerElapsed; } }
private void WifiService_CheckingConnectionStatusUpdated(object sender, Common.WiFi.CheckingConnectionStatusUpdatedEventArgs e) { if (e.IsConnected) { if (DeviceSetupService.SSIDIsEdisonDevice(e.SSID)) { switch (State) { case RegistrationState.ConnectingConnectingToDeviceFirstTime: State = RegistrationState.ConnectedToDevice; Task.Factory.StartNew(async() => { await GenerateDeviceInfo(new WifiNetwork() { SSID = e.SSID }); }, new CancellationTokenSource(TimeSpan.FromSeconds(20)).Token); break; case RegistrationState.ConnectingConnectingToDeviceSecondTime: State = RegistrationState.ConnectedToDevice; Task.Factory.StartNew(async() => { await OnboardDevice(); }, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token); break; default: SetPairingStatusText($"State was set to {State}"); break; } } else { if (State == RegistrationState.DeviceInfoGenerated) { State = RegistrationState.ProvisioningWithCloud; Task.Factory.StartNew(async() => { await ProvisionWithCloud(); }, new CancellationTokenSource(TimeSpan.FromSeconds(20)).Token); } } } }
public async Task <bool> ConnectDeviceToNetwork(string ssid, string password) { this.ssid = ssid; this.password = password; try { var currentlyConnectedWifiNetwork = await wifiService.GetCurrentlyConnectedWifiNetwork(); if (!DeviceSetupService.SSIDIsEdisonDevice(currentlyConnectedWifiNetwork.SSID)) { await wifiService.ConnectToWifiNetwork(deviceSetupService.CurrentDeviceHotspotNetwork.SSID, deviceSetupService.WiFiPassword); } return(true); } catch (Exception e) { logger.Log(e); return(false); } }
private async void WifiService_CheckingConnectionStatusUpdated(object sender, Common.WiFi.CheckingConnectionStatusUpdatedEventArgs e) { if (e.IsConnected && DeviceSetupService.SSIDIsEdisonDevice(e.SSID)) { var result = await onboardingRestService.ConnectToNetwork(new RequestNetworkInformationModel { NetworkInformation = new NetworkInformationModel { Ssid = ssid, Password = password, }, }); if (result.IsSuccess) { //change wifi back await wifiService.DisconnectFromWifiNetwork(deviceSetupService.CurrentDeviceHotspotNetwork); } PasswordSetCompleted?.Invoke(this, result.IsSuccess); } }
public ChooseDeviceTypeViewModel(DeviceSetupService deviceSetupService) { this.deviceSetupService = deviceSetupService; }
public RegisterDeviceViewModel(DeviceSetupService deviceSetupService, IWifiService wifiService) { this.deviceSetupService = deviceSetupService; this.wifiService = wifiService; }
public CompleteRegistrationViewModel(DeviceSetupService deviceSetupService, DeviceProvisioningRestService deviceProvisioningRestService, IOnboardingRestService onboardingRestService, IWifiService wifiService) : base(deviceSetupService, deviceProvisioningRestService, onboardingRestService, wifiService) { }
public void SetDeviceType(DeviceType deviceType) { deviceSetupService.ClearDevice(); deviceSetupService.CurrentDeviceModel.DeviceType = DeviceSetupService.DeviceTypeToString(deviceType); deviceSetupService.IsNew = true; }
public ManualConnectViewModel(DeviceSetupService deviceSetupService, IWifiService wifiService, OnboardingRestService onboardingRestService) { this.deviceSetupService = deviceSetupService; this.wifiService = wifiService; this.onboardingRestService = onboardingRestService; }