npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yolanda-qn/handheld-height-protocols

v1.0.0

Published

手持身高测量仪

Downloads

3

Readme

手持身高测量仪

关联资源

  • 轻牛小程序蓝牙库:https://www.npmjs.com/package/@yolanda-qn/qn-mp-plugin
  • 轻牛蓝牙类型库:https://www.npmjs.com/package/@yolanda-qn/qn-ble-types
  • demo地址:https://gitee.com/yolandaqingniu/qn_mp_plugin_demo

使用

具体用法查看 pages/handheld-height 目录下的代码

npm install @yolanda-qn/qn-mp-plugin
npm install @yolanda-qn/handheld-height-protocols
import { QNMPPlugin } from '@yolanda-qn/qn-mp-plugin';
import { HandheldHeightProtocol } from '@yolanda-qn/handheld-height-protocols';

// 初始化蓝牙
this.bleApi = new QNMPPlugin({
  useSdk: false, // 体脂秤才需要。这里需要关闭
  logger: logger(), // 非必须,日志功能,最好有,方便排查问题,可以替换为客户自己的
  protocols: [HandheldHeightProtocol],
});

设备事件回调

// 获取设备信息
const onGetDeviceInfo = (device) => {
  console.log('获取设备信息', device);
  this.setData({ deviceInfo: device.info });
}

// 获取测量结果
const onGetHandHeightData = (handHeightData) => {
  console.log('获取测量身高结果', handHeightData);
  const { height, heightUnit } = handHeightData;
  this.setData({ height, heightUnit });
}

// 获取同步时间结果
const onSyncTimeResult = (state) => {
  console.log('同步时间结果', state);
}

// 获取存储数据
const onGetStoredDatas = (historyData) => {
  console.warn('获取存储数据', historyData);
  this.setData({ historyData });
}

// 设置当前用户结果
const onSetUerResult = ({ setIndexState, setUnitState, userIndex }) => {
  if (!setUnitState) {
    wx.showToast({ title: '设置单位失败,请确认设备是否支持该单位', icon: 'none' });
  }

  if (!setIndexState) {
    wx.showToast({ title: '设置用户位失败', icon: 'none' });
  }

  if (setIndexState) this.setData({ userIndex });
}
// 在创建连接时传入
const deviceEventListener = { onGetDeviceInfo, onGetHandHeightData, onSyncTimeResult, onGetStoredDatas, onSetUerResult };
this.bleApi.createBleConnection(device, deviceEventListener);

device.info

|字段名|类型|说明| |:--:|:--:|:--:| |userIndex|number|用户位| |bleVersion|number|蓝牙版本| |fwVersion|number|固件版本| |historyCount|number[]|用户历史数据 [用户1, 用户2, 用户3]| |isSupportCm|boolean|设备是否支持 cm 单位| |isSupportFtIn|boolean|设备是否支持 ft:in 单位| |isSupportIn|boolean|设备是否支持 in 单位| |isSupportFt|boolean|设备是否支持 ft 单位|

historyData

| 字段名 | 类型 | 说明 | | :-------: | :----: | :----------: | | height | number | 历史测量数据 | | timestamp | number | 测量时间戳 | | userIndex | number | 用户位 |

handHeightData

| 字段名 | 类型 | 说明 | | :--------: | :----------------: | :----------------------------------------------------: | | userIndex | number | 用户位 | | height | number | 身高测量结果 | | heightUnit | number | 测量单位 | | state | number:01、02、03 | 测量状态:01(成功)| 02(超时)| 03(超出测量范围) |

QNBleHeightUnit

// 身高测量仪单位
export enum QNBleHeightUnit {
  CM = 'cm',
  FT = 'ft',
  IN = 'in',
  FTIN = 'ft:in',
}
npm install @yolanda-qn/qn-ble-types