AnnotatorComm.h

00001 /*-----------------------------------------------------------------------------
00002  * AnnotatorComm declaration
00003  * Ionetrics 2006
00004  * John Williams
00005  * AnnotatorComm.h
00006  *---------------------------------------------------------------------------*/
00007 
00008 #ifndef ANNOTATORCOMM_H
00009 #define ANNOTATORCOMM_H
00010 
00011 //-----------------------------------------------------------------------------
00012 
00013 #include <string>
00014 #include <vector>
00015 
00016 #include "AnnotatorCommApi.h"
00017 #include "CommandMessage.h"
00018 #include "DeviceId.h"
00019 #include "FirmwareVersion.h"
00020 #include "GenericAsynchronousCommands.h"
00021 #include "GenericSynchronousCommands.h"
00022 #include "InputStream.h"
00023 #include "IOException.h"
00024 #include "MicrosecondTimestamp.h"
00025 #include "OutputStream.h"
00026 #include "ResponseMessage.h"
00027 #include "ResponseMessageQueue.h"
00028 #include "ResponseReader.h"
00029 #include "TextMessageListener.h"
00030 #include "TimeSource.h"
00031 #include "TimeSourceLockStatus.h"
00032 #include "Timestamp.h"
00033 #include "TimestampListener.h"
00034 
00035 using namespace std;
00036 
00037 //-----------------------------------------------------------------------------
00038 
00039 namespace annotatorcomm
00040 {
00041 
00046 class ANNCOMM_API AnnotatorComm
00047 {
00048 public:
00052         static const string VERSION;
00053         
00057         static const unsigned int MAX_NAME_LEN;
00058         
00062         static const int STX;
00063         
00067         static const int ETX;
00068         
00074         static string getLibAnnotatorCommVersion();
00075         
00076 public:
00083         AnnotatorComm(InputStream* in, OutputStream* out);
00084         
00088         virtual ~AnnotatorComm();
00089         
00095         virtual void close() throw(IOException);
00096     
00104         virtual void signal(ResponseMessage & rsp);
00105 
00111         virtual void addTimestampListener(TimestampListener* listener);
00112         
00118         virtual void removeTimestampListener(TimestampListener* listener);
00119         
00125         virtual vector<TimestampListener*> getTimestampListeners();
00126         
00132         virtual void addTextMessageListener(TextMessageListener* listener);
00133             
00139         virtual void removeTextMessageListener(TextMessageListener* listener);
00140         
00146         virtual vector<TextMessageListener*> getTextMessageListeners();
00147     
00153         void noop() throw(IOException);
00154         
00161         const DeviceId* getDeviceId() throw(IOException);
00162         
00169         FirmwareVersion getFirmwareVersion() throw(IOException);
00170         
00177         string getFirmwareTimestamp() throw(IOException);
00178         
00185         int getSerialNumber() throw(IOException);
00186         
00195         void setSerialNumber(int serialno, int key) throw(IOException);
00196         
00203         string getDeviceName() throw(IOException);
00204         
00212         void setDeviceName(string name) throw(IOException);
00213         
00221         vector<const TimeSource*> getSupportedTimeSources() throw(IOException);
00222         
00229         const TimeSource* getTimeSource() throw(IOException);
00230         
00237         void setTimeSource(const TimeSource* source) throw(IOException);
00238         
00245         MicrosecondTimestamp getCurrentTime() throw(IOException);
00246         
00253         void setCurrentTime(MicrosecondTimestamp & timestamp) throw(IOException);
00254         
00261         const TimeSourceLockStatus* getTimeSourceLockStatus() throw(IOException);
00262         
00270         void setTimeSourceTimestampMode(bool isEnabled) throw(IOException);
00271         
00278         bool isTimeSourceTimestampMode() throw(IOException);
00279         
00286         void saveOptions() throw(IOException);
00287 
00288 protected:
00296         virtual ResponseMessage sendRecv(CommandMessage & msg) throw(IOException);
00297 
00303         virtual void signalTimestampListeners(Timestamp & timestamp);
00304         
00310         virtual void signalSynchronousResponse(ResponseMessage & rsp);
00311 
00312 private:
00316         InputStream* in;
00317         
00321         OutputStream* out;
00322         
00326         ResponseReader* reader;
00327         
00331         ResponseMessageQueue responseMessageQueue;
00332         
00336         vector<TimestampListener*> timestampListeners;
00337         
00341         vector<TextMessageListener*> textMessageListeners;
00342 };
00343 
00344 }
00345 
00346 //-----------------------------------------------------------------------------
00347 
00348 #endif /* ANNOTATORCOMM_H */

Generated on Tue Aug 1 11:14:11 2006 for libAnnotatorComm by  doxygen 1.4.7