|
|
|
@ -160,18 +160,9 @@ pub struct UpdateListener {
@@ -160,18 +160,9 @@ pub struct UpdateListener {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl UpdateListener { |
|
|
|
|
pub fn start( |
|
|
|
|
section_events: SectionEventRecv, |
|
|
|
|
program_events: ProgramEventRecv, |
|
|
|
|
sec_runner_state: SecRunnerStateRecv, |
|
|
|
|
mqtt_interface: MqttInterface, |
|
|
|
|
) -> Self { |
|
|
|
|
pub fn start(mqtt_interface: MqttInterface) -> Self { |
|
|
|
|
let addr = UpdateListenerActor { mqtt_interface }.start(); |
|
|
|
|
let mut l = Self { addr }; |
|
|
|
|
l.listen(section_events); |
|
|
|
|
l.listen(program_events); |
|
|
|
|
l.listen(sec_runner_state); |
|
|
|
|
l |
|
|
|
|
Self { addr } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn listen<L: 'static>(&mut self, listener: L) |
|
|
|
@ -181,6 +172,18 @@ impl UpdateListener {
@@ -181,6 +172,18 @@ impl UpdateListener {
|
|
|
|
|
self.addr.do_send(Listen(listener)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn listen_section_events(&mut self, section_events: SectionEventRecv) { |
|
|
|
|
self.listen(section_events); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn listen_program_events(&mut self, program_events: ProgramEventRecv) { |
|
|
|
|
self.listen(program_events); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn listen_section_runner(&mut self, sec_runner_state_recv: SecRunnerStateRecv) { |
|
|
|
|
self.listen(sec_runner_state_recv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub async fn quit(self) -> eyre::Result<()> { |
|
|
|
|
Ok(self.addr.send(Quit).await?) |
|
|
|
|
} |
|
|
|
|