bschwind / ir-slinger

A small C library for sending infrared packets on the Raspberry Pi
The Unlicense
99 stars 30 forks source link

PySlinger: Python implementation of IR-Slinger #5

Closed danijelt closed 8 years ago

danijelt commented 8 years ago

As I promised, here's the Python version of IR-Slinger. It uses ctypes to interface with pigpio library, removing the need for pigpiod daemon.

Once initialized and running as a daemon, this thing sends IR signals instantly.

Toggle bit in RC-5 is not (and can't be) implemented in this version as it's not running as a daemon.

bschwind commented 8 years ago

Looks good to me, thanks for working on that!

Once initialized and running as a daemon, this thing sends IR signals instantly

Does this script run as a daemon? I didn't see anything in the code which indicated it was a daemon.

Toggle bit in RC-5 is not (and can't be) implemented in this version as it's not running as a daemon

Just curious, why do you need a daemon for the toggle bit?

danijelt commented 8 years ago

Does this script run as a daemon? I didn't see anything in the code which indicated it was a daemon.

It doesn't in this state, but in my application, this is imported into daemon app (with some minimal changes) which keeps it initialized and just calls send_code() when it's needed.

Just curious, why do you need a daemon for the toggle bit?

Well, the toggle bit state could be kept in a file, but that would introduce an FS overhead. The better way would be to keep it in a variable in RC5 class and daemonize it.
Both methods should be easy to implement. However, I didn't bother with it at all since my TVs seem to ignore the toggle bit and happily accept the static IR code.

bschwind commented 8 years ago

Ah I gotcha, it's just if you want to keep some persistent state around. The goal with ir-slinger is to allow some higher level process to manage state keeping, and only worry about sending an already defined IR signal. It makes sense that you left it out of the python script.

Thanks for writing this! I'll go ahead and merge it now.