Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor the event of finding a new device in Mini Program

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this article entitled "how to listen for events of finding new devices in Mini Program", the sample code in this article is very detailed and has certain reference value. Interested friends must refer to it. For "how to monitor events of finding new devices in Mini Program", the editor has sorted out the following knowledge points. Please follow the steps of the editor to slowly understand it step by step. Next, let's get to the topic.

Listen for events that find new devices

CALLBACK parameter description:

Parameter type describes the new device list device object searched by devicesArray

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.onBluetoothDeviceFound (function (devices) {console.log ('new device list has founded') console.dir (devices) console.log (ab2hex (devices [0] .advertisData)}) Mini Program 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.

These are all the contents of this article entitled "how to listen for New Devices on Mini Program". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report