00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef BlinkingLED_h_DEFINED
00013 #define BlinkingLED_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 BlinkingLEDState {
00021 BLS_IDLE,
00022 BLS_START
00023 };
00024
00025 static const char* const LED_LOCATOR[] = {
00026 "PRM:/r1/c1/c2/c3/l1-LED2:l1",
00027 "PRM:/r1/c1/c2/c3/l2-LED2:l2",
00028 "PRM:/r1/c1/c2/c3/l3-LED2:l3",
00029 "PRM:/r1/c1/c2/c3/l4-LED2:l4",
00030 "PRM:/r1/c1/c2/c3/l5-LED2:l5",
00031 "PRM:/r1/c1/c2/c3/l6-LED2:l6",
00032 "PRM:/r1/c1/c2/c3/l7-LED2:l7",
00033 };
00034
00035 class BlinkingLED : public OObject {
00036 public:
00037 BlinkingLED();
00038 virtual ~BlinkingLED() {}
00039
00040 OSubject* subject[numOfSubject];
00041 OObserver* observer[numOfObserver];
00042
00043 virtual OStatus DoInit (const OSystemEvent& event);
00044 virtual OStatus DoStart (const OSystemEvent& event);
00045 virtual OStatus DoStop (const OSystemEvent& event);
00046 virtual OStatus DoDestroy(const OSystemEvent& event);
00047
00048 void Ready(const OReadyEvent& event);
00049
00050 private:
00051 void OpenPrimitives();
00052 void NewCommandVectorData();
00053 void BlinkLED();
00054
00055 static const size_t NUM_COMMAND_VECTOR = 2;
00056 static const size_t NUM_LEDS = 7;
00057
00058 BlinkingLEDState blinkingLEDState;
00059 OPrimitiveID ledID[NUM_LEDS];
00060 RCRegion* region[NUM_COMMAND_VECTOR];
00061 };
00062
00063 #endif // BlinkingLED_h_DEFINED