• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 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 <base/logging.h>
20 #include <cstdint>
21 #include <memory>
22 #include <vector>
23 
24 #include "include/sco.h"
25 #include "packets/packet_view.h"
26 
27 namespace test_vendor_lib {
28 namespace packets {
29 
30 // SCO data packets are specified in the Bluetooth Core Specification Version
31 // 4.2, Volume 2, Part E, Section 5.4.3
32 class ScoPacketView : public PacketView<true> {
33  public:
34   virtual ~ScoPacketView() override = default;
35 
36   static ScoPacketView Create(std::shared_ptr<std::vector<uint8_t>> packet);
37 
38   uint16_t GetHandle() const;
39   sco::PacketStatusFlagsType GetPacketStatusFlags() const;
40   PacketView<true> GetPayload() const;
41 
42  private:
43   ScoPacketView(std::shared_ptr<std::vector<uint8_t>> packet);
44   ScoPacketView() = delete;
45 };
46 
47 }  // namespace packets
48 }  // namespace test_vendor_lib
49