00001 // Copyright (C) 2006 Pablo Mejia 00002 00003 00004 #ifndef AEVIT_INFO_FRAME_H 00005 #define AEVIT_INFO_FRAME_H 00006 00007 00008 #include "aevit_frame.H" 00009 00010 00011 namespace aevit 00012 { 00013 00014 00015 class info_frame_t : public frame_t 00016 { 00017 protected: 00018 static unsigned const COMMAND_OFFSET = 0; 00019 00020 static unsigned const GENERIC_OFFSET = 1; 00021 00022 static unsigned const PRESENT_MASK = 0x01; 00023 static unsigned const BOOTED_MASK = 0x02; 00024 static unsigned const TEST_MODE_MASK = 0x04; 00025 static unsigned const STEERING_1_REQUESTED_MASK = 0x10; 00026 static unsigned const STEERING_2_REQUESTED_MASK = 0x20; 00027 static unsigned const GAS_BRAKE_1_REQUESTED_MASK = 0x40; 00028 static unsigned const GAS_BRAKE_2_REQUESTED_MASK = 0x80; 00029 00030 public: 00031 info_frame_t (frame_t const &frame_) : frame_t (frame_) {} 00032 00033 unsigned command () const { return m_data[COMMAND_OFFSET]; } 00034 00035 unsigned generic (unsigned index_) const 00036 { return m_data[GENERIC_OFFSET + index_]; } 00037 00038 bool present () const 00039 { return (m_data[7] & PRESENT_MASK) != 0; } 00040 bool booted () const 00041 { return (m_data[7] & BOOTED_MASK) != 0; } 00042 bool test_mode () const 00043 { return (m_data[7] & TEST_MODE_MASK) != 0; } 00044 bool steering_1_requested () const 00045 { return (m_data[7] & STEERING_1_REQUESTED_MASK) != 0; } 00046 bool steering_2_requested () const 00047 { return (m_data[7] & STEERING_2_REQUESTED_MASK) != 0; } 00048 bool gas_brake_1_requested () const 00049 { return (m_data[7] & GAS_BRAKE_1_REQUESTED_MASK) != 0; } 00050 bool gas_brake_2_requested () const 00051 { return (m_data[7] & GAS_BRAKE_2_REQUESTED_MASK) != 0; } 00052 }; 00053 00054 00055 }; 00056 00057 00058 #endif