Skip to main content
Explorer II
April 26, 2017
Question

How to detect acceleration events with BlueSTSDK Android App?

  • April 26, 2017
  • 1 reply
  • 698 views
Posted on April 26, 2017 at 15:29

Hi at all,

I am using the BlueSTSDK Android App to receive data transfered via Bluetooth Low Energy by the STEVAL-STLKT01V1 SensorTile.

I would like to detect accelerometer events as orientations, single taps, etc, with this app but I don't undestand how to unblock the 'Accelerometer Events' in the 'Feature list' activity.

In the FeatureAccelerationEvent.java file is reported that I must call the following functions:

- detectEvent()

- onDetectableEventChange()

but I don't know where and how I must call this functions.

Is there anybody that can help me?

Best regards,

Tommaso

#sensortile #bluestsdk
    This topic has been closed for replies.

    1 reply

    Visitor II
    April 26, 2017
    Posted on April 26, 2017 at 17:35

    Hi Tommaso,

    To receive an acceleration event you have to:

    - enable the Feature notification (using the enableNotificaiton Node method)

    - register a feature listener for the FeatureAccelerationEvent instance

    - enable the event detection using the enableEvent(eventType, true) method. 

    When the board enables the detection of the event you will receive a callback on the  

    onDetectableEventChange method.

    To stop detecting an event you have to  use

    enableEvent(eventType, false)

     

    If you need more examples you can look to the 

    https://github.com/STMicroelectronics-CentralLabs/STBlueMS_Android/blob/master/BlueMS/src/main/java/com/st/BlueMS/demos/MemsSensorFusionFragment.java#L363

      or the 

    https://github.com/STMicroelectronics-CentralLabs/STBlueMS_Android/blob/master/BlueMS/src/main/java/com/st/BlueMS/demos/AccEventFragment.java

    Best Regards

    Giovanni

    Explorer II
    April 27, 2017
    Posted on April 27, 2017 at 12:46

    Hi,

    very thanks for your answer, I finally resolved my problems with the examples that you suggested me.

    Best Regards

    Tommaso