OSDN Git Service

Rename IPCHandlerUnix to IPCHandlerLinux
[android-x86/system-bt.git] / service / low_energy_constants.h
1 //
2 //  Copyright (C) 2015 Google, Inc.
3 //
4 //  Licensed under the Apache License, Version 2.0 (the "License");
5 //  you may not use this file except in compliance with the License.
6 //  You may obtain a copy of the License at:
7 //
8 //  http://www.apache.org/licenses/LICENSE-2.0
9 //
10 //  Unless required by applicable law or agreed to in writing, software
11 //  distributed under the License is distributed on an "AS IS" BASIS,
12 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 //  See the License for the specific language governing permissions and
14 //  limitations under the License.
15 //
16
17 #pragma once
18
19 namespace bluetooth {
20
21 // Defined here are various status codes that can be returned from the stack for
22 // BLE operations.
23 enum BLEStatus {
24   BLE_STATUS_SUCCESS = 0,
25   BLE_STATUS_ADV_ERROR_DATA_TOO_LARGE = 1,
26   BLE_STATUS_ADV_ERROR_TOO_MANY_ADVERTISERS = 2,
27   BLE_STATUS_ADV_ERROR_ALREADY_STARTED = 3,
28   BLE_STATUS_ADV_ERROR_FEATURE_UNSUPPORTED = 5,
29   BLE_STATUS_FAILURE = 0x101,
30
31   // TODO(armansito): Add ATT protocol error codes
32 };
33
34 // Advertising interval for different modes.
35 const int kAdvertisingIntervalHighMs = 1000;
36 const int kAdvertisingIntervalMediumMs = 250;
37 const int kAdvertisingIntervalLowMs = 100;
38
39 // Add some randomness to the advertising min/max interval so the controller can
40 // do some optimization.
41 // TODO(armansito): I took this directly from packages/apps/Bluetooth but based
42 // on code review comments this constant and the accompanying logic doesn't make
43 // sense. Let's remove this constant and figure out how to properly calculate
44 // the Max. Adv. Interval. (See http://b/24344075).
45 const int kAdvertisingIntervalDeltaUnit = 10;
46
47 // Advertising types (ADV_IND, ADV_SCAN_IND, etc.) that are exposed to
48 // applications.
49 const int kAdvertisingEventTypeConnectable = 0;
50 const int kAdvertisingEventTypeScannable = 2;
51 const int kAdvertisingEventTypeNonConnectable = 3;
52
53 // Advertising channels. These should be kept the same as those defined in the
54 // stack.
55 const int kAdvertisingChannel37 = (1 << 0);
56 const int kAdvertisingChannel38 = (1 << 1);
57 const int kAdvertisingChannel39 = (1 << 2);
58 const int kAdvertisingChannelAll =
59     (kAdvertisingChannel37 | kAdvertisingChannel38 | kAdvertisingChannel39);
60
61 // Various Extended Inquiry Response fields types that are used for advertising
62 // data fields as defined in the Core Specification Supplement.
63 const uint8_t kEIRTypeFlags = 0x01;
64 const uint8_t kEIRTypeIncomplete16BitUUIDs = 0x02;
65 const uint8_t kEIRTypeComplete16BitUUIDs = 0x03;
66 const uint8_t kEIRTypeIncomplete32BitUUIDs = 0x04;
67 const uint8_t kEIRTypeComplete32BitUUIDs = 0x05;
68 const uint8_t kEIRTypeIncomplete128BitUUIDs = 0x06;
69 const uint8_t kEIRTypeComplete128BitUUIDs = 0x07;
70 const uint8_t kEIRTypeManufacturerSpecificData = 0xFF;
71
72 }  // namespace bluetooth