========================================================================
       DYNAMIC LINK LIBRARY : MceIr V0.21
       by Bruno FLEURETTE (2005)
       extended by Aaron Dinnage (2007)
       extended by James Lee (2008)
========================================================================

========================================================================
History
========================================================================

0.21
- Support the native Vista driver
- Fixed RC6 decoding error for some remotes
- Restart if the driver start to return bogus data

0.20
- Added speed settings (fast/medium/slow)
- Added manufacturer settings (microsoft/smk)

0.19
- Uses secure C++ function calls
- Removed girder stuff

0.18
- Blaster selection is now possible (1, 2 or both)
- Introduce MceIrSelectBlaster() and MceIrCheckFile() functions
- Driver now will install all MCE 2005 remote models

0.17
- Receiving IR with REC-80 protocol is now recognized (Panasonic)
- Fix : Bug in sending RC6 Pronto files
- Fix : Poor key recognition when running CPU expensive application (IR data missed)

0.16
- MCEIR driver now supports going into hibernate S4 state
- Receiving IR with RC5X/RC6/RC6A protocols is now recognized
- Sending IR from all Pronto IR format is now supported (not only learned IR format)

0.15
- Fix : Bug fixed in handling Girder's command parameters

0.14
- Fix : IR Blasters stop sending and improve sending quality

0.13
- Introduce MceIrSuspend() and MceIrResume() function to handle standby power features
- Fix : power messages generated by Girder are now handled
- Fix : 100% CPU usage when USB driver stops (USB cable unplugged or resuming from standby)
- Known problem : MCEIR driver prevents Windows from going into hibernate S4 power state (I'm working on it...)

0.12
- Fix : reading Pronto files (only Seq1 is blastered)

0.11
- A 300ms delay is now observed before blasting (avoid IR mixing)
- Support of Pronto IR format for blasting (HEX codes saved as an TXT file)
- IR decoding improvements (Buffering suppressed + bug fixes)

0.10
- The very first version

========================================================================
GIRDER PLUGIN
========================================================================

The general purpose of this plug-in is to receive/send IR with Microsoft XP MCE USB receiver/blasters.
- Receiving IR codes from MCE remotes (no big deal...) but for other remotes too ! (actually the plug can receive RC5/NEC/SONY protocols)
- Learning IR codes from other remotes and send them through the IR blasters ! (normally restricted to MCE certified appliances by Microsoft)

Before using the plugin, you have to choose between 2 drivers :
- Built-in Microsoft driver (irbus.sys) : in this mode, keyboards and apps events are still generated by HID keyboard.
  Choosing this option, you will use your MCE remote as before... and add features with Girder
- My own driver (mceir.sys) : in this mode, keyboards and apps events are no more generated and must be generated with Girder.
  Install
So if you are satisfied with MCE remote behavior, keep the original driver. If you want to control everything, choose to install mceir.sys.

========================================================================
MCEIR.sys SETUP
========================================================================

Make sure the MCE remote is installed.
In the Control Panel/System, select the Device Manager button on the Hardware Tab.
In the Universal Serial Bus Controllers section, locate the entry for the remote, right click and select "Update Driver"
- Select "No, not at the time" for the Window Update prompt.
- Select "Install from a list or specific location"
- Select "Don't search. I will choose the driver to install"
- Select the "Have Disk" button and enter the location of the supplied drivers.
- Select the MCE Infrared Remote Receiver option and the rest should be self explanatory.

Easy mistakes to make are :
- The remote is listed as an input device as well, but you need to change the driver for the USB device
- To find the driver you need to navigate right to the driver folder and select the "mceir.inf" file.
- Follow the instruction entirely - if you don't the system will most likely find the std MS driver.

Again please note that as you are no longer using the MS driver, any keypresses will not control the PC

If you want to go back to the normal driver, just repeat the above but instead of "No, not at the time" click "yes, this time only"
and it should find the original driver. 

========================================================================
GIRDER PLUGIN SETUP
========================================================================

Just copy MceIr.dll into your girder\plugins forlder then restart Girder.
Then activate "MCE Remote plugin" in Options->Plugins tab. That's it !

========================================================================
COMMAND LINE TOOLS
========================================================================

- MceIrRec.exe : allows you to record IR into a file
  syntax: MCEIRREC -o C:\TEST.IRK
- MceIrPlay : to send a previously recorded file through IR blaster #1
  syntax: MCEIRPLAY -i C:\TEST.IRK -b 1

========================================================================
MCEIR API Description (developpers restricted area)
========================================================================

BOOL WINAPI MceIrRegisterEvents(HWND hWnd)
------------------------------------------
To register the window that will receives messages on keystroke events (from MceIr only)
(IR code analysis is automatically suspended during a learning phase)

hWnd : handle to the window which will receives WM_USER messages
       wParam values is ID_MCEIR_KEYCODE
       LOWORD(lParam) contains the key code (see MceIr.h for the list)
       HIWORD(lParam) contains the repeat count (0 means a new keystroke)
returns TRUE if successfull

BOOL WINAPI MceIrUnregisterEvents()
-----------------------------------
To stop receiving keystrokes from IR

returns TRUE if successfull

BOOL WINAPI MceIrSetRepeatTimes(DWORD FirstRepeat, DWORD NextRepeats)
---------------------------------------------------------------------
To specify the repeat rate when a key remains pressed
FirstRepeat : Time (in ms) to wait before sending a second WM_USER message (HIWORD(lParam) will be 1)
NextRepeats : Interval between next messages until the key is released

returns TRUE if successfull

BOOL WINAPI MceIrRecordToFile(HANDLE hFile, DWORD Timeout)
----------------------------------------------------------
To record raw IR code (learning function). This function waits for the IR receiver to become silent for 1 second,
then enters the recording phase. 

hFile  : handle to the file in which raw IR codes will be stored
        (must be opened previously then closed when function returns)
Timeout: applies to the recording phase and occurs is nothing is received from the MceIr (in ms) 

returns TRUE if successfull

BOOL WINAPI MceIrPlaybackFromFile(HANDLE hFile)
-----------------------------------------------
To playback a previously recorded file.

hFile  : handle to the file in which raw IR codes has been stored
        (must be opened previously then closed when function returns)

returns TRUE if successfull

BOOL WINAPI MceIrSuspend()
-----------------------------------------------
Call this function before entering a suspend power state (WM_POWERBROADCAST + PBT_APMSUSPEND event)

BOOL WINAPI MceIrResume()
-----------------------------------------------
Call this function on resuming a suspend power state (WM_POWERBROADCAST + PBT_APMRESUMEAUTOMATIC event)

BOOL WINAPI MceIrSelectBlaster()
-----------------------------------------------
To select a blaster port on which further IR playback will be sent

BOOL WINAPI MceIrCheckFile(HANDLE hFile)
-----------------------------------------------
To check if the API supports playing this file