Re: convert LIRC file to IRToy raw commands
Reply #2 –
[quote author="zoulou"]...
But how do I get from a LIRC file to the bytes that I need to send to the IRToy[/quote]
Sending an IR signal to the 'toy is not THAT easy, it involves timing and checking return values and such. It is not just the matter of transforming a string into another representation. So I suggest that you use one existing driver. For example the one in IrScrutinizer :-).
Assuming that Java is an allowed solution, I would suggest that you try to write a program like this (Java >= 7):
// This code is in the public domain.
package javaapplication47;
import org.harctoolbox.IrpMaster.IrSignal;
import org.harctoolbox.harchardware.ir.IrToy;
public class JavaApplication47 {
public static void main(String[] args) {
try {
String parameters = null;
switch (args[0]) {
case "NEXT":
parameters = "D=128 F=154";
break;
case "PREVIOUS":
parameters = "D=128 F=158";
break;
default:
System.err.println("Unknown command");
System.exit(1);
}
IrSignal irSignal = new IrSignal("IrpProtocols.ini", "NEC1", parameters);
IrToy irToy = new IrToy("/dev/ttyACM0");
irToy.open();
irToy.sendIr(irSignal, 1, null);
irToy.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
which would generate the signals you want and send iit to the 'toy. Note that this is examle code, but should be enough to try the idea. You will need IrpProtocols.ini, IrpMaster.jar, HarcHardware.jar, antlr-3.4-complete.jar, and rxtx.jar and you need to have librxtxSerial in your java.library.path.(All contained in IrScrutinizer dist.)
If you have a working LIRC setup, including a working IrToy driver, that should also work. But that is a big IF.