Loading system/gd/hci/classic_security_manager.cc +5 −11 Original line number Diff line number Diff line Loading @@ -160,13 +160,8 @@ struct ClassicSecurityManager::impl { common::BindOnce(&impl::on_command_complete, common::Unretained(this)), handler_); } void write_stored_link_key(uint8_t num_keys_to_write, Address address, common::LinkKey link_key) { // TODO send multi link key std::array<uint8_t, 16> link_key_array; std::copy(std::begin(link_key.link_key), std::end(link_key.link_key), std::begin(link_key_array)); std::unique_ptr<WriteStoredLinkKeyBuilder> packet = WriteStoredLinkKeyBuilder::Create(num_keys_to_write, address, link_key_array); void write_stored_link_key(std::vector<KeyAndAddress> keys) { std::unique_ptr<WriteStoredLinkKeyBuilder> packet = WriteStoredLinkKeyBuilder::Create(keys); hci_layer_->EnqueueCommand(std::move(packet), common::BindOnce(&impl::on_command_complete, common::Unretained(this)), handler_); } Loading Loading @@ -330,9 +325,8 @@ void ClassicSecurityManager::ReadStoredLinkKey(Address address, ReadStoredLinkKe GetHandler()->Post(BindOnce(&impl::read_stored_link_key, common::Unretained(pimpl_.get()), address, read_all_flag)); } void ClassicSecurityManager::WriteStoredLinkKey(uint8_t num_keys_to_write, Address address, common::LinkKey link_key) { GetHandler()->Post( BindOnce(&impl::write_stored_link_key, common::Unretained(pimpl_.get()), num_keys_to_write, address, link_key)); void ClassicSecurityManager::WriteStoredLinkKey(std::vector<KeyAndAddress> keys) { GetHandler()->Post(BindOnce(&impl::write_stored_link_key, common::Unretained(pimpl_.get()), keys)); } void ClassicSecurityManager::DeleteStoredLinkKey(Address address, DeleteStoredLinkKeyDeleteAllFlag delete_all_flag) { Loading system/gd/hci/classic_security_manager.h +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class ClassicSecurityManager : public Module { void RemoteOobDataRequestReply(Address address, std::array<uint8_t, 16> c, std::array<uint8_t, 16> r); void RemoteOobDataRequestNegativeReply(Address address); void ReadStoredLinkKey(Address address, ReadStoredLinkKeyReadAllFlag read_all_flag); void WriteStoredLinkKey(uint8_t num_keys_to_write, Address address, common::LinkKey link_key); void WriteStoredLinkKey(std::vector<KeyAndAddress> keys); void DeleteStoredLinkKey(Address address, DeleteStoredLinkKeyDeleteAllFlag delete_all_flag); void RefreshEncryptionKey(uint16_t connection_handle); void ReadSimplePairingMode(); Loading system/gd/hci/controller.cc +3 −3 Original line number Diff line number Diff line Loading @@ -66,9 +66,9 @@ struct Controller::impl { ASSERT(acl_credits_handler_ != nullptr); auto complete_view = NumberOfCompletedPacketsView::Create(event); ASSERT(complete_view.IsValid()); for (auto completed_packets : complete_view.GetHandlesAndCompletedPackets()) { uint16_t handle = completed_packets & 0x0fff; uint16_t credits = (completed_packets & 0xffff0000) >> 16; for (auto completed_packets : complete_view.GetCompletedPackets()) { uint16_t handle = completed_packets.connection_handle_; uint16_t credits = completed_packets.host_num_of_completed_packets_; acl_credits_handler_->Post(Bind(acl_credits_callback_, handle, credits)); } } Loading system/gd/hci/controller_test.cc +9 −4 Original line number Diff line number Diff line Loading @@ -109,10 +109,15 @@ class TestHciLayer : public HciLayer { } void IncomingCredit() { std::vector<uint32_t> handles_and_completed_packets; handles_and_completed_packets.push_back(kCredits1 << 16 | kHandle1); handles_and_completed_packets.push_back(kCredits2 << 16 | kHandle2); auto event_builder = NumberOfCompletedPacketsBuilder::Create(handles_and_completed_packets); std::vector<CompletedPackets> completed_packets; CompletedPackets cp; cp.host_num_of_completed_packets_ = kCredits1; cp.connection_handle_ = kHandle1; completed_packets.push_back(cp); cp.host_num_of_completed_packets_ = kCredits2; cp.connection_handle_ = kHandle2; completed_packets.push_back(cp); auto event_builder = NumberOfCompletedPacketsBuilder::Create(completed_packets); auto packet = GetPacketView(std::move(event_builder)); EventPacketView event = EventPacketView::Create(packet); ASSERT(event.IsValid()); Loading system/gd/hci/facade.cc +10 −5 Original line number Diff line number Diff line Loading @@ -457,12 +457,17 @@ class ClassicSecurityManagerFacadeService : public ClassicSecurityManagerFacade: ::google::protobuf::Empty* response) { std::unique_lock<std::mutex> lock(mutex_); uint8_t num_keys_to_write = request->num_keys_to_write(); Address peer; std::vector<KeyAndAddress> keys; for (size_t i = 0; i < num_keys_to_write; i++) { KeyAndAddress key; common::LinkKey link_key; ASSERT(Address::FromString(request->remote().address(), peer)); ASSERT(Address::FromString(request->remote().address(), key.address_)); ASSERT(common::LinkKey::FromString(request->link_keys(), link_key)); std::copy(std::begin(link_key.link_key), std::end(link_key.link_key), std::begin(key.link_key_)); keys.push_back(key); } classic_security_manager_->WriteStoredLinkKey(num_keys_to_write, peer, link_key); classic_security_manager_->WriteStoredLinkKey(keys); return ::grpc::Status::OK; }; Loading Loading
system/gd/hci/classic_security_manager.cc +5 −11 Original line number Diff line number Diff line Loading @@ -160,13 +160,8 @@ struct ClassicSecurityManager::impl { common::BindOnce(&impl::on_command_complete, common::Unretained(this)), handler_); } void write_stored_link_key(uint8_t num_keys_to_write, Address address, common::LinkKey link_key) { // TODO send multi link key std::array<uint8_t, 16> link_key_array; std::copy(std::begin(link_key.link_key), std::end(link_key.link_key), std::begin(link_key_array)); std::unique_ptr<WriteStoredLinkKeyBuilder> packet = WriteStoredLinkKeyBuilder::Create(num_keys_to_write, address, link_key_array); void write_stored_link_key(std::vector<KeyAndAddress> keys) { std::unique_ptr<WriteStoredLinkKeyBuilder> packet = WriteStoredLinkKeyBuilder::Create(keys); hci_layer_->EnqueueCommand(std::move(packet), common::BindOnce(&impl::on_command_complete, common::Unretained(this)), handler_); } Loading Loading @@ -330,9 +325,8 @@ void ClassicSecurityManager::ReadStoredLinkKey(Address address, ReadStoredLinkKe GetHandler()->Post(BindOnce(&impl::read_stored_link_key, common::Unretained(pimpl_.get()), address, read_all_flag)); } void ClassicSecurityManager::WriteStoredLinkKey(uint8_t num_keys_to_write, Address address, common::LinkKey link_key) { GetHandler()->Post( BindOnce(&impl::write_stored_link_key, common::Unretained(pimpl_.get()), num_keys_to_write, address, link_key)); void ClassicSecurityManager::WriteStoredLinkKey(std::vector<KeyAndAddress> keys) { GetHandler()->Post(BindOnce(&impl::write_stored_link_key, common::Unretained(pimpl_.get()), keys)); } void ClassicSecurityManager::DeleteStoredLinkKey(Address address, DeleteStoredLinkKeyDeleteAllFlag delete_all_flag) { Loading
system/gd/hci/classic_security_manager.h +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class ClassicSecurityManager : public Module { void RemoteOobDataRequestReply(Address address, std::array<uint8_t, 16> c, std::array<uint8_t, 16> r); void RemoteOobDataRequestNegativeReply(Address address); void ReadStoredLinkKey(Address address, ReadStoredLinkKeyReadAllFlag read_all_flag); void WriteStoredLinkKey(uint8_t num_keys_to_write, Address address, common::LinkKey link_key); void WriteStoredLinkKey(std::vector<KeyAndAddress> keys); void DeleteStoredLinkKey(Address address, DeleteStoredLinkKeyDeleteAllFlag delete_all_flag); void RefreshEncryptionKey(uint16_t connection_handle); void ReadSimplePairingMode(); Loading
system/gd/hci/controller.cc +3 −3 Original line number Diff line number Diff line Loading @@ -66,9 +66,9 @@ struct Controller::impl { ASSERT(acl_credits_handler_ != nullptr); auto complete_view = NumberOfCompletedPacketsView::Create(event); ASSERT(complete_view.IsValid()); for (auto completed_packets : complete_view.GetHandlesAndCompletedPackets()) { uint16_t handle = completed_packets & 0x0fff; uint16_t credits = (completed_packets & 0xffff0000) >> 16; for (auto completed_packets : complete_view.GetCompletedPackets()) { uint16_t handle = completed_packets.connection_handle_; uint16_t credits = completed_packets.host_num_of_completed_packets_; acl_credits_handler_->Post(Bind(acl_credits_callback_, handle, credits)); } } Loading
system/gd/hci/controller_test.cc +9 −4 Original line number Diff line number Diff line Loading @@ -109,10 +109,15 @@ class TestHciLayer : public HciLayer { } void IncomingCredit() { std::vector<uint32_t> handles_and_completed_packets; handles_and_completed_packets.push_back(kCredits1 << 16 | kHandle1); handles_and_completed_packets.push_back(kCredits2 << 16 | kHandle2); auto event_builder = NumberOfCompletedPacketsBuilder::Create(handles_and_completed_packets); std::vector<CompletedPackets> completed_packets; CompletedPackets cp; cp.host_num_of_completed_packets_ = kCredits1; cp.connection_handle_ = kHandle1; completed_packets.push_back(cp); cp.host_num_of_completed_packets_ = kCredits2; cp.connection_handle_ = kHandle2; completed_packets.push_back(cp); auto event_builder = NumberOfCompletedPacketsBuilder::Create(completed_packets); auto packet = GetPacketView(std::move(event_builder)); EventPacketView event = EventPacketView::Create(packet); ASSERT(event.IsValid()); Loading
system/gd/hci/facade.cc +10 −5 Original line number Diff line number Diff line Loading @@ -457,12 +457,17 @@ class ClassicSecurityManagerFacadeService : public ClassicSecurityManagerFacade: ::google::protobuf::Empty* response) { std::unique_lock<std::mutex> lock(mutex_); uint8_t num_keys_to_write = request->num_keys_to_write(); Address peer; std::vector<KeyAndAddress> keys; for (size_t i = 0; i < num_keys_to_write; i++) { KeyAndAddress key; common::LinkKey link_key; ASSERT(Address::FromString(request->remote().address(), peer)); ASSERT(Address::FromString(request->remote().address(), key.address_)); ASSERT(common::LinkKey::FromString(request->link_keys(), link_key)); std::copy(std::begin(link_key.link_key), std::end(link_key.link_key), std::begin(key.link_key_)); keys.push_back(key); } classic_security_manager_->WriteStoredLinkKey(num_keys_to_write, peer, link_key); classic_security_manager_->WriteStoredLinkKey(keys); return ::grpc::Status::OK; }; Loading