|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
de.unikassel.android.sdcframework.util.AbstractWorkerThread
de.unikassel.android.sdcframework.util.AbstractAsynchrounousSampleObserver
de.unikassel.android.sdcframework.broadcast.SampleBroadcastServiceImpl
public class SampleBroadcastServiceImpl
Implementation of the sample broadcast service interface.
This service can observe a sample event source, like the device manager, and
is broadcasting observed samples with the configured frequency to the system.
SampleBroadcastService
,
AbstractAsynchrounousSampleObserver
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private Context |
applicationContext
The application context for broadcasts |
private AtomicLong |
frequency
The broadcast frequency in milliseconds |
private Object |
frequencyWaitLock
The frequency wait lock |
private AtomicLong |
lastExecutionTimeStamp
The timestamp of the last execution |
Fields inherited from class de.unikassel.android.sdcframework.util.AbstractAsynchrounousSampleObserver |
---|
collector |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SampleBroadcastServiceImpl(Context applicationContext,
long frequency)
Constructor |
Method Summary | |
---|---|
private void |
broadcastCachedSamples()
Method to broadcast all cached samples |
protected void |
doSignalFrequencyChange()
Method to signal frequency changes |
protected void |
doWork()
The working method executed in the running loop if started |
void |
onPause(Context applicationContext)
Pause method |
void |
onResume(Context applicationContext)
Resume method |
void |
updateFrequency(long frequency)
Method to update the frequency of broadcasts in milliseconds (>= 0 ms). |
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractAsynchrounousSampleObserver |
---|
doCleanUp, getObserver, onCreate, onDestroy |
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractWorkerThread |
---|
doTerminate, hasTerminated, isLogging, isWorking, logMessage, run, setLogging, start, startWork, stopWork |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.WorkerThread |
---|
doTerminate, hasTerminated, isLogging, isWorking, setLogging, startWork, stopWork |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.LifeCycleObject |
---|
onCreate, onDestroy |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.DelegatingSampleObserver |
---|
getObserver |
Field Detail |
---|
private final Context applicationContext
private final AtomicLong frequency
private final Object frequencyWaitLock
private final AtomicLong lastExecutionTimeStamp
Constructor Detail |
---|
public SampleBroadcastServiceImpl(Context applicationContext, long frequency)
applicationContext
- the application contextfrequency
- the frequencyMethod Detail |
---|
public void onResume(Context applicationContext)
LifeCycleObject
onResume
in interface LifeCycleObject
onResume
in class AbstractAsynchrounousSampleObserver
applicationContext
- the application contextpublic void onPause(Context applicationContext)
LifeCycleObject
onPause
in interface LifeCycleObject
onPause
in class AbstractAsynchrounousSampleObserver
applicationContext
- the application contextprotected void doWork()
AbstractWorkerThread
doWork
in class AbstractWorkerThread
private void broadcastCachedSamples()
public void updateFrequency(long frequency)
SampleBroadcastService
updateFrequency
in interface SampleBroadcastService
frequency
- the new frequency valueprotected void doSignalFrequencyChange()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |