Open ajuniper opened 4 years ago
Thanks for the PR! It'll take me some time to look over, and I'm starting to think I should re-work this library to be a bit cleaner. I wrote this almost 4 years ago, and I probably have more C experience now to make it better.
I'd also like to move all the non-C versions to another directory so it's more clear where other language implementations should go. When I have some free time I'll make that change, as I'd like to add a Rust port as well.
I added a program irsling.cpp that uses irslinger.h to transmit codes loaded from a lirc remote control config file. I've only tested it with an NEC remote and a raw remote but believe it should work with RC5 too. (Apologies for using c++ but there were so many things which would have been a PITA in c but easy in c++).
g++ -o irsling irsling.cpp -lpigpio -lm -lpthread sudo ./irsling -p pinnumber -f lircconfigfile buttonname buttonname buttonname ...
It can load multiple remotes and you can combine transmissions to >1 remote:
sudo ./irsling -p pinnumber -f lircconfigfile -f lircconfigfile remotename.buttonname remotename.buttonname remotename.buttonname ...
To make this work I had to break the existing transmission functions down in to distinct components but have kept the existing APIs unchanged, with the exception that you can now also pass a hex string e.g. 0x1ee1f30c instead of a binary string for the codes.
I also fixed a couple of type mismatches which caused compile failures with c++.