Turning on Led while charging

Hi!
I'd like to being able to turn on the MetaMotionR's LED when in charge, and off when not charging.
Do you know if it's possible?

When I'm connected (via bluetooth) to the sensor I can turn the led on and off according to the charging status, but as soon as the connection is closed the powerStatus change callback doesn't works anymore.

I'm using an android table, tha SDK version 3.7.0 and a sensor updated to 1.4.4 firmware.

Here is a snippet of Android code I'm using to perform this operation:

    this.mSettings = this.mBoard.getModule(Settings.class);
    this.mLed = this.mBoard.getModule(Led.class);
    this.mSettings.editBleConnParams()
                .slaveLatency((short)0)
                .maxConnectionInterval(params.getMaxConnectionInterval())
                .commit();

        final Haptic vibrationModule = this.mBoard.getModule(Haptic.class);

        this.mSettings.powerStatus().addRouteAsync(source -> source.stream((Subscriber) (data, env) -> {

            Byte state = data.value(Byte.class);
            if(state.intValue() == BATTERY_CHARGING){
                vibrationModule.startMotor(100.f, (short) 1000);

                    this.mLed.editPattern(Led.Color.RED)
                            .riseTime((short) 0)
                            .pulseDuration((short) 1000)
                            .repeatCount((byte) 5)
                            .highTime((short) 500)
                            .highIntensity((byte) 16)
                            .lowIntensity((byte) 1)
                            .commit();
                    this.mLed.play();
        }));

Is there a way to achieve the goal?
Thanks,
Giovanni

Sign In or Register to comment.