http://www.newton-inc.com/dev/techinfo/qa/qa.htm
cookie := OpenRemoteControl();
Call this function once to initialize the remote control functions. It returns a magic cookie that must be passed to subsequent remote control calls, or nil if the initialization failed.CloseRemoteControl(cookie);
Call this function once when all remote control operations are completed, passing cookie returned from OpenRemoteControl
. Always returns nil
. cookie is invalid after this call returns.SendRemoteControlCode(cookie, command, count);
Given the cookie returned from OpenRemoteControl
, this function sends the remote control command (see below for format of data). The command is sent count times. count must be at least 1. Returns after the command has been sent (or after the last loop for count
> 1). (see diagram)struct IRCodeWord { unsigned long name; unsigned long timeBase; unsigned long leadIn; unsigned long repeat; unsigned long leadOut; unsigned long count; unsigned long transitions[];};
name
identifies the command code; set to anything you liketimeBase
in microseconds; sets the bit time baseleadIn
duration in timeBase units of the lead bit cellrepeat
duration in timeBase units of the last bit cell for loop commandsleadOut
duration timeBase units of the last bit cell for non-loop commandscount
one-based count of transitions followingtransitions
[ ] array of transition durations in timeBase units
Note that the repeat time is used only when the code is sent multiple times.GetNamedResource
and when you send data, use the constant as the resource used. OpenRemoteControl
is called in viewSetupFormscript
, and closeRemoteControl
is called in viewQuitScript
. Note that these are methods, not global functions; same is true of SendRemoteControlCode
.