Selaa lähdekoodia

增加BM30广播模块

master
陈炫华 9 kuukautta sitten
vanhempi
commit
254a84e1f8
3 muutettua tiedostoa jossa 54 lisäystä ja 72 poistoa
  1. 1
    1
      ailink_demo/app.json
  2. 4
    3
      ailink_demo/pages/index/index.js
  3. 49
    68
      ailink_demo/project.config.json

+ 1
- 1
ailink_demo/app.json Näytä tiedosto

}, },
"plugins": { "plugins": {
"sdkPlugin": { "sdkPlugin": {
"version": "1.1.2",
"version": "2.4.0",
"provider": "wx17e93aad47cdae1a" "provider": "wx17e93aad47cdae1a"
} }
}, },

+ 4
- 3
ailink_demo/pages/index/index.js Näytä tiedosto

allowDuplicatesKey: true, allowDuplicatesKey: true,
services: [ services: [
"FFE0", "FFE0",
// "F0A0", // BM30广播模块需加上,如使用连接模块可忽略
"F0A0", // BM30广播模块需加上,如使用连接模块可忽略
], ],
powerLevel: 'high',
success: (res) => { success: (res) => {
console.log('startBluetoothDevicesDiscovery success', res) console.log('startBluetoothDevicesDiscovery success', res)
this.onBluetoothDeviceFound() this.onBluetoothDeviceFound()
device.analyzeDataText = analyzeData.text device.analyzeDataText = analyzeData.text
} }
} else { } else {
let buff = device.advertisData.slice(-6)
let buff = device.advertisData.slice(8,14)
device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址 device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址
let tempMac = Array.from(device.mac) let tempMac = Array.from(device.mac)
tempMac.reverse() tempMac.reverse()
} else { } else {
// ... 其他单位 // ... 其他单位
} }
this.weight = weightValue / (decPoint * 10) // 除去小数点位数
this.weight = weightValue / (10 ** decPoint) // 除去小数点位数
break; break;
// ... 其他指令请根据协议解析 // ... 其他指令请根据协议解析
/** /**

+ 49
- 68
ailink_demo/project.config.json Näytä tiedosto

{ {
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
"description": "项目配置文件",
"packOptions": {
"ignore": [],
"include": []
}, },
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.14.1",
"appid": "wx17e93aad47cdae1a",
"projectname": "ailink_demo",
"debugOptions": {
"hidedInDevtools": []
},
"scripts": {},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
"setting": {
"urlCheck": true,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
}, },
"conversation": {
"list": []
},
"game": {
"list": []
},
"plugin": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": []
"compileType": "miniprogram",
"libVersion": "2.14.1",
"appid": "wx17e93aad47cdae1a",
"projectname": "ailink_demo",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
} }
}
} }

Loading…
Peruuta
Tallenna