home *** CD-ROM | disk | FTP | other *** search
/ ftp.hitl.washington.edu / ftp.hitl.washington.edu.tar / ftp.hitl.washington.edu / pub / people / habib / kodak / orb.h < prev    next >
C/C++ Source or Header  |  2000-04-18  |  3KB  |  98 lines

  1. /*
  2.  * orb.h -- The user accessible API for liborb.  
  3.  *
  4.  *  Copyright 1997 John E. Stone (j.stone@acm.org)
  5.  *
  6.  *  $Id: orb.h,v 1.12 1998/02/12 09:58:16 johns Exp $
  7.  */
  8.  
  9. #ifdef  __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. typedef void * OrbHandle; /* Orb Handle type, used by all orb API functions */
  14.  
  15. /* SpaceOrb Button bit-masks */
  16. #define ORB_BUTTON_A      1
  17. #define ORB_BUTTON_B      2
  18. #define ORB_BUTTON_C      4
  19. #define ORB_BUTTON_D      8
  20. #define ORB_BUTTON_E      16
  21. #define ORB_BUTTON_F      32
  22. #define ORB_BUTTON_RESET  64
  23.  
  24. /* 
  25.  * orb_open() 
  26.  *   Open a named serial port which a SpaceOrb 360 is attached to.
  27.  * Returns a handle which is used by all other orb API functions.
  28.  * If the serial port open fails, or the orb does not pass initialization
  29.  * tests, then a NULL is returned as the handle.   
  30.  */
  31. OrbHandle orb_open(char * orbname); 
  32.  
  33. /*
  34.  * orb_close()
  35.  *   Closes down the SpaceOrb serial port, frees allocated resources and
  36.  * discards any unprocessed orb messages.
  37.  */ 
  38. int orb_close(OrbHandle voidhandle);
  39.  
  40. /*
  41.  * orb_getstatus()
  42.  *   Polls the SpaceOrb serial port for new packets, performs any optional
  43.  * postprocessing of SpaceOrb data such as null-region, scaling, and
  44.  * value clamping.  The most recent values for translation, rotation and
  45.  * buttons are stored in the memory locations supplied by the caller.
  46.  * Returns the number of events processed.  If the number of events returned
  47.  * is less than 1, either an error occured or there were no SpaceOrb
  48.  * events to process.
  49.  */
  50. int orb_getstatus(OrbHandle voidhandle, 
  51.                  int * tx, int * ty, int * tz, 
  52.                  int * rx, int * ry, int * rz, int * buttons);
  53.  
  54. /*
  55.  * orb_rezero()
  56.  *   Forces the Orb to re-zero itself at the present twist/position.
  57.  * All future event data is relative to this zero point.
  58.  */
  59. int orb_rezero(OrbHandle voidhandle);
  60.  
  61. /* 
  62.  * orb_init()
  63.  *   Performs a software re-initialization of the SpaceOrb, clearing
  64.  * all unprocessed events.  Initialization also forces the Orb to re-zero 
  65.  * itself.
  66.  */
  67. int orb_init(OrbHandle voidhandle);
  68.  
  69. /* 
  70.  * orb_set_nullregion()
  71.  *  Enables null-region processing on SpaceOrb output.
  72.  * The null-region is the area (centered at 0) around which
  73.  * each coordinate will report zero even when the SpaceOrb itself
  74.  * reports a number whose absolute value is less than the null region
  75.  * value for that coordinate.  For example, if the null region on the
  76.  * X translation coordinate is set to 50, all orb_getstatus() would report
  77.  * 0 if X is less than 50 and greater than -50.  If X is 51, orb_getstatus
  78.  * would report 1.  If X is -51, orb_getstatus() would report -1.  
  79.  * Null-regions help novice users gradually become accustomed to the 
  80.  * incredible sensitivity of the SpaceOrb, and make some applications 
  81.  * significantly easier to control.  A resonable default nullregion for all
  82.  * six axes is 65.  Null regions should be tunable by the user, since its
  83.  * likely that not all SpaceOrbs are quite identical, and it is guaranteed
  84.  * that users have varying levels of manual dexterity.
  85.  * Note that setting the null-region too high significantly reduces the
  86.  * dynamic range of the output values from the SpaceOrb.
  87.  */
  88. void orb_set_nullregion(OrbHandle voidhandle,
  89.         int nulltx, int nullty, int nulltz,
  90.         int nullrx, int nullry, int nullrz);
  91.  
  92.  
  93. #ifdef  __cplusplus
  94. }
  95. #endif
  96.  
  97.  
  98.