Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
11class QtBluetoothGattCharacteristic extends BluetoothGattCharacteristic {
12 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 int minValueLength;
19 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 @SuppressWarnings("deprecation")
27 boolean setLocalValue(byte[] value) {
28 if (Build.VERSION.SDK_INT >= 33) {
29 m_localValue = value;
30 return true;
31 } else {
32 return setValue(value);
33 }
34 }
35
36 @SuppressWarnings("deprecation")
37 byte[] getLocalValue()
38 {
39 if (Build.VERSION.SDK_INT >= 33)
40 return m_localValue;
41 else
42 return getValue();
43 }
44
45 private byte[] m_localValue = null;
46}
static constexpr QCssKnownValue properties[]
EGLOutputLayerEXT EGLint EGLAttrib value
[3]
static Value getValue(const QHash< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())