00001 #ifndef FCAM_EVENT_H
00002 #define FCAM_EVENT_H
00003
00006
00007 #include <string>
00008
00009 #include "Time.h"
00010 #include "TSQueue.h"
00011
00012
00013 namespace FCam {
00014
00018 class EventGenerator {
00019 };
00020
00023 class Event {
00024 public:
00025 EventGenerator *creator;
00026 int type;
00027 int data;
00028 Time time;
00029 std::string description;
00030
00039 enum {Error = 0,
00040 Warning,
00041 FocusPressed,
00042 FocusReleased,
00043 ShutterPressed,
00044 ShutterReleased,
00045 N900LensClosed = 10000,
00046 N900LensOpened,
00047 N900SlideOpened,
00048 N900SlideClosed,
00049 F2LensRemoved = 20000,
00050 F2LensInstalled,
00051 F2ZoomChanged,
00052 F2FocusChanged
00053 };
00054
00059 enum {Unknown = 0,
00060 InternalError,
00061 DriverLockedError,
00062 DriverMissingError,
00063 DriverError,
00064 ImageTargetLocked,
00065 ResolutionMismatch,
00066 OutOfMemory,
00067 FrameLimitHit,
00068 LensHistoryError,
00069 FlashHistoryError,
00070 DemosaicError,
00071 ImageLockError,
00072 BadCast,
00073 FileLoadError,
00074 FileLoadWarning,
00075 FileSaveError,
00076 FileSaveWarning,
00077 SensorStoppedError,
00078 ParseError,
00079 FrameDataError,
00080 OutOfRange,
00081 };
00082 };
00083
00108 bool getNextEvent(Event *);
00112 bool getNextEvent(Event *, int type);
00116 bool getNextEvent(Event *, int type, int data);
00120 bool getNextEvent(Event *, int type, EventGenerator *creator);
00125 bool getNextEvent(Event *, int type, int data, EventGenerator *creator);
00130 bool getNextEvent(Event *, EventGenerator *creator);
00131
00133 void postEvent(Event);
00134
00137 void postEvent(int type, int code, const std::string &msg, EventGenerator *creator = NULL);
00138
00140 void error(int code, EventGenerator *creator, const char *fmt, ...);
00141
00143 void warning(int code, EventGenerator *creator, const char *fmt, ...);
00144
00146 void error(int code, const char *fmt, ...);
00147
00149 void warning(int code, const char *fmt, ...);
00150
00152 extern TSQueue<Event> _eventQueue;
00153 }
00154
00155 #endif