|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.Android_Seminar.backend.impl.SensorControllerImpl
public class SensorControllerImpl
Constructor Summary | |
---|---|
SensorControllerImpl(SensorManager manager,
Activity activity)
standard constructor |
Method Summary | |
---|---|
void |
activateSensor(SensorType sensor)
Activates a sensor and makes it ready to record data. |
void |
activateSensor(SensorType sensor,
int bufferSize)
|
void |
close()
closes the SensorController and disables all sensors. |
void |
deactivateSensor(SensorType sensor)
Disables a sensor and prevents it from recording data. |
java.util.List<SensorType> |
getActiveSensors()
|
SensorData[] |
getBufferedData(SensorType sensor,
int amount)
|
SensorData |
getCurrentData(SensorType sensor)
|
int |
getDeviceSensorNumber()
|
java.util.List<SensorType> |
getDeviceSensors()
|
FileTransmitter |
getFileTransmitter()
|
double |
getMaxValue(SensorType sensor)
returns an sensor specific, expected maximum value. |
double |
getMinValue(SensorType sensor)
returns an sensor specific, expected minimum value. |
SensorConfiguration |
getSensorConfiguration()
|
XmlCreator |
getXmlCreator()
|
boolean |
hasSensor(SensorType sensor)
Determines if the device has a specific sensor |
boolean |
isRecordin()
Determines if a recording is running |
boolean |
sensorIsActive(SensorType sensor)
Checks, if a sensor is active or not |
void |
startRecording(java.lang.String tag,
java.lang.String file)
Starts a data recording. |
void |
stopRecording()
Stops a recording immediately. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SensorControllerImpl(SensorManager manager, Activity activity)
Method Detail |
---|
public void activateSensor(SensorType sensor)
SensorController
SensorConfiguration
corresponding to this SensorController
object. Otherwise the default sample rate determined by the SensorConfiguration
class will be used.
activateSensor
in interface SensorController
sensor
- the sensor which should be activatedSensorController#startRecording(String, String, float)
,
SensorController.deactivateSensor(SensorType)
public void activateSensor(SensorType sensor, int bufferSize)
activateSensor
in interface SensorController
sensor
- the sensor which should be activatedbufferSize
- the size of the sensor's buffer. If the size is smaller than
one, the default size will be usedSensorController.activateSensor(SensorType)
public void close()
SensorController
close
in interface SensorController
SensorController.deactivateSensor(SensorType)
public void deactivateSensor(SensorType sensor)
SensorController
deactivateSensor
in interface SensorController
SensorController#startRecording(String, String, float)
,
SensorController.activateSensor(SensorType)
,
SensorType
public java.util.List<SensorType> getActiveSensors()
getActiveSensors
in interface SensorController
SensorController.activateSensor(SensorType)
,
SensorType
public SensorData[] getBufferedData(SensorType sensor, int amount)
getBufferedData
in interface SensorController
sensor
- the sensor where the data should be obtained fromamount
- the number of data sets that should be returned.
If 'amount' is greater than the sernsor's buffer size, all buffered
data will be returned.
SensorType
was activated: (SensorController.activateSensor(SensorType)
).
An empty array if no data were received from the sensorSensorType
,
SensorData
public SensorData getCurrentData(SensorType sensor)
getCurrentData
in interface SensorController
sensor
- the sensor where the data should be obtained from
SensorType
was activated (SensorController.activateSensor(SensorType)
),
or no data have been received already.SensorType
,
SensorData
public int getDeviceSensorNumber()
getDeviceSensorNumber
in interface SensorController
SensorController.activateSensor(SensorType)
,
SensorType
public java.util.List<SensorType> getDeviceSensors()
getDeviceSensors
in interface SensorController
SensorType
public double getMaxValue(SensorType sensor)
SensorController
getMaxValue
in interface SensorController
sensor
- the sensor where the maximal value should be obtained from
SensorType
public double getMinValue(SensorType sensor)
SensorController
getMinValue
in interface SensorController
sensor
- the sensor where the minimal value should be obtained from
SensorType
public SensorConfiguration getSensorConfiguration()
getSensorConfiguration
in interface SensorController
SensorController
SensorConfiguration
public boolean hasSensor(SensorType sensor)
SensorController
hasSensor
in interface SensorController
sensor
- the sensor which should be checked for availability
SensorType
public boolean isRecordin()
SensorController
isRecordin
in interface SensorController
SensorController#startRecording(String, String, float)
,
SensorController.stopRecording()
public boolean sensorIsActive(SensorType sensor)
SensorController
sensorIsActive
in interface SensorController
sensor
- the sensor which should be checked
SensorType
public void startRecording(java.lang.String tag, java.lang.String file)
SensorController
SensorConfiguration.getLastTimeout()
value is reached.
A recording will start after SensorConfiguration.getLastStartDelay()
seconds.
startRecording
in interface SensorController
tag
- determines how a data set will be tagged. If the tag is a null
valuefile
- the path and name of the xml file (audio file) the data will be saved to.
If audio data will be recorded, for this data type a audio file (mp3) will be created.
Thus all data, except audio data will be saved in a single xml file with path and name
specified in the 'file' attribute. For audio data, a mp3 file will be created with path
and name specified in the 'file' attribute.
If no tag should be set, an empty string or a null value can be delivered.SensorController.stopRecording()
,
SensorController.activateSensor(SensorType)
,
SensorController.deactivateSensor(SensorType)
public void stopRecording()
SensorController
stopRecording
in interface SensorController
SensorController#startRecording(String, String, float)
,
SensorController.activateSensor(SensorType)
,
SensorController.deactivateSensor(SensorType)
public XmlCreator getXmlCreator()
getXmlCreator
in interface SensorController
XmlCreator
that gives you some xml creating/manipulation features
for activitiespublic FileTransmitter getFileTransmitter()
getFileTransmitter
in interface SensorController
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |