Logging and download data at the same time using MeteamotionC and MetamotionS?

Hello,

I have MetamotionC and MetamotionS.
Both boards can log the data on the device memory.
Can anyone help me with this :Can I download and log data at the same time in Android ?

If it is possible then how downloading data works?
How already downloaded data works Is it override or manually delete it?

Quote

Comments

  • edited January 2022

    **Details about the sensor: **

    Model MetaMotion S
    Model Number 8
    Firmware 1.7.0
    Hardware 0.1

    Details about Android device:
    Phone: Jelly 2
    Android Version: 11

    Details about Android project
    CompileSDK 30
    MinSDK 26

    Currently, I am logging data. However, I can't download the data from the device. In addition,
    Our app wants to download data from the device every 3 seconds. When I tried to download the data from the device the connection dropped unexpectedly.

    **Code snippet. **

     Accelerometer accelerometer = board.getModule(Accelerometer.class);
            if (accelerometer != null) {
                accelerometer.configure()
                        .odr(25f)
                        .range(4f)
                        .commit();
            } 
    
     if (accelerometer != null) {
                accelerometer.acceleration().addRouteAsync(new RouteBuilder() {
                    @Override
                    public void configure(RouteComponent source) {
                        source.log(new Subscriber() {
                            @Override
                            public void apply(Data data, Object... env) {
                                Acceleration acceleration = data.value(Acceleration.class);
                                metaMotion.accelerometer.add(new Axis(acceleration.x(), acceleration.y(), acceleration.z()));
                                Log.e("Accelerometer", data.value(Acceleration.class).toString());
    
                            }
                        });
                    }
                }).continueWith(new Continuation<Route, Void>() {
                    @Override
                    public Void then(Task<Route> task) throws Exception {
                        accelerometer.acceleration().start();
                        accelerometer.start();
                        Logging logging = board.getModule(Logging.class);
                        logging.start(true);
                        return null;
                    }
                });
            }
    
    
    Downloading data at every 3.5 seconds:
      Logging logging = board.getModule(Logging.class);
            logging.start(true);
            logging.flushPage();
            logging.downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
                @Override
                public void receivedUpdate(long nEntriesLeft, long totalEntries) {
                    Log.i("downloading", "Progress Update = " + nEntriesLeft + "/" + totalEntries);
                }
            }).continueWithTask(new Continuation<Void, Task<Void>>() {
                @Override
                public Task<Void> then(Task<Void> task) throws Exception {
                    Log.i("downloading", "Download completed");
                    return null;
                }
            });
    

    Using the above code, we could not see the logs( Log.e("Accelerometer", data.value(Acceleration.class).toString());
    ). Plus, we get the connection error.

    Could you please help with logging and downloading at the same time.

    Thanks.

  • Yes you can do download and log at the same time.
    Unfortunately we don't have anyone who can help with Android code right now.

  • edited January 2022

    @Laura
    Thanks for the reply.

    Our app wants to download the data at some interval and continue logging data at the same time.

    As of now if you don't have anyone who can help with Android. However, Would it be possible to get the source code of the iOS that download and logs data at the same time.?

    We will try to decode the code and understand the functionality.

    Thanks.

  • @Raghav,
    I'll see what I can do.

Sign In or Register to comment.