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

@gggxbbb/w96p-ble-sdk

v17.0.2

Published

W96P/W66D BLE fan protocol SDK

Readme

@gggxbbb/w96p-ble-sdk

W96P / W66D BLE 风扇协议 SDK,零外部依赖(仅 Zustand)。

安装

npm install @gggxbbb/w96p-ble-sdk

使用

import { BleManager } from '@gggxbbb/w96p-ble-sdk';
import type { BleSnapshot, IBleManager } from '@gggxbbb/w96p-ble-sdk';

const mgr = new BleManager();
mgr.onSnapshot = (snap: BleSnapshot) => {
  console.log('风扇转速:', snap.fanSpeed);
  console.log('电池:', snap.battery);
};
mgr.onState = (state, name) => {
  console.log('连接状态:', state, name);
};
await mgr.connect();
mgr.startPolling(1000);

// 设置转速
await mgr.writeFanSpeed(50);
// 设置档位
await mgr.writeGear(2);
// 开启自然风
await mgr.writeNatureWind(true);

// 断开
mgr.disconnect();

虚拟设备(无需蓝牙)

import { VirtualManager } from '@gggxbbb/w96p-ble-sdk';

const vm = new VirtualManager();
vm.setVirtualProfile(false);  // false=W96P, true=W66D
vm.onSnapshot = (snap) => console.log(snap);
await vm.connect();

波形合成

import { generateWaveSample, synthesizeLayers, applyEnvelope } from '@gggxbbb/w96p-ble-sdk';

const layers = [{ enabled: true, waveform: 'sine', amplitude: 30, frequency: 2, offset: 0, phase: 0, invert: false }];
const curve = synthesizeLayers(128, layers);

API 概览

BLE 管理器

| 接口 | 说明 | |------|------| | BleManager | Web Bluetooth 连接管理器 | | VirtualManager | 虚拟设备(开发调试) | | IBleManager | 管理器接口 | | BleSnapshot | 设备状态快照 |

解析 & 命令

| 函数 | 说明 | |------|------| | parseBatteryInfo | 解析 FFD1 电池数据 | | parsePowerStatus | 解析 FFD2 电源状态 | | parseMotorInfo | 解析 FFD3 电机信息 | | parsePowerConfig | 解析 FFD4 电源配置寄存器 | | cmd | 命令模板(setBatteryCapacity 等) | | encodeCmd | 命令字符串 → Uint8Array |

版本特性

| 函数 | 说明 | |------|------| | compareVersion | 语义版本号比较 | | getFeatures | 根据固件版本获取功能集 |

电源开关

| 常量 | 说明 | |------|------| | POW_SWITCHES | 电源寄存器开关位定义 | | POW_SEGS | 电源寄存器多选位域 | | REG_TITLES | 寄存器中文标题 |

自然风曲线

| 函数 | 说明 | |------|------| | generateWaveSample | 单点波形采样 | | generateLayer | 生成完整波形层 | | synthesizeLayers | 多层合成 | | applyEnvelope | ADSR 包络调制 | | DEFAULT_CURVE | 默认曲线 (128 点) | | PRESETS | 内置曲线预设 |

版本号

主版本号对应该 SDK 支持的最高固件主版本。

| SDK | 固件 | 说明 | |-----|------|------| | 17.x.y | 1.7 | Turbo, BLE_SN, 灯光控制 |

许可

MIT