Class: Toybox::AntPlus::Device

Inherits:
Lang::Object show all

Overview

The Device object represents an ANT+ Device instance.

Since:

  • 2.2.0

Device States collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Method Details

getBatteryStatus(identifier) ⇒ Toybox::AntPlus::BatteryStatus

Retrieve battery status for provided component identifier.

Examples:

using Toybox.AntPlus;

// Assumes valid componenet identifier enum value (for bike lights)
// or null for a single component device

var batteryStatus = AntPlus.getBatteryStatus(null);  // Get the batteryStatus Enum value
                                                     // for a single component system.
if (batteryStatus == 3) {                            // 3 is the BATT_STATUS_OK
    System.prinln("Battery Status: Okay!");          // enum value.
} else {
    // display another battery status message
}

Parameters:

  • identifier (Toybox::Lang::Number)

    The component identifier to retrieve battery status for

    • null if single-component

    • Light index for bike lights.

Returns:

Since:

  • 2.2.0


14902
14903
# File 'Monkeybrains.rb', line 14902

def getBatteryStatus(identifier)
end

getComponentIdentifiersToybox::Lang::Array

Retrieve a list of known component identifiers for this Device.

This list may update over time as ANT+ devices with >1 component periodically send information about each of their components. The device reports its total number of components in CommonData.numComponents. The returned Array will only contain entries for components that the ANT+ device has provided a component identifier for.

Examples:

using Toybox.AntPlus;

// Get the list of known components as an Array
var componentList = AntPlus.getComponentIdentifiers();

Returns:

  • (Toybox::Lang::Array)

    A list of known component identifiers

    • null if there are no known component identifiers

Since:

  • 2.2.0


14921
14922
# File 'Monkeybrains.rb', line 14921

def getComponentIdentifiers()
end

getDeviceStateToybox::AntPlus::DeviceState

Retrieve the state of the device.

Examples:

using Toybox.AntPlus;

// Get the DEVICE_STATE_* enum value
var deviceState = AntPlus.getDeviceState(null);

Returns:

Since:

  • 2.2.0


14966
14967
# File 'Monkeybrains.rb', line 14966

def getDeviceState()
end

getManufacturerInfo(identifier) ⇒ Toybox::AntPlus::ManufacturerInfo

Retrieve manufacturer information for provided component identifier.

Examples:

using Toybox.AntPlus;

// Get the ManufacturerInfo object
var manufacturerInfo = AntPlus.getManufacturerInfo(null);

Parameters:

  • identifier (Toybox::Lang::Number)

    The component identifier to retrieve manufacturer information for

    • null if single-component

    • Light index for bike lights

Returns:

Since:

  • 2.2.0


14938
14939
# File 'Monkeybrains.rb', line 14938

def getManufacturerInfo(identifier)
end

getProductInfo(identifier) ⇒ Toybox::AntPlus::ProductInfo

Retrieve product information for provided component identifier.

Examples:

using Toybox.AntPlus;

// Get the ProductInfo object
var productInfo = AntPlus.getProductInfo(null);

Parameters:

  • identifier (Toybox::Lang::Number)

    The component identifier to retrieve product information for

    • null if single-component

    • Light index for bike lights

Returns:

Since:

  • 2.2.0


14955
14956
# File 'Monkeybrains.rb', line 14955

def getProductInfo(identifier)
end