command_packet.cc revision f3b1820e1676261886a6537e1f6abac6a35ed6d4
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 21extern "C" { 22#include "hci/include/hci_hal.h" 23#include "osi/include/log.h" 24#include "stack/include/hcidefs.h" 25 26#include <assert.h> 27} // extern "C" 28 29namespace test_vendor_lib { 30 31CommandPacket::CommandPacket() : Packet(DATA_TYPE_COMMAND) {} 32 33uint16_t CommandPacket::GetOpcode() const { 34 return 0 | (GetHeader()[0] | (GetHeader()[1] << 8)); 35} 36 37uint8_t CommandPacket::GetOGF() const { 38 return HCI_OGF(GetOpcode()); 39} 40 41uint16_t CommandPacket::GetOCF() const { 42 return HCI_OCF(GetOpcode()); 43} 44 45} // namespace test_vendor_lib 46