Loading system/vendor_libs/test_vendor_lib/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ cc_test_host { "src/event_packet.cc", "src/packet.cc", "src/packet_stream.cc", "src/l2cap.cc", "src/l2cap_packet.cc", "src/l2cap_sdu.cc", "test/async_manager_unittest.cc", "test/bt_address_unittest.cc", Loading system/vendor_libs/test_vendor_lib/include/l2cap.h→system/vendor_libs/test_vendor_lib/include/l2cap_packet.h +5 −5 Original line number Diff line number Diff line Loading @@ -29,10 +29,10 @@ namespace test_vendor_lib { const int kSduHeaderLength = 4; class L2cap { class L2capPacket { public: // Returns an assembled L2cap object if successful, nullptr if failure. static std::unique_ptr<L2cap> assemble( static std::unique_ptr<L2capPacket> assemble( const std::vector<L2capSdu>& sdu_packet); // Construct a vector of just the L2CAP payload. This essentially Loading @@ -42,7 +42,7 @@ class L2cap { uint16_t get_l2cap_cid() const; private: L2cap() = default; L2capPacket() = default; // Entire L2CAP packet: length, CID, and payload in that order. std::vector<uint8_t> l2cap_packet_; Loading @@ -64,7 +64,7 @@ class L2cap { // Reasembly is 10b, false otherwise. static bool check_if_ending_sdu(const uint8_t bytes); DISALLOW_COPY_AND_ASSIGN(L2cap); }; // L2cap DISALLOW_COPY_AND_ASSIGN(L2capPacket); }; // L2capPacket } // namespace test_vendor_lib system/vendor_libs/test_vendor_lib/src/l2cap.cc→system/vendor_libs/test_vendor_lib/src/l2cap_packet.cc +8 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ ******************************************************************************/ #define LOG_TAG "l2cap_assemble" #include "l2cap.h" #include "l2cap_packet.h" #include <algorithm> Loading @@ -31,9 +31,9 @@ const uint16_t kSduTxSeqBits = 0x007e; const int kSduStandardHeaderLength = 6; const int kSduFirstHeaderLength = 8; std::unique_ptr<L2cap> L2cap::assemble( std::unique_ptr<L2capPacket> L2capPacket::assemble( const std::vector<L2capSdu>& sdu_packets) { std::unique_ptr<L2cap> built_l2cap_packet(new L2cap()); std::unique_ptr<L2capPacket> built_l2cap_packet(new L2capPacket()); uint16_t l2cap_payload_length = 0; uint16_t first_packet_channel_id = 0; uint8_t txseq_start; Loading Loading @@ -124,7 +124,7 @@ std::unique_ptr<L2cap> L2cap::assemble( return built_l2cap_packet; } // Assemble std::vector<uint8_t> L2cap::get_l2cap_payload() const { std::vector<uint8_t> L2capPacket::get_l2cap_payload() const { std::vector<uint8_t> payload_sub_vector; payload_sub_vector.clear(); Loading @@ -135,19 +135,19 @@ std::vector<uint8_t> L2cap::get_l2cap_payload() const { return payload_sub_vector; } uint16_t L2cap::get_l2cap_cid() const { uint16_t L2capPacket::get_l2cap_cid() const { return ((l2cap_packet_[3] << 8) | l2cap_packet_[2]); } bool L2cap::check_if_only_sdu(const uint8_t bits) { bool L2capPacket::check_if_only_sdu(const uint8_t bits) { return ((bits & 0xc) == 0x0); } bool L2cap::check_if_starting_sdu(const uint8_t bits) { bool L2capPacket::check_if_starting_sdu(const uint8_t bits) { return ((bits & 0xc) == 0x4); } bool L2cap::check_if_ending_sdu(const uint8_t bits) { bool L2capPacket::check_if_ending_sdu(const uint8_t bits) { return ((bits & 0xc) == 0x8); } Loading Loading
system/vendor_libs/test_vendor_lib/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ cc_test_host { "src/event_packet.cc", "src/packet.cc", "src/packet_stream.cc", "src/l2cap.cc", "src/l2cap_packet.cc", "src/l2cap_sdu.cc", "test/async_manager_unittest.cc", "test/bt_address_unittest.cc", Loading
system/vendor_libs/test_vendor_lib/include/l2cap.h→system/vendor_libs/test_vendor_lib/include/l2cap_packet.h +5 −5 Original line number Diff line number Diff line Loading @@ -29,10 +29,10 @@ namespace test_vendor_lib { const int kSduHeaderLength = 4; class L2cap { class L2capPacket { public: // Returns an assembled L2cap object if successful, nullptr if failure. static std::unique_ptr<L2cap> assemble( static std::unique_ptr<L2capPacket> assemble( const std::vector<L2capSdu>& sdu_packet); // Construct a vector of just the L2CAP payload. This essentially Loading @@ -42,7 +42,7 @@ class L2cap { uint16_t get_l2cap_cid() const; private: L2cap() = default; L2capPacket() = default; // Entire L2CAP packet: length, CID, and payload in that order. std::vector<uint8_t> l2cap_packet_; Loading @@ -64,7 +64,7 @@ class L2cap { // Reasembly is 10b, false otherwise. static bool check_if_ending_sdu(const uint8_t bytes); DISALLOW_COPY_AND_ASSIGN(L2cap); }; // L2cap DISALLOW_COPY_AND_ASSIGN(L2capPacket); }; // L2capPacket } // namespace test_vendor_lib
system/vendor_libs/test_vendor_lib/src/l2cap.cc→system/vendor_libs/test_vendor_lib/src/l2cap_packet.cc +8 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ ******************************************************************************/ #define LOG_TAG "l2cap_assemble" #include "l2cap.h" #include "l2cap_packet.h" #include <algorithm> Loading @@ -31,9 +31,9 @@ const uint16_t kSduTxSeqBits = 0x007e; const int kSduStandardHeaderLength = 6; const int kSduFirstHeaderLength = 8; std::unique_ptr<L2cap> L2cap::assemble( std::unique_ptr<L2capPacket> L2capPacket::assemble( const std::vector<L2capSdu>& sdu_packets) { std::unique_ptr<L2cap> built_l2cap_packet(new L2cap()); std::unique_ptr<L2capPacket> built_l2cap_packet(new L2capPacket()); uint16_t l2cap_payload_length = 0; uint16_t first_packet_channel_id = 0; uint8_t txseq_start; Loading Loading @@ -124,7 +124,7 @@ std::unique_ptr<L2cap> L2cap::assemble( return built_l2cap_packet; } // Assemble std::vector<uint8_t> L2cap::get_l2cap_payload() const { std::vector<uint8_t> L2capPacket::get_l2cap_payload() const { std::vector<uint8_t> payload_sub_vector; payload_sub_vector.clear(); Loading @@ -135,19 +135,19 @@ std::vector<uint8_t> L2cap::get_l2cap_payload() const { return payload_sub_vector; } uint16_t L2cap::get_l2cap_cid() const { uint16_t L2capPacket::get_l2cap_cid() const { return ((l2cap_packet_[3] << 8) | l2cap_packet_[2]); } bool L2cap::check_if_only_sdu(const uint8_t bits) { bool L2capPacket::check_if_only_sdu(const uint8_t bits) { return ((bits & 0xc) == 0x0); } bool L2cap::check_if_starting_sdu(const uint8_t bits) { bool L2capPacket::check_if_starting_sdu(const uint8_t bits) { return ((bits & 0xc) == 0x4); } bool L2cap::check_if_ending_sdu(const uint8_t bits) { bool L2capPacket::check_if_ending_sdu(const uint8_t bits) { return ((bits & 0xc) == 0x8); } Loading