home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / cm17ce.zip / fcinst.EXE / cmda1on.cmd < prev    next >
OS/2 REXX Batch file  |  2000-01-18  |  3KB  |  94 lines

  1. /* CMDA1ON.CMD - X10 Command Control from the OS/2 Desktop */
  2.  
  3. /*
  4.   This is an example to show how to access the CM17A Comm Engine functions.
  5.   This program connects to the Comm Engine pipe, turns on a module and exits.
  6.   You can change the X10 commands below to any house, device or function code
  7.   and rename this script accordingly. Consult the Comm Engine documentation
  8.   for details on X10 command structure.
  9.  
  10.     Written by: Lone Peak Automation, LLC
  11.     Date: Jan. 15, 2000
  12.     This program requires the CM17A Comm Engine.
  13.     See http://home.att.net/~ASchw for more information.
  14.  
  15.     Important: The CM17A Comm Engine must be running and be connected
  16.                to the X10 FireCracker before using this script.
  17. */
  18.  
  19. /* Load the REXXUTIL.DLL */
  20. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  21. call SysLoadFuncs
  22.  
  23. /* Load CM17A Comm Engine Functions */
  24. call RxFuncAdd 'X10FLLoadFuncs', 'X10FLDLL', 'X10FLLoadFuncs'
  25. call X10FLLoadFuncs
  26.  
  27. /* Unremark pipename below for your Comm Engine */
  28. pipename = '\PIPE\CM17ACE'    /* pipe for CM17A Comm Engine */
  29.  
  30. /*
  31. /* if using over network, replace CLIENT527 with your own computer's name */
  32. pipename = '\\CLIENT527\PIPE\CM17ACE'
  33. */
  34.  
  35. piperr = MakePipe( pipename )   /* open control pipe */
  36. IF piperr = 1 then
  37.   EXIT
  38.  
  39. /*
  40. Edit your X10 command here. Refer to Comm Engine documentation for valid commands.
  41. Some valid commands are: A12 ON, B1 OFF, E10 DIM 30, M5 BRI 25
  42. */
  43. temp = '}ID1 A1 ON'      /* X10 House, Device and Function code */
  44.  
  45. rc = FCLWritePipe(temp)  /* write command to Comm Engine */
  46. CALL SysSleep 2          /* Delay of 2 seconds to wait for command execution */
  47. rc = FCLReadPipe('0')    /* read confirmation */
  48. /* next line can be remarked out for troubleshooting */
  49. /* SAY 'reading from pipe >' || rc || '<' */
  50.  
  51. /*
  52.    Close pipe to free up Comm Engine.
  53.    If pipe is not closed and the command line window
  54.    remains open, then the Comm Engine stays tied up.
  55.    Closing of command line window will also close the
  56.    pipe automatically.
  57. */
  58. rc = FCLClosePipe('0')
  59.  
  60. call X10FLDropFuncs
  61.  
  62. EXIT
  63.  
  64.  
  65. /* Open control pipe */
  66.  
  67. MakePipe: PROCEDURE
  68.  
  69. ARG pipename
  70. piperr = 1
  71. rc = FCLOpenPipe(pipename)
  72.  
  73. IF rc = 0 then
  74.   DO
  75.     rc = FCLPeekPipe('0')
  76.     IF Right(rc, 1) = 3 then
  77.       DO
  78.        SAY pipename || ' connected'
  79.        piperr = 0
  80.       END
  81.     else
  82.       DO
  83.        SAY pipename || ' unavailable, close'
  84.        rc = FCLClosePipe('0')
  85.       END
  86.   END
  87. ELSE
  88.   DO
  89.    SAY pipename || ' not available'
  90.    rc = FCLClosePipe('0')
  91.   END
  92. RETURN piperr
  93.  
  94.