Get the App
SLTechnology News&Howtos  ›  Development  › 

How to get the Bluetooth module effective in Mini Program

Shulou Source: shulou.com Published: 2022-06-02 01:26:21 11月12日 Update

This article mainly shows you how to get the Bluetooth module in Mini Program into effect. The content is easy to understand and clear. I hope it can help you solve your doubts. Now let the editor take you to study and learn the article "how to get the Bluetooth module in Mini Program to take effect".

Get all Bluetooth devices that have been discovered during the Mini Program Bluetooth module takes effect, including those that have been connected to the machine.

OBJECT parameter description:

Parameter type required indicates that successFunction returns the status of the native Bluetooth adapter if it is successful. FailFunction No API call failed callback function completeFunction No API call ended callback function (both successful and failed calls will be executed)

Success return parameters:

Parameter type indicates that the list of connected devices corresponding to devicesArrayuuid errMsgString succeeded: ok, error: details device object

Bluetooth device Information

Parameter type description nameString Bluetooth device name, some devices may not have deviceIdString to distinguish the signal strength of the device's idRSSINumber current Bluetooth device ManufacturerData segment in the broadcast segment of the current Bluetooth device (note: vConsole cannot print out ArrayBuffer type data) advertisServiceUUIDsArray ServiceUUIDs segment in the broadcast segment of the current Bluetooth device localNameString LocalName segment in the current Bluetooth device broadcast segment

Sample code:

/ / ArrayBuffer to 16 progress string example function ab2hex (buffer) {var hexArr = Array.prototype.map.call (new Uint8Array (buffer), function (bit) {return ('00' + bit.toString (16). Slice (- 2)}) return hexArr.join ('') } wx.getBluetoothDevices ({success: function (res) {console.log (res) if (res.devices [0])) {console.log (ab2hex (res.devices [0] .advertisData))}}) what is the advantage of Mini Program compared with developers, Mini Program is less difficult to develop, can save development and operating costs, and allows developers to quickly develop a Mini Program. And Mini Program can be easily obtained and spread in Wechat, which can meet the basic life applications, in line with life services offline stores and non-rigid needs of low-frequency applications. For users, it can save time cost and mobile phone memory space, and have excellent use experience at the same time.

The above is about "how to get the Bluetooth module to take effect in Mini Program". If this article is helpful and well written, please share it with your friends to learn new knowledge. if you want to know more about it, please pay more attention to the industry information channel.

Tags: Bluetooth devices programs data parameters development modules types success content broadcasts messages functions developers costs interfaces status examples articles native Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Huawei Docker MariaDB Linux