- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Rtapi/ME/ME_rtapi.h

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #ifndef _ME_RTAPI_H
    00015 #define _ME_RTAPI_H
    00016
    00017 // #include <fstream>
    00018
    00019 #include <Mers/Executives/DeductiveController/Rtapi/ThreadSafeObjectQueue.h>
    00020 #include <Mers/Utils/Containers/ObjectArray.h>
    00021 #include <Mers/Executives/DeductiveController/Rtapi/CommandCallback.h>
    00022
    00023 namespace Mers {
    00024         namespace Estimation {
    00025                 namespace Discrete {
    00026                         class ME_connection;
    00027                 }
    00028         }
    00029         namespace Executives {
    00030                 namespace DeductiveController {
    00031                         namespace Rtapi {
    00032
    00033                                 class RTAPICallback;
    00034
    00035                                 namespace ME {
    00036
    00037                                         class ME_dispatcher;
    00038                                         class ME_rtapi;
    00039
    00051                                         class ME_rtapi
    00052                                         {
    00053                                         public:
    00054
    00065                                                 ME_rtapi(Mers::Estimation::Discrete::ME_connection * syst, Mers::Executives::DeductiveController::Rtapi::RTAPICallback * liv_report);
    00066
    00070                                                 virtual ~ME_rtapi();
    00071
    00087                                                 virtual int queue_command(unsigned int cmd_index, unsigned int cmd_value);
    00088
    00102                                                 virtual int queue_observation(unsigned int obs_index,
    00103                                                                                                                                                                         unsigned int value_index);
    00104
    00120                                                 virtual int queue_initial_state(unsigned int state_index,
    00121                                                                                                                                                                                 unsigned int value_index);
    00122
    00139                                                 int queue_observations(int number, unsigned int obs [],
    00140                                                                                                                                          unsigned int values[]);
    00141
    00152                                                 int queue_find_mode_estimate();
    00153
    00169                                                 virtual int queue_start_command_and_time(unsigned int cmd_index,
    00170                                                                                                                                                                                                                  unsigned int cmd_value);
    00171
    00189                                                 virtual int queue_observations_and_time(unsigned int obs_index,
    00190                                                                                                                                                                                                                 unsigned int value_index);
    00196                                                 int queue_abort_command();
    00208                                                 int queue_report_full_state();
    00209
    00225                                                 int registerCommandListener(unsigned int command,
    00226                                                                                                                                                                 Mers::Executives::DeductiveController::Rtapi::CommandCallback * listener);
    00227
    00235                                                 virtual int observation_timeout();
    00243                                                 virtual int command_timeout();
    00244
    00249                                                 void decrementTimeouts();
    00254                                                 void incrementTimeouts();
    00261                                                 unsigned int getTimeouts();
    00262
    00263                                         protected:
    00265                                                 pthread_attr_t timer_attr;
    00266
    00269                                                 Mers::Executives::DeductiveController::Rtapi::ThreadSafeObjectQueue &thequeue;
    00270
    00273                                                 Mers::Estimation::Discrete::ME_connection * mec;
    00276                                                 ME_dispatcher *dispatcher;
    00277
    00284                                                 bool active;
    00285
    00288                                                 pthread_mutex_t timersMutex;
    00290                                                 unsigned int activeTimers;
    00291
    00296                                                 Mers::Utils::Containers::ObjectArray listeners;
    00297                                         };
    00298                                 }
    00299                         }
    00300                 }
    00301         }
    00302 }
    00303
    00304
    00305 #endif