|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.util.ObservableEventSourceImpl<Sample>
de.unikassel.android.sdcframework.devices.AbstractSensorDeviceScanner
de.unikassel.android.sdcframework.devices.SampleReceivingDeviceScanner
public abstract class SampleReceivingDeviceScanner
Abstract base class for scanner types, which do receive sensor data from
system broadcasts after the explicit initiation of a system scan.
Such a scanner does run a thread to trigger device scans in the configured
frequency and it is using a broadcast receiver to receive the scan results.
Extending classes have to define the related Intent and to implement the
handler for received samples, as
well as the start and
stop methods for the system scan.
WifiDeviceScanner
,
BluetoothDeviceScanner
Nested Class Summary | |
---|---|
private class |
SampleReceivingDeviceScanner.ScanWorkerThread
Inner class for a device polling worker thread |
Field Summary | |
---|---|
protected AtomicBoolean |
lastScanFinished
Flag indicating if last scan has finished ( minimal scan frequency is always limited by device speed ) |
protected BroadcastReceiver |
receiver
The broadcast receiver for the device scan results |
protected SampleReceivingDeviceScanner.ScanWorkerThread |
worker
the worker thread |
Constructor Summary | |
---|---|
SampleReceivingDeviceScanner()
Constructor |
Method Summary | |
---|---|
protected abstract void |
doHandleScanResults(Intent intent)
Handler for the device scan results |
protected abstract boolean |
doStartDeviceScan()
Method to start a device scan |
protected abstract void |
doStopDeviceScan()
Method to stop a device scan which is called if scanner is stopped while a scan is ongoing |
protected abstract IntentFilter |
getIntentFilter()
Getter for intent filter used by the broadcast receiver |
boolean |
isLastScanFinished()
Getter for the lastScanFinished |
void |
onDestroy(Context context)
Is called when the owner destroys this scanner |
private void |
registerReceiver(Context context)
Does register the broadcast receiver for device scan results |
void |
setLastScanFinished(boolean lastScanFinished)
Setter for the lastScanFinished |
boolean |
start(Context context)
Does start sampling |
boolean |
stop(Context context)
Does stop sampling |
private void |
unregisterReceiver(Context context)
Does unregister the broadcast receiver for device scan results |
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractSensorDeviceScanner |
---|
enable, getDevice, isActive, isCompatibleDevice, isEnabled, setActive, setDevice |
Methods inherited from class de.unikassel.android.sdcframework.util.ObservableEventSourceImpl |
---|
getObservers, hasObservers, notify, onObserverRegistration, onObserverUnregistration, registerEventObserver, removeAllObservers, unregisterEventObserver |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ObservableEventSource |
---|
hasObservers, notify |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ObserverRegistration |
---|
registerEventObserver, removeAllObservers, unregisterEventObserver |
Field Detail |
---|
protected final BroadcastReceiver receiver
protected final SampleReceivingDeviceScanner.ScanWorkerThread worker
protected AtomicBoolean lastScanFinished
Constructor Detail |
---|
public SampleReceivingDeviceScanner()
Method Detail |
---|
public final boolean start(Context context)
SensorDeviceScanner
context
- the application context
public final boolean stop(Context context)
SensorDeviceScanner
context
- the application context
private final void registerReceiver(Context context)
context
- the application contextprivate final void unregisterReceiver(Context context)
context
- the application contextpublic final boolean isLastScanFinished()
public final void setLastScanFinished(boolean lastScanFinished)
lastScanFinished
- the lastScanFinished to setpublic void onDestroy(Context context)
SensorDeviceScanner
onDestroy
in interface SensorDeviceScanner
onDestroy
in class AbstractSensorDeviceScanner
context
- the application contextprotected abstract IntentFilter getIntentFilter()
protected abstract void doHandleScanResults(Intent intent)
intent
- the broadcast intent to handleprotected abstract boolean doStartDeviceScan()
protected abstract void doStopDeviceScan()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |