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 namespace firevision { 00037 #if 0 /* just to make Emacs auto-indent happy */ 00038 } 00039 #endif 00040 00041 /** FUSE version enum. */ 00042 typedef enum { 00043 FUSE_VERSION_1 = 1, /**< Version 1 */ 00044 FUSE_VERSION_2 = 2, /**< Version 2 */ 00045 FUSE_VERSION_3 = 3 /**< Version 3 - current */ 00046 } FUSE_version_t; 00047 00048 /** Current FUSE version */ 00049 #define FUSE_CURRENT_VERSION FUSE_VERSION_3 00050 00051 /** FUSE packet types */ 00052 typedef enum { 00053 /* bi-directional packages, 1-999 and 0xFFFFFFFE */ 00054 FUSE_MT_GREETING = 0xFFFFFFFE, /**< version */ 00055 00056 /* server to client, 1000-1999 */ 00057 FUSE_MT_IMAGE = 1000, /**< image */ 00058 FUSE_MT_LUT = 1001, /**< lookup table */ 00059 FUSE_MT_IMAGE_LIST = 1002, /**< image list */ 00060 FUSE_MT_LUT_LIST = 1003, /**< lut list */ 00061 FUSE_MT_GET_IMAGE_FAILED = 1004, /**< Fetching an image failed */ 00062 FUSE_MT_GET_LUT_FAILED = 1005, /**< Fetching a LUT failed */ 00063 FUSE_MT_SET_LUT_SUCCEEDED = 1006, /**< Setting a LUT succeeded */ 00064 FUSE_MT_SET_LUT_FAILED = 1007, /**< Setting a LUT failed */ 00065 FUSE_MT_IMAGE_INFO = 1008, /**< image info */ 00066 FUSE_MT_IMAGE_INFO_FAILED = 1009, /**< Retrieval of image info failed */ 00067 00068 /* client to server, 2000-2999 */ 00069 FUSE_MT_GET_IMAGE = 2000, /**< request image */ 00070 FUSE_MT_GET_LUT = 2001, /**< request lookup table */ 00071 FUSE_MT_SET_LUT = 2002, /**< set lookup table */ 00072 FUSE_MT_GET_IMAGE_LIST = 2003, /**< get image list */ 00073 FUSE_MT_GET_LUT_LIST = 2004, /**< get LUT list */ 00074 FUSE_MT_GET_IMAGE_INFO = 2005, /**< get image info */ 00075 00076 } FUSE_message_type_t; 00077 00078 /** Image format. */ 00079 typedef enum { 00080 FUSE_IF_RAW = 1, /**< Raw image */ 00081 FUSE_IF_JPEG = 2 /**< JPEG image */ 00082 } FUSE_image_format_t; 00083 00084 00085 /** general packet header */ 00086 typedef struct { 00087 uint32_t message_type; /**< packet type from FUSE_message_type_t */ 00088 uint32_t payload_size; /**< payload size */ 00089 } FUSE_header_t; 00090 00091 /** FUSE message. */ 00092 typedef struct { 00093 FUSE_header_t header; /**< header */ 00094 void * payload; /**< payload */ 00095 } FUSE_message_t; 00096 00097 /** version packet, bi-directional */ 00098 typedef struct { 00099 uint32_t version; /**< version from FUSE_version_t */ 00100 } FUSE_greeting_message_t; 00101 00102 /** Lookup table packet header. 00103 * server to client: PT_LUT 00104 * client to server: PT_SETLUT 00105 */ 00106 typedef struct { 00107 char lut_id[LUT_ID_MAX_LENGTH]; /**< LUT ID */ 00108 uint32_t width; /**< width of LUT */ 00109 uint32_t height; /**< height of LUT */ 00110 uint32_t depth; /**< depth of LUT */ 00111 uint32_t bytes_per_cell; /**< bytes per cell */ 00112 } FUSE_lut_message_header_t; 00113 00114 00115 00116 // uint32_t next_header; /**< ID of next header. */ 00117 /** Image packet header. 00118 * (server to client) 00119 */ 00120 typedef struct { 00121 char image_id[IMAGE_ID_MAX_LENGTH]; /**< image ID */ 00122 uint32_t format : 8; /**< Image format */ 00123 uint32_t colorspace : 16; /**< color space */ 00124 uint32_t reserved : 8; /**< reserved for future use */ 00125 uint32_t width; /**< width in pixels */ 00126 uint32_t height; /**< height in pixels */ 00127 uint32_t buffer_size; /**< size of following image buffer in bytes */ 00128 int64_t capture_time_sec; /**< capture time seconds part */ 00129 int64_t capture_time_usec; /**< capture time microseconds part */ 00130 } FUSE_image_message_header_t; 00131 00132 /* 00133 uint32_t roi_x; *< ROI X coordinate 00134 uint32_t roi_y; *< ROI Y coordinate 00135 uint32_t roi_width; *< ROI width 00136 uint32_t roi_height; *< ROI height 00137 // Circle relative to ROI 00138 00139 int32_t circle_x; *< circle x coordinate 00140 int32_t circle_y; *< circle y coordinate 00141 uint32_t circle_radius; *< circle radius 00142 uint32_t flag_circle_found : 1; *< circle found, 1 if found 00143 uint32_t flag_reserved : 31; *< reserved for future use 00144 */ 00145 00146 /** Image request message. */ 00147 typedef struct { 00148 char image_id[IMAGE_ID_MAX_LENGTH]; /**< image ID */ 00149 uint32_t format : 8; /**< requested image format, see FUSE_image_format_t */ 00150 uint32_t reserved : 24; /**< reserved for future use */ 00151 } FUSE_imagereq_message_t; 00152 00153 00154 /** Image description message. */ 00155 typedef struct { 00156 char image_id[IMAGE_ID_MAX_LENGTH]; /**< image ID */ 00157 } FUSE_imagedesc_message_t; 00158 00159 /** LUT description message. */ 00160 typedef struct { 00161 char lut_id[LUT_ID_MAX_LENGTH]; /**< LUT ID */ 00162 } FUSE_lutdesc_message_t; 00163 00164 /** Image info message. */ 00165 typedef struct { 00166 char image_id[IMAGE_ID_MAX_LENGTH]; /**< image ID */ 00167 uint32_t colorspace : 16; /**< color space */ 00168 uint32_t reserved : 16; /**< reserved for future use */ 00169 uint32_t width; /**< width in pixels */ 00170 uint32_t height; /**< height in pixels */ 00171 uint32_t buffer_size; /**< size of following image buffer in bytes */ 00172 } FUSE_imageinfo_t; 00173 00174 /** LUT info message. */ 00175 typedef struct { 00176 char lut_id[LUT_ID_MAX_LENGTH]; /**< LUT ID */ 00177 uint32_t width; /**< width of LUT */ 00178 uint32_t height; /**< height of LUT */ 00179 uint32_t depth; /**< depth of LUT */ 00180 uint32_t bytes_per_cell; /**< bytes per cell */ 00181 } FUSE_lutinfo_t; 00182 00183 /** Image list message. */ 00184 typedef struct { 00185 fawkes::dynamic_list_t image_list; /**< DynamicBuffer holding a list of FUSE_imageinfo_t */ 00186 } FUSE_imagelist_message_t; 00187 00188 /** LUT list message. */ 00189 typedef struct { 00190 fawkes::dynamic_list_t lut_list; /**< DynamicBuffer holding a list of FUSE_lutinfo_t */ 00191 } FUSE_lutlist_message_t; 00192 00193 } // end namespace firevision 00194 00195 #pragma pack(pop) 00196 #endif