• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 The Android Open Source Project
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 #include <stdlib.h>
20 
21 // HCI UART transport packet types (Volume 4, Part A, 2)
22 enum HciPacketType {
23   HCI_PACKET_TYPE_UNKNOWN = 0,
24   HCI_PACKET_TYPE_COMMAND = 1,
25   HCI_PACKET_TYPE_ACL_DATA = 2,
26   HCI_PACKET_TYPE_SCO_DATA = 3,
27   HCI_PACKET_TYPE_EVENT = 4,
28   HCI_PACKET_TYPE_ISO_DATA = 5,
29 };
30 
31 // 2 bytes for opcode, 1 byte for parameter length (Volume 2, Part E, 5.4.1)
32 const size_t HCI_COMMAND_PREAMBLE_SIZE = 3;
33 const size_t HCI_LENGTH_OFFSET_CMD = 2;
34 
35 // 2 bytes for handle, 2 bytes for data length (Volume 2, Part E, 5.4.2)
36 const size_t HCI_ACL_PREAMBLE_SIZE = 4;
37 const size_t HCI_LENGTH_OFFSET_ACL = 2;
38 
39 // 2 bytes for handle, 1 byte for data length (Volume 2, Part E, 5.4.3)
40 const size_t HCI_SCO_PREAMBLE_SIZE = 3;
41 const size_t HCI_LENGTH_OFFSET_SCO = 2;
42 
43 // 1 byte for event code, 1 byte for parameter length (Volume 2, Part E, 5.4.4)
44 const size_t HCI_EVENT_PREAMBLE_SIZE = 2;
45 const size_t HCI_LENGTH_OFFSET_EVT = 1;
46 
47 const size_t HCI_PREAMBLE_SIZE_MAX = HCI_ACL_PREAMBLE_SIZE;
48 
49 // Event codes (Volume 2, Part E, 7.7.14)
50 const uint8_t HCI_COMMAND_COMPLETE_EVENT = 0x0E;
51