Socket
Book a DemoInstallSign in
Socket

activ5-device

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

activ5-device

Library to provide Bluetooth connection and Isometric data retrieval from one or two Activ5 devices.

1.1.0
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
4
Weekly downloads
 
Created
Source

activ5-bluetooth-web library and Example App

Description

Library to provide Bluetooth connection and Isometric data retrieval from one or two Activ5 devices.

Installation

activ5-device is available through npm

Steps:

  • To perform installation under Windows or MAC OS, you need to install npm and node.js.

  • Clone the repository activ5-bluetooth-web or download the zip file

  • To install the library, run: npm install activ5-device

  • To install the Example App from folder "activ5-bluetooth-web\Example", run: npm install then run: npm start

  • Open http://localhost:4200 in the web browser

Use of framework

Framework initialisation

In order to initialize the framework you need to import it.

import { A5DeviceManager, A5Device } from 'activ5-device';

A5DeviceManager is the instance, from which devices of type A5Device are connected and returned.

Search and Connect to a device

You need to search for devices in order to connect. This will open the browser popup for the available bluetooth devices. Choose the desired one and click the Pair button. The device data is received in a callback function.

new A5DeviceManager().connect().then((newDevice: A5Device) => {
  this.device = newDevice;
});

Request Isometric Data from the activ5-device

Isometric data start to be stream when startIsometric() function is called.

this.device.startIsometric();

The isometric data is going to be received in the observable function getIsometricData(). The data received is in Newtons.

this.device.getIsometricData().subscribe((data: string) => {
  // do something
});

Stop receiving isometric data

In order to save device battery it is recomended to call stop() function. That way the device consumption drops to a minimum while still is being connected.

this.device.stop();

NB: After 7 minutes in stop mode the device will switch off . If you don't want the device to timeout after 7 minutes you can switch on evergreen mode. This will keep the device awake.

this.device.evergreenMode(true);

Execute tare

This is executing tare command on the device. During "tare" execution, the user should not apply any force to the Activ5 device.

this.device.tare();

Disconnect device

Disconnecting the device happens with calling disconnect() function.

this.device.disconnect();

An event will be fired to notify for the disconnect success.

this.device.onDisconnect().subscribe((event: Event) => {
  // do something
});

Author

Ivo Zhulev, contact: service@activbody.com

License

Example App source code is available under the Apache license. See the LICENSE file for more info.

FAQs

Package last updated on 29 Aug 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.