00001 // Copyright (C) 2004 Pablo Mejia 00002 00003 00004 #ifndef NCOM_CHANNEL_3_H 00005 #define NCOM_CHANNEL_3_H 00006 00007 00008 #include "ncom_channel.H" 00009 00010 00011 namespace ncom 00012 { 00013 00014 class channel_3_t : public channel_t 00015 { 00016 protected: 00017 static unsigned const N_POSITION_ACCURACY_OFFSET = 0; 00018 static unsigned const E_POSITION_ACCURACY_OFFSET = 2; 00019 static unsigned const D_POSITION_ACCURACY_OFFSET = 4; 00020 static unsigned const AGE_OFFSET = 6; 00021 00022 public: 00023 channel_3_t (packet_t const *packet) : channel_t (packet) 00024 { 00025 assert (packet->channel () == 3); 00026 } 00027 00028 double n_position_accuracy (void) const 00029 { 00030 return (1E-3 * letoh<u16_t> 00031 (m_data + N_POSITION_ACCURACY_OFFSET)); 00032 } 00033 double e_position_accuracy (void) const 00034 { 00035 return (1E-3 * letoh<u16_t> 00036 (m_data + E_POSITION_ACCURACY_OFFSET)); 00037 } 00038 double d_position_accuracy (void) const 00039 { 00040 return (1E-3 * letoh<u16_t> 00041 (m_data + D_POSITION_ACCURACY_OFFSET)); 00042 } 00043 unsigned age (void) const 00044 { 00045 return (m_data[AGE_OFFSET]); 00046 } 00047 bool position_accuracy_valid (void) const 00048 { 00049 return (age () < 150); 00050 } 00051 }; 00052 }; 00053 00054 00055 #endif