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 start searching for nearby Bluetooth peripherals in WeChat Mini Programs's development

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you how to start searching for nearby Bluetooth peripherals in the development of WeChat Mini Programs. The content is simple and clear. I hope it can help you solve your doubts. Next, let me take you to study and learn the article "how to start searching for nearby Bluetooth peripherals in the development of WeChat Mini Programs".

Start searching for nearby Bluetooth peripherals. Note that this operation consumes system resources, please call the stop method to stop the search after searching and connecting to the device.

OBJECT parameter description:

Parameter type is required to indicate whether servicesArray No Bluetooth device Master service uuid list allowDuplicatesKeyBoolean allows repeated reporting of the same device. If repeated escalation is allowed, the onDeviceFound method will report the same device many times, but the RSSI value will have the interval between different intervalNumber not reporting the device. The default is 0, which means to find a new device and report it immediately. Otherwise, if the successFunction is reported as successful according to the passed interval, the local Bluetooth adapter status failFunction No API call failed callback function completeFunction No API call end callback function (both successful and failed calls will be executed)

The services parameter states that some Bluetooth devices broadcast the uuid of their own primary service. If the array is passed here, then according to the uuid list, only Bluetooth devices that send broadcast packets with this main service are searched. It is recommended to filter out other Bluetooth devices that do not need to be processed around.

Success return parameters:

Parameter type description errMsgString success: ok, error: details

Sample code:

/ / take the Bluetooth smart lamp of Wechat hardware platform as an example. The UUID of the main service is FEE7. Enter this parameter to search only devices whose main service UUID is FEE7 wx.startBluetoothDevicesDiscovery ({services: ['FEE7'], success: function (res) {console.log (res)}}) what does Mini Program mean? Mini Program is an application that can be used without download and installation. It can be used immediately by scanning the QR code or searching for it. It is easy to operate and easy to spread. It can realize seven functions, such as message notification, offline scanning code, official account association and so on. It is based on Wechat, similar to APP. You can use it whenever you want. After using it, you will leave without taking up memory.

The above is about "how to start searching for nearby Bluetooth peripherals in the development of WeChat Mini Programs". If this article is helpful to you and think it is 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.

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