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 use wx.writeBLECharacteristicValue in Mini Program

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

Share

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

This "how to use wx.writeBLECharacteristicValue in Mini Program" in addition to programmers, most people do not understand, today, in order to make you more understand how to use wx.writeBLECharacteristicValue in Mini Program, the editor summed up the following contents, with a certain reference value, the detailed steps are clear, the details are handled properly, I hope you can get something through this article, now let's take a look at the specific content.

Write binary data to the eigenvalues of the low-power Bluetooth device. Note: the eigenvalue of the device must support write before it can be successfully called. For more information, please see the properties attribute of characteristic.

Tips: there is the possibility of read-write failure when calling the read-write interface multiple times in parallel.

OBJECT parameter description:

Parameter type required indicates that deviceIdString is a Bluetooth device id, reference device object serviceIdString is Bluetooth eigenvalue corresponding to service uuidcharacteristicIdString is Bluetooth eigenvalue, uuidvalueArrayBuffer is Bluetooth eigenvalue corresponding to Bluetooth device eigenvalue, successFunction is a binary value corresponding to Bluetooth device eigenvalue, if successFunction is successful, return local Bluetooth adapter status completeFunction No API call failed callback function completeFunction No API call end callback function (both successful and failed calls will be executed)

Success return parameters:

Parameter type description errMsgString success: ok, error: details

Sample code:

/ / send a 0x00 hexadecimal data let buffer = new ArrayBuffer (1) let dataView = new DataView (buffer) dataView.setUint8 (0,0) wx.writeBLECharacteristicValue ({/ / the deviceId here needs to obtain deviceId: deviceId from the above getBluetoothDevices or onBluetoothDeviceFound interface, / / the serviceId here needs to obtain serviceId: serviceId from the above getBLEDeviceServices interface, / / the characteristicId here needs to obtain characteristicId: characteristicId from the getBLEDeviceCharacteristics interface above) / / the value here is of ArrayBuffer type value: buffer, success: function (res) {console.log ('writeBLECharacteristicValue success', res.errMsg)}}) what does Mini Program mean? Mini Program is an application that can be used without download or installation. By scanning the QR code or searching it for immediate use, it is easy to operate and easy to spread, and can achieve seven functions such as message notification, offline code scanning, 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.

Thank you for your reading. I hope you have a certain understanding of the key issue of "how to use wx.writeBLECharacteristicValue in Mini Program". The specific use needs to be understood by everyone through hands-on experiments. Go and try it. If you want to read more articles on relevant knowledge points, 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