Page 1 of 1

Problem coding IRCode with UUIRTTransmitIR in perl

PostPosted: Thu Apr 14, 2005 7:19 am
by cnicolas
Hello !
I am trying to create a program in perl for IR transmit with my USB-UIRT.

I use Active Perl 5.8 (downloaded from www.activestate.com in msi format)
with Win32-API package (to install it, launch ppm and type : Install Win32-API)

My first program is :
Code: Select all
use Win32::API;
Win32::API::Type->typedef("HUUHANDLE","PHANDLE");
Win32::API->Import("uuirtdrv","HUUHANDLE UUIRTOpen()");
Win32::API->Import("uuirtdrv","BOOL UUIRTTransmitIR(HUUHANDLE hHandle, PCHAR IRCode,
                               INT codeFormat, INT repeatCount, INT inactivityWaitTime,
                               HANDLE hEvent, PVOID reserved0, PVOID reserved1)");
Win32::API->Import("uuirtdrv","BOOL UUIRTClose(HUUHANDLE hHandle)");

$uirt = UUIRTOpen();
if ($uirt ne -1) {
  print "USB-UIRT Opened\n";
 
  # ...

  UUIRTClose($uirt);
} else {
  print "Error opening USB-UIRT\n";
}

Work nice !

Now, I wish to transmit some IR code to my USB-UIRT
For the test I use a simple IR code (channel change on my TV) in pronto format.
I add this code in the middle of my program :
Code: Select all
  $IRCode = "0000 0072 0000 000D 0020 0021 0020 0021 0040 0021 0020 0021 0020 0021 0020 0021 0020 0021 0020 0021 0020 0021 0020 0021 0020 0021 0020 0041 0020 0CAE";
  $intcodeFormat = 2;
  $repeatCount = 1;
  if (!UUIRTTransmitIR($uirt,$IRCode,$intcodeFormat,$repeatCount,0,0,$reserved0,$reserved1)) {
    print("ERROR\n");
  } else {
    print("OK\n");
  }

But that doesn't work. It always return ERROR.
In fact if I put 0 in $intcodeFormat the program work, the UIRT LED blink, but nothing occurs on my TV.

What's wrong ?
What is the correct intcodeFormat for Pronto format ?

Thank's if you can help me...
Christophe

PostPosted: Fri Apr 15, 2005 4:05 am
by jrhees
Pronto format is 0x0010 (or 16 decimal).

-Jon

PostPosted: Sat Apr 16, 2005 8:02 pm
by cnicolas
Jon,

I have the same problem with intcodeFormat = 16.
The program return a transmission Error.
only intcodeFormat 0 works.

Thank's if you have any idea.

PostPosted: Sun Apr 17, 2005 5:52 am
by jrhees
Sorry, everything else looks correct. The only other idea I have is perhaps Perl is passing the parameters in reverse order on the stack??? The uuirtdrv.dll uses the Pascal parameter passing convention.

-Jon