0

I'm having some trouble to subscribe to the values that the sends. Previously, I managed to get the accelerometer and gyroscope data at the same time by creating my own service in which both are contained as it was suggested by user1987093 as the answer to the following question: Simultaniously read accelerometer and gyroscope.

This was working properly until the new device update was released and when I wanted to use the new features from the update (basically the higher sampling rates from the fast sensors), I realized that my Android app was not working anymore even if I adapted the classes to what is supposed to receive now from the sensor which is briefly explained in the answer to the following question: How can I set the sampling rate in a Movesense device?.

To sum up, I'm not able to read the data that the sensor is sending and I don't even know if the sensor is sending something at all.

To see if this was a problem with the class I created to read my service's values (which includes acc&gyro values at the same time) or a problem with the new update structure which makes the current android app obsolete, I tried the suggested AccelerometerSampleService which provides with a new maximal linear acceleration value every 5 seconds approximately and a timestamp. I directly used the dfu package provided with the new update from the following link https://bitbucket.org/aschaer/movesense-device-lib/src/23b4512dbc128a8c1f17a33cd453160bc3256f67/samples/accelerometer_app/bin/?at=master. As long as I know, this service was kept untouched with the new version(appart from the function get which was deleted but we are trying to subscribe to the service right?) and should provide with a value and the timestamp every 5 seconds. The problem is in the following code lines:

      listenMaxAccelerationDisposable = movesense.getDevice(address)
            .listen("/Sample/Accelerometer/Data", MaxLinearAcceleration.class)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeWith(new DisposableObserver<MovesenseResponse<MaxLinearAcceleration>>() {
                @Override
                public void onNext(MovesenseResponse<MaxLinearAcceleration> maxLinearAcceleration) {
                    if (maxLinearAcceleration.body != null) {
                        dismissInitializingDialog();

It never calls the method onNext and therefore I don't get any values and I don't know if it is because they are not being sent on that path (I also tried with the path Sample/Accelerometer/Data/Subscription with the same negative result) or because I don't know how to read them properly from the android side.

I have the following questions:

  • When is the new version of the Android App going to be released? At the moment the latest version is from April and a lot of things have changed on the embedded side since then.

  • How can I effectively subscribe to this AccelerometerSampleService in the first place in order to get this maximal value and timestamp and see it on the app.

  • I didn't find any reference to how the function listen works and how it differs from post. When you use post, do you always have to use delete after?

For the people like me that are trying to use the android app, I think we'd kindly appreciate if you published a bit more of documentation regarding the android app that makes it easier for us to follow the updates on the device side.

sanferro
  • 19
  • 3

2 Answers2

0

The issue that was causing the failure for simultaneous subscriptions has been fixed in the latest Movesense-mobile-lib. However the recent sensor improvements introduced a bug that cause non-functioning of gyro if the accelerometer is subscribed first and gyro later.

So in short:

  • Now you can subscribe more than one service directly from mobile
  • You must (until the recent bug has been fixed at least) subscribe Gyro first and Accelerometer second

Full disclaimer: I work for the Movesense team

PetriL
  • 1,211
  • 1
  • 7
  • 11
0

Subscribe in new Api required URI and Contract.

Looks like You trying to use old api/lib.

Please look at the example Android App in BitBucket repository.

It's already updated.

There are examples how to use new API and how to use "new" subscribe.

Esperanz0
  • 1,524
  • 13
  • 35