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
SKException
public void registerSensor(SKSensorType sensorType) throws SKException
registerSensor
in interface SensingKitLibInterface
sensorType
- The type of the sensor that will be initialized and registered in the library.SKException
public void deregisterSensor(SKSensorType sensorType) throws SKException
deregisterSensor
in interface SensingKitLibInterface
sensorType
- The type of the sensor that will be deregistered.SKException
public boolean isSensorRegistered(SKSensorType sensorType) throws SKException
isSensorRegistered
in interface SensingKitLibInterface
sensorType
- The type of the sensor that will be checked.SKException
public SKSensorData getDataFromSensor(SKSensorType sensorType) throws SKException
SensingKitLibInterface
getDataFromSensor
in interface SensingKitLibInterface
SKException
public void subscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException
subscribeSensorDataListener
in interface SensingKitLibInterface
sensorType
- 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.SKException
public void unsubscribeSensorDataListener(SKSensorType sensorType, SKSensorDataListener dataListener) throws SKException
unsubscribeSensorDataListener
in interface SensingKitLibInterface
sensorType
- The type of the sensor for which the event listener will be unsubscribed.dataListener
- The event listener to be unsubscribed.SKException
public void unsubscribeAllSensorDataListeners(SKSensorType sensorType) throws SKException
unsubscribeAllSensorDataListeners
in interface SensingKitLibInterface
sensorType
- The type of the sensor for which the event listener will be unsubscribed.SKException
public void startContinuousSensingWithSensor(SKSensorType sensorType) throws SKException
startContinuousSensingWithSensor
in interface SensingKitLibInterface
sensorType
- The type of the sensor that will be started.SKException
public void stopContinuousSensingWithSensor(SKSensorType sensorType) throws SKException
stopContinuousSensingWithSensor
in interface SensingKitLibInterface
sensorType
- The type of the sensor that will be stopped.SKException
public void startContinuousSensingWithAllRegisteredSensors() throws SKException
startContinuousSensingWithAllRegisteredSensors
in interface SensingKitLibInterface
SKException
public void stopContinuousSensingWithAllRegisteredSensors() throws SKException
stopContinuousSensingWithAllRegisteredSensors
in interface SensingKitLibInterface
SKException
public boolean isSensorSensing(SKSensorType sensorType) throws SKException
isSensorSensing
in interface SensingKitLibInterface
sensorType
- The type of the sensor that will be checked.SKException
public long getCurrentTimeMillis()
getCurrentTimeMillis
in interface SensingKitLibInterface
public long getNanoTime()
getNanoTime
in interface SensingKitLibInterface