public class BaseSensor extends Device implements SensorModes
| Modifier and Type | Field and Description |
|---|---|
protected int |
currentMode |
protected SensorMode[] |
modes |
| Constructor and Description |
|---|
BaseSensor() |
| Modifier and Type | Method and Description |
|---|---|
void |
fetchSample(float[] sample,
int offset)
Fetches a sample from a sensor or filter.
|
java.util.ArrayList<java.lang.String> |
getAvailableModes()
Return a list of string descriptions for the sensors available modes.
|
int |
getCurrentMode()
Gets the index number of the current mode.
|
SensorMode |
getMode(int mode)
Return the sample provider interface for the requested mode
|
SensorMode |
getMode(java.lang.String modeName)
Return the sample provider for the request mode
|
int |
getModeCount()
Gets the number of supported modes
|
java.lang.String |
getName()
return a string description of this sensor mode
|
int |
sampleSize()
Returns the number of elements in a sample.
The number of elements does not change during runtime. |
void |
setCurrentMode(int mode)
Sets the current mode for fetching samples
|
void |
setCurrentMode(java.lang.String modeName)
Sets the current mode for fetching samples
|
protected void |
setModes(SensorMode[] m)
Define the set of modes to be made available for this sensor.
|
close, releaseOnCloseprotected int currentMode
protected SensorMode[] modes
protected void setModes(SensorMode[] m)
m - An array containing a list of modespublic java.util.ArrayList<java.lang.String> getAvailableModes()
SensorModesgetAvailableModes in interface SensorModespublic SensorMode getMode(int mode)
SensorModesgetMode in interface SensorModesmode - the mode numberpublic SensorMode getMode(java.lang.String modeName)
SensorModesgetMode in interface SensorModesmodeName - the name/description of the modepublic java.lang.String getName()
SensorModegetName in interface SensorModepublic int sampleSize()
SampleProvidersampleSize in interface SampleProviderpublic void fetchSample(float[] sample,
int offset)
SampleProviderfetchSample in interface SampleProvidersample - The array to store the sample in.offset - The elements of the sample are stored in the array starting at the offset position.public void setCurrentMode(int mode)
SensorModessetCurrentMode in interface SensorModesmode - the index number of the mode. Index number corresponds with the item order of the list from getAvailableModes().public void setCurrentMode(java.lang.String modeName)
SensorModessetCurrentMode in interface SensorModesmodeName - the name of the mode. name corresponds with the item value of the list from getAvailableModes().public int getCurrentMode()
SensorModesgetCurrentMode in interface SensorModespublic int getModeCount()
SensorModesgetModeCount in interface SensorModes