public class JavelinSensorManager extends ISensorManager implements com.javelindevices.javelinsdk.model.BleServiceListener
ISensorManager.JavelinEventListener
Constructor and Description |
---|
JavelinSensorManager(Context context,
java.lang.String deviceAddress)
Create a JavelinSensorManager object
|
Modifier and Type | Method and Description |
---|---|
boolean |
createBond()
Bonds the application to the javelin device.
|
void |
disable()
Disconnects the javelin device.
|
void |
enable()
Connects to the javelin device.
|
static JavelinSensorManager |
getJavelinSensorManager(Context context,
java.lang.String deviceAddress) |
void |
ledEnable(boolean enable)
LED on/off switch.
|
void |
onConnected()
This method is called on separate from Main thread.
|
void |
onDataAvailable(java.lang.String serviceUuid,
java.lang.String characteristicUUid,
java.lang.String text,
byte[] data)
This method is called on separate from Main thread.
|
void |
onDisconnected()
This method is called on separate from Main thread.
|
void |
onReadRemoteRssi(int rssi) |
void |
onSensorChanged(int sensor,
float[] data) |
void |
onServiceDiscovered()
This method is called on separate from Main thread.
|
void |
readRssi()
Reads the signal strength from the javelin device to the central device.
|
void |
registerListener(ISensorManager.JavelinEventListener listener,
int sensorType)
Enable notifications from a sensor.
|
boolean |
removeBond()
Removes the bond from the application to the javelin device.
|
void |
setAccelerometerFullScaleRange(int range) |
void |
setAcceleromGyroRate(int rate)
It's not going to be exact, but it will attempt to approximate given sample rate
|
void |
setAcceleromGyroSampleRateDivisor(int divisor)
Set the divisor used to divide the default sample rate up.
|
void |
setAudioQuality(int quality) |
void |
setGyroscopeFullScaleRange(int range) |
void |
setLedBlinkNumber(int times)
Sets how many times the LED goes on and off for the specified number of times at the current
rate, pulsation type, and intensity.
|
void |
setLedBlinkRate(int rate)
Sets the LED's blinking rate for the PULSE, TRIANGLE, and SAWTOOTH LED types.
|
void |
setLedBlinkType(int blinkType)
Sets the kind of blinking type to enable when
ledEnable(true) is called |
void |
setLedIntensity(int intensity)
Sets the LED intensity on a scale of 1 - 100, 100 being the strongest intensity.
|
void |
setListener(ISensorManager.JavelinEventListener listener)
Allows the android activity to receive sensor events.
|
void |
setVibrationIntensity(int intensity) |
void |
setVibrationRate(int rate)
Sets the vibration rate for the PULSE, TRIANGLE, and SAWTOOTH vibration types.
|
void |
setVibrationRepeatNumber(int times)
Sets the number of times to vibrate if the SOLID, PULSE, TRIANGLE or SAWTOOTH vibration type is set.
|
void |
setVibrationType(int type)
Sets the vibration type to use
|
void |
unregisterAll()
Removes all listeners, stopping sensor updates.
|
void |
unregisterListener(ISensorManager.JavelinEventListener listener,
int sensorType)
Disables notifications and data from a sensor for the given listener, if it is already subscribed.
|
void |
vibrationEnable(boolean enable)
Vibrator on / off switch.
|
public JavelinSensorManager(Context context, java.lang.String deviceAddress)
context
- an android ActivitydeviceAddress
- the address of the javelin device to connect to.public static JavelinSensorManager getJavelinSensorManager(Context context, java.lang.String deviceAddress)
public void setListener(ISensorManager.JavelinEventListener listener)
ISensorManager
setListener
in class ISensorManager
listener
- the ISensorManager.JavelinEventListener
public void enable()
ISensorManager
enable
in class ISensorManager
public void disable()
ISensorManager
disable
in class ISensorManager
public void registerListener(ISensorManager.JavelinEventListener listener, int sensorType)
ISensorManager
JavelinSensorManager
will remember all registered listenersregisterListener
in class ISensorManager
sensorType
- The sensor to enable.public void unregisterListener(ISensorManager.JavelinEventListener listener, int sensorType)
ISensorManager
unregisterListener
in class ISensorManager
sensorType
- a type defined in ISensor
public void unregisterAll()
ISensorManager
unregisterAll
in class ISensorManager
public void onSensorChanged(int sensor, float[] data)
public void onConnected()
com.javelindevices.javelinsdk.model.BleServiceListener
onConnected
in interface com.javelindevices.javelinsdk.model.BleServiceListener
public void onDisconnected()
com.javelindevices.javelinsdk.model.BleServiceListener
onDisconnected
in interface com.javelindevices.javelinsdk.model.BleServiceListener
public void readRssi()
ISensorManager
ISensorManager.JavelinEventListener
.readRssi
in class ISensorManager
public void onReadRemoteRssi(int rssi)
onReadRemoteRssi
in interface com.javelindevices.javelinsdk.model.BleServiceListener
public void onServiceDiscovered()
com.javelindevices.javelinsdk.model.BleServiceListener
onServiceDiscovered
in interface com.javelindevices.javelinsdk.model.BleServiceListener
public void onDataAvailable(java.lang.String serviceUuid, java.lang.String characteristicUUid, java.lang.String text, byte[] data)
com.javelindevices.javelinsdk.model.BleServiceListener
onDataAvailable
in interface com.javelindevices.javelinsdk.model.BleServiceListener
public boolean createBond()
ISensorManager
createBond
in class ISensorManager
public boolean removeBond()
ISensorManager
removeBond
in class ISensorManager
public void ledEnable(boolean enable)
ISensorManager
Must set setLedBlinkType(int blinkType)
before calling ledEnable(boolean)
ledEnable
in class ISensorManager
enable
- booleanpublic void setLedIntensity(int intensity)
ISensorManager
setLedIntensity
in class ISensorManager
intensity
- the intensity of the LED from 1 to 100 inclusive.public void setLedBlinkType(int blinkType)
ISensorManager
ledEnable(true)
is calledsetLedBlinkType
in class ISensorManager
blinkType
- Integer constant describing the kind of blinking type to enable.
This can be any of the LED_TYPE contants from JavelinSettings
public void setLedBlinkRate(int rate)
ISensorManager
setLedBlinkRate
in class ISensorManager
rate
- the blinking rate, in .1Hz values. A value of 10 will make the LED blink once per second.public void setLedBlinkNumber(int times)
ISensorManager
setLedBlinkNumber
in class ISensorManager
times
- how many times to blink the LED when calling the ledEnable
method. Allowed values are [1,255].public void vibrationEnable(boolean enable)
ISensorManager
Must set setVibrationType(int type)
before calling vibrationEnable(boolean)
vibrationEnable
in class ISensorManager
enable
- booleanpublic void setVibrationIntensity(int intensity)
setVibrationIntensity
in class ISensorManager
intensity
- the intensity of vibration from 1 to 100 inclusive.public void setVibrationType(int type)
ISensorManager
setVibrationType
in class ISensorManager
type
- one of the VIB_TYPE constants in ISensor
public void setVibrationRate(int rate)
ISensorManager
setVibrationRate
in class ISensorManager
rate
- an integer indicating the number of vibrations per 1/10th of a second (.1Hz).
A value of 10 will make it vibrate once per second.public void setVibrationRepeatNumber(int times)
ISensorManager
setVibrationRepeatNumber
in class ISensorManager
times
- the number of times to vibratepublic void setAudioQuality(int quality)
setAudioQuality
in class ISensorManager
public void setAcceleromGyroRate(int rate)
setAcceleromGyroRate
in class ISensorManager
rate
- the sampling rate to use.public void setAcceleromGyroSampleRateDivisor(int divisor)
ISensorManager
setAcceleromGyroSampleRateDivisor
in class ISensorManager
public void setAccelerometerFullScaleRange(int range)
setAccelerometerFullScaleRange
in class ISensorManager
public void setGyroscopeFullScaleRange(int range)
setGyroscopeFullScaleRange
in class ISensorManager