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

Commit 2b570b47 authored by Zach Johnson's avatar Zach Johnson
Browse files

rusty-gd: protect protected events in hci

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I5d79687eb4d464fb5942651f86945db31cfa62d3
parent c68e9859
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -105,6 +105,14 @@ impl HciExports {

    /// Indicate interest in specific HCI events
    pub async fn register_event_handler(&mut self, code: EventCode, sender: Sender<EventPacket>) {
        match code {
            EventCode::CommandStatus
            | EventCode::CommandComplete
            | EventCode::LeMetaEvent
            | EventCode::PageScanRepetitionModeChange
            | EventCode::MaxSlotsChange
            | EventCode::VendorSpecific => panic!("{:?} is a protected event", code),
            _ => {
                assert!(
                    self.evt_handlers
                        .lock()
@@ -115,6 +123,8 @@ impl HciExports {
                    code
                );
            }
        }
    }

    /// Remove interest in specific HCI events
    pub async fn unregister_event_handler(&mut self, code: EventCode) {