1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2%
    3%  FILE      : Env/rcx_swi.pl
    4%  Time-stamp: <02/11/30 01:25:17 ssardina>
    5%
    6%  Author      : Sebastian Sardina
    7%  DESCRIPTION : Interface to communicate with the Lego RCX via SWI
    8%  email       : ssardina@cs.toronto.edu
    9%  WWW         : www.cs.toronto.edu/~ssardina
   10%  TYPE CODE   : system dependent predicates
   11%  TESTED      : SWI Prolog 5.0.10 under RedHat Linux 6.2-8.0
   12%
   13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   14%
   15%                             November 22, 2002
   16%
   17% This software was developed by the Cognitive Robotics Group under the
   18% direction of Hector Levesque and Ray Reiter.
   19%
   20%        Do not distribute without permission.
   21%        Include this notice in any copy made.
   22%
   23%
   24%         Copyright (c) 2000 by The University of Toronto,
   25%                        Toronto, Ontario, Canada.
   26%
   27%                          All Rights Reserved
   28%
   29% Permission to use, copy, and modify, this software and its
   30% documentation for non-commercial research purpose is hereby granted
   31% without fee, provided that the above copyright notice appears in all
   32% copies and that both the copyright notice and this permission notice
   33% appear in supporting documentation, and that the name of The University
   34% of Toronto not be used in advertising or publicity pertaining to
   35% distribution of the software without specific, written prior
   36% permission.  The University of Toronto makes no representations about
   37% the suitability of this software for any purpose.  It is provided "as
   38% is" without express or implied warranty.
   39% 
   40% THE UNIVERSITY OF TORONTO DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
   41% SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
   42% FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TORONTO BE LIABLE FOR ANY
   43% SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
   44% RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
   45% CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
   46% CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   47% 
   48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   49%
   50% NOTE: All communication between Prolog and the RCX is initiated by Prolog
   51%
   52% The interface to Lego RCX is divided into two parts/files:
   53%
   54%   (a) a system independent part/file dealing with the protocol (lego_rcx.pl)
   55%   (b) a system dependent part/file dealing with the actual low level comm
   56%
   57% This file defines the following interface:
   58%
   59% -- initializeRcx 
   60%             prepare the RCX for reading
   61% -- finalizeRcx 
   62%             finished with RCX for reading and writing
   63% -- sendRcxActionNumber(+Num, -Result) 
   64%             send the action number Num to the RCX, and return 
   65%             the value Result from the RCX
   66% -- receiveRcxActionNumber(-Actions) 
   67%             receive 0 or 1 action numbers in list Actions from RCX. 
   68%             Fail if no reply from RCX
   69%
   70%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   71
   72:- module(rcx_swi,
   73          [initializeRcx/0,
   74           finalizeRcx/0,
   75           sendRcxActionNumber/2,
   76           receiveRcxActionNumber/1]).   77
   78:- include(legorcx).  % System independent part
   79:- include(lego_swi). % System dependent part for SWI
   80
   81
   82%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   83% EOF: Env/rcx_swi.pl
   84%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%