BlinkingFaceLED.h

Go to the documentation of this file.
00001 //
00002 // Copyright 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 BlinkingFaceLED_h_DEFINED
00013 #define BlinkingFaceLED_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 BlinkingFaceLEDState {
00021     BFLS_IDLE,
00022     BFLS_START,
00023     BFLS_MODE_A_0to255,
00024     BFLS_MODE_A_255to0,
00025     BFLS_MODE_A_0,
00026     BFLS_MODE_B_0to255,
00027     BFLS_MODE_B_255to0,
00028     BFLS_MODE_B_0
00029 };
00030 
00031 enum LED3Result {
00032     LED3_CONT,
00033     LED3_FINISH
00034 };
00035 
00036 static const char* const LED3_LOCATOR[] = {
00037     "PRM:/r1/c1/c2/c3/la-LED3:la", // Face light1
00038     "PRM:/r1/c1/c2/c3/lb-LED3:lb", // Face light2
00039     "PRM:/r1/c1/c2/c3/lc-LED3:lc", // Face light3
00040     "PRM:/r1/c1/c2/c3/ld-LED3:ld", // Face light4
00041     "PRM:/r1/c1/c2/c3/le-LED3:le", // Face light5
00042     "PRM:/r1/c1/c2/c3/lf-LED3:lf", // Face light6
00043     "PRM:/r1/c1/c2/c3/lg-LED3:lg", // Face light7
00044     "PRM:/r1/c1/c2/c3/lh-LED3:lh", // Face light8
00045     "PRM:/r1/c1/c2/c3/li-LED3:li", // Face light9
00046     "PRM:/r1/c1/c2/c3/lj-LED3:lj", // Face light10
00047     "PRM:/r1/c1/c2/c3/lk-LED3:lk", // Face light11
00048     "PRM:/r1/c1/c2/c3/ll-LED3:ll", // Face light12
00049     "PRM:/r1/c1/c2/c3/lm-LED3:lm", // Face light13
00050     "PRM:/r1/c1/c2/c3/ln-LED3:ln"  // Face light14
00051 };
00052 
00053 class BlinkingFaceLED : public OObject {
00054 public:
00055     BlinkingFaceLED();
00056     virtual ~BlinkingFaceLED() {}
00057 
00058     OSubject*  subject[numOfSubject];
00059     OObserver* observer[numOfObserver];
00060 
00061     virtual OStatus DoInit   (const OSystemEvent& event);
00062     virtual OStatus DoStart  (const OSystemEvent& event);
00063     virtual OStatus DoStop   (const OSystemEvent& event);
00064     virtual OStatus DoDestroy(const OSystemEvent& event);
00065 
00066     void Ready(const OReadyEvent& event);
00067 
00068 private:
00069     void OpenPrimitives();
00070     void NewCommandVectorData();
00071 
00072     LED3Result ModeA_0to255();
00073     LED3Result ModeA_255to0();
00074     LED3Result ModeA_0();
00075     LED3Result ModeB_0to255();
00076     LED3Result ModeB_255to0();
00077     LED3Result ModeB_0();
00078     void SetLED3Value(RCRegion* rgn, int level, int slope, OLED3Mode mode);
00079     void SetLED3Value(RCRegion* rgn, sword intensity, OLED3Mode mode);
00080     RCRegion* FindFreeRegion();
00081 
00082     static const size_t NUM_LEDS           = 14;
00083     static const size_t NUM_COMMAND_VECTOR = 2;
00084     static const int    MAX_LEVEL          = 15;
00085     static const int    POSITIVE_SLOPE     = 1;
00086     static const int    NEGATIVE_SLOPE     = -1;
00087 
00088     BlinkingFaceLEDState  blinkingLEDState;
00089     OPrimitiveID          ledID[NUM_LEDS];
00090     RCRegion*             region[NUM_COMMAND_VECTOR];
00091 };
00092 
00093 #endif // BlinkingFaceLED_h_DEFINED

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