fuse.h

00001
00002 /***************************************************************************
00003  *  fuse.h - FireVision Remote Control Protocol
00004  *
00005  *  Generated: Mon Jan 09 15:47:58 2006
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023
00024 #ifndef __FIREVISION_FVUTILS_NET_FUSE_H_
00025 #define __FIREVISION_FVUTILS_NET_FUSE_H_
00026 
00027 #include <fvutils/color/colorspaces.h>
00028 #include <stdint.h>
00029 #include <fvutils/ipc/defs.h>
00030 #include <netcomm/utils/dynamic_buffer.h>
00031
00032 /* Present this e-a-s-t-e-r e-g-g to Tim and get one package of Maoam! */
00033
00034 #pragma pack(push,4)
00035 
00036 /** FUSE version enum. */
00037 typedef enum {
00038   FUSE_VERSION_1 = 1,   /**< Version 1 */
00039   FUSE_VERSION_2 = 2,   /**< Version 2 */
00040   FUSE_VERSION_3 = 3    /**< Version 3 - current */
00041 } FUSE_version_t;
00042 
00043 /** Current FUSE version */
00044 #define FUSE_CURRENT_VERSION FUSE_VERSION_3
00045 
00046 /** FUSE packet types */
00047 typedef enum {
00048   /* bi-directional packages,  1-999 and 0xFFFFFFFE */
00049   FUSE_MT_GREETING            = 0xFFFFFFFE,     /**< version */
00050
00051   /* server to client, 1000-1999 */
00052   FUSE_MT_IMAGE               = 1000,           /**< image */
00053   FUSE_MT_LUT                 = 1001,           /**< lookup table */
00054   FUSE_MT_IMAGE_LIST          = 1002,           /**< image list */
00055   FUSE_MT_LUT_LIST            = 1003,           /**< lut list */
00056   FUSE_MT_GET_IMAGE_FAILED    = 1004,           /**< Fetching an image failed */
00057   FUSE_MT_GET_LUT_FAILED      = 1005,           /**< Fetching a LUT failed */
00058   FUSE_MT_SET_LUT_SUCCEEDED   = 1006,           /**< Setting a LUT succeeded */
00059   FUSE_MT_SET_LUT_FAILED      = 1007,           /**< Setting a LUT failed */
00060   FUSE_MT_IMAGE_INFO          = 1008,           /**< image info */
00061   FUSE_MT_IMAGE_INFO_FAILED   = 1009,           /**< Retrieval of image info failed */
00062
00063   /* client to server, 2000-2999 */
00064   FUSE_MT_GET_IMAGE           = 2000,           /**< request image */
00065   FUSE_MT_GET_LUT             = 2001,           /**< request lookup table */
00066   FUSE_MT_SET_LUT             = 2002,           /**< set lookup table */
00067   FUSE_MT_GET_IMAGE_LIST      = 2003,           /**< get image list */
00068   FUSE_MT_GET_LUT_LIST        = 2004,           /**< get LUT list */
00069   FUSE_MT_GET_IMAGE_INFO      = 2005,           /**< get image info */
00070
00071 } FUSE_message_type_t;
00072 
00073 /** Image format. */
00074 typedef enum {
00075   FUSE_IF_RAW      = 1, /**< Raw image */
00076   FUSE_IF_JPEG     = 2  /**< JPEG image */
00077 } FUSE_image_format_t;
00078
00079 
00080 /** general packet header */
00081 typedef struct {
00082   uint32_t message_type; /**< packet type from FUSE_message_type_t */
00083   uint32_t payload_size; /**< payload size */
00084 } FUSE_header_t;
00085 
00086 /** FUSE message. */
00087 typedef struct {
00088   FUSE_header_t  header;        /**< header */
00089   void *         payload;       /**< payload */
00090 } FUSE_message_t;
00091 
00092 /** version packet, bi-directional */
00093 typedef struct {
00094   uint32_t version;     /**< version from FUSE_version_t */
00095 } FUSE_greeting_message_t;
00096 
00097 /** Lookup table packet header.
00098  * server to client: PT_LUT
00099  * client to server: PT_SETLUT
00100  */
00101 typedef struct {
00102   char     lut_id[LUT_ID_MAX_LENGTH];   /**< LUT ID */
00103   uint32_t width;                       /**< width of LUT */
00104   uint32_t height;                      /**< height of LUT */
00105   uint32_t depth;                       /**< depth of LUT */
00106   uint32_t bytes_per_cell;              /**< bytes per cell */
00107 } FUSE_lut_message_header_t;
00108
00109
00110
00111 //  uint32_t  next_header;              /**< ID of next header. */
00112 /** Image packet header.
00113  * (server to client)
00114  */
00115 typedef struct {
00116   char      image_id[IMAGE_ID_MAX_LENGTH];      /**< image ID */
00117   uint32_t  format       :  8;                  /**< Image format */
00118   uint32_t  colorspace   : 16;                  /**< color space */
00119   uint32_t  reserved     :  8;                  /**< reserved for future use */
00120   uint32_t  width;                              /**< width in pixels */
00121   uint32_t  height;                             /**< height in pixels */
00122   uint32_t  buffer_size;                        /**< size of following image buffer in bytes */
00123   int64_t   capture_time_sec;                   /**< capture time seconds part */
00124   int64_t   capture_time_usec;                  /**< capture time microseconds part */
00125 } FUSE_image_message_header_t;
00126
00127 /*
00128   uint32_t  roi_x;                      *< ROI X coordinate 
00129   uint32_t  roi_y;                      *< ROI Y coordinate 
00130   uint32_t  roi_width;          *< ROI width 
00131   uint32_t  roi_height;         *< ROI height 
00132   // Circle relative to ROI
00133 
00134   int32_t   circle_x;                   *< circle x coordinate 
00135   int32_t   circle_y;                   *< circle y coordinate 
00136   uint32_t  circle_radius;              *< circle radius 
00137   uint32_t  flag_circle_found :  1;     *< circle found, 1 if found 
00138   uint32_t  flag_reserved     : 31;     *< reserved for future use 
00139 */
00140 
00141 /** Image request message. */
00142 typedef struct {
00143   char image_id[IMAGE_ID_MAX_LENGTH];   /**< image ID */
00144   uint32_t format   : 8;                /**< requested image format, see FUSE_image_format_t */
00145   uint32_t reserved : 24;               /**< reserved for future use */
00146 } FUSE_imagereq_message_t;
00147
00148 
00149 /** Image description message. */
00150 typedef struct {
00151   char image_id[IMAGE_ID_MAX_LENGTH];   /**< image ID */
00152 } FUSE_imagedesc_message_t;
00153 
00154 /** LUT description message. */
00155 typedef struct {
00156   char lut_id[LUT_ID_MAX_LENGTH];       /**< LUT ID */
00157 } FUSE_lutdesc_message_t;
00158 
00159 /** Image info message. */
00160 typedef struct {
00161   char      image_id[IMAGE_ID_MAX_LENGTH];      /**< image ID */
00162   uint32_t  colorspace   : 16;                  /**< color space */
00163   uint32_t  reserved     : 16;                  /**< reserved for future use */
00164   uint32_t  width;                              /**< width in pixels */
00165   uint32_t  height;                             /**< height in pixels */
00166   uint32_t  buffer_size;                        /**< size of following image buffer in bytes */
00167 } FUSE_imageinfo_t;
00168 
00169 /** LUT info message. */
00170 typedef struct {
00171   char     lut_id[LUT_ID_MAX_LENGTH];   /**< LUT ID */
00172   uint32_t width;                       /**< width of LUT */
00173   uint32_t height;                      /**< height of LUT */
00174   uint32_t depth;                       /**< depth of LUT */
00175   uint32_t bytes_per_cell;              /**< bytes per cell */
00176 } FUSE_lutinfo_t;
00177 
00178 /** Image list message. */
00179 typedef struct {
00180   fawkes::dynamic_list_t image_list;    /**< DynamicBuffer holding a list of FUSE_imageinfo_t */
00181 } FUSE_imagelist_message_t;
00182 
00183 /** LUT list message. */
00184 typedef struct {
00185   fawkes::dynamic_list_t lut_list;      /**< DynamicBuffer holding a list of FUSE_lutinfo_t */
00186 } FUSE_lutlist_message_t;
00187
00188 #pragma pack(pop)
00189 #endif