ant-plus-next

ant-plus-next v0.3.2


ant-plus-next / HeartRateSensor

Class: HeartRateSensor

Represents a Heart Rate sensor. This class extends the AntPlusSensor class to handle specific data related to heart rate monitoring.

Extends

Constructors

new HeartRateSensor()

new HeartRateSensor(stick): HeartRateSensor

Constructs an instance of the AntPlusSensor class.

Parameters

stick

USBDriverBase

The USB driver instance used for communication with the ANT+ stick.

Returns

HeartRateSensor

Inherited from

AntPlusSensor.constructor

Defined in

sensors/antPlusSensor.ts:16

Properties

deviceType

readonly static deviceType: number = 120

The device type code for Heart Rate sensors.

Defined in

sensors/heartRate/heartRateSensor.ts:22

Methods

attach()

attach(channel, deviceId): Promise<void>

Attaches the sensor to a specified ANT+ channel and initializes its state.

Parameters

channel

number

The ANT+ channel number used for communication with the sensor.

deviceId

number

The unique identifier of the sensor device.

Returns

Promise<void>

Example

const sensor = new HeartRateSensor();
sensor.attach(1, 12345); // Attaches to channel 1 with device ID 12345

Defined in

sensors/heartRate/heartRateSensor.ts:36


detach()

detach(): Promise<void>

Detaches the sensor from its assigned channel and stops communication.

Returns

Promise<void>

Throws

Will throw an error if there is an issue detaching.

Inherited from

AntPlusSensor.detach

Defined in

sensors/baseSensor.ts:249