Class: Toybox::Ant::DeviceConfig

Inherits:
Lang::Object show all

Overview

A class to define the ANT wireless channel device configuration.

Examples:

// Set the configuration
deviceCfg = new Ant.DeviceConfig(
    {
    :deviceNumber => 0,                 // Wild card our search
    :deviceType => 31,                  // 1 byte type identifier
    :transmissionType => 0,             // Manufacturer-specific transport type
    :messagePeriod => 8192,             // The message period
    :radioFrequency => 57,              // Ant+ Frequency
    :searchTimeoutLowPriority => 10,    // Timeout in 25s
    :searchThreshold => 0               // Pair to all transmitting sensors
    }
);
GenericChannel.setDeviceConfig(deviceCfg);

See Also:

Since:

  • 1.0.0

Constant Summary

DEFAULT_DEVICE_NUMBER = 123

The default values for a device configuration

Since:

  • 1.0.0

DEFAULT_DEVICE_TYPE = 1

Since:

  • 1.0.0

DEFAULT_TRANSMISSION_TYPE = 0

Since:

  • 1.0.0

DEFAULT_MESSAGE_PERIOD = 8192

Since:

  • 1.0.0

DEFAULT_RADIO_FREQUENCY = 10

Since:

  • 1.0.0

DEFAULT_SEARCH_TIMEOUT_LOW = 6

Since:

  • 1.0.0

DEFAULT_SEARCH_TIMEOUT_HIGH = 0

Since:

  • 1.0.0

DEFAULT_THRESHOLD = 0

Since:

  • 1.0.0

DEFAULT_NETWORK_KEY = 0

Since:

  • 1.2.0

NETWORK_KEY_LENGTH_64BIT = 8

Network key lengths

Since:

  • 1.2.0

NETWORK_KEY_LENGTH_128BIT = 16

Since:

  • 1.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(options) ⇒ DeviceConfig

The constructor for the device configuration object.

Parameters:

Options Hash (options):

  • :deviceNumber (Toybox::Lang::Number)

    The ANT-id of the device to search for. Not setting enables a wild card search

  • :deviceType (Toybox::Lang::Number)

    1-Byte device type identifier

  • :transmissionType (Toybox::Lang::Number)

    The manufacturer-specific transport type and extended device number

  • :messagePeriod (Toybox::Lang::Number)

    The message period that the sensor uses

  • :radioFrequency (Toybox::Lang::Number)

    The radio frequency that the sensor operates on. Range of 2 to 80.

  • :searchTimeoutLowPriority (Toybox::Lang::Number)

    The Low Priority search timeout that a receiving channel will wait for in order to start tracking a master

    • Low Priority search provides the capability of searching for a master without interrupting other channels on the device

    • Range of 0 to 12 (2.5s increments)

    • Default 6 (15s)

  • :searchTimeoutHighPriority (Toybox::Lang::Number)

    The High Priority search timeout that a receiving channel will wait for in order to start tracking a master

    • Is triggered after the Low Priority search mode times out

    • Will interrupt other channels

    • Will take priority over any other open channels on that device

    • If it overlaps another channel the High Priority search takes priority and that other channel is blocked

    • Keeping this search type disabled unless you have great difficulty acquiring a master through Low Priority search is recommended

    • High Priority searches are disabled in data-fields, and will be ignored for that application type

    • Range of 0 to 2 (2.5s increments)

    • Default 0 (disabled)

  • :searchThreshold (Toybox::Lang::Number)

    A proximity threshold bin as a Number

    • Configures the RSSI threshold a slave channel will search for which is effectively the distance at which a slave is willing to be from a master

    • Values are 0 (disabled), 1 (closest), 10 (farthest)

  • :networkKey64Bit (Toybox::Lang::Number)

    64 bit network key

  • :networkKey128Bit (Toybox::Lang::Number)

    128 bit network key

    • Set this when NETWORK_PRIVATE was chosen in the channel assignment

See Also:

Since:

  • 1.2.0


1402
1403
# File 'Monkeybrains.rb', line 1402

def initialize(options)
end

Instance Attribute Details

deviceNumberObject

The unique device number (ANT-id)

Since:

  • 1.0.0


1317
1318
1319
# File 'Monkeybrains.rb', line 1317

def deviceNumber
  @deviceNumber
end

deviceTypeObject

A 1-Byte device type identifier

Since:

  • 1.0.0


1321
1322
1323
# File 'Monkeybrains.rb', line 1321

def deviceType
  @deviceType
end

messagePeriodObject

The Message period that the sensor uses

Since:

  • 1.0.0


1329
1330
1331
# File 'Monkeybrains.rb', line 1329

def messagePeriod
  @messagePeriod
end

networkKey128BitObject

A 128 bit network key

Since:

  • 1.2.0


1359
1360
1361
# File 'Monkeybrains.rb', line 1359

def networkKey128Bit
  @networkKey128Bit
end

networkKey64BitObject

A 64 bit network key

Since:

  • 1.2.0


1355
1356
1357
# File 'Monkeybrains.rb', line 1355

def networkKey64Bit
  @networkKey64Bit
end

radioFrequencyObject

The radio frequency that the sensor operates on

Since:

  • 1.0.0


1333
1334
1335
# File 'Monkeybrains.rb', line 1333

def radioFrequency
  @radioFrequency
end

searchThresholdObject

The proximity threshold bin

Since:

  • 1.0.0


1351
1352
1353
# File 'Monkeybrains.rb', line 1351

def searchThreshold
  @searchThreshold
end

searchTimeoutHighPriorityObject

High Priority search timeout that a receiving channel will wait for in order to start tracking a master

  • Measured in 2.5s increments

  • Limited to a maximum of 5 seconds (Range of 0 to 2)

Since:

  • 1.0.0


1347
1348
1349
# File 'Monkeybrains.rb', line 1347

def searchTimeoutHighPriority
  @searchTimeoutHighPriority
end

searchTimeoutLowPriorityObject

The low Priority search timeout that a receiving channel will wait for in order to start tracking a master

  • Measured in 2.5s increments

  • Limited to a maximum of 30 seconds (Range of 0 to 12)

Since:

  • 1.0.0


1340
1341
1342
# File 'Monkeybrains.rb', line 1340

def searchTimeoutLowPriority
  @searchTimeoutLowPriority
end

transmissionTypeObject

The manufacturer-specific transport type and extended device number

Since:

  • 1.0.0


1325
1326
1327
# File 'Monkeybrains.rb', line 1325

def transmissionType
  @transmissionType
end