-
Notifications
You must be signed in to change notification settings - Fork 17
RDKEMW-9895: IAppNotifications: move Emit to callback #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/RDKEMW-9458
Are you sure you want to change the base?
RDKEMW-9895: IAppNotifications: move Emit to callback #592
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the event emission mechanism in the AppNotifications API by extracting the Emit method into a separate callback interface. The changes enable a callback-based approach where event emitters are passed to handlers rather than being directly invoked on the main interface.
Key changes:
- Extracted
Emitmethod into a new nestedIEmitercallback interface - Modified
HandleAppEventNotifierto accept an emitter callback parameter - Changed
Emitreturn type fromCore::hresulttovoid
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| apis/Ids.h | Added new ID constant for the emitter callback interface |
| apis/AppNotifications/IAppNotifications.h | Refactored event emission into a callback interface and updated handler signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apis/Ids.h
Outdated
| ID_APP_NOTIFICATIONS = ID_ENTOS_OFFSET + 0x450, | ||
| ID_APP_NOTIFICATIONS_HANDLER_INTERNAL = ID_APP_NOTIFICATIONS + 1 | ||
| ID_APP_NOTIFICATIONS_HANDLER_INTERNAL = ID_APP_NOTIFICATIONS + 1, | ||
| ID_APP_NOTIFICATIONS_HANDLER_INTERNAL_EMITER = ID_APP_NOTIFICATIONS + 2 |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'EMITER' to 'EMITTER'.
| ID_APP_NOTIFICATIONS_HANDLER_INTERNAL_EMITER = ID_APP_NOTIFICATIONS + 2 | |
| ID_APP_NOTIFICATIONS_HANDLER_INTERNAL_EMITTER = ID_APP_NOTIFICATIONS + 2 |
| }; | ||
|
|
||
|
|
||
| struct EXTERNAL IEmiter : virtual public Core::IUnknown |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'IEmiter' to 'IEmitter'.
|
|
||
| struct EXTERNAL IEmiter : virtual public Core::IUnknown | ||
| { | ||
| enum { ID = ID_APP_NOTIFICATIONS_HANDLER_INTERNAL_EMITER }; |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'EMITER' to 'EMITTER' to match the corrected constant name.
|
|
||
| // @json:omit | ||
| // @text handleAppEventNotifier | ||
| // @brief Handle AppEvent Notfier expectations for a given event |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Notfier' to 'Notifier'.
| // @brief Handle AppEvent Notfier expectations for a given event | |
| // @brief Handle AppEvent Notifier expectations for a given event |
| // @param status: status to be filled in | ||
| // @returns Core::hresult | ||
| virtual Core::hresult HandleAppEventNotifier(const string& event /* @in */, const bool& listen /* @in */, bool& status /* @out */) = 0; | ||
| virtual Core::hresult HandleAppEventNotifier(IEmiter *emitCb, const string& event /* @in */, const bool& listen /* @in */, bool& status /* @out */) = 0; |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'IEmiter' to 'IEmitter' to match the corrected interface name.
6aa91d5 to
7517319
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // @param event: the event to emit | ||
| // @param payload: the payload to emit | ||
| // @param appId (optional): the appId to emit the event for, if empty the event is emitted for all Apps | ||
| virtual void Emit(const string &event /* @in */, |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type changed from Core::hresult to void, removing the ability to report errors during emission. Consider keeping Core::hresult as the return type to allow error handling and propagation when emission fails.
| virtual void Emit(const string &event /* @in */, | |
| virtual Core::hresult Emit(const string &event /* @in */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For notification we do not return a value
| // @param status: status to be filled in | ||
| // @returns Core::hresult | ||
| virtual Core::hresult HandleAppEventNotifier(const string& event /* @in */, const bool& listen /* @in */, bool& status /* @out */) = 0; | ||
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb, const string& event /* @in */, bool listen /* @in */, bool& status /* @out */) = 0; |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The emitCb parameter should be a reference (IEmitter&) or a smart pointer rather than a raw pointer to clarify ownership semantics and prevent null pointer issues. If null is a valid value, this should be documented in the @param comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a THunder way of passing pointers
7517319 to
686890c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // @param status: status to be filled in | ||
| // @returns Core::hresult | ||
| virtual Core::hresult HandleAppEventNotifier(const string& event , const bool& listen , bool& status /* @out */) = 0; | ||
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb, const string& event /* @in */, bool listen /* @in */, bool& status /* @out */) = 0; |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The emitCb parameter should be marked with /* @in */ to be consistent with other parameters and clarify it's an input parameter. Additionally, consider whether this should be a non-nullable pointer or if it should use a reference instead.
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb, const string& event /* @in */, bool listen /* @in */, bool& status /* @out */) = 0; | |
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb /* @in */, const string& event /* @in */, bool listen /* @in */, bool& status /* @out */) = 0; |
| // @param status: status to be filled in | ||
| // @returns Core::hresult | ||
| virtual Core::hresult HandleAppEventNotifier(const string& event , const bool& listen , bool& status /* @out */) = 0; | ||
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb, const string& event /* @in */, bool listen /* @in */, bool& status /* @out */) = 0; |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter listen is changed from const bool& to bool. For consistency with the existing codebase style where the original signature used const bool&, consider whether this change in parameter passing style is intentional. If this is a breaking API change, ensure it's documented.
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb, const string& event /* @in */, bool listen /* @in */, bool& status /* @out */) = 0; | |
| virtual Core::hresult HandleAppEventNotifier(IEmitter *emitCb, const string& event /* @in */, const bool& listen /* @in */, bool& status /* @out */) = 0; |
No description provided.