Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtl_status.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   OpenIGTLink Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlutil/igtl_status.h $
00005   Language:  C
00006   Date:      $Date: 2009-12-16 23:58:02 -0500 (Wed, 16 Dec 2009) $
00007   Version:   $Revision: 5466 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010 
00011   This software is distributed WITHOUT ANY WARRANTY; without even
00012   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013   PURPOSE.  See the above copyright notices for more information.
00014 
00015 =========================================================================*/
00016 
00017 #ifndef __IGTL_STATUS_H
00018 #define __IGTL_STATUS_H
00019 
00020 #include "igtl_util.h"
00021 #include "igtl_types.h"
00022 
00023 #define IGTL_STATUS_HEADER_SIZE         30
00024 
00025 #define IGTL_STATUS_ERROR_NAME_LENGTH   20
00026 
00027 /* Status codes */
00028 
00029 #define IGTL_STATUS_INVALID              0
00030 #define IGTL_STATUS_OK                   1
00031 #define IGTL_STATUS_UNKNOWN_ERROR        2
00032 #define IGTL_STATUS_PANICK_MODE          3 /* emergency */
00033 #define IGTL_STATUS_NOT_FOUND            4 /* file, configuration, device etc */
00034 #define IGTL_STATUS_ACCESS_DENIED        5 
00035 #define IGTL_STATUS_BUSY                 6
00036 #define IGTL_STATUS_TIME_OUT             7 /* Time out / Connection lost */
00037 #define IGTL_STATUS_OVERFLOW             8 /* Overflow / Can't be reached */
00038 #define IGTL_STATUS_CHECKSUM_ERROR       9 /* Checksum error */
00039 #define IGTL_STATUS_CONFIG_ERROR        10 /* Configuration error */
00040 #define IGTL_STATUS_RESOURCE_ERROR      11 /* Not enough resource (memory, storage etc) */
00041 #define IGTL_STATUS_ILLEGAL_INSTRUCTION 12 /* Illegal/Unknown instruction */
00042 #define IGTL_STATUS_NOT_READY           13 /* Device not ready (starting up)*/
00043 #define IGTL_STATUS_MANUAL_MODE         14 /* Manual mode (device does not accept commands) */
00044 #define IGTL_STATUS_DISABLED            15 /* Device disabled */
00045 #define IGTL_STATUS_NOT_PRESENT         16 /* Device not present */
00046 #define IGTL_STATUS_UNKNOWN_VERSION     17 /* Device version not known */
00047 #define IGTL_STATUS_HARDWARE_FAILURE    18 /* Hardware failure */
00048 #define IGTL_STATUS_SHUT_DOWN           19 /* Exiting / shut down in progress */
00049 
00050 
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054 
00055 #pragma pack(1)     /* For 1-byte boundary in memroy */
00056 
00057 /*
00058  * Status data header for OpenIGTLinik protocol
00059  *
00060  */
00061 
00062 typedef struct {
00063   igtl_uint16    code;             /* status code defined above */
00064   igtl_int64     subcode;          /* sub code for the error    */
00065   char           error_name[IGTL_STATUS_ERROR_NAME_LENGTH]; 
00066                                    /* error name -- can be anything, don't rely on this */
00067   /*char           status_message[]; */
00068 } igtl_status_header;
00069 
00070 #pragma pack()
00071 
00072 /*
00073  * Byte order conversion for the status data structure
00074  *
00075  * This function converts endianness of each member variable
00076  * in igtl_status_header from host byte order to network byte order,
00077  * or vice versa.
00078  */
00079 
00080 void igtl_export igtl_status_convert_byte_order(igtl_status_header* status);
00081 
00082 
00083 /*
00084  * CRC calculation
00085  *
00086  * This function calculates CRC of status data body including status message part
00087  *
00088  */
00089 
00090 igtl_uint64 igtl_export igtl_status_get_crc(igtl_status_header* status, igtl_uint32 msglen, const char* msg);
00091 
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095 
00096 #endif /* __IGTL_IMAGE_H */
00097 
00098 
00099 

Generated at Sat Dec 3 2011 08:54:20 for OpenIGTLink by doxygen 1.7.4 written by Dimitri van Heesch, © 1997-2000