Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a690cd6 authored by Gopi Sakshihally Bhuthaiah's avatar Gopi Sakshihally Bhuthaiah
Browse files

Bumble Java Android Headtracker Test Infra Changes

Introduced new RPC call to support run time HID and
HOGP service configuration.

Bug: 368045103
Test: atest -v HidHeadTrackerTest
Flag: TEST_ONLY
Change-Id: I89c1e47493944597719055929747d53fabec94c1
parent 78d250f8
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ option java_outer_classname = "HidProto";
import "google/protobuf/empty.proto";

service HID {
  // Register service
  rpc RegisterService(ServiceRequest) returns (google.protobuf.Empty);
  // Connect HID Host
  rpc ConnectHost(google.protobuf.Empty) returns (google.protobuf.Empty);
  // Disconnect HID Host
@@ -39,6 +41,16 @@ enum HidReportId {
  HID_INVALID_RPT_ID = 3;
}

enum HidServiceType {
  SERVICE_TYPE_HID = 0;
  SERVICE_TYPE_HOGP = 1;
  SERVICE_TYPE_BOTH = 2;
}

message ServiceRequest {
  HidServiceType service_type = 1;
}

message SendHostReportRequest {
  bytes address = 1;
  HidReportType report_type = 2;
+33 −12
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ from pandora_experimental.hid_pb2 import (
    PROTOCOL_REPORT_MODE,
    PROTOCOL_BOOT_MODE,
    PROTOCOL_UNSUPPORTED_MODE,
    SERVICE_TYPE_HID,
    SERVICE_TYPE_HOGP,
)

from bumble.core import (
@@ -705,19 +707,11 @@ def on_virtual_cable_unplug_cb():

hid_protoMode_queue = None
hid_report_queue = None

# This class implements the Hid Pandora interface.
class HIDService(HIDServicer):

hid_device = None

    def __init__(self, device: Device) -> None:
        super().__init__()
        self.device = device

def register_hid(self) -> None:
    self.device.sdp_service_records.update(sdp_records())
        self.event_queue: Optional[asyncio.Queue[ProtocolModeEvent]] = None
        hogp_device(self.device)
        logging.info(f'Hid device register: ')
    global hid_device
    hid_device = HID_Device(self.device)
    # Register for  call backs
@@ -728,6 +722,33 @@ class HIDService(HIDServicer):
    # Register for virtual cable unplug call back
    hid_device.on('virtual_cable_unplug', on_virtual_cable_unplug_cb)


# This class implements the Hid Pandora interface.
class HIDService(HIDServicer):

    hid_device = None

    def __init__(self, device: Device) -> None:
        super().__init__()
        self.device = device
        self.event_queue: Optional[asyncio.Queue[ProtocolModeEvent]] = None

    @utils.rpc
    async def RegisterService(self, request: empty_pb2.Empty, context: grpc.ServicerContext) -> empty_pb2.Empty:

        if request.service_type == SERVICE_TYPE_HID:
            logging.info(f'Registering HID')
            register_hid(self)
        elif request.service_type == SERVICE_TYPE_HOGP:
            logging.info(f'Registering HOGP')
            hogp_device(self.device)
        else:
            logging.info(f'Registering both HID and HOGP')
            register_hid(self)
            hogp_device(self.device)

        return empty_pb2.Empty()

    @utils.rpc
    async def ConnectHost(self, request: empty_pb2.Empty, context: grpc.ServicerContext) -> empty_pb2.Empty: