I believe this should be trivial using a tiny C program that uses libdecodeir.so but unfortunately I can't seem to find any C sample code.
Can you please point me toward the correct solution?
Also, it should be possible to call the library from Python using ctypes, if anyone knows how to do that, I'd be very much interested too.
Here is what you are looking for. Possibly with the exception that it takes the CCF form as input, not the raw form you are using, modifying it should not present any problem for you. (Note that no-one of the replies understand (or care) for the content of the posting -- what a nice forum )
Hi Barf, thanks a lot. Unfortunately I have exactly zero Java skills, so I have to wait until you release your next version that supports raw decoding.
Talking about IrpMaster, I would be very interested in a server-side version of it. Do you know how to do this? Running "java -jar IrpMaster.jar ... " on the server is slow, I am sure there must be a better way?
probono wrote:... Unfortunately I have exactly zero Java skills, so I have to wait until you release your next version that supports raw decoding.
The first part talked about a main routine in C++, so I do not understand that sentence as it stands.
Talking about IrpMaster, I would be very interested in a server-side version of it.
IrpMaster is first of all a library will reasonably well defined and documented API. That means that you can just "link" with it, see the API example in the documentation and the doc directory. At least as long as you write your program in Java! Writing an "IrpMaster server" would thus essentially be a matter of a few hours for an experienced Java programmer. Since I do not have a particular use case, I do not have it on my TODO-list.But feel free to try to persuade me
About the server, I think it could be very useful to build kind of a wiki for IR codes. People could upload their detected raw codes, they would be decoded and the clean version of the IR code would be displayed. This would also be integrated with a devices database. This way we could build the world's largest IR code database that would grow better and larger than any commercial database.
We would make it very easy to use: no software installation, automatic conversion of the codes into the most common formats. This coupled with very inexpensive and common devices, such as Arduino, should allow for rapid adoption.
One day, we could even design a fully open-source infrared remote control. What do you think?
I have written down my thoughts here, which may also be a more appropriate place to take the discussion. After all, this is the forum for getting the maximum out out UEI remotes.
#! /usr/bin/env python
import os, sys, serial, select
port = "/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0"
here = os.path.abspath(os.path.dirname(__file__))
# This is important, otherwise we get no decodes
os.environ['LD_LIBRARY_PATH'] = here + "/IrMaster-bin-0.3.1/Linux-i386/"
class Arduino():
def run(self, baud=9600):
try:
self.ser = serial.Serial(port, baud, timeout=1)
except:
print "Could not open the serial port " + port
sys.exit(1)
self.ser.flushInput()
while True :
inp, outp, err = select.select([sys.stdin, self.ser], [], [], .2)
if self.ser in inp :
line = self.ser.readline().strip()
if("+" in line):
command = here + "/jre/bin/java -jar " + here + \
"/IrMaster-bin-0.3.1/lib/IrpMaster.jar --decodeir --ccf " + \
line + " -43992"
# print command
os.system(command)
arduino = Arduino()
arduino.run()
If only I could get rid of all the Java overhead just to call that c++ library...
If only I could get rid of all the Java overhead just to call that c++ library...
Agreed, it is not sound to call a Java program, firing up the JVM, just to invoke a C++ shared library. But In my first posting, second in the thread, I gave you (in the link) a C++-program that did almost exactly what you asked for, as expressed in the thread title. The only thing you need to do is the fairly trivial conversion from the Pronto type input to raw inputs. That should be quite simple with your programming knowledge. The other direction would be considerably harder.
It should also be possible to call shared libraries directly from Python. I just entered "shared libraries with python" in Google, and got interesting hits.
Thanks Barf. In our link to the C++-program the first thing I had trouble with is the Java stuff in the Makefile. I can't even get this to compile, as it always complains about some JNI stuff I have no real clue about...
The "Java stuff" is DecodeIR's JNI connection, which we do not need here. You can just comment out/remove everything offending, like the include and all function starting with Java_com_hifiremote_decodeir. Possibly easier, in particular if you are not that familiar with C syntax, would be to install a JDK, Java Developer Kit, after which it should compile.
Thanks Barf, removing everything related to Java and Windows indeed did the trick for me. I now have a tiny Linux decodeir executable. If anyone else is interested, I have uploaded the modified source to https://github.com/probonopd/decodeir