ant-plus-next / FitnessEquipmentSensor
Represents a Fitness Equipment sensor. This class extends the AntPlusSensor class to handle specific data related to fitness equipment.
AntPlusSensor
new FitnessEquipmentSensor(
stick
):FitnessEquipmentSensor
Constructs an instance of the AntPlusSensor class.
The USB driver instance used for communication with the ANT+ stick.
AntPlusSensor.constructor
readonly
static
deviceType:number
=0x11
The device type code for Fitness Equipment sensors.
sensors/fitnessEquipment/fitnessEquipmentSensor.ts:24
attach(
channel
,deviceId
):Promise
<void
>
Attaches the sensor to a specified ANT+ channel and initializes its state.
number
The ANT+ channel number used for communication with the sensor.
number
The unique identifier of the sensor device.
Promise
<void
>
const sensor = new FitnessEquipmentSensor();
sensor.attach(1, 12345); // Attaches to channel 1 with device ID 12345
sensors/fitnessEquipment/fitnessEquipmentSensor.ts:45
detach():
Promise
<void
>
Detaches the sensor from its assigned channel and stops communication.
Promise
<void
>
Will throw an error if there is an issue detaching.
AntPlusSensor.detach
setBasicResistance(
resistance
,cbk
?):Promise
<void
>
Sets the basic resistance level on the fitness equipment.
number
The resistance level to set (0 to 100).
Optional callback function to handle the send response.
Promise
<void
>
sensor.setBasicResistance(50, callbackFunction);
sensors/fitnessEquipment/fitnessEquipmentSensor.ts:124
setTargetPower(
power
,cbk
?):Promise
<void
>
Sets the target power level on the fitness equipment.
number
The target power level in watts.
Optional callback function to handle the send response.
Promise
<void
>
sensor.setTargetPower(250, callbackFunction);
sensors/fitnessEquipment/fitnessEquipmentSensor.ts:142
setTrackResistance(
slopeOrCallback
?,rollingResistanceCoeff
?,cbk
?):Promise
<void
>
Sets the track resistance on the fitness equipment.
The track slope percentage or a callback function.
number |
SendCallback |
number
The rolling resistance coefficient.
Optional callback function to handle the send response.
Promise
<void
>
sensor.setTrackResistance(5, 0.005, callbackFunction);
sensors/fitnessEquipment/fitnessEquipmentSensor.ts:222
setUserConfiguration(
userWeightOrCallback
?,bikeWeight
?,wheelDiameter
?,gearRatio
?,cbk
?):Promise
<void
>
Sets the user configuration for the sensor.
The user’s weight in kilograms or a callback function.
number |
SendCallback |
number
The weight of the bike in kilograms.
number
The diameter of the wheel in meters.
number
The gear ratio.
Optional callback function to handle the send response.
Promise
<void
>
sensor.setUserConfiguration(70, 10, 0.7, 3.5, callbackFunction);
sensors/fitnessEquipment/fitnessEquipmentSensor.ts:99
setWindResistance(
windCoeffOrCallback
?,windSpeed
?,draftFactor
?,cbk
?):Promise
<void
>
Sets the wind resistance on the fitness equipment.
The wind resistance coefficient or a callback function.
number |
SendCallback |
number
The wind speed in km/h.
number
The drafting factor (0 to 1).
Optional callback function to handle the send response.
Promise
<void
>
sensor.setWindResistance(0.5, 20, 0.1, callbackFunction);