Loading system/gd/facade/grpc_root_server.cc +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ class RootFacadeService : public ::bluetooth::facade::RootFacade::Service { modules.add<::bluetooth::neighbor::facade::NeighborFacadeModule>(); break; case BluetoothModule::L2CAP: modules.add<::bluetooth::hci::facade::ControllerFacadeModule>(); modules.add<::bluetooth::neighbor::facade::NeighborFacadeModule>(); modules.add<::bluetooth::facade::ReadOnlyPropertyServerModule>(); modules.add<::bluetooth::l2cap::classic::L2capClassicModuleFacadeModule>(); break; Loading system/gd/l2cap/classic/cert/simple_l2cap_test.py +6 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ from facade import rootservice_pb2 as facade_rootservice_pb2 from google.protobuf import empty_pb2 from l2cap.classic import facade_pb2 as l2cap_facade_pb2 from l2cap.classic.cert import api_pb2 as l2cap_cert_pb2 from hci.facade import controller_facade_pb2 as controller_facade from neighbor.facade import facade_pb2 as neighbor_facade ASYNC_OP_TIME_SECONDS = 1 # TODO: Use events to synchronize events instead Loading Loading @@ -94,18 +96,19 @@ class SimpleL2capTest(GdBaseTestClass): self.device_under_test.wait_channel_ready() self.cert_device.wait_channel_ready() dut_address = self.device_under_test.controller_read_only_property.ReadLocalAddress( self.device_under_test.address = self.device_under_test.hci_controller.GetMacAddress( empty_pb2.Empty()).address self.device_under_test.address = dut_address cert_address = self.cert_device.controller_read_only_property.ReadLocalAddress( empty_pb2.Empty()).address self.cert_device.address = cert_address self.dut_address = common_pb2.BluetoothAddress( address=self.device_under_test.address) self.cert_address = common_pb2.BluetoothAddress( address=self.cert_device.address) self.device_under_test.neighbor.EnablePageScan( neighbor_facade.EnableMsg(enabled=True)) self.next_scid = 0x40 self.scid_dcid_map = {} self.retransmission_mode = l2cap_cert_pb2.ChannelRetransmissionFlowControlMode.BASIC Loading system/gd/l2cap/classic/facade.cc +0 −4 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include "common/bind.h" #include "grpc/grpc_event_queue.h" #include "hci/address.h" #include "hci/hci_layer.h" #include "l2cap/classic/facade.grpc.pb.h" #include "l2cap/classic/facade.h" #include "l2cap/classic/l2cap_classic_module.h" Loading Loading @@ -386,13 +385,10 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service void L2capClassicModuleFacadeModule::ListDependencies(ModuleList* list) { ::bluetooth::grpc::GrpcFacadeModule::ListDependencies(list); list->add<l2cap::classic::L2capClassicModule>(); list->add<hci::HciLayer>(); } void L2capClassicModuleFacadeModule::Start() { ::bluetooth::grpc::GrpcFacadeModule::Start(); GetDependency<hci::HciLayer>()->EnqueueCommand(hci::WriteScanEnableBuilder::Create(hci::ScanEnable::PAGE_SCAN_ONLY), common::BindOnce([](hci::CommandCompleteView) {}), GetHandler()); service_ = new L2capClassicModuleFacadeService(GetDependency<l2cap::classic::L2capClassicModule>(), GetHandler()); } Loading system/gd/neighbor/facade/facade.cc +26 −4 Original line number Diff line number Diff line Loading @@ -34,10 +34,11 @@ namespace facade { class NeighborFacadeService : public NeighborFacade::Service { public: NeighborFacadeService(ConnectabilityModule* connectability_module, DiscoverabilityModule* discoverability_module, InquiryModule* inquiry_module, NameModule* name_module, PageModule*, ScanModule*, InquiryModule* inquiry_module, NameModule* name_module, PageModule*, ScanModule* scan_module, ::bluetooth::os::Handler* facade_handler) : connectability_module_(connectability_module), discoverability_module_(discoverability_module), inquiry_module_(inquiry_module), name_module_(name_module), facade_handler_(facade_handler) {} inquiry_module_(inquiry_module), name_module_(name_module), scan_module_(scan_module), facade_handler_(facade_handler) {} ::grpc::Status SetConnectability(::grpc::ServerContext* context, const ::bluetooth::neighbor::EnableMsg* request, ::google::protobuf::Empty* response) override { Loading Loading @@ -68,7 +69,7 @@ class NeighborFacadeService : public NeighborFacade::Service { return ::grpc::Status::OK; } ::grpc::Status SetInquiry(::grpc::ServerContext* context, const ::bluetooth::neighbor::InquiryMsg* request, ::grpc::Status SetInquiryMode(::grpc::ServerContext* context, const ::bluetooth::neighbor::InquiryMsg* request, ::grpc::ServerWriter<InquiryResultMsg>* writer) override { inquiry_module_->RegisterCallbacks(inquiry_callbacks_); switch (request->result_mode()) { Loading Loading @@ -127,6 +128,26 @@ class NeighborFacadeService : public NeighborFacade::Service { return ::grpc::Status::OK; } ::grpc::Status EnableInquiryScan(::grpc::ServerContext* context, const ::bluetooth::neighbor::EnableMsg* request, ::google::protobuf::Empty* response) override { if (request->enabled()) { scan_module_->SetInquiryScan(); } else { scan_module_->ClearInquiryScan(); } return ::grpc::Status::OK; } ::grpc::Status EnablePageScan(::grpc::ServerContext* context, const ::bluetooth::neighbor::EnableMsg* request, ::google::protobuf::Empty* response) override { if (request->enabled()) { scan_module_->SetPageScan(); } else { scan_module_->ClearPageScan(); } return ::grpc::Status::OK; } private: void on_incoming_inquiry_result(hci::EventPacketView view) { InquiryResultMsg inquiry_result_msg; Loading Loading @@ -157,6 +178,7 @@ class NeighborFacadeService : public NeighborFacade::Service { DiscoverabilityModule* discoverability_module_; InquiryModule* inquiry_module_; NameModule* name_module_; ScanModule* scan_module_; ::bluetooth::os::Handler* facade_handler_; ::bluetooth::grpc::GrpcEventQueue<InquiryResultMsg> pending_events_{"InquiryResponses"}; }; Loading system/gd/neighbor/facade/facade.proto +3 −1 Original line number Diff line number Diff line Loading @@ -7,8 +7,10 @@ import "google/protobuf/empty.proto"; service NeighborFacade { rpc SetConnectability(EnableMsg) returns (google.protobuf.Empty) {} rpc SetDiscoverability(DiscoverabilitiyMsg) returns (google.protobuf.Empty) {} rpc SetInquiry(InquiryMsg) returns (stream InquiryResultMsg) {} rpc SetInquiryMode(InquiryMsg) returns (stream InquiryResultMsg) {} rpc ReadRemoteName(RemoteNameRequestMsg) returns (RemoteNameResponseMsg) {} rpc EnableInquiryScan(EnableMsg) returns (google.protobuf.Empty) {} rpc EnablePageScan(EnableMsg) returns (google.protobuf.Empty) {} } message EnableMsg { Loading Loading
system/gd/facade/grpc_root_server.cc +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ class RootFacadeService : public ::bluetooth::facade::RootFacade::Service { modules.add<::bluetooth::neighbor::facade::NeighborFacadeModule>(); break; case BluetoothModule::L2CAP: modules.add<::bluetooth::hci::facade::ControllerFacadeModule>(); modules.add<::bluetooth::neighbor::facade::NeighborFacadeModule>(); modules.add<::bluetooth::facade::ReadOnlyPropertyServerModule>(); modules.add<::bluetooth::l2cap::classic::L2capClassicModuleFacadeModule>(); break; Loading
system/gd/l2cap/classic/cert/simple_l2cap_test.py +6 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ from facade import rootservice_pb2 as facade_rootservice_pb2 from google.protobuf import empty_pb2 from l2cap.classic import facade_pb2 as l2cap_facade_pb2 from l2cap.classic.cert import api_pb2 as l2cap_cert_pb2 from hci.facade import controller_facade_pb2 as controller_facade from neighbor.facade import facade_pb2 as neighbor_facade ASYNC_OP_TIME_SECONDS = 1 # TODO: Use events to synchronize events instead Loading Loading @@ -94,18 +96,19 @@ class SimpleL2capTest(GdBaseTestClass): self.device_under_test.wait_channel_ready() self.cert_device.wait_channel_ready() dut_address = self.device_under_test.controller_read_only_property.ReadLocalAddress( self.device_under_test.address = self.device_under_test.hci_controller.GetMacAddress( empty_pb2.Empty()).address self.device_under_test.address = dut_address cert_address = self.cert_device.controller_read_only_property.ReadLocalAddress( empty_pb2.Empty()).address self.cert_device.address = cert_address self.dut_address = common_pb2.BluetoothAddress( address=self.device_under_test.address) self.cert_address = common_pb2.BluetoothAddress( address=self.cert_device.address) self.device_under_test.neighbor.EnablePageScan( neighbor_facade.EnableMsg(enabled=True)) self.next_scid = 0x40 self.scid_dcid_map = {} self.retransmission_mode = l2cap_cert_pb2.ChannelRetransmissionFlowControlMode.BASIC Loading
system/gd/l2cap/classic/facade.cc +0 −4 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ #include "common/bind.h" #include "grpc/grpc_event_queue.h" #include "hci/address.h" #include "hci/hci_layer.h" #include "l2cap/classic/facade.grpc.pb.h" #include "l2cap/classic/facade.h" #include "l2cap/classic/l2cap_classic_module.h" Loading Loading @@ -386,13 +385,10 @@ class L2capClassicModuleFacadeService : public L2capClassicModuleFacade::Service void L2capClassicModuleFacadeModule::ListDependencies(ModuleList* list) { ::bluetooth::grpc::GrpcFacadeModule::ListDependencies(list); list->add<l2cap::classic::L2capClassicModule>(); list->add<hci::HciLayer>(); } void L2capClassicModuleFacadeModule::Start() { ::bluetooth::grpc::GrpcFacadeModule::Start(); GetDependency<hci::HciLayer>()->EnqueueCommand(hci::WriteScanEnableBuilder::Create(hci::ScanEnable::PAGE_SCAN_ONLY), common::BindOnce([](hci::CommandCompleteView) {}), GetHandler()); service_ = new L2capClassicModuleFacadeService(GetDependency<l2cap::classic::L2capClassicModule>(), GetHandler()); } Loading
system/gd/neighbor/facade/facade.cc +26 −4 Original line number Diff line number Diff line Loading @@ -34,10 +34,11 @@ namespace facade { class NeighborFacadeService : public NeighborFacade::Service { public: NeighborFacadeService(ConnectabilityModule* connectability_module, DiscoverabilityModule* discoverability_module, InquiryModule* inquiry_module, NameModule* name_module, PageModule*, ScanModule*, InquiryModule* inquiry_module, NameModule* name_module, PageModule*, ScanModule* scan_module, ::bluetooth::os::Handler* facade_handler) : connectability_module_(connectability_module), discoverability_module_(discoverability_module), inquiry_module_(inquiry_module), name_module_(name_module), facade_handler_(facade_handler) {} inquiry_module_(inquiry_module), name_module_(name_module), scan_module_(scan_module), facade_handler_(facade_handler) {} ::grpc::Status SetConnectability(::grpc::ServerContext* context, const ::bluetooth::neighbor::EnableMsg* request, ::google::protobuf::Empty* response) override { Loading Loading @@ -68,7 +69,7 @@ class NeighborFacadeService : public NeighborFacade::Service { return ::grpc::Status::OK; } ::grpc::Status SetInquiry(::grpc::ServerContext* context, const ::bluetooth::neighbor::InquiryMsg* request, ::grpc::Status SetInquiryMode(::grpc::ServerContext* context, const ::bluetooth::neighbor::InquiryMsg* request, ::grpc::ServerWriter<InquiryResultMsg>* writer) override { inquiry_module_->RegisterCallbacks(inquiry_callbacks_); switch (request->result_mode()) { Loading Loading @@ -127,6 +128,26 @@ class NeighborFacadeService : public NeighborFacade::Service { return ::grpc::Status::OK; } ::grpc::Status EnableInquiryScan(::grpc::ServerContext* context, const ::bluetooth::neighbor::EnableMsg* request, ::google::protobuf::Empty* response) override { if (request->enabled()) { scan_module_->SetInquiryScan(); } else { scan_module_->ClearInquiryScan(); } return ::grpc::Status::OK; } ::grpc::Status EnablePageScan(::grpc::ServerContext* context, const ::bluetooth::neighbor::EnableMsg* request, ::google::protobuf::Empty* response) override { if (request->enabled()) { scan_module_->SetPageScan(); } else { scan_module_->ClearPageScan(); } return ::grpc::Status::OK; } private: void on_incoming_inquiry_result(hci::EventPacketView view) { InquiryResultMsg inquiry_result_msg; Loading Loading @@ -157,6 +178,7 @@ class NeighborFacadeService : public NeighborFacade::Service { DiscoverabilityModule* discoverability_module_; InquiryModule* inquiry_module_; NameModule* name_module_; ScanModule* scan_module_; ::bluetooth::os::Handler* facade_handler_; ::bluetooth::grpc::GrpcEventQueue<InquiryResultMsg> pending_events_{"InquiryResponses"}; }; Loading
system/gd/neighbor/facade/facade.proto +3 −1 Original line number Diff line number Diff line Loading @@ -7,8 +7,10 @@ import "google/protobuf/empty.proto"; service NeighborFacade { rpc SetConnectability(EnableMsg) returns (google.protobuf.Empty) {} rpc SetDiscoverability(DiscoverabilitiyMsg) returns (google.protobuf.Empty) {} rpc SetInquiry(InquiryMsg) returns (stream InquiryResultMsg) {} rpc SetInquiryMode(InquiryMsg) returns (stream InquiryResultMsg) {} rpc ReadRemoteName(RemoteNameRequestMsg) returns (RemoteNameResponseMsg) {} rpc EnableInquiryScan(EnableMsg) returns (google.protobuf.Empty) {} rpc EnablePageScan(EnableMsg) returns (google.protobuf.Empty) {} } message EnableMsg { Loading