home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / HP95_100 / COMM / REMOTE / README < prev   
Encoding:
Text File  |  1994-01-11  |  11.4 KB  |  310 lines

  1.               Remote Control 100 Version 1.0
  2.               ------------------------------
  3.  
  4. Introduction
  5.  
  6. Rc converts your HP-100LX into a universal remote control.  The output
  7. of most remote control units can be captured by pointing them from a
  8. distance of about 1-2 inches to the plastic opening on the right of the
  9. "/" key.  The remote control signal can then be sent back to the device 
  10. to be controlled.  Remote control definition files allow you to program 
  11. complicated interfaces to control a number of devices.
  12.  
  13.  
  14. 0. Package Contents
  15.  
  16. The package contains the following files.  As a minimum only rc.exm 
  17. needs to be installed on the system (possibly with the rc.icn icon 
  18. file).
  19.  
  20. readme            This file
  21. rc.icn            Program icon
  22. rc.exm            Program executable (System Manager compliant)
  23. rc.exe            Program executable (DOS version)
  24. bitconv.exe        Recording format conversion program
  25. keycode.exe        Keyboard scan code program
  26. rc.rcf            Example definition file (7-bit compatible)
  27. rc.rc8            Example definition file (8-bit)
  28.  
  29. 1. Program Usage
  30.  
  31. There are two versions of the program.  A DOS version and a System
  32. Manager compliant version.  The DOS version is to be run from the
  33. DOS prompt, while the system manager version is  run from within
  34. the system manager.  In addition there are two ways to represent
  35. the remote control signals.  One way uses 7-bit characters and is
  36. compatible with all ASCII editors (appart from line length problems),
  37. while the other method uses a more compact 8-bit representation.
  38. The "memo" editor that comes with the 100LX can use both formats,
  39. so you will probably want to use the 8 bit representation to save
  40. space (8 bit files are about half the size of the 7 bit equivalent
  41. files).  The program can read both forms without any additional
  42. specifications.  When recording, the user can specify which recording
  43. mode is to be used.  An external DOS program is provided to convert
  44. betweem the two recording formats.
  45.  
  46. The DOS version of the remote control (rc.exe) is used as follows:
  47.  
  48. rc definition-file [entry-routine]
  49.  
  50. rc -r[c] recording-file
  51.  
  52. The first form starts the remote control with a given remote command
  53. definition file.  The optional second argument can specify the
  54. program's entry point.  The program will execute the contents of
  55. the defintion file.
  56.  
  57. The second form starts the remote control program in recording
  58. operation.  In this mode the program will enter a loop and accept
  59. key strokes and associated remote control signals.  These will then
  60. be recorded in the recording file in the form of a trivial remote
  61. control program.  Any previus contents of the recording file will
  62. be erased. If the -rc option is used in place of the -c, the
  63. recording is done using the 7 bit compatible format.
  64.  
  65. In order to use the system manager compliant version (rc.exm) the
  66. program is added to the list of programs using the "Application
  67. Manager" (&..., File, Application, Add).  The program is started
  68. using a hot-key, or via the Application Manager.  The files used
  69. by the program can not be specified, and are hard coded as follows:
  70.  
  71. Definition file:c:\_dat\rc.rcf
  72. Recording file:    c:\dat_\record.rcf
  73.  
  74. In order to start recording in the system manager compliant version,
  75. press ALT-R to generate an 8-bit program or ALT-C to generate a 7-bit
  76. compatible file.
  77.  
  78. 2. Definition Files
  79.  
  80. The program's operation is based on the remote control definition
  81. files.  These files contain commands to draw the screen and key
  82. bindings to send the appropriate remote control codes.  The following
  83. paragraphs contain more details on the definition files.
  84.  
  85. 2.1. Lexical Structure
  86. A remote-100 definition file consists of a set of commands.  Every
  87. command must start on a new line.  Blank lines and white-space is
  88. ignored.  Lines that begin using the '#' character are regarded as
  89. comments and are ignored.
  90.  
  91. 2.2. Program Structure
  92. The commands inside a remote-100 definition file are organised as
  93. procedure definitions.  No other commands are allowed outside the
  94. scope of a procedure definition.  A procedure definition is structured
  95. as follows:
  96.  
  97. define <procname>
  98.     <command>
  99.     ...
  100. end
  101.  
  102. This construct defines a procedure named <procname>.  The commands
  103. are executed when the procedure is invoked using the "call <procname>"
  104. command.  The procedure "main" is the starting point for the
  105. interpretation of the definition file.
  106.  
  107. A minimal file for the control of a simple on/off device could be
  108. the following:
  109.  
  110. # Minimal remote control file
  111. define main
  112.     print 0 0 "+):On   -):Off   ESC):Quit"
  113.     key 0x1b exit
  114.     key '+ send "##'##[##'#%+##'##X##'##X"
  115.     key '- send "##'##[##'#%+##'##X##'##Y"
  116. end
  117.  
  118. A remote control file for controling two devices with a mode change
  119. can be implemented as follows:
  120.  
  121. define main
  122.     cls
  123.     clkey
  124.     print 0 0 "t) TV  v) Video  ESC) Quit"
  125.     key 't call tv
  126.     key 'v call video
  127.     key 0x1b exit
  128. end
  129.  
  130. define tv
  131.     print 0 0 "ESC) Main"
  132.     cls
  133.     clkey
  134.     key 0x1b call main
  135.     # TV commands are place here
  136. end
  137.  
  138. defive video
  139.     ...
  140.  
  141. The remote control files can be used to create new features that
  142. are not available in the original products.  As an example the
  143. following sequence implements a "zap" command that cycles through
  144. three tv stations:
  145.  
  146. define z1
  147.     send "##'##[##'#%+##'##X##'##Y"
  148.     key 'z call z2
  149. end
  150.  
  151. define z2
  152.     send "##'##[##'#%+##'##A##'##B"
  153.     key 'z call z3
  154. end
  155.  
  156. define z3
  157.     send "##'##[##'#%+##'##M##'##N"
  158.     key 'z call z1
  159. end
  160.  
  161. main
  162.     key 'z call z1
  163.     ...
  164.  
  165. A complete, sophisticated control file with mode changes 
  166. and global key definitions is provided in the file rc.rcf.
  167.  
  168. 2.3. Command Description
  169. - define <procname>
  170. Begins a procedure definition.  Following this command other commands
  171. except for the "define" command can be placed.
  172.  
  173. - end
  174. Terminates a procedure 
  175.  
  176. - call <procname>
  177. Uppon execution of this command control is transfered to the procedure
  178. <procname>.  When the "end" statement is reached in <procname> control
  179. is transfered back to the command after the "call" command.
  180.  
  181. - clkey
  182. Clears all key bindings.  The key binding table is entirely cleared.
  183. As a minimum a key binding that results in the program's termination
  184. (via an "exit" command) needs to be installed.
  185.  
  186. - cls
  187. Clears the screen contents.
  188.  
  189. - print <row> <column> "<string>"
  190. Prints a string is the row and column specified.  The size of the
  191. screen can be changed when the program is started using the Fn-Zoom
  192. key combination.  Rows and columns are numbered from (0,0).
  193.  
  194. - exit
  195. Terminates the program.
  196.  
  197. - key '<character> <command>
  198.   key <number> <command>
  199. Installs a key binding for the specified key.  ASCII keys are
  200. specified using the '<character> notation.  Other keys (arrows,
  201. ALT combinations etc.) are specified by giving the key's scan code
  202. in the top byte of the <number> as in 0x2e00.  (The 0x prefix is
  203. used to specify hexadecimal numbers).  The scan codes can be found
  204. using the "keycode" program or in a technical reference manual for
  205. PC computers.  The scan codes are also automaticaly generated during
  206. the record operation.  The command specified can be any command
  207. appart from "define" and "end".
  208.  
  209. - send "<string>"
  210. Sends the code signals specified by the string to the infrared
  211. control port.  There are two possible string encodings depending
  212. on the amount of portability desired.  The fully portable 7-bit
  213. format encodes 16-bit integers as three ASCII characters with values
  214. ranging from 0-63 with 0 represented as '#'.
  215.  
  216. The compact format is represented as follows:
  217.  
  218. Values 0-127 are represented by a single character where 0 is '\x80'
  219. up to 126 being '\xfe'.  127 is represented by '~'.
  220.  
  221. Values 128-3711 are represented by two characters using base 128
  222. notation.  The value of the first character is given by representing
  223. 1 with 'c', while the value of the second character is represented
  224. as above.
  225.  
  226. Values 3712 and above are represented using the three byte 7-bit
  227. portable encoding.
  228.  
  229. Both kinds of encoding can contain embedded spaces to allow for a
  230. bug in the HP 100-LX Memo program which introduces spaces inside
  231. very long strings.
  232.  
  233. 2.4. Run-time Semantics
  234. Program execution normaly starts from the procedure called "main".
  235. Control proceeds serialy from that point transfering control when
  236. a "call" command is encountered.  When the called procedure has
  237. been executed (i.e. the "end" command has been reached) control is
  238. transfered back to the command immediately following the "call"
  239. command.  As the language does not provide any imperative input
  240. statements the "main" procedure normaly terminates after some
  241. initial processing.  After that stage the system enters an event
  242. loop (yes they do crop up everywhere) which transfers control based
  243. on keyboard input events and the corresponding key definitions.
  244. The program terminates when the "exit" command is executed.
  245.  
  246. All execution is performed directly from the file.  The file is
  247. not read into memory and thus occupies no additional storage.  A
  248. 16 element cache stores the last 16 procedures that have been used.
  249. For this reason any initial slugish performance will smooth as the
  250. cache is filled in.  Keys are also directly associated with file
  251. position.  A maximum of 200 key bindings can be stored in the table.
  252. The definition file must not be modified while the program is
  253. running.
  254.  
  255. 3. The Record Format Conversion Program
  256. Bitconv converts definition files from the 8-bit format to the 7-bit
  257. compatible format.
  258.  
  259. To convert from 8-bit to 7-bit run the program as follows:
  260.  
  261. bitconv -c <input_file >output_file
  262.  
  263. To convert from 7-bit to 8-bit run the program as follows:
  264.  
  265. bitconv <input_file >output_file
  266.  
  267. 4. The keyboard scan code program
  268. In order to find out the scan code of a key run the "keycode" program.
  269. Press any key to see its scan code definition printed out.  Terminate
  270. the program by pressing CTRL-BREAK.
  271.  
  272. 5. Author Contact
  273. The programs have been written by:
  274.  
  275.     Diomidis Spinellis
  276.     Myrsinis 1
  277.     GR-145 62 Kifissia
  278.     GREECE
  279.  
  280.     E-mail: dds@doc.ic.ac.uk
  281.  
  282. Many thanks to Steve Loughran and Gilles Kohl for their assistance.
  283.  
  284. 6. Copyright and Disclaimer
  285.  
  286.   Copyright (c) 1993, 1994 Diomidis Spinellis.  All rights reserved.
  287.  
  288.   Redistribution and use in binary form, without modification, is 
  289.   permitted provided that the following conditions are met:
  290.   1. Redistributions in binary form must reproduce the above copyright
  291.      notice, this list of conditions and the following disclaimer in the
  292.      documentation and/or other materials provided with the distribution.
  293.   2. The name of the author may not be used to endorse or promote products 
  294.      derived from this software without specific prior written permission.
  295.   3. Redistribution for profit is not allowed.
  296.  
  297.   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  298.   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  299.   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  300.   DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
  301.   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  302.   OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  303.   OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  304.   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  305.   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  306.   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  307.   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  308.   IN PARTICULAR, NOTE THAT SENDING INCORRECT CODES TO THE REMOTE
  309.   CONTROL LED OF THE HP-100LX MAY PERMANENTLY DAMAGE THE DEVICE.
  310.