00001 // Copyright (C) 2007 University of Louisiana at Lafayette 00002 // Authors: Chandan Uddaraju 00003 00004 00005 #ifndef CAJUN_IBEO_ALASCA_H 00006 #define CAJUN_IBEO_ALASCA_H 00007 00008 #include "ibeo_message_header.H" 00009 00010 00011 namespace cajun 00012 { 00013 class input_buffer_t; 00014 00015 using namespace ibeo; 00016 00017 class ibeo_alasca_t 00018 { 00019 public: 00020 ibeo_alasca_t (); 00021 ~ibeo_alasca_t (); 00022 00023 int create_tcp_socket (); 00024 00025 bool connect_tcp_interface (int ,char *, int); 00026 00027 void handle_input (int fd_); 00028 void debug (bool flag) { m_debug = flag; } 00029 00030 class observer_t 00031 { 00032 public: 00033 enum message_t 00034 { 00035 STATUS_OK, 00036 STATUS_FULL_BUFFER, 00037 STATUS_GARBAGE_DATA, 00038 UNKNOWN_MESSAGE_FORMAT, 00039 ERROR_DECODING_MESSAGE, 00040 }; 00041 00042 virtual ~observer_t () {} 00043 00044 virtual void log_raw_data (unsigned len, void const *msg) {} 00045 00046 virtual void publish_status (double tstamp_, message_t msg_) {} 00047 }; 00048 00049 void register_observer (observer_t *observer) 00050 { m_observer = observer; } 00051 00052 bool decode_message_body (ibeo_message_header_t *); 00053 00054 protected: 00055 bool m_garbage_data; 00056 input_buffer_t *m_ib; 00057 observer_t *m_observer; 00058 bool m_debug; 00059 00060 double m_sys_tstamp; 00061 00062 00063 unsigned m_magic_word; 00064 unsigned m_size; 00065 unsigned m_msgtype; 00066 unsigned m_timestamp; 00067 00068 00069 static unsigned const BUFFER_SIZE = 103808; 00070 00071 static unsigned const OBJECT_MESSAGE = 1; 00072 static unsigned const SCAN_MESSAGE = 15; 00073 00074 static unsigned const ALASCA_SCANNER = 2; 00075 00076 00077 }; 00078 00079 00080 }; 00081 00082 00083 #endif