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

IR Protocol Suggestion #87

Open
AndruePeters opened this issue Oct 29, 2019 · 1 comment
Open

IR Protocol Suggestion #87

AndruePeters opened this issue Oct 29, 2019 · 1 comment

Comments

@AndruePeters
Copy link

I'm not creating a pull request because it's such a small thing to do, but I thought it was worth suggesting. I first saw this used while doing some TI development.

Currently you have

`#define UNKNOWN 0
#define NEC 1
...
#define LAST_PROTOCOL 12 // Be sure to update this`

What you can do instead is

enum {
UNKNOWN = 0,
NEC, 
SONY,
...
LAST_PROTOCOL
}

This will automatically update the value for LAST_PROTOCOL as well as provide a bit more structure. Since you're already using OOP paradigms with C++, then I'd also suggest enum classes. However, that would require rewriting some code. What I suggested shouldn't break anything and also make it less error prone.

@AndruePeters
Copy link
Author

By keeping the enum anonymous, it shouldn't interfere with any of your existing code. I'd also request changing the names of the protocols or namespace because they've interfered with other projects.

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

1 participant