ImageObserver/ImageObserver/ImageObserver.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2002,2003 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #ifndef ImageObserver_h_DEFINED
00013 #define ImageObserver_h_DEFINED
00014 
00015 #include <OPENR/OObject.h>
00016 #include <OPENR/OSubject.h> 
00017 #include <OPENR/OObserver.h>
00018 #include "def.h"
00019 
00020 enum ImageObserverState {
00021     IOS_IDLE,
00022     IOS_START
00023 };
00024 
00025 static const char* const FBK_LOCATOR = "PRM:/r1/c1/c2/c3/i1-FbkImageSensor:F1";
00026 
00027 class ImageObserver : public OObject {
00028 public:  
00029     ImageObserver();
00030     virtual ~ImageObserver() {}
00031   
00032     OSubject*  subject[numOfSubject];
00033     OObserver* observer[numOfObserver];
00034 
00035     virtual OStatus DoInit   (const OSystemEvent& event);
00036     virtual OStatus DoStart  (const OSystemEvent& event);
00037     virtual OStatus DoStop   (const OSystemEvent& event);
00038     virtual OStatus DoDestroy(const OSystemEvent& event);
00039     
00040     void Notify(const ONotifyEvent& event);
00041 
00042 private:
00043     void OpenPrimitive();
00044     void SetCdtVectorDataOfPinkBall();
00045     void PrintTagInfo(OFbkImageVectorData* imageVec);
00046     void SaveRawData(char* path,
00047                      OFbkImageVectorData* imageVec, OFbkImageLayer layer);
00048     bool ReconstructImage(OFbkImageVectorData* imageVec,
00049                           OFbkImageLayer layer,
00050                           byte** image, int* width, int* height);
00051     void FreeImage(byte* image);
00052 
00053     void PutPixel(byte* img, int w, int x, int y, byte pix) {
00054         *(img + w*y + x) = pix;
00055     }
00056 
00057     byte ClipRange(int val) {
00058         if (val < 0)        { return 0;         }
00059         else if (val > 255) { return 255;       }
00060         else                { return (byte)val; }
00061     }
00062 
00063     ImageObserverState  imageObserverState;
00064     OPrimitiveID        fbkID;
00065 };
00066 
00067 #endif // ImageObserver_h_DEFINED

Generated on Sun Dec 2 23:04:28 2007 for openSDK by  doxygen 1.3.9.1