This is a IR signal decoder for the Asus 713x TV capture card series. It is an
adaptation by Julian Chennales of a reverse-engineering effort by
Boris Barbulovski. The program replaces the original "P7131RemoteAppl.exe" or
similar program that converts IR signals to a fixed set of keys. This version
sends UDP messages to a configurable server. It was written to target a program
called EventGhost, which can accept UDP messages via a plugin called
"Broadcaster". EventGhost can then do whatever you choose with the event of a
remote button press, hold or release.

EventGhost receives events with optional "payloads". This program sends the
decoded RC5 address+command values combined for a given button and as
payload the texts "press" "hold" "release". Alternatively, for the release
event you can choose to send "release" as the event and the button code as
the payload to make it easier to have a generic action when any button is
released.

If you just want to use this all you need is in the "Release" folder. Example
EventGhost settings and XBMC remote key mappings are in the "DocUtil" folder
For XBMC control I use the "XBMC Repeat" plugin which is not the one in the
default EG installation.

If you intend to run this at startup make sure you either specify the working
directory or you place the ini file in a correct place. The program doesn't
absolutely need the ini file but if you configure your listening server to
anything other than the default then you won't be able to send messages to it
without the ini. There is a reg file in the DocUtil folder that shows how to add
a shortcut to it to the windows "run at startup" key. The shortcut would have
the working dir.

The program is controlled by an ini file in which all values are optional
The ini file would look something like this:

; All settings are in a "Config" section
[Config]
; Server address (127.0.0.1). This is the target server for the UDP messages
ServerAddress=192.168.0.200
; Server port (1024). This is the port where the server is listening
ServerPort=33333
; SendBtnRepeat (1). If this is 1, the "hold" event will be repeatedly send
; as per the settings below. If it is 0, no "hold" events will be sent
SendBtnRepeat=1
; SendBtnUp (0). If this is 1, the "release" event will be sent as a payload
; to the button code after the button is released. If it is 2, it will be
; sent as an event in itself with the button code as payload. If it is 0
; "release" events will not be sent.
SendBtnUp=0
; PulseTiming (889). This is the time of half a pulse. According to the RC5
; standard it is 0.889ms, but on my board it is .895. The DEBUG version of the
; program spits out the timestamps so you can find out yours with a little
; brains and a spreadsheet program ;) (otherwise let it be)
PulseTiming=895
; PulseTimeout (5). This is the maximum time in milliseconds to wait for a rising
; edge. From the RC5 standard this should be more than 4 times <PulseTiming>.
; This is 3.556ms so technically 4 should do. I find that 5 is better and helps
; avoid timeouts in the middle of decoding a button. The less this value is, the
; more responsive the program will be, but more error prone. 5 is a very decent
; value, but if your PC is slow maybe you need more.
PulseTimeout=5
; IgnorePrematureTimeouts (1). Flag to indicate whether the program should
; completely ignore a timeout that happens before 4 gaps of code. This is
; an ugly fix to a somewhat unknown issue I have with WaitForSingleObject.
; Leave it as it is!
IgnorePrematureTimeouts=1
; MaxKeyUpTimeOut (40). Number of timeouts until we consider the button
; released. I recommed you keep this as is. It is how many multiples of
; <PulseTimeout> the program will wait for a repeated code when a button is 
; held down until it decides the button was released. The RC5 standard says
; the code will be repeated every 114ms, so anything > 30 may be ok.
MaxKeyUpTimeOut=40
; MinRepeatTriggerDelayCount (5). This is on which code repetition to start
; sending the "hold" messages. This is here because it is almost impossible
; (at least for me) to press a button and only produce one instance of the IR
; code. So, a few repetitions are still considered as a single press.
MinRepeatTriggerDelayCount=5
; MinRepeatTriggerCount (1). This is on which repetition after we triggered the
; repeat to send each message. 1 means send every one (every .114 ms)
MinRepeatTriggerCount=1
