Loading system/vendor_libs/test_vendor_lib/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ cc_test_host { "test/async_manager_unittest.cc", "test/bt_address_unittest.cc", "test/packet_stream_unittest.cc", "test/l2cap_test.cc", "test/l2cap_sdu_test.cc", ], local_include_dirs: [ "include", Loading system/vendor_libs/test_vendor_lib/include/l2cap_packet.h +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ class L2capPacket { // Construct a vector of just the L2CAP payload. This essentially // will remove the L2CAP header from the private member variable. // TODO: Remove this in favor of custom iterators. std::vector<uint8_t> get_l2cap_payload() const; uint16_t get_l2cap_cid() const; Loading system/vendor_libs/test_vendor_lib/include/l2cap_sdu.h +3 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ class L2capSdu { // Returns a completed L2capSdu object. L2capSdu(std::vector<uint8_t> create_from); // Adds an FCS to create_from and returns an L2capSdu object static L2capSdu L2capSduBuilder(std::vector<uint8_t> create_from); // Get a vector iterator that points to the first byte of the // L2CAP payload within an SDU. The offset parameter will be the // number of bytes that are in the SDU header. This should always Loading system/vendor_libs/test_vendor_lib/include/l2cap_test_packets.h 0 → 100644 +1446 −0 File added.Preview size limit exceeded, changes collapsed. Show changes system/vendor_libs/test_vendor_lib/src/l2cap_sdu.cc +13 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,19 @@ L2capSdu::L2capSdu(std::vector<uint8_t> create_from) { sdu_data_.insert(sdu_data_.end(), create_from.begin(), create_from.end()); } L2capSdu L2capSdu::L2capSduBuilder(std::vector<uint8_t> create_from) { L2capSdu packet(create_from); packet.sdu_data_.resize(packet.sdu_data_.size() + 2, 0x00); uint16_t fcs = packet.calculate_fcs(); packet.sdu_data_[packet.sdu_data_.size() - 2] = fcs & 0xFF; packet.sdu_data_[packet.sdu_data_.size() - 1] = (fcs & 0xFF00) >> 8; return packet; } uint16_t L2capSdu::convert_from_little_endian( const unsigned int starting_index) const { uint16_t convert = sdu_data_[starting_index + 1]; Loading Loading
system/vendor_libs/test_vendor_lib/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ cc_test_host { "test/async_manager_unittest.cc", "test/bt_address_unittest.cc", "test/packet_stream_unittest.cc", "test/l2cap_test.cc", "test/l2cap_sdu_test.cc", ], local_include_dirs: [ "include", Loading
system/vendor_libs/test_vendor_lib/include/l2cap_packet.h +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ class L2capPacket { // Construct a vector of just the L2CAP payload. This essentially // will remove the L2CAP header from the private member variable. // TODO: Remove this in favor of custom iterators. std::vector<uint8_t> get_l2cap_payload() const; uint16_t get_l2cap_cid() const; Loading
system/vendor_libs/test_vendor_lib/include/l2cap_sdu.h +3 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ class L2capSdu { // Returns a completed L2capSdu object. L2capSdu(std::vector<uint8_t> create_from); // Adds an FCS to create_from and returns an L2capSdu object static L2capSdu L2capSduBuilder(std::vector<uint8_t> create_from); // Get a vector iterator that points to the first byte of the // L2CAP payload within an SDU. The offset parameter will be the // number of bytes that are in the SDU header. This should always Loading
system/vendor_libs/test_vendor_lib/include/l2cap_test_packets.h 0 → 100644 +1446 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
system/vendor_libs/test_vendor_lib/src/l2cap_sdu.cc +13 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,19 @@ L2capSdu::L2capSdu(std::vector<uint8_t> create_from) { sdu_data_.insert(sdu_data_.end(), create_from.begin(), create_from.end()); } L2capSdu L2capSdu::L2capSduBuilder(std::vector<uint8_t> create_from) { L2capSdu packet(create_from); packet.sdu_data_.resize(packet.sdu_data_.size() + 2, 0x00); uint16_t fcs = packet.calculate_fcs(); packet.sdu_data_[packet.sdu_data_.size() - 2] = fcs & 0xFF; packet.sdu_data_[packet.sdu_data_.size() - 1] = (fcs & 0xFF00) >> 8; return packet; } uint16_t L2capSdu::convert_from_little_endian( const unsigned int starting_index) const { uint16_t convert = sdu_data_[starting_index + 1]; Loading