@0x77/iqos 中文文档教程

发布于 5年前 浏览 27 项目主页 更新于 3年前

iQOS.js

一个用 JavaScript 编写的 iQOS 库,用于通过 BLE 与 iQOS 对话。

How to Use

  • You will need to install this library:
    • yarn: yarn add @0x77/iqos
    • npm: npm i -S @0x77/iqos
  • Then you need to import and bootstrap it:
// Import the library:
import iQOS from '@0x77/iqos';
const iqos = new iQOS();
// Then bootstrap:
iqos.bootstrap();
// You will receive a prompt to select iQOS device.
  • Get the charge status:
// Imagine that Holder not inside Chrager:
console.log(iqos.holderCharge);
// Will return -> false -> because its not inside Charger
/*
 If it will be inside Charger 
 it will be non false and 0 or 100
*/
console.log(iqos.chargerCharge);
// It will return the percentage of Charger Charge.

// To access the raw data of iQOS status you can use:
console.log(iqos.rawStatus);

// Check if device ready (to realtime data updates):
console.log(iqos.deviceReady);

// Check is it connected:
console.log(iqos.connected);

iQOS.js

an iQOS library written in JavaScript to talk with iQOS over BLE.

How to Use

  • You will need to install this library:
    • yarn: yarn add @0x77/iqos
    • npm: npm i -S @0x77/iqos
  • Then you need to import and bootstrap it:
// Import the library:
import iQOS from '@0x77/iqos';
const iqos = new iQOS();
// Then bootstrap:
iqos.bootstrap();
// You will receive a prompt to select iQOS device.
  • Get the charge status:
// Imagine that Holder not inside Chrager:
console.log(iqos.holderCharge);
// Will return -> false -> because its not inside Charger
/*
 If it will be inside Charger 
 it will be non false and 0 or 100
*/
console.log(iqos.chargerCharge);
// It will return the percentage of Charger Charge.

// To access the raw data of iQOS status you can use:
console.log(iqos.rawStatus);

// Check if device ready (to realtime data updates):
console.log(iqos.deviceReady);

// Check is it connected:
console.log(iqos.connected);
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文