* Takes care of the IPC Events sent to Homebridge
()
| 703 | * Takes care of the IPC Events sent to Homebridge |
| 704 | */ |
| 705 | private initializeIpcEventHandlers() { |
| 706 | // start ipc service |
| 707 | this.ipcService.start() |
| 708 | |
| 709 | // handle restart child bridge event |
| 710 | this.ipcService.on(IpcIncomingEvent.RESTART_CHILD_BRIDGE, (username) => { |
| 711 | // noinspection SuspiciousTypeOfGuard |
| 712 | if (typeof username === 'string') { |
| 713 | const childBridge = this.childBridges.get(username.toUpperCase()) |
| 714 | childBridge?.restartChildBridge() |
| 715 | } |
| 716 | }) |
| 717 | |
| 718 | // handle stop child bridge event |
| 719 | this.ipcService.on(IpcIncomingEvent.STOP_CHILD_BRIDGE, (username) => { |
| 720 | // noinspection SuspiciousTypeOfGuard |
| 721 | if (typeof username === 'string') { |
| 722 | const childBridge = this.childBridges.get(username.toUpperCase()) |
| 723 | childBridge?.stopChildBridge() |
| 724 | } |
| 725 | }) |
| 726 | |
| 727 | // handle start child bridge event |
| 728 | this.ipcService.on(IpcIncomingEvent.START_CHILD_BRIDGE, (username) => { |
| 729 | // noinspection SuspiciousTypeOfGuard |
| 730 | if (typeof username === 'string') { |
| 731 | const childBridge = this.childBridges.get(username.toUpperCase()) |
| 732 | childBridge?.startChildBridge() |
| 733 | } |
| 734 | }) |
| 735 | |
| 736 | this.ipcService.on(IpcIncomingEvent.CHILD_BRIDGE_METADATA_REQUEST, () => { |
| 737 | this.ipcService.sendMessage( |
| 738 | IpcOutgoingEvent.CHILD_BRIDGE_METADATA_RESPONSE, |
| 739 | Array.from(this.childBridges.values(), x => x.getMetadata()), |
| 740 | ) |
| 741 | }) |
| 742 | |
| 743 | // Matter monitoring lifecycle handlers |
| 744 | this.ipcService.on(IpcIncomingEvent.START_MATTER_MONITORING, (data) => { |
| 745 | this.handleStartMatterMonitoring(data) |
| 746 | }) |
| 747 | |
| 748 | this.ipcService.on(IpcIncomingEvent.STOP_MATTER_MONITORING, (data) => { |
| 749 | this.handleStopMatterMonitoring(data) |
| 750 | }) |
| 751 | |
| 752 | this.ipcService.on(IpcIncomingEvent.GET_MATTER_ACCESSORIES, (data) => { |
| 753 | void this.handleGetMatterAccessories(data) |
| 754 | }) |
| 755 | |
| 756 | this.ipcService.on(IpcIncomingEvent.GET_MATTER_ACCESSORY_INFO, (data) => { |
| 757 | this.handleGetMatterAccessoryInfo(data?.uuid) |
| 758 | }) |
| 759 | |
| 760 | this.ipcService.on(IpcIncomingEvent.MATTER_ACCESSORY_CONTROL, (data) => { |
| 761 | void this.handleMatterAccessoryControl(data) |
| 762 | }) |
no test coverage detected