powerstatus, chargestatus events and commands

edited April 2017 in iOS
Hi there,

How would I go about determining the status of the powerstatus or chargestatus events when using programCommandsToRunOnEventAsync?  For example to achieve something like the following, to either turn the led on, or have different colors

[_device.settings.powerStatus programCommandsToRunOnEventAsync:^{
    if (power status is 1)
    [_device.led setLEDColorAsync:[UIColor greenColor] withIntensity:1.0];
    else
  [_device.led setLEDColorAsync:[UIColor redColor] withIntensity:1.0];
}];

It would seem as though there should be a readPowerStatusAsync somewhere, but it seems to be missing, or is there another way to determine the status inside the event?

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #31595d}
span.s1 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #4f8187}
span.s3 {font-variant-ligatures: no-common-ligatures}
span.s4 {font-variant-ligatures: no-common-ligatures; color: #703daa}
span.s5 {font-variant-ligatures: no-common-ligatures; color: #3e1e81}
span.s6 {font-variant-ligatures: no-common-ligatures; color: #272ad8}

Comments

  • or should it be like:?

    MBLEvent *chargingEvent = [_device.settings.chargerStatus compareEventUsingOperation:MBLComparisonOperationEqual data:@[@1] output:MBLComparisonOutputValue];
    [chargingEvent programCommandsToRunOnEventAsync:^{
            [_device.led setLEDColorAsync:[UIColor blueColor] withIntensity:1.0];
    }];

    MBLEvent *notChargingEvent = [_device.settings.chargerStatus compareEventUsingOperation:MBLComparisonOperationEqual data:@[@0] output:MBLComparisonOutputValue];
    [notChargingEvent programCommandsToRunOnEventAsync:^{
        [_device.led setLEDColorAsync:[UIColor whiteColor] withIntensity:1.0];
    }];
  • The second post is the correct approach for automatically setting the LED on a battery charge status change event.

    Please make sure that chargerStatus or powerStatus is not nil before using as this feature is only available on MetaMotionR with the latest firmware.
  • cheers
This discussion has been closed.