CaptureIR progress

Discussion forum for JP1 software tools currently in use, or being developed, such as IR, KM, RemoteMaster, and other misc apps/tools.

Moderator: Moderators

johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

I'll make that change shortly.

I'm not clear on what the change to CaptureIR would look like to call it, but maybe that will be obvious when I see how it calls other things in packages.
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

You can either add an import statement to import the package:

Code: Select all

import com.hifiremote.decodeir.*;
or you can use the fully qualified class name directly in your code:

Code: Select all

DecodeIRVersion = new com.hifiremote.decodeir.DecodeIRCaller().getVersion();
You'll also have to put DecodeIRCaller.java in the subdirectory com/hifiremote/decodeir
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

I'm getting bogged down on some details.

I can't build the new DecodeIRCaller (with package com.hifiremote.decodeir;) unless I move the .java file to that subdirectory.

Then the import line in CaptureIR.java can't find it (though the subdirectory is right there).

I'm also confused on other details of the makefile for CaptureIR related to introducing that subdirectory.
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

Yes, you do have to move DecodeIRCaller.java to the subdirectory, and
In order to compile it you must compile it from the base directory:

Code: Select all

javac <options> com\hifiremote\decodeir\DecodeIRCaller.java
producing com\hifiremote\decodeir\DecodeIRCaller.class
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

I did all that (and it seems to compile correctly), and I've tried several different things in the CLASSPATH= line in the makefile for CaptureIR, but I haven't yet found a way to get it to accept that import line in CaptureIR.java

Edit: I've tried so many different combinations of makefile changes and package line changes and import line changes, I'm getting lost. It no longer rejects the import line. Now it says

CaptureIR.java:121: cannot access DecodeIRCaller
bad class file: com\hifiremote\decodeir\DecodeIRCaller.class
class file contains wrong class: com.hifiremote.decodeir.DecodeIRCaller

I can't figure out where to go from that.
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

Using the version of CaptureIR source I have, I got it to build with the following changes:
  • move DecodeIRCaller.java to com\hifiremote\decodeir
  • delete DecodeIRCaller.class
  • Add package com.hifiremote.decodeir; at the beginning of com\hifiremote\decodeir\DecodeIRCaller.java
  • change line 14 of makefile to com/hifiremote/decodeir/DecodeIRCaller.class RegValue.class Preferences.class \
  • add import com.hifiremote.decodeir.*; to CaptureIR.java
  • add import com.hifiremote.decodeir.*; to DecodeIRWrapper.java
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

Any idea how to get DecodeIRCaller.h to build?
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

You should regenerate DecodeIRCaller.h using

Code: Select all

javah -classpath . com.hifiremote.decodeir.DecodeIRCaller
That will create the file com_hifiremote_decodeir_DecodeIRCaller.h, which is what you will need to use. In that file the entry points will have been changed to include com_hifiremote_decodeir_
Those entry point names will also have to be changed in the source for DecodeIR.dll
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

I thought I had tried that manually, but I must have mistyped it. That worked this time. I have to take it out of the makefile so I can tell what else in the makefile is/isn't working. It would be nice to have the makefile issue that command as it used to, but I have no idea how to make it understand a source file with / seperators generates a destination file with _ seperators using a command with . seperators. I find this Java package stuff very inconvenient.
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

I don't understand which change stopped the build from complaining. I don't know whether I really built it.

When I run it I get

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/hifiremote/decodeir/DecodeIRCaller
at CaptureIR.<init>(CaptureIR.java:121)

I HATE this package stuff.
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

How are you running it?
If you are running it from the .jar file, you need to include com/hifiremote/decodeir/DecodeIRCaller.class in the .jar file.

Change line 37 of makefile to

Code: Select all

	jar cmvf  Manifest $@ *.class com/hifiremote/decodeir/*.class CaptureIR-src.jar
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

More makefile changes and manual steps (that I'll forget later and not be able to rebuild captureIR). But I have something that seems to work and I emailed it to you.
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

Thanks John. Sorry it was such a pain.
johnsfine
Site Admin
Posts: 4766
Joined: Sun Aug 10, 2003 5:00 pm
Location: Bedford, MA
Contact:

Post by johnsfine »

I just uploaded a CaptureIR.zip to
https://www.hifi-remote.com/forums/dload ... le_id=3760

I think the three files it holds are all you need (other than Java and DecodeIR) but I'm not certain. When someone tries it an runs into trouble, I'll try to help quickly.

It contains
1) CaptureIR.jar
If Java is properly set up you can run by double clicking that. I usually need a .bat file to invoke Java to invoke CaptureIR.jar, sometimes even a .bat file to invole allowio to invoke Java to invoke CaptureIR.jar. But I think that is due to strangeness on those systems. Even if you have similar issues, I don't yet know enough to know what you would need in a .bat file.

2) CaptureIR.dll
That and DecodeIR.dll need to be where CaptureIR.jar can find them. I have CaptureIR.dll in the directory with CaptureIR.jar and I have DecodeIR.dll in Windows/system32

3) Porttalk.sys
I think that needs to be in Windows/system32/drivers
But I'm not sure that is enough. On each computer I've tried I had some initial trouble getting that to work. You might need to get a complete package from
http://beyondlogic.org/porttalk/porttalk.htm
and run something in there to get porttalk.sys properly installed.

Sorry this is in such a half baked form. As I get some feedback I'll try to improve things.

Also, check the File/preferences dialog when you first run CaptureIR. Most of that is fill waiting for the underlying code to be written, but some parts are important. If I'm remembering correctly, important parts are:
Hardware:
Capture Pin: The printer port pin 2 through 13 or 15 to which you connected the IR data pin (middle pin of one of the QSE15x parts).
Active High or Low: QSE156 and QSE158 are active high. QSE157 and 159 are active low. For other three pin detectors see their documentation. All two pin detectors are active low (I don't know yet whether any two pin detectors swing enough current to work directly connected to the printer port).
Timing:
Post Sampling Delay or Max. Sampling time (I need to check which is connected and whether it's badly named). One of those determines how quickly a capture stops when the signal seems to stop. Set that low (200 or 300 msec) for quick response on ordinary signals. Set it higher (maybe even thousands of msec) to avoid truncating macros or other complex signals (of course then you have to wait that long after the signal really ends before seeing results).
gfb107
Expert
Posts: 3411
Joined: Sun Aug 03, 2003 7:18 pm
Location: Cary, NC
Contact:

Post by gfb107 »

I built my cable using pin 1 for power, pin 10 for capture, and pin 20 for ground (actually I connected pins 18-25 together, just like the simple interface).

I've verified 4.6 volts between power and ground.
I've set the Capture Pin to 10 in File->Preferences

But CaptureIR doesn't detect any signals. Here's the stderr/stdout trace:

Code: Select all

D:\CaptureIR>java -jar Captureir.jar
PLATFORM_WIN32_NT: using porttalk
Opening PortTalk Driver
pid = 2448

PortReader: clock=3.58Mhz unit=279.365nS timeout=640000uS gap_limit=2290908
PortReader: readLen=0
At first I got a protection exception in CaptureIR.dll, but once I installed porttalk.sys (by copying it to Windows/system32/drivers and opening porttalk.reg, and rebooting) that went away.

Ideas?
Post Reply