Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use wx.writeBLECharacteristicValue in Mini Program

Shulou Source: shulou.com Published: 2022-06-02 01:26:22 09月28日 Update

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!

Tags: Bluetooth programs interfaces features eigenvalues devices success parameters content type surface binary function data proper one search seven value public memory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Tech Info Shulou Technology vpn Xiaomi