Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QtBluetoothGattCharacteristic.java
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4package org.qtproject.qt.android.bluetooth;
5
6import android.bluetooth.BluetoothGattCharacteristic;
7import android.os.Build;
8
9import java.util.UUID;
10
11public class QtBluetoothGattCharacteristic extends BluetoothGattCharacteristic {
12 public QtBluetoothGattCharacteristic(UUID uuid, int properties, int permissions,
13 int minimumValueLength, int maximumValueLength) {
14 super(uuid, properties, permissions);
15 minValueLength = minimumValueLength;
16 maxValueLength = maximumValueLength;
17 }
18 public int minValueLength;
19 public int maxValueLength;
20 // Starting from API 33 Android Bluetooth deprecates characteristic local value caching by
21 // deprecating the getValue() and setValue() accessors. For peripheral role we store the value
22 // locally in the characteristic as a convenience - looking up the value on the C++ side would
23 // be somewhat complicated. This should be safe as all accesses to this class are synchronized.
24 // For clarity: For API levels below 33 we still need to use the setValue() of the base class
25 // because Android internally uses getValue() with APIs below 33.
26 public boolean setLocalValue(byte[] value) {
27 if (Build.VERSION.SDK_INT >= 33) {
28 m_localValue = value;
29 return true;
30 } else {
31 return setValue(value);
32 }
33 }
34
35 public byte[] getLocalValue()
36 {
37 if (Build.VERSION.SDK_INT >= 33)
38 return m_localValue;
39 else
40 return getValue();
41 }
42
43 private byte[] m_localValue = null;
44}
QtBluetoothGattCharacteristic(UUID uuid, int properties, int permissions, int minimumValueLength, int maximumValueLength)
static const QCssKnownValue properties[NumProperties - 1]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
settings setValue("DataPump/bgcolor", color)