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


16668
16669
# File 'Monkeybrains.rb', line 16668

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


16687
16688
# File 'Monkeybrains.rb', line 16687

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


16732
16733
# File 'Monkeybrains.rb', line 16732

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


16704
16705
# File 'Monkeybrains.rb', line 16704

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


16721
16722
# File 'Monkeybrains.rb', line 16721

def getProductInfo(identifier)
end

sendManufacturerMessage(message) ⇒ Object

Send Manufacturer Message

Parameters:

  • message (Toybox::Ant::Message)

    The Ant message to send. Only exploration (0xE0-0xEF) and manufacturer specific (0xF0-0xFF) pages are allowed. It is recomended to contact the ANT+ group when exploration pages are used at thisisant.com. The [Toybox::AntPlus::DeviceListener::onsentMessage] will be called to indicate sent manufacturer message status.

Raises:

See Also:

Since:

  • 3.1.0


16748
16749
# File 'Monkeybrains.rb', line 16748

def sendManufacturerMessage(message)
end

sendPageRequest(pageNumber) ⇒ Object

Send Page request Request 2 broadcast pages from connected sensor. Use [Toybox::AntPlus::DeviceListener::onMessage] to process requested page broadcasts from the sensor.

Parameters:

  • pageNumber (Toybox::Lang::Number)

    The requested page number. Requesting the ANTFS page (0x43) isn't allowed. Page request can change the page rotation of the sensor so they will not be allowed to be sent too frequently. Sending page requests is limited to once every 2 seconds.

Raises:

Since:

  • 3.1.0


16765
16766
# File 'Monkeybrains.rb', line 16765

def sendPageRequest(pageNumber)
end