public abstract bool Authenticate(WakeLock wakeLock);
public abstract void Connect(WakeLock wakeLock);
public override bool Authenticate(WakeLock wakeLock) { throw new NotImplementedException(); }
public override void Connect(WakeLock wakeLock) { throw new NotImplementedException(); }
private static void StartInternal(Service registeredService, WakeLock wakeLock) { if (IsManualSettingsNeeded(registeredService)) { throw new ServiceSchedulerException("Service " + registeredService.Information.ServiceName + " needs manual input for settings."); } if (!IsRegistered(registeredService)) { throw new ServiceSchedulerException("Could not locate service " + registeredService.Information.ServiceName + ". Are you sure you registered it?"); } if (IsRunning(registeredService)) { throw new ServiceSchedulerException(registeredService.Information.ServiceName + " service is already running."); } ClearFailures(registeredService); ServiceEvents.RaiseServiceSettingsLoaded(registeredService); Action connect = () => { try { registeredService.Connect(wakeLock); } catch (NotImplementedException) { } catch (ServiceSpecialRestartException) { throw; } catch (ServiceExpiredException) { throw; } catch (Exception ex) { GetFlags(registeredService).ConnectionFailed = true; throw new Exception("Service " + registeredService.Information.ServiceName + " flat out failed to connect. Problem: " + ex); } }; Action authenticate = () => { try { var authSuccess = registeredService.Authenticate(wakeLock); if (!authSuccess) { throw new Exception("Failed authentication " + registeredService.Information.ServiceName + "."); } } catch (NotImplementedException) { } catch (ServiceSpecialRestartException) { throw; } catch (ServiceExpiredException) { throw; } catch (Exception ex) { GetFlags(registeredService).AuthenticationFailed = true; throw new Exception("Service " + registeredService.Information.ServiceName + " flat out failed to authenticate. Problem: " + ex); } }; if (registeredService.Information.Procedure == ServiceInfo.ProcedureType.AuthenticateConnect) { authenticate(); connect(); } else if (registeredService.Information.Procedure == ServiceInfo.ProcedureType.ConnectAuthenticate) { connect(); authenticate(); } GetFlags(registeredService).Running = true; ServiceEvents.RaiseServiceStarted(registeredService); }
public static void StartUnified(UnifiedService unifiedService, WakeLock wakeLock) { StartInternal(unifiedService, wakeLock); }
public TemporaryFree(WakeLock wakeLock) { _wakeLock = wakeLock; _wakeLock.TemporaryRelease(); }
public void ScheduleWakeLock(WakeLock newWakeLock) { _wakeLockBalancer.ScheduleWakeLock(newWakeLock); }
public void RemoveWakeLock(WakeLock newWakeLock) { _wakeLockBalancer.RemoveWakeLock(newWakeLock); }