New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

qcloud-iotexplorer-h5-panel-sdk

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qcloud-iotexplorer-h5-panel-sdk - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

2

package.json
{
"name": "qcloud-iotexplorer-h5-panel-sdk",
"version": "1.1.1",
"version": "1.1.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/release/qcloud-iotexplorer-h5-panel-sdk",

@@ -387,2 +387,15 @@ # qcloud-iotexplorer-h5-panel-sdk

#### 事件
##### blueToothAdapter.on('adapterStateChange', ({ available, discovering }) => {})
当适配器状态变化时触发。
### DeviceAdapter
设备适配器构造函数
#### DeviceAdapter.serviceId
子类在继承基类后需要设置该属性,代表该设备的主服务ID
#### DeviceAdapter.deviceFilter: (deviceInfo: DeviceInfo) => { deviceName: string, serviceId: string, ...deviceInfo }
子类在继承基类后需要实现该静态方法,在搜索蓝牙设备时会将每个搜出的设备信息传入该方法,如果判断是本产品的设备,则需在除入参deviceInfo之外返回设备唯一标识 deviceName 及 serviceId,否则返回空;
### deviceAdapter

@@ -400,2 +413,5 @@ 设备适配器

#### deviceAdapter.serviceId
getter,设备的主服务ID,实际上既是挂在构造函数上的静态属性 DeviceAdapter.serviceId
#### deviceAdapter.originName

@@ -409,1 +425,32 @@ getter,设备的原始名称,即小程序接口搜索出来时的 name 字段

主动断开设备连接
#### deviceAdapter.write: (hexString) => Promise
* hexString: string; 需要写给蓝牙设备的16进制字符串
往蓝牙设备写数据。
#### deviceAdapter.handleBLEMessage: (hexString) => { reportData?: any, ...any }
子类继承基类后需要实现该方法,用于处理收到 onBLECharacteristicValueChange 回调后的协议解析。
返回值中如果返回 reportData,则会将该部分数据上报到云端(注意需与产品定义物模型匹配),其他字段则会透传到 `message` 事件的 payload 中。
#### deviceAdapter 事件
##### Event: 'connect'
设备连接后触发
##### Event: 'disconnect'
设备断开后触发
##### Event: 'message'
* timestamp: number; 收到设备消息的时间戳,单位毫秒
* dataReported: boolean; 收到设备的消息是否已上报云端
* 其他; handleBLEMessage 函数返回的其他参数将会透传到 message 事件中
当收到 onBLECharacteristicValueChange 回调,并经过 handleBLEMessage 处理后触发
##### Event: 'bLEConnectionStateChange'
* connected: boolean; 设备是否连接
当 onBleConnectionStateChange 触发时触发,若 connected 为 true,则接下来会触发事件 'connect',否则会触发事件 'disconnect'
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc