• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3# Copyright (C) 2016 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may not
6# use this file except in compliance with the License. You may obtain a copy of
7# the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations under
15# the License.
16
17from enum import Enum
18
19
20class ScanSettingsCallbackType(Enum):
21    CALLBACK_TYPE_ALL_MATCHES = 1
22    CALLBACK_TYPE_FIRST_MATCH = 2
23    CALLBACK_TYPE_MATCH_LOST = 4
24    CALLBACK_TYPE_FOUND_AND_LOST = 6
25
26
27class ScanSettingsMatchMode(Enum):
28    AGGRESIVE = 1
29    STICKY = 2
30
31
32class ScanSettingsMatchNum(Enum):
33    MATCH_NUM_ONE_ADVERTISEMENT = 1
34    MATCH_NUM_FEW_ADVERTISEMENT = 2
35    MATCH_NUM_MAX_ADVERTISEMENT = 3
36
37
38class ScanSettingsScanResultType(Enum):
39    SCAN_RESULT_TYPE_FULL = 0
40    SCAN_RESULT_TYPE_ABBREVIATED = 1
41
42
43class ScanSettingsScanMode(Enum):
44    SCAN_MODE_OPPORTUNISTIC = -1
45    SCAN_MODE_LOW_POWER = 0
46    SCAN_MODE_BALANCED = 1
47    SCAN_MODE_LOW_LATENCY = 2
48
49
50class ScanSettingsReportDelaySeconds(Enum):
51    MIN = 0
52    MAX = 9223372036854775807
53
54
55class ScanSettingsPhy(Enum):
56    PHY_LE_1M = 1
57    PHY_LE_CODED = 3
58    PHY_LE_ALL_SUPPORTED = 255
59
60
61class AdvertiseSettingsAdvertiseType(Enum):
62    ADVERTISE_TYPE_NON_CONNECTABLE = 0
63    ADVERTISE_TYPE_CONNECTABLE = 1
64
65
66class AdvertiseSettingsAdvertiseMode(Enum):
67    ADVERTISE_MODE_LOW_POWER = 0
68    ADVERTISE_MODE_BALANCED = 1
69    ADVERTISE_MODE_LOW_LATENCY = 2
70
71
72class AdvertiseSettingsAdvertiseTxPower(Enum):
73    ADVERTISE_TX_POWER_ULTRA_LOW = 0
74    ADVERTISE_TX_POWER_LOW = 1
75    ADVERTISE_TX_POWER_MEDIUM = 2
76    ADVERTISE_TX_POWER_HIGH = 3
77
78
79class BLEConnectionPriority(Enum):
80    # Connection Interval: BALANCED = 36ms, HIGH = 12ms, LOW = 96ms
81    CONNECTION_PRIORITY_BALANCED = 0
82    CONNECTION_PRIORITY_HIGH = 1
83    CONNECTION_PRIORITY_LOW = 2
84
85
86class JavaInteger(Enum):
87    MIN = -2147483648
88    MAX = 2147483647
89
90
91class Uuids(Enum):
92    P_Service = "0000feef-0000-1000-8000-00805f9b34fb"
93    HR_SERVICE = "0000180d-0000-1000-8000-00805f9b34fb"
94
95
96class AdvertiseErrorCode(Enum):
97    DATA_TOO_LARGE = 1
98    TOO_MANY_ADVERTISERS = 2
99    ADVERTISE_ALREADY_STARTED = 3
100    BLUETOOTH_INTERNAL_FAILURE = 4
101    FEATURE_NOT_SUPPORTED = 5
102
103
104class BluetoothAdapterState(Enum):
105    STATE_OFF = 10
106    STATE_TURNING_ON = 11
107    STATE_ON = 12
108    STATE_TURNING_OFF = 13
109    STATE_BLE_TURNING_ON = 14
110    STATE_BLE_ON = 15
111    STATE_BLE_TURNING_OFF = 16
112