• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2015 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 #define LOG_TAG "command_packet"
18 
19 #include "vendor_libs/test_vendor_lib/include/command_packet.h"
20 
21 extern "C" {
22 #include "hci/include/hci_hal.h"
23 #include "osi/include/log.h"
24 #include "stack/include/hcidefs.h"
25 }  // extern "C"
26 
27 namespace test_vendor_lib {
28 
CommandPacket()29 CommandPacket::CommandPacket() : Packet(DATA_TYPE_COMMAND) {}
30 
GetOpcode() const31 uint16_t CommandPacket::GetOpcode() const {
32   return 0 | (GetHeader()[0] | (GetHeader()[1] << 8));
33 }
34 
GetOGF() const35 uint8_t CommandPacket::GetOGF() const {
36   return HCI_OGF(GetOpcode());
37 }
38 
GetOCF() const39 uint16_t CommandPacket::GetOCF() const {
40   return HCI_OCF(GetOpcode());
41 }
42 
43 }  // namespace test_vendor_lib
44