Loading system/gd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ cc_binary { srcs: [ "facade/facade_main.cc", "facade/grpc_root_server.cc", "facade/read_only_property_server.cc", "grpc/grpc_module.cc", ":BluetoothFacade_hci_hal", ":BluetoothFacade_hci_layer", Loading Loading @@ -176,6 +177,7 @@ cc_binary { srcs: [ "cert/cert_main.cc", "cert/grpc_root_server.cc", "cert/read_only_property_server.cc", "grpc/grpc_module.cc", ":BluetoothCertSource_hci_hal", ":BluetoothCertSource_hci_layer", Loading system/gd/cert/gd_cert_device.py +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ class GdCertDevice(GdDeviceBase): # Cert stubs self.rootservice = cert_rootservice_pb2_grpc.RootCertStub(self.grpc_root_server_channel) self.hal = hal_cert_pb2_grpc.HciHalCertStub(self.grpc_channel) self.controller_read_only_property = cert_rootservice_pb2_grpc.ReadOnlyPropertyStub(self.grpc_channel) self.hci = hci_cert_pb2_grpc.AclManagerCertStub(self.grpc_channel) self.l2cap = l2cap_cert_pb2_grpc.L2capModuleCertStub(self.grpc_channel) Loading system/gd/cert/gd_device.py +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ class GdDevice(GdDeviceBase): # Facade stubs self.rootservice = facade_rootservice_pb2_grpc.RootFacadeStub(self.grpc_root_server_channel) self.hal = hal_facade_pb2_grpc.HciHalFacadeStub(self.grpc_channel) self.controller_read_only_property = facade_rootservice_pb2_grpc.ReadOnlyPropertyStub(self.grpc_channel) self.hci = hci_facade_pb2_grpc.AclManagerFacadeStub(self.grpc_channel) self.hci_classic_security = hci_facade_pb2_grpc.ClassicSecurityManagerFacadeStub(self.grpc_channel) self.l2cap = l2cap_facade_pb2_grpc.L2capModuleFacadeStub(self.grpc_channel) Loading system/gd/cert/grpc_root_server.cc +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <string> #include "cert/read_only_property_server.h" #include "cert/rootservice.grpc.pb.h" #include "grpc/grpc_module.h" #include "hal/cert/cert.h" Loading Loading @@ -53,9 +54,11 @@ class RootCertService : public ::bluetooth::cert::RootCert::Service { modules.add<::bluetooth::hal::cert::HalCertModule>(); break; case BluetoothModule::HCI: modules.add<::bluetooth::cert::ReadOnlyPropertyServerModule>(); modules.add<::bluetooth::hci::cert::AclManagerCertModule>(); break; case BluetoothModule::L2CAP: modules.add<::bluetooth::cert::ReadOnlyPropertyServerModule>(); modules.add<::bluetooth::l2cap::cert::L2capModuleCertModule>(); break; default: Loading system/gd/cert/read_only_property_server.cc 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "cert/read_only_property_server.h" #include "hci/controller.h" namespace bluetooth { namespace cert { class ReadOnlyPropertyService : public ReadOnlyProperty::Service { public: ReadOnlyPropertyService(hci::Controller* controller) : controller_(controller) {} ::grpc::Status ReadLocalAddress(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::bluetooth::facade::BluetoothAddress* response) override { auto address = controller_->GetControllerMacAddress().ToString(); response->set_address(address); return ::grpc::Status::OK; } private: hci::Controller* controller_; }; void ReadOnlyPropertyServerModule::ListDependencies(ModuleList* list) { GrpcFacadeModule::ListDependencies(list); list->add<hci::Controller>(); } void ReadOnlyPropertyServerModule::Start() { GrpcFacadeModule::Start(); service_ = std::make_unique<ReadOnlyPropertyService>(GetDependency<hci::Controller>()); } void ReadOnlyPropertyServerModule::Stop() { service_.reset(); GrpcFacadeModule::Stop(); } ::grpc::Service* ReadOnlyPropertyServerModule::GetService() const { return service_.get(); } const ModuleFactory ReadOnlyPropertyServerModule::Factory = ::bluetooth::ModuleFactory([]() { return new ReadOnlyPropertyServerModule(); }); } // namespace cert } // namespace bluetooth Loading
system/gd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ cc_binary { srcs: [ "facade/facade_main.cc", "facade/grpc_root_server.cc", "facade/read_only_property_server.cc", "grpc/grpc_module.cc", ":BluetoothFacade_hci_hal", ":BluetoothFacade_hci_layer", Loading Loading @@ -176,6 +177,7 @@ cc_binary { srcs: [ "cert/cert_main.cc", "cert/grpc_root_server.cc", "cert/read_only_property_server.cc", "grpc/grpc_module.cc", ":BluetoothCertSource_hci_hal", ":BluetoothCertSource_hci_layer", Loading
system/gd/cert/gd_cert_device.py +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ class GdCertDevice(GdDeviceBase): # Cert stubs self.rootservice = cert_rootservice_pb2_grpc.RootCertStub(self.grpc_root_server_channel) self.hal = hal_cert_pb2_grpc.HciHalCertStub(self.grpc_channel) self.controller_read_only_property = cert_rootservice_pb2_grpc.ReadOnlyPropertyStub(self.grpc_channel) self.hci = hci_cert_pb2_grpc.AclManagerCertStub(self.grpc_channel) self.l2cap = l2cap_cert_pb2_grpc.L2capModuleCertStub(self.grpc_channel) Loading
system/gd/cert/gd_device.py +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ class GdDevice(GdDeviceBase): # Facade stubs self.rootservice = facade_rootservice_pb2_grpc.RootFacadeStub(self.grpc_root_server_channel) self.hal = hal_facade_pb2_grpc.HciHalFacadeStub(self.grpc_channel) self.controller_read_only_property = facade_rootservice_pb2_grpc.ReadOnlyPropertyStub(self.grpc_channel) self.hci = hci_facade_pb2_grpc.AclManagerFacadeStub(self.grpc_channel) self.hci_classic_security = hci_facade_pb2_grpc.ClassicSecurityManagerFacadeStub(self.grpc_channel) self.l2cap = l2cap_facade_pb2_grpc.L2capModuleFacadeStub(self.grpc_channel) Loading
system/gd/cert/grpc_root_server.cc +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <string> #include "cert/read_only_property_server.h" #include "cert/rootservice.grpc.pb.h" #include "grpc/grpc_module.h" #include "hal/cert/cert.h" Loading Loading @@ -53,9 +54,11 @@ class RootCertService : public ::bluetooth::cert::RootCert::Service { modules.add<::bluetooth::hal::cert::HalCertModule>(); break; case BluetoothModule::HCI: modules.add<::bluetooth::cert::ReadOnlyPropertyServerModule>(); modules.add<::bluetooth::hci::cert::AclManagerCertModule>(); break; case BluetoothModule::L2CAP: modules.add<::bluetooth::cert::ReadOnlyPropertyServerModule>(); modules.add<::bluetooth::l2cap::cert::L2capModuleCertModule>(); break; default: Loading
system/gd/cert/read_only_property_server.cc 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "cert/read_only_property_server.h" #include "hci/controller.h" namespace bluetooth { namespace cert { class ReadOnlyPropertyService : public ReadOnlyProperty::Service { public: ReadOnlyPropertyService(hci::Controller* controller) : controller_(controller) {} ::grpc::Status ReadLocalAddress(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::bluetooth::facade::BluetoothAddress* response) override { auto address = controller_->GetControllerMacAddress().ToString(); response->set_address(address); return ::grpc::Status::OK; } private: hci::Controller* controller_; }; void ReadOnlyPropertyServerModule::ListDependencies(ModuleList* list) { GrpcFacadeModule::ListDependencies(list); list->add<hci::Controller>(); } void ReadOnlyPropertyServerModule::Start() { GrpcFacadeModule::Start(); service_ = std::make_unique<ReadOnlyPropertyService>(GetDependency<hci::Controller>()); } void ReadOnlyPropertyServerModule::Stop() { service_.reset(); GrpcFacadeModule::Stop(); } ::grpc::Service* ReadOnlyPropertyServerModule::GetService() const { return service_.get(); } const ModuleFactory ReadOnlyPropertyServerModule::Factory = ::bluetooth::ModuleFactory([]() { return new ReadOnlyPropertyServerModule(); }); } // namespace cert } // namespace bluetooth