canaerotypes.h

Go to the documentation of this file.
00001 // Copyright (C) 2008,2009,2010 by Philipp Münzel. All rights reserved.
00002 // Released under the terms of the license described in license.txt
00003 
00151 #ifndef CANAEROTYPES_H
00152 #define CANAEROTYPES_H
00153 
00154 #include "dllexport.h"
00155 #include <string>
00156 
00157 #ifdef HAVE_TR1
00158 #include <tr1/cstdint>
00159 #else
00160 #include <stdint.h>
00161 #endif
00162 
00164 
00166 #define CAN2AB_PAYLOAD 8
00167 
00168 namespace SCS {
00169 
00175 union DLL_PUBLIC canAS_Data_t {
00176     float       flt;        
00177     uint32_t    uLong;      
00178     int32_t     sLong;      
00179     uint16_t    uShort[2];  
00180     int16_t     sShort[2];  
00181     uint8_t     uChar[4];   
00182     int8_t      sChar[4];   
00183     char        aChar[4];   
00184 };
00185 
00186 
00190 struct DLL_PUBLIC canAS_t {
00191     uint8_t         nodeId;         
00192     uint8_t         dataType;       
00193     uint8_t         serviceCode;    
00194     uint8_t         messageCode;    
00195     canAS_Data_t    data;           
00196 };
00197 
00198 
00203 union DLL_PUBLIC can_Data_t {
00204     uint8_t     byte[CAN2AB_PAYLOAD];   
00205     canAS_t     aero;                   
00206 };
00207 
00211 enum AS_IDwidth {
00212     BIT11 = 0,
00213     BIT29 = 1
00214 };
00215 
00216 
00220 struct DLL_PUBLIC can_Id_t {
00221     can_Id_t();
00222     can_Id_t(uint32_t unflagged_id, AS_IDwidth width);
00223     AS_IDwidth idWidth() const;
00224     uint32_t id() const;
00225     std::string toString() const;
00226     bool operator<(const can_Id_t& rhs) const;
00227     uint32_t id_;
00228 };
00229 
00233 template <typename T, uint32_t id, AS_IDwidth width>
00234 struct DLL_PUBLIC scs_Id_t {
00235     typedef T Type;                                     
00236     static can_Id_t Id() {return can_Id_t(id, width);}  
00237 };
00238 
00239 
00244 struct DLL_PUBLIC can_t {
00245     can_Id_t    id;         
00246     can_Data_t  msg;        
00247     uint8_t     byte_count; 
00248 };
00249 
00250 
00255 enum AS_HeaderTypes {
00256     AS_Standard = 0
00257 };
00258 
00259 
00263 enum AS_Identifier_Distribution {
00264     Distribution_Standard = 0,      
00265     Distribution_Flightpanels = 100 
00266 };
00267 
00268 
00272 enum AS_Identifier_Distribution_Revision {
00273     Identifier_Distribution_Revision_This_Release = 1
00274 };
00275 
00276 
00281 enum AS_NodeIds{
00282     BROADCAST_NODE_ID = 0,
00283     SCS_NODE_ID = 1,
00284     VASFMC_NODE_ID = 2
00285 };
00286 
00287 
00291 enum AS_NodeService {
00292     IDS = 0,    
00293     NSS = 1,    
00294     // DDS and DUS not implemented in plugin
00295     // SCS n.a.
00296     // TIS supersed by TIS29
00297     // FLASH n.a.
00298     STS = 7,    
00299     // FSS n.a.
00300     // TCS n.a.
00301     // BSS n.a.
00302     // NIS superseded by NCS
00303     MIS = 12,   
00304     MCS = 13,   
00305     // CIS n.a.
00306 
00307     // User defined range starts here
00308     DRS = 100,  
00309     TIS29=101,  
00310     NCS = 102   
00311 };
00312 
00313 
00317 enum AS_Type {
00318     AS_NODATA   = 0,
00319     AS_ERROR    = 1,
00320     AS_FLOAT    = 2,
00321     AS_LONG     = 3,
00322     AS_ULONG    = 4,
00323     AS_BLONG    = 5,
00324     AS_SHORT    = 6,
00325     AS_USHORT   = 7,
00326     AS_BSHORT   = 8,
00327     AS_CHAR     = 9,
00328     AS_UCHAR    = 10,
00329     AS_BCHAR    = 11,
00330     AS_SHORT2   = 12,
00331     AS_USHORT2  = 13,
00332     AS_BSHORT2  = 14,
00333     AS_CHAR4    = 15,
00334     AS_UCHAR4   = 16,
00335     // Left out some types that are not needed at the moment
00336     AS_ACHAR    = 23,
00337     AS_ACHAR2   = 24,
00338     AS_ACHAR4   = 25,
00339     // user defined (FP = flightpanels) type of sending 5 ascii charachters (4 in message, 1 in servie code)
00340     FP_ACHAR5   = 100,
00341     FP_VFLOAT   = 101,
00342     FP_VLONG    = 102
00343 };
00344 
00345 
00349 union char4{
00350     int32_t i;                  
00351     int8_t  c[4];               
00352     char4():i(0){};
00353     char4(int init):i(init){};
00354     std::string toString();
00355 };
00356 
00357 }
00358 
00359 #endif // CANAEROTYPES_H