Skip to content
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

how best to extend? #88

Open
dhershko2 opened this issue Aug 1, 2020 · 1 comment
Open

how best to extend? #88

dhershko2 opened this issue Aug 1, 2020 · 1 comment

Comments

@dhershko2
Copy link

Just came across the package - i have periodic GPS messages coming in from my device, where best to add a handler to parse/process either in a generic (new) callback or how to add a callback for my specific message type? currently they are getting tagged as 'Unhandled unsolicited modem notification'. any suggestions welcome.

@tomchy
Copy link

tomchy commented Feb 12, 2021

Hi @dhershko2 !
I've looked into the code and I'd propose to copy logic used in _callStatusUpdates, create a new field (e.g. _userNotoficationHandlers) and a new method (e.g. addNotificationHandler or registerNotificationHandler). Afterwards - you should be able to extend the notification logic from your app.

It is questionable if the user-defined callback should be called as the first one or the last one. Calling at the begining allows to easily override the default modem behaviour.

On the contrary, if the notification is not custom, but well-specified, I'd advise to simply add another if statement and a notification-specific, configurable handler.

I'm not a code owner, so I cannot guarantee that the proposal is good enough. Either way - I hope that you will find my suggestion valuable 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants