Problem coding IRCode with UUIRTTransmitIR in perl

Interested in integrating USB-UIRT support into an application? Look here!

Moderator: jrhees

Problem coding IRCode with UUIRTTransmitIR in perl

Postby cnicolas » Thu Apr 14, 2005 7:19 am

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
cnicolas
 
Posts: 3
Joined: Sun Apr 10, 2005 2:58 pm

Postby jrhees » Fri Apr 15, 2005 4:05 am

Pronto format is 0x0010 (or 16 decimal).

-Jon
jrhees
Site Admin
 
Posts: 1652
Joined: Tue Jan 28, 2003 11:49 pm

Postby cnicolas » Sat Apr 16, 2005 8:02 pm

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.
cnicolas
 
Posts: 3
Joined: Sun Apr 10, 2005 2:58 pm

Postby jrhees » Sun Apr 17, 2005 5:52 am

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
jrhees
Site Admin
 
Posts: 1652
Joined: Tue Jan 28, 2003 11:49 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 15 guests