USB-UIRT Transmit

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
niczoom
Posts: 78
Joined: 09 Mar 2016, 22:17

USB-UIRT Transmit

Post by niczoom » 09 Mar 2016, 22:37

Ive been trying to get my USB-UIRT (infrared transmitter and receiver) to transmit a command, but with not luck.

I have been through the following forum : https://autohotkey.com/board/topic/6302 ... teraction/

I am running Win 10 Pro x64, AHK v1.1.23.01 32-bit Unicode.

My USB-UIRT is working with eventghost and the 'USB-UIRT Learning Helper Utility'.

I can query the device with the following code:

Code: Select all

#SingleInstance Force
#NoEnv

;SetBatchLines -1
;SetWinDelay -1

OnExit releasedll

;test := USBUIRT_HardwareInfo()
;MsgBox % test
;return

;DllCall("uuirtdrv.dll\UUIRTGetDrvInfo", UIntP,vers)
;MsgBox % vers

VarSetCapacity(uInfo,12)

hndl := DllCall("uuirtdrv.dll\UUIRTOpen")
DllCall("uuirtdrv.dll\UUIRTGetUUIRTInfo", UInt, hndl, UInt, &uInfo)

MsgBox % "fwVersion: " NumGet(uInfo,0) "`nProtocolVersion: "  NumGet(uInfo,4)
 . "`nFW D/M/Y :" NumGet(uInfo,8,"UChar") "/"  NumGet(uInfo,9,"UChar") "/"  NumGet(uInfo,10,"UChar")

releasedll:
;USBUIRT_ReleaseDLL()
DllCall("uuirtdrv.dll\UUIRTClose", UInt,hndl)
And it returns the correct information from the device (When i use 64bit AHK it return nothing, all zeroes).

When i try to transmit a command from the device it does not work, the red transmit light does not work, the script runs and exits without error. Here is the code:

Code: Select all

#SingleInstance Force
#NoEnv

OnExit releasedll

VolUp := "0000 006D 0000 0022 00AB 00AB 0015 0040 0015 0040 0015 0040 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0040 0015 0040 0015 0040 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0040 0015 0040 0015 0016 0015 0040 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0040 0015 0016 0015 0040 0015 0040 0015 0040 0015 0040 0015 06EB"

VolUp2 := "2F0115009544"
 
;msgbox %VolUp% 

currentbatch = %A_BatchLines%
curentwind = %A_WinDelay%
SetBatchLines -1
SetWinDelay -1
hndl := DllCall("uuirtdrv.dll\UUIRTOpen")
;MsgBox % hndl
test1 := DllCall("uuirtdrv.dll\UUIRTTransmitIR", UInt,hndl
	, Str, %VolUp% ; Variable containing IR code to transmit
	, Int, 0x0010 ;Codeformat (UUIRT: 0, PRONTO: 0x0010)
	, Int, 1  ; repeatCount
	, Int, 100  ; inactivityWaitTime ms
	, Int, 0  ; HANDLE hEvent to signal code sent
	, UInt, 0, UInt, 0) ; reserved
SetBatchLines %currentbatch%
SetWinDelay %curentwind%

;MsgBox % test1

return

releasedll:
DllCall("uuirtdrv.dll\UUIRTClose", UInt,hndl)
Ive been trying to get it working for a while but without luck, any ideas?
[AHK] 1.1.23.05 x32 Unicode
[WIN] 10 Pro x64 Version 5111 (Build 10586.218)

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: USB-UIRT Transmit

Post by lexikos » 09 Mar 2016, 23:27

%VolUp% is the wrong syntax for a variable reference within an expression. Normally you will get an error message alluding to the fact that the contents of VolUp (0000 006D ...) are being interpreted as a variable name, but apparently that doesn't happen if the string is longer than the maximum length of a variable name. So firstly, remove the percent signs.

Does UUIRTTransmitIR expect a string of hexadecimal digits encoded as ANSI/UTF-16, with a space after every fourth digit? Or does it expect binary data? They are two (or three) very different things. For example, the string "00" can be encoded as 0x30,0x30,0x00 (null-terminated) in ANSI/ASCII or 0x30,0x00,0x30,0x00,0x00,0x00 in UTF-16 (little endian byte order); but maybe the function expects a single byte 0x00 (zero).

At the very least, I expect the string must be in 8-bit/ANSI form and not UTF-16. If it expects a hexadecimal string and you are using a Unicode version of AutoHotkey, you would need to use "AStr" instead of "Str".

If it expects binary, you will need to translate the hexadecimal string to binary. There are various scripts for that; you can find some by searching for "Hex2Bin" (but note that some versions of that function may not work with newer AutoHotkey versions).

Also note that you may need to manually load the DLL to ensure it is not automatically unloaded in between your calls to UUIRTOpen and UUIRTTransmitIR.


I almost forgot: Scripts & Functions is the wrong place for scripts that don't work. I have moved the topic to Ask for Help.

User avatar
niczoom
Posts: 78
Joined: 09 Mar 2016, 22:17

Re: USB-UIRT Transmit

Post by niczoom » 10 Mar 2016, 21:20

If it expects a hexadecimal string and you are using a Unicode version of AutoHotkey, you would need to use "AStr" instead of "Str".
Thx for the reply lexikos, your suggestion worked.

I changed the string which holds the 'IR Code' from Str to Astr and it worked !

I also had to install the Unicode 32-bit version for it to work. It did not work on Unicode 64-bit. Any idea why?
[AHK] 1.1.23.05 x32 Unicode
[WIN] 10 Pro x64 Version 5111 (Build 10586.218)

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: USB-UIRT Transmit

Post by lexikos » 11 Mar 2016, 00:08

For functions which return a handle or pointer, you must specify the return type "ptr" or "uptr". The default return type is "int", which will truncate 64-bit values.

For input parameters which are handles or pointers, you should use "ptr", but it doesn't matter because in that context (plain input values) DllCall always passes a pointer sized integer (unless you use "Int64" in a 32-bit process). The called function will simply truncate the value if it expects a smaller type.

User avatar
niczoom
Posts: 78
Joined: 09 Mar 2016, 22:17

Re: USB-UIRT Transmit

Post by niczoom » 11 Mar 2016, 02:52

This info is beyond my knowledge, I did have a read on using 'Ptr' in the AHK Help file as well, and from what you wrote I understand I need to add this to get it working with AHK x64 but have no idea how to implement it to get it working.

Im now running AHK x64, so in my example I added 'Ptr' to the following hndl := DllCall("uuirtdrv.dll\UUIRTOpen", Ptr), I tried with and without quotes, did not work for me, hndl returns nothing.

Do I need to use 'ptr' in this call somewhere ?? DllCall("uuirtdrv.dll\UUIRTTransmitIR", UInt, hndl

Again, thankyou for your help.
[AHK] 1.1.23.05 x32 Unicode
[WIN] 10 Pro x64 Version 5111 (Build 10586.218)

SifJar
Posts: 398
Joined: 11 Jan 2016, 17:52

Re: USB-UIRT Transmit

Post by SifJar » 11 Mar 2016, 06:10

You could try hndl := DllCall("uuirtdrv.dll\UUIRTOpen", "Cdecl Ptr")

Usually Cdecl isn't required, but for some functions it is, this might be one of them.

You could also try looking at the value of ErrorLevel right after the DllCall (just add a MsgBox % ErrorLevel line, and see if that sheds any light, with reference to https://autohotkey.com/docs/commands/DllCall.htm#error to understand the meaning of various values)

As for your second call, I would suggest that if the value in hndl1 is a ptr (as per the previous call), you should define it's type as ptr instead of UInt (i.e. DllCall("uuirtdrv.dll\UUIRTTransmitIR", ptr, hndl)), if only for the sake of clarity in the code, as I believe from Lexikos' post that AHK will always pass a ptr-sized integer for int/uint, so it should probably work either way.

User avatar
niczoom
Posts: 78
Joined: 09 Mar 2016, 22:17

Re: USB-UIRT Transmit

Post by niczoom » 11 Mar 2016, 06:30

Just tried adding 'Cdecl' as you suggested, didnt seem to work. ErrorLevel returned -3 though.

Code: Select all

hndl := DllCall("uuirtdrv.dll\UUIRTOpen", "Cdecl Ptr")
MsgBox % ErrorLevel
DllCall("uuirtdrv.dll\UUIRTTransmitIR", Ptr, hndl
	, AStr, VolUp_Pronto ; Variable containing IR code to transmit - needed AStr (ANSI String)
	, Int, 0x0010 ;Codeformat (UUIRT: 0 | 'UIRT-native STRUCT' or RAW: 0x0000 | PRONTO: 0x0010 )
	, Int, 1  ; repeatCount
	, Int, 0  ; inactivityWaitTime ms
	, Int, 0  ; HANDLE hEvent to signal code sent
	, UInt, 0, UInt, 0) ; reserved
return
[AHK] 1.1.23.05 x32 Unicode
[WIN] 10 Pro x64 Version 5111 (Build 10586.218)

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: USB-UIRT Transmit

Post by lexikos » 11 Mar 2016, 07:06

I'm pretty sure the reason for the failure is the final one listed next to -3 in the DllCall documentation...

User avatar
niczoom
Posts: 78
Joined: 09 Mar 2016, 22:17

Re: USB-UIRT Transmit

Post by niczoom » 11 Mar 2016, 08:03

Sorry, I did not read up on the error :facepalm: .
-3: The specified DllFile could not be accessed or loaded. If no explicit path was specified for DllFile, the file must exist in the system's PATH or A_WorkingDir. This error might also occur if the user lacks permission to access the file, or if AutoHotkey is 32-bit and the DLL is 64-bit or vice versa.
I checked the dll and its 32bit.
[AHK] 1.1.23.05 x32 Unicode
[WIN] 10 Pro x64 Version 5111 (Build 10586.218)

stevesmithtx
Posts: 5
Joined: 25 Apr 2018, 02:06

Re: USB-UIRT Transmit

Post by stevesmithtx » 29 Jul 2018, 23:04

Newbie here. Can someone point me in the direction for reading up on how to make the usb uirt transmit IR codes when a certain key is pressed? I can read the IR codes from the remote, but I'm having a hell of a time getting the usb uirt to activate at all. Not looking for a hand out or for others to do the work, but just for a resource on how to ahk this device. I have been looking through old forums and a lot of the scripts that people have suggested are no longer available .

Thanks all!

User avatar
niczoom
Posts: 78
Joined: 09 Mar 2016, 22:17

Re: USB-UIRT Transmit

Post by niczoom » 07 Aug 2018, 21:44

Hi stevesmithtx, I've attached my complete HTPC script that I wrote. I went from using 'EventGhost' to Autohotkey around 2 years ago. The script contains hotkeys and functions which utilize my USBUIRT. Hope it helps in some way!
Attachments
AutoHTPC.ahk
(164.18 KiB) Downloaded 69 times
[AHK] 1.1.23.05 x32 Unicode
[WIN] 10 Pro x64 Version 5111 (Build 10586.218)

stevesmithtx
Posts: 5
Joined: 25 Apr 2018, 02:06

Re: USB-UIRT Transmit

Post by stevesmithtx » 19 Nov 2018, 17:33

Just now seeing this! Thank you! I’ll check it out tonight

stevesmithtx
Posts: 5
Joined: 25 Apr 2018, 02:06

Re: USB-UIRT Transmit

Post by stevesmithtx » 22 Nov 2018, 11:57

Thanks for this! It’s helpful but I’m still having issue sending code.

I need something very basic (or seemingly basic) such as

Space::
Send certain ir code

R::
Send certain ir code

C::
Send certain IR code


Any idea as what I may be missing or how to best transmit that?

stevesmithtx
Posts: 5
Joined: 25 Apr 2018, 02:06

Re: USB-UIRT Transmit

Post by stevesmithtx » 22 Nov 2018, 12:04

Ick. Sorry just read above and think I may have some additional things to try. Still open to suggestions but I’ll try a few other things.

rbinckahk
Posts: 2
Joined: 13 Aug 2021, 17:32

Re: USB-UIRT Transmit

Post by rbinckahk » 14 Aug 2021, 09:44

stevesmithtx

I know this is an old thread, but in case someone finds it I have this suggestion.

There is an app named uutx that will send out an IR code in the Pronto format. It can be used with the run function like this.

Code: Select all

run, C:\uutx "0000 0067 0000 0004 0011 0011 0022 0022 0011 0022 0011 0387"
This app also allows you to submit a file containing all of your remote codes in a .txt file and invoke the send like this:

Code: Select all

run, C:\uutx -f<filename.txt> <IRCodeName>  

where:
<filename.txt> is the code file location with full path
<IRCodeName> is the particular code you wish to send

Example: run, C:\uutx C:\remote\codes.txt play

The function is case sensitive, so play and PLAY are different.

In the code file the codes are entered like this:
; Format: <IRCodeName> <IRCode> (you can add comments in the file with ; )
play 0000 0067 0000 0004 0011 0011 0022 0022 0011 0022 0011 0387
pause 0000 0067 0000 0004 0011 0011 0022 0022 0011 0022 0011 0388

Use tabs between the IRcodeName and the learned code
For other control by an AHK script will be a matter of calling the uutx app with the appropriate filename and IRCodeName.

To get the codes required you can use the lrnhelper app. When run it will have a button to Learn an IR Code. After clicking on it, point your remote at the USB-UIRT and press the button on the remote to be learned. The code you need will be displayed when the learning is complete. Hold down the button on the remote until the learning process has finished. Then you can copy and paste the code into your script or code file as needed.

You will need to download the various software drivers and apps for the USB-UIRT.
To download the USB-UIRT driver goto the USB-UIRT webpage at http://www.usbuirt.com/getstart.htm and select the Windows system you have. Use the i386 folder if you
have an Intel CPU.
To download the uutx app here is the download link: http://www.etcwiki.org/dl/uutx_0_3.zip
To download the lrnhelper app, here is the link: http://www.usbuirt.com/lrnhelper_0_0_5.zip

You will also need the uuirtdrv.dll file available in the i386 folder for the driver.
The uuirtdrv.dll should be copied or moved from the i386 folder to C:\WINDOWS\system32\ folder.
Once the USB-UIRT driver is downloaded, the driver is installed using the device manager per the instructions on the USB-UIRT getstart page.

Seamndel
Posts: 8
Joined: 25 Jul 2021, 03:46

Re: USB-UIRT Transmit

Post by Seamndel » 09 Jan 2022, 14:14

@rbinckahk Can you please explain how to use uutx?

I installed it uutx_0_3

Code: Select all

run, C:\uutx "0000 0067 0000 0004 0011 0011 0022 0022 0011 0022 0011 0387"
I figure this code is supposed to be inserted in a .ahk file (".ahk" means AutoHotKeys)

I installed uutx_0_3 in a different path than the aforementioned one :
C:\Program Files\uutx - USB UIRT Path Enabler

So where does the IR Pronto code come in? Cause' when I copy-paste your run command to a .ahk this is what I get:
Image
Attachments
image.png
image.png (86.54 KiB) Viewed 1056 times

x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: USB-UIRT Transmit

Post by x32 » 25 Nov 2022, 22:33

I see this is a few months old but it just popped up in a Google search I was doing for another project. Anyway, if it helps, I have recently partially updated my old USBUIRT library which would be much easier to use I believe. Support for the USBUIRT had gone away for a few years but there is a Windows 10 64 bit driver available on the website now. http://www.usbuirt.com/support.htm

I say partially updated because I had help converting parts of in into unicode but not all. The non unicode parts will have chinese characters in the captured IR codes but these codes can be transmitted and received just the same.

I have some sample scripts I can post with this if there is still any interest. I likely should just make a new post on the forum.

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;             USB-UIRT Functions Library             ;;;;;;;;;;;;;;;;;;;;;;;;
;                                                                                                     ;
; Completed by Specter333 (I'm only half evil)                                                        ;  
; Based almost entirely on the work of Laszlo, cynopsys and Thracx.  I would have never been able to  ;
; complete this if not for them getting it as far along as they did.  Thank You.                      ;
; http://www.autohotkey.com/forum/viewtopic.php?t=43255&start=0                                       ;
;                                                                                                     ;
; USB-UIRT developed by Jon Rhees, http://www.usbuirt.com/.                                           ;                                                       ;
; A large database of IR remote codes can be found here;                                              ;
; http://files.remotecentral.com/                                                                     ;
; Test these remote codes by copying them into the edit window of the Transmit IR example script.     ;
;                                                                                                     ;
; Once installed the uuirt.dll should be in C:\WINDOWS\system32\                                      ;
; Example scripts and USB-UIRT developer info located at bottom.                                      ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/*
                            USB-UIRT Functions 
USBUIRT_LoadDLL() 				Opens communication with the USB-UIRT.
USBUIRT_ReleaseDLL() 			Terminates communication with the USB-UIRT.
USBUIRT_ReceiveIR()				Receives IR codes suitable for use as a label.
USBUIRT_SendIRRaw(IRCode)		Sends IR code stored in parameter in UIRT-native STRUCT or RAW format.
USBUIRT_SendIRPronto(IRCode)	Sends IR code stored in parameter in Pronto format.
USBUIRT_DriverInfo()			Retrieves driver version.
USBUIRT_HardwareInfo()			Retrieves the USB-UIRT's firmware version, protocol version and firmware install date.
USBUIRT_ConfigInfo()			Retrieves the USB-UIRT's configuration settings.
USBUIRT_SetConfig(config)		Change the configuration.
USBUIRT_LearnRaw()				Learn an IR code from a remote control and save in Raw format.
*/


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Load the DLL.
USBUIRT_LoadDLL(){ 
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	DllCall("LoadLibrary", Str,"C:\WINDOWS\system32\uuirtdrv.dll")
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Release the DLL.
USBUIRT_ReleaseDLL(){ 
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTClose", UInt,hndl)
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Receive IR codes for use as labels.
; Functioning but incomplete
USBUIRT_ReceiveIR(){ 
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen") 
	getAirIrCodeAddress := RegisterCallback("USBUIRT_AirCode")
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTSetReceiveCallback", UInt, hndl 
		, UInt, getAirIrCodeAddress ; Address of received IR code.
		, Str, Userdata) ; This parameter is useful for carrying context information, etc.
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}

USBUIRT_AirCode(IrEventStr,Data){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	VarSetCapacity(IrCode, 2048) 
	DllCall("lstrcpy", Str, IrCode, UInt, irEventStr) ; Copy the string into the script's variable.
	VarSetCapacity(IrCode, -1) ; Update the variable's internally-stored length to reflect its new contents.
	If IsLabel(IRcode)  
		GoSub, %IRcode%
	retcode := NumGet(IRcode,0) "-" Userdata 
	Return retcode
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Transmit an IR code for UIRT-native STRUCT or RAW.
; Unicode Version
USBUIRT_SendIRRaw(IRCode){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1 
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTTransmitIR", UInt,hndl
		, "Ptr", &IRCode ; Variable containing IR code to transmit
		, Int, 0x00 ;Codeformat (UUIRT: 0, UIRT-native STRUCT or RAW: 0x0000)
		, Int, 1  ; repeatCount
		, Int, 100  ; inactivityWaitTime ms
		, Int, 0  ; HANDLE hEvent to signal code sent
		, UInt, 0, UInt, 0) ; reserved
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%	
}
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Transmit an IR code for UIRT-native STRUCT or RAW.
USBUIRT_SendIRRaw(IRCode){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1 
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTTransmitIR", UInt,hndl
		, Str, IRCode ; Variable containing IR code to transmit
		, Int, 0x00 ;Codeformat (UUIRT: 0, UIRT-native STRUCT or RAW: 0x0000)
		, Int, 1  ; repeatCount
		, Int, 100  ; inactivityWaitTime ms
		, Int, 0  ; HANDLE hEvent to signal code sent
		, UInt, 0, UInt, 0) ; reserved
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%	
}
*/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Transmit an IR code for PRONTO.
; Unicode Version
USBUIRT_SendIRPronto(IRCode){ 
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTTransmitIR", UInt,hndl
		, "Ptr", IRCode ; Variable containing IR code to transmit
		, Int, 0x10 ;Codeformat (UUIRT: 0, PRONTO: 0x0010)
		, Int, 1  ; repeatCount
		, Int, 100  ; inactivityWaitTime ms
		, Int, 0  ; HANDLE hEvent to signal code sent
		, UInt, 0, UInt, 0) ; reserved
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Transmit an IR code for PRONTO.
USBUIRT_SendIRPronto(IRCode){ 
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTTransmitIR", UInt,hndl
		, Str, IRCode ; Variable containing IR code to transmit
		, Int, 0x10 ;Codeformat (UUIRT: 0, PRONTO: 0x0010)
		, Int, 1  ; repeatCount
		, Int, 100  ; inactivityWaitTime ms
		, Int, 0  ; HANDLE hEvent to signal code sent
		, UInt, 0, UInt, 0) ; reserved
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}
*/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Retrieve Driver Information.
USBUIRT_DriverInfo(){ 
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	VarSetCapacity(vers,12)
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTGetDrvInfo", UIntP,vers) ; Current driver version
	drvvers := NumGet(vers,0)
	Return vers
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Retrieve Hardware Information
USBUIRT_HardwareInfo(){ 
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen") 
	VarSetCapacity(uInfo,12)
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTGetUUIRTInfo", UInt, hndl
	, UInt, &uInfo) ; String containing USB-UIRT hardware information.
	fwVersion:= NumGet(uInfo,0)"," ; Firmware Version
	ProtocolVersion:= NumGet(uInfo,4)"," ; Protocol Version 
	FW_DMY:= NumGet(uInfo,9,"UChar") "/" NumGet(uInfo,8,"UChar") "/"  NumGet(uInfo,10,"UChar")+2000 ; Firmware install date.
	Return fwVersion ProtocolVersion FW_DMY
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Get Current Configuration Info
USBUIRT_ConfigInfo(){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen") 
	VarSetCapacity(uInfo,12)
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTGetUUIRTConfig", UInt, hndl
		, UInt, &uInfo) ; Current configuration number.  See "Set Configuration" below for numbers.
	cinf:= NumGet(uInfo)
	Return cinf
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Set Configuration
USBUIRT_SetConfig(config){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTSetUUIRTConfig", UInt, hndl
		, UInt, config) ; 1 = Blink on receive, 2 = Light on Transmit, 3 = Generate Legacy codes
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%	
} ; Add numbers together to combine configuration settings. ie, 3 = Blink on receive and light on transmit.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Unicode version
USBUIRT_LearnRaw(){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	VarSetCapacity(IRcode, 2048)
	abort = 0
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTLearnIR", UInt,hndl
		, Int, 0x100      ; codeFormat: UUIRTDRV_IRFMT_LEARN_FORCERAW
		, "Ptr", &IRCode     ; the received code
		, UInt, CBfunc    ; PLEARNCALLBACKPROC progressProc --------------- Not yet implemented
		, Str, "Userdata" ; *userData: passed by the USB-UIRT driver to progressProc calls
		, UIntP, abort    ; *pAbort set to 1 in another thread: requests abort --- Not yet implemented
		, UInt, 0         ; param1 = forced frequency
		, UInt,0, UInt,0) ; reserved
	Return StrGet(&IRCode, "CP0") "-" Userdata
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Learn IR Code, Raw Format
; Functioning but incomplete
USBUIRT_LearnRaw(){
	currentbatch = %A_BatchLines%
	curentwind = %A_WinDelay%
	SetBatchLines -1
	SetWinDelay -1
	hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
	VarSetCapacity(IRcode, 2048)
	abort = 0
	DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTLearnIR", UInt,hndl
		, Int, 0x100      ; codeFormat: UUIRTDRV_IRFMT_LEARN_FORCERAW
		, Str, IRCode     ; the received code
		, UInt, CBfunc    ; PLEARNCALLBACKPROC progressProc --------------- Not yet implemented
		, Str, "Userdata" ; *userData: passed by the USB-UIRT driver to progressProc calls
		, UIntP, abort    ; *pAbort set to 1 in another thread: requests abort --- Not yet implemented
		, UInt, 0         ; param1 = forced frequency
		, UInt,0, UInt,0) ; reserved
	Return IRCode "-" Userdata
	SetBatchLines %currentbatch%
	SetWinDelay %curentwind%
}
*/

Post Reply

Return to “Ask for Help (v1)”