BlinkingBackLED.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 BlinkingBackLED_h_DEFINED
00013 #define BlinkingBackLED_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 BlinkingBackLEDState {
00021     BBLS_IDLE,
00022     BBLS_START,
00023     BBLS_WHITE0to255_COLOR0,
00024     BBLS_WHITE255_COLOR0to255,
00025     BBLS_WHITE255to0_COLOR255,
00026     BBLS_WHITE0_COLOR255to0,
00027     BBLS_WHITE0_COLOR0
00028 };
00029 
00030 enum LED3Result {
00031     LED3_CONT,
00032     LED3_FINISH
00033 };
00034 
00035 static const char* const LED3_LOCATOR[] = {
00036     "PRM:/lu-LED3:lu", // Back light (front,  color)
00037     "PRM:/lv-LED3:lv", // Back light (front,  white)
00038     "PRM:/lw-LED3:lw", // Back light (middle, color)
00039     "PRM:/lx-LED3:lx", // Back light (middle, white)
00040     "PRM:/ly-LED3:ly", // Back light (rear,   color)
00041     "PRM:/lz-LED3:lz"  // Back light (rear,   white) 
00042 };
00043 
00044 class BlinkingBackLED : public OObject {
00045 public:
00046     BlinkingBackLED();
00047     virtual ~BlinkingBackLED() {}
00048 
00049     OSubject*  subject[numOfSubject];
00050     OObserver* observer[numOfObserver];
00051 
00052     virtual OStatus DoInit   (const OSystemEvent& event);
00053     virtual OStatus DoStart  (const OSystemEvent& event);
00054     virtual OStatus DoStop   (const OSystemEvent& event);
00055     virtual OStatus DoDestroy(const OSystemEvent& event);
00056 
00057     void Ready(const OReadyEvent& event);
00058 
00059 private:
00060     void OpenPrimitives();
00061     void NewCommandVectorData();
00062 
00063     LED3Result White0to255_Color0();
00064     LED3Result White255_Color0to255();
00065     LED3Result White255to0_Color255();
00066     LED3Result White0_Color255to0();
00067     LED3Result White0_Color0();
00068     void SetWhiteLED3Value(RCRegion* rgn, int level, int slope);
00069     void SetColorLED3Value(RCRegion* rgn, int level, int slope);
00070     void SetWhiteLED3Value(RCRegion* rgn, sword intensity);
00071     void SetColorLED3Value(RCRegion* rgn, sword intensity);
00072     RCRegion* FindFreeRegion();
00073 
00074     static const size_t NUM_LEDS           = 6;
00075     static const size_t NUM_COMMAND_VECTOR = 2;
00076     static const int    MAX_LEVEL          = 15;
00077     static const int    POSITIVE_SLOPE     = 1;
00078     static const int    NEGATIVE_SLOPE     = -1;
00079 
00080     BlinkingBackLEDState  blinkingLEDState;
00081     OPrimitiveID          ledID[NUM_LEDS];
00082     RCRegion*             region[NUM_COMMAND_VECTOR];
00083 };
00084 
00085 #endif // BlinkingBackLED_h_DEFINED

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