srcs: [
"facade/stack_with_grpc_main.cc",
"grpc/grpc_module.cc",
- ":BluetoothCertFacade_hci_hal",
+ ":BluetoothFacade_hci_hal",
],
generated_headers: [
"BluetoothGeneratedPackets_h",
- "BluetoothCertFacadeGeneratedStub_h",
+ "BluetoothFacadeGeneratedStub_h",
],
generated_sources: [
- "BluetoothCertFacadeGeneratedStub_cc",
+ "BluetoothFacadeGeneratedStub_cc",
],
static_libs: [
"libbluetooth_gd",
}
filegroup {
- name: "BluetoothCertFacadeProto",
+ name: "BluetoothFacadeProto",
srcs: [
"facade/common.proto",
- "hal/facade/api.proto",
+ "hal/facade.proto",
],
}
genrule {
- name: "BluetoothCertFacadeGeneratedStub_h",
+ name: "BluetoothFacadeGeneratedStub_h",
tools: [
"aprotoc",
"protoc-gen-grpc-cpp-plugin",
],
cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
srcs: [
- ":BluetoothCertFacadeProto",
+ ":BluetoothFacadeProto",
],
out: [
"facade/common.grpc.pb.h",
"facade/common.pb.h",
- "hal/facade/api.grpc.pb.h",
- "hal/facade/api.pb.h",
+ "hal/facade.grpc.pb.h",
+ "hal/facade.pb.h",
],
}
genrule {
- name: "BluetoothCertFacadeGeneratedStub_cc",
+ name: "BluetoothFacadeGeneratedStub_cc",
tools: [
"aprotoc",
"protoc-gen-grpc-cpp-plugin",
],
cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
srcs: [
- ":BluetoothCertFacadeProto",
+ ":BluetoothFacadeProto",
],
out: [
"facade/common.grpc.pb.cc",
"facade/common.pb.cc",
- "hal/facade/api.grpc.pb.cc",
- "hal/facade/api.pb.cc",
+ "hal/facade.grpc.pb.cc",
+ "hal/facade.pb.cc",
],
}
genrule {
- name: "BluetoothCertFacadeGeneratedStub_py",
+ name: "BluetoothFacadeGeneratedStub_py",
tools: [
"aprotoc",
"protoc-gen-grpc-python-plugin",
cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(in) --grpc_out=$(genDir) --python_out=$(genDir); " +
"touch $(genDir)/__init__.py; " +
"touch $(genDir)/facade/__init__.py; " +
- "touch $(genDir)/hal/__init__.py; " +
- "touch $(genDir)/hal/facade/__init__.py; ",
+ "touch $(genDir)/hal/__init__.py; ",
srcs: [
- ":BluetoothCertFacadeProto",
+ ":BluetoothFacadeProto",
],
out: [
"__init__.py",
"facade/common_pb2_grpc.py",
"facade/common_pb2.py",
"hal/__init__.py",
- "hal/facade/__init__.py",
- "hal/facade/api_pb2_grpc.py",
- "hal/facade/api_pb2.py",
+ "hal/facade_pb2_grpc.py",
+ "hal/facade_pb2.py",
],
}
ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
-sys.path.append(ANDROID_BUILD_TOP + '/out/soong/.intermediates/system/bt/gd/BluetoothCertFacadeGeneratedStub_py/gen')
+sys.path.append(ANDROID_BUILD_TOP + '/out/soong/.intermediates/system/bt/gd/BluetoothFacadeGeneratedStub_py/gen')
ANDROID_HOST_OUT = os.environ.get('ANDROID_HOST_OUT')
ROOTCANAL = ANDROID_HOST_OUT + "/nativetest64/root-canal/root-canal"
import grpc
-from hal.facade import api_pb2
-from hal.facade import api_pb2_grpc
+from hal import facade_pb2_grpc as hal_facade_pb2_grpc
ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
ANDROID_HOST_OUT = os.environ.get('ANDROID_HOST_OUT')
stderr=self.backing_process_logs)
self.grpc_channel = grpc.insecure_channel("localhost:" + grpc_port)
- self.hal = api_pb2_grpc.HciTransportationStub(self.grpc_channel)
+ self.hal = hal_facade_pb2_grpc.HciHalFacadeStub(self.grpc_channel)
def clean_up(self):
self.grpc_channel.close()
#include "grpc/grpc_module.h"
#include "hal/hci_hal_host_rootcanal.h"
-#include "hal/facade/facade.h"
+#include "hal/facade.h"
#include <csignal>
#include <string>
}
ModuleList modules;
- modules.add<::bluetooth::hal::facade::HalFacadeModule>();
+ modules.add<::bluetooth::hal::HciHalFacadeModule>();
Thread* stack_thread = new Thread("stack_thread", Thread::Priority::NORMAL);
stack = new StackManager();
}
filegroup {
- name: "BluetoothCertFacade_hci_hal",
+ name: "BluetoothFacade_hci_hal",
srcs: [
- "facade/facade.cc",
+ "facade.cc",
],
}
from cert.gd_base_test import GdBaseTestClass
from facade import common_pb2
-from hal.facade import api_pb2
+from hal import facade_pb2 as hal_facade_pb2
class SimpleHalTest(GdBaseTestClass):
def test_example(self):
- response = self.gd_devices[0].hal.SetLoopbackMode(api_pb2.LoopbackModeSettings(enable=True))
+ response = self.gd_devices[0].hal.SetLoopbackMode(hal_facade_pb2.LoopbackModeSettings(enable=True))
print("Response " + str(response))
def test_fetch_hci_event(self):
- response = self.gd_devices[0].hal.SetLoopbackMode(api_pb2.LoopbackModeSettings(enable=True))
+ response = self.gd_devices[0].hal.SetLoopbackMode(hal_facade_pb2.LoopbackModeSettings(enable=True))
request = common_pb2.EventStreamRequest(subscription_mode=common_pb2.SUBSCRIBE,
fetch_mode=common_pb2.NONE)
response = self.gd_devices[0].hal.FetchHciEvent(request)
inquiry_string = b'\x01\x04\x05\x33\x8b\x9e\x30\x01'
- response = self.gd_devices[0].hal.SendHciCommand(api_pb2.HciCmdPacket(payload=inquiry_string))
+ response = self.gd_devices[0].hal.SendHciCommand(hal_facade_pb2.HciCommandPacket(payload=inquiry_string))
request = common_pb2.EventStreamRequest(subscription_mode=common_pb2.UNCHANGED,
fetch_mode=common_pb2.AT_LEAST_ONE)
#include "common/blocking_queue.h"
#include "grpc/grpc_event_stream.h"
-#include "hal/facade/api.grpc.pb.h"
+#include "hal/facade.grpc.pb.h"
#include "hal/hci_hal.h"
#include "hci/hci_packets.h"
#include "os/log.h"
using ::grpc::ServerCompletionQueue;
using ::grpc::ServerContext;
+using ::bluetooth::facade::EventStreamRequest;
+
namespace bluetooth {
namespace hal {
-namespace facade {
-class HciTransportationService
- : public HciTransportation::Service,
+class HciHalFacadeService
+ : public HciHalFacade::Service,
public ::bluetooth::hal::HciHalCallbacks {
public:
- HciTransportationService(HciHal* hal)
+ HciHalFacadeService(HciHal* hal)
: hal_(hal), hci_event_stream_(&hci_event_stream_callback_), hci_acl_stream_(&hci_acl_stream_callback_),
- hci_sco_stream_(&hci_sco_stream_callback_) {}
+ hci_sco_stream_(&hci_sco_stream_callback_) {
+ hal->registerIncomingPacketCallback(this);
+ }
::grpc::Status SetLoopbackMode(::grpc::ServerContext* context,
- const ::bluetooth::hal::facade::LoopbackModeSettings* request,
+ const ::bluetooth::hal::LoopbackModeSettings* request,
::google::protobuf::Empty* response) override {
bool enable = request->enable();
auto packet = hci::WriteLoopbackModeBuilder::Create(enable ? hci::LoopbackMode::ENABLE_LOCAL
return ::grpc::Status::OK;
}
- ::grpc::Status SendHciCommand(::grpc::ServerContext* context, const ::bluetooth::hal::facade::HciCmdPacket* request,
+ ::grpc::Status SendHciCommand(::grpc::ServerContext* context, const ::bluetooth::hal::HciCommandPacket* request,
::google::protobuf::Empty* response) override {
std::string req_string = request->payload();
hal_->sendHciCommand(std::vector<uint8_t>(req_string.begin(), req_string.end()));
return ::grpc::Status::OK;
}
- ::grpc::Status SendHciAcl(::grpc::ServerContext* context, const ::bluetooth::hal::facade::HciAclPacket* request,
+ ::grpc::Status SendHciAcl(::grpc::ServerContext* context, const ::bluetooth::hal::HciAclPacket* request,
::google::protobuf::Empty* response) override {
std::string req_string = request->payload();
hal_->sendAclData(std::vector<uint8_t>(req_string.begin(), req_string.end()));
return ::grpc::Status::OK;
}
- ::grpc::Status SendHciSco(::grpc::ServerContext* context, const ::bluetooth::hal::facade::HciScoPacket* request,
+ ::grpc::Status SendHciSco(::grpc::ServerContext* context, const ::bluetooth::hal::HciScoPacket* request,
::google::protobuf::Empty* response) override {
std::string req_string = request->payload();
hal_->sendScoData(std::vector<uint8_t>(req_string.begin(), req_string.end()));
return ::grpc::Status::OK;
}
- ::grpc::Status FetchHciEvent(::grpc::ServerContext* context, const ::bluetooth::facade::EventStreamRequest* request,
- ::grpc::ServerWriter<HciEvtPacket>* writer) override {
+ ::grpc::Status FetchHciEvent(::grpc::ServerContext* context, const EventStreamRequest* request,
+ ::grpc::ServerWriter<HciEventPacket>* writer) override {
return hci_event_stream_.HandleRequest(context, request, writer);
};
- ::grpc::Status FetchHciAcl(::grpc::ServerContext* context, const ::bluetooth::facade::EventStreamRequest* request,
+ ::grpc::Status FetchHciAcl(::grpc::ServerContext* context, const EventStreamRequest* request,
::grpc::ServerWriter<HciAclPacket>* writer) override {
return hci_acl_stream_.HandleRequest(context, request, writer);
};
- ::grpc::Status FetchHciSco(::grpc::ServerContext* context, const ::bluetooth::facade::EventStreamRequest* request,
+ ::grpc::Status FetchHciSco(::grpc::ServerContext* context, const EventStreamRequest* request,
::grpc::ServerWriter<HciScoPacket>* writer) override {
return hci_sco_stream_.HandleRequest(context, request, writer);
};
private:
HciHal* hal_;
- class HciEventStreamCallback : public ::bluetooth::grpc::GrpcEventStreamCallback<HciEvtPacket, HciPacket> {
+ class HciEventStreamCallback : public ::bluetooth::grpc::GrpcEventStreamCallback<HciEventPacket, HciPacket> {
public:
- void OnWriteResponse(HciEvtPacket* response, const HciPacket& event) override {
+ void OnWriteResponse(HciEventPacket* response, const HciPacket& event) override {
std::string response_str = std::string(event.begin(), event.end());
response->set_payload(std::string(event.begin(), event.end()));
}
} hci_event_stream_callback_;
- ::bluetooth::grpc::GrpcEventStream<HciEvtPacket, HciPacket> hci_event_stream_;
+ ::bluetooth::grpc::GrpcEventStream<HciEventPacket, HciPacket> hci_event_stream_;
class HciAclStreamCallback : public ::bluetooth::grpc::GrpcEventStreamCallback<HciAclPacket, HciPacket> {
public:
::bluetooth::grpc::GrpcEventStream<HciScoPacket, HciPacket> hci_sco_stream_;
};
-void HalFacadeModule::ListDependencies(ModuleList* list) {
+void HciHalFacadeModule::ListDependencies(ModuleList* list) {
::bluetooth::grpc::GrpcFacadeModule::ListDependencies(list);
list->add<HciHal>();
}
-void HalFacadeModule::Start() {
+void HciHalFacadeModule::Start() {
::bluetooth::grpc::GrpcFacadeModule::Start();
- auto hal = GetDependency<HciHal>();
-
- service_ = new HciTransportationService(hal);
- hal->registerIncomingPacketCallback(service_);
+ service_ = new HciHalFacadeService(GetDependency<HciHal>());
}
-void HalFacadeModule::Stop() {
+void HciHalFacadeModule::Stop() {
delete service_;
}
-::grpc::Service* HalFacadeModule::GetService() const {
+::grpc::Service* HciHalFacadeModule::GetService() const {
return service_;
}
-const ModuleFactory HalFacadeModule::Factory = ::bluetooth::ModuleFactory([]() {
- return new HalFacadeModule();
+const ModuleFactory HciHalFacadeModule::Factory = ::bluetooth::ModuleFactory([]() {
+ return new HciHalFacadeModule();
});
-} // namespace facade
} // namespace hal
} // namespace bluetooth
namespace bluetooth {
namespace hal {
-namespace facade {
-class HciTransportationService;
+class HciHalFacadeService;
-class HalFacadeModule : public ::bluetooth::grpc::GrpcFacadeModule {
+class HciHalFacadeModule : public ::bluetooth::grpc::GrpcFacadeModule {
public:
static const ModuleFactory Factory;
::grpc::Service* GetService() const override;
private:
- HciTransportationService* service_;
+ HciHalFacadeService* service_;
friend class IncomingPacketCallback;
};
-} // namespace facade
} // namespace hal
} // namespace bluetooth
syntax = "proto3";
-package bluetooth.hal.facade;
+package bluetooth.hal;
import "google/protobuf/empty.proto";
import "facade/common.proto";
-// The HCI HAL transportation layer certification API surface definition
-
-service HciTransportation {
+service HciHalFacade {
rpc SetLoopbackMode(LoopbackModeSettings) returns (google.protobuf.Empty) {}
- rpc SendHciCommand(HciCmdPacket) returns (google.protobuf.Empty) {}
+ rpc SendHciCommand(HciCommandPacket) returns (google.protobuf.Empty) {}
rpc SendHciAcl(HciAclPacket) returns (google.protobuf.Empty) {}
rpc SendHciSco(HciScoPacket) returns (google.protobuf.Empty) {}
- rpc FetchHciEvent(bluetooth.facade.EventStreamRequest) returns (stream HciEvtPacket) {}
+ rpc FetchHciEvent(bluetooth.facade.EventStreamRequest) returns (stream HciEventPacket) {}
rpc FetchHciAcl(bluetooth.facade.EventStreamRequest) returns (stream HciAclPacket) {}
rpc FetchHciSco(bluetooth.facade.EventStreamRequest) returns (stream HciScoPacket) {}
}
bool enable = 1;
}
-message HciEvtPacket {
+message HciEventPacket {
bytes payload = 1;
}
-message HciCmdPacket {
+message HciCommandPacket {
bytes payload = 1;
}