|
||||||||||
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.ContentProviderDeviceScanner
public abstract class ContentProviderDeviceScanner
Abstract base class for content provider based device scanner types.
A content provider based scanner does register itself as observer for a
content provider and creates samples from the notified data. It can be used
together with the VirtualSensorDevice
to create virtual observable
sensor devices which are not related to a physical device.
Just to mention it, this scanner is triggered by content provider changes and
is simply ignoring the configured device frequency.
TwitterDeviceScanner
Field Summary | |
---|---|
private ContentObserver |
contentObserver
The content observer |
private Uri |
contentURI
The URI for the scanned provider content |
private ContentResolver |
resolver
The content resolver context |
Constructor Summary | |
---|---|
ContentProviderDeviceScanner(ContentResolver resolver,
Uri contentURI)
Constructor |
Method Summary | |
---|---|
void |
doDeleteGatheredData(ContentResolver contentResolver,
Queue<Long> rowIds)
Method to delete content from the provider |
protected void |
doGatherSamples()
The gathering method to request available data from the content provider, create samples from it, notify observers and finally remove gathered data from the provider content. |
Queue<Long> |
doNotifyForSamples(ContentResolver contentResolver)
Method to gather content from the provider and create sample notifications |
protected ContentObserver |
getContentObserver()
Getter for the content observer |
protected ContentResolver |
getContentResolver()
Getter for the content resolver |
protected Uri |
getContentURI()
Getter for the content URI |
protected abstract SampleData |
getSampleDataFromCursor(Cursor cursor)
Method to extract concrete sample data at database cursor position |
protected boolean |
isCompatibleDevice(SensorDevice device)
Validation method for a compatible device type |
void |
onDestroy(Context context)
Is called when the owner destroys this scanner |
boolean |
start(Context context)
Does start sampling |
boolean |
stop(Context context)
Does stop sampling |
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractSensorDeviceScanner |
---|
enable, getDevice, isActive, 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 |
---|
private final ContentResolver resolver
private final Uri contentURI
private final ContentObserver contentObserver
Constructor Detail |
---|
public ContentProviderDeviceScanner(ContentResolver resolver, Uri contentURI)
resolver
- the content resolvercontentURI
- Method Detail |
---|
protected boolean isCompatibleDevice(SensorDevice device)
AbstractSensorDeviceScanner
isCompatibleDevice
in class AbstractSensorDeviceScanner
device
- the device to test for compatibilityprotected final ContentResolver getContentResolver()
protected ContentObserver getContentObserver()
protected final Uri getContentURI()
public final boolean start(Context context)
SensorDeviceScanner
context
- the application context
public final boolean stop(Context context)
SensorDeviceScanner
context
- the application context
public void onDestroy(Context context)
SensorDeviceScanner
onDestroy
in interface SensorDeviceScanner
onDestroy
in class AbstractSensorDeviceScanner
context
- the application contextprotected final void doGatherSamples()
public void doDeleteGatheredData(ContentResolver contentResolver, Queue<Long> rowIds)
contentResolver
- the content resolver to userowIds
- the row id's to deletepublic final Queue<Long> doNotifyForSamples(ContentResolver contentResolver)
contentResolver
- the content resolver to use
protected abstract SampleData getSampleDataFromCursor(Cursor cursor)
cursor
- the database cursor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |