public class SensingKitLib extends java.lang.Object implements SensingKitLibInterface
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterSensor(SKSensorType sensorType)
Deregisters a sensor from the library.
|
long |
getCurrentTimeMillis()
Get the current time in milliseconds (the difference between the current time and midnight, January 1, 1970 UTC).
|
SKSensorData |
getDataFromSensor(SKSensorType sensorType)
One Shot Sensing
|
long |
getNanoTime()
Get the current time in nanoseconds (the current value of the running Java Virtual Machine's high-resolution time source)
|
static SensingKitLibInterface |
getSensingKitLib(Context context) |
boolean |
isSensorRegistered(SKSensorType sensorType)
A Boolean value that indicates whether the sensor is registered.
|
boolean |
isSensorSensing(SKSensorType sensorType)
A Boolean value that indicates whether the sensor is currently sensing.
|
void |
registerSensor(SKSensorType sensorType)
Initializes and registers a sensor into the library with a default sensor configuration.
|
void |
startContinuousSensingWithAllRegisteredSensors()
Starts continuous sensing with all registered sensors.
|
void |
startContinuousSensingWithSensor(SKSensorType sensorType)
Starts continuous sensing with the specified sensor.
|
void |
stopContinuousSensingWithAllRegisteredSensors()
Starts continuous sensing with all registered sensors.
|
void |
stopContinuousSensingWithSensor(SKSensorType sensorType)
Stops continuous sensing with the specified sensor.
|
void |
subscribeSensorDataListener(SKSensorType sensorType,
SKSensorDataListener dataListener)
Subscribes for sensor updates using a specified event listener.
|
void |
unsubscribeAllSensorDataListeners(SKSensorType sensorType)
Unsubscribes all event listenerss.
|
void |
unsubscribeSensorDataListener(SKSensorType sensorType,
SKSensorDataListener dataListener)
Unsubscribes an event listener.
|
public static SensingKitLibInterface getSensingKitLib(Context context) throws SKException
SKExceptionpublic void registerSensor(SKSensorType sensorType) throws SKException
registerSensor in interface SensingKitLibInterfacesensorType - The type of the sensor that will be initialized and registered in the library.SKExceptionpublic void deregisterSensor(SKSensorType sensorType) throws SKException
deregisterSensor in interface SensingKitLibInterfacesensorType - The type of the sensor that will be deregistered.SKExceptionpublic boolean isSensorRegistered(SKSensorType sensorType) throws SKException
isSensorRegistered in interface SensingKitLibInterfacesensorType - The type of the sensor that will be checked.SKExceptionpublic SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException
SensingKitLibInterfacegetDataFromSensor in interface SensingKitLibInterfaceSKExceptionpublic void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException
subscribeSensorDataListener in interface SensingKitLibInterfacesensorType - The type of the sensor that the data handler will be subscribed to.dataListener - An event listener that is invoked with each update to handle new sensor data. The block must conform to the SKSensorDataListener type.SKExceptionpublic void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException
unsubscribeSensorDataListener in interface SensingKitLibInterfacesensorType - The type of the sensor for which the event listener will be unsubscribed.dataListener - The event listener to be unsubscribed.SKExceptionpublic void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException
unsubscribeAllSensorDataListeners in interface SensingKitLibInterfacesensorType - The type of the sensor for which the event listener will be unsubscribed.SKExceptionpublic void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException
startContinuousSensingWithSensor in interface SensingKitLibInterfacesensorType - The type of the sensor that will be started.SKExceptionpublic void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException
stopContinuousSensingWithSensor in interface SensingKitLibInterfacesensorType - The type of the sensor that will be stopped.SKExceptionpublic void startContinuousSensingWithAllRegisteredSensors()
throws SKException
startContinuousSensingWithAllRegisteredSensors in interface SensingKitLibInterfaceSKExceptionpublic void stopContinuousSensingWithAllRegisteredSensors()
throws SKException
stopContinuousSensingWithAllRegisteredSensors in interface SensingKitLibInterfaceSKExceptionpublic boolean isSensorSensing(SKSensorType sensorType) throws SKException
isSensorSensing in interface SensingKitLibInterfacesensorType - The type of the sensor that will be checked.SKExceptionpublic long getCurrentTimeMillis()
getCurrentTimeMillis in interface SensingKitLibInterfacepublic long getNanoTime()
getNanoTime in interface SensingKitLibInterface