Class: Toybox::AntPlus::DeviceState

Inherits:
Lang::Object show all

Overview

The DeviceState object represents the state of the device.

Fields may return null so you should null check values before using them.

Examples:

using Toybox.AntPlus;

// Assumes AntPlus.Device.getDeviceState(); already called
var state = deviceState.state;
var deviceNumber = deviceState.deviceNumber;

System.println("Current device state is: " + state);
System.println("Current device number is: " + deviceNumber);

Since:

  • 2.2.0

Device States collapse

Method Summary

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Attribute Details

deviceNumberToybox::Lang::Number

The current Device ID being tracked/searched for.

ID will be null if device state is DEVICE_STATE_DEAD

Returns:

Since:

  • 2.2.0


14873
14874
14875
# File 'Monkeybrains.rb', line 14873

def deviceNumber
  @deviceNumber
end

stateToybox::Lang::Number

The state of the device as an DEVICE_STATE_* value.

Returns:

Since:

  • 2.2.0


14866
14867
14868
# File 'Monkeybrains.rb', line 14866

def state
  @state
end