Socket
Book a DemoInstallSign in
Socket

acgam-t02p

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acgam-t02p

ACGAM T02P Treadmill BLE communication library

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

acgam-t02p

ACGAM T02P Treadmill BLE communication library for Node.js.

It can be easily used for instance on Raspberry Pi 4 with Raspbian OS to grab live stats from your treadmill.

Installation

npm i acgam-t02p

Example usage

import { BluetoothDeviceAddress, TreadmillConnection, TreadmillStatus } from 'acgam-t02p';

const DEVICE_ADDRESS = 'FF:FF:FF:FF:FF:FF'; // TODO: Change with your real device address

(async () => {
  const connection = await TreadmillConnection.forAddress(
    BluetoothDeviceAddress.fromString(DEVICE_ADDRESS)
  );

  connection.addStatusNotificationEventListener(handleNotification);
})();

function handleNotification(status: TreadmillStatus) {
  console.log(status);
}

API

TreadmillConnection

This is main class that enables you to maintain a connection and communication with treadmill device.

BluetoothDeviceAddress

Helper value object that stores valid bluetooth device address.

TreadmillStatus

It's data structure that will come into your treadmill status notification listener:

type TreadmillStatus
  = { status: 'STANDBY' }
  | { status: 'STOPPED' }
  | { status: 'WAKING_UP' }
  | { status: 'PRESTART' }
  | { status: 'STARTING'; countdown: number }
  | {
      status: 'RUNNING' | 'STOPPING';
      elapsedSeconds: number;
      distanceInMeters: number;
      speed: {
        currentKmh: number;
        targetKmh: number;
      };
    };

Example status data with its interpretation:

JSONInterpretation
{ "status": "STOPPED" }Treadmill is stopped
{ "status": "STARTING", "countdown": 5 }Treadmill is going to start and it's 5 seconds until start.
{ "status": "RUNNING", "elapsedSeconds": 330, "distanceInMeters": 1500, "speed": { "currentKmh": 11.5, "targetKmh": 8 } }Treadmill is running. Elapsed time: 5 minutes 30 seconds. Distance: 1.5km. Current speed 11.5 km/h and it's slowly descending to target 8 km/h.

Keywords

treadmill

FAQs

Package last updated on 22 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts