00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef BlinkingHeadLED_h_DEFINED
00013 #define BlinkingHeadLED_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 BlinkingHeadLEDState {
00021 BHLS_IDLE,
00022 BHLS_START
00023 };
00024
00025 static const char* const LED2_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 };
00033
00034 const size_t NUM_LEDS = 6;
00035 const size_t NUM_FRAMES = 8;
00036 const OLEDValue LED2_VALUE[NUM_LEDS][NUM_FRAMES] = {
00037 { oledON, oledON, oledOFF, oledOFF, oledON, oledON, oledOFF, oledOFF },
00038 { oledOFF, oledON, oledON, oledOFF, oledOFF, oledON, oledON, oledOFF },
00039 { oledON, oledOFF, oledOFF, oledOFF, oledON, oledON, oledON, oledOFF },
00040 { oledOFF, oledON, oledOFF, oledON, oledOFF, oledON, oledON, oledOFF },
00041 { oledOFF, oledOFF, oledON, oledON, oledON, oledOFF, oledON, oledOFF },
00042 { oledON, oledOFF, oledON, oledOFF, oledON, oledOFF, oledON, oledOFF }
00043 };
00044
00045 class BlinkingHeadLED : public OObject {
00046 public:
00047 BlinkingHeadLED();
00048 virtual ~BlinkingHeadLED() {}
00049
00050 OSubject* subject[numOfSubject];
00051 OObserver* observer[numOfObserver];
00052
00053 virtual OStatus DoInit (const OSystemEvent& event);
00054 virtual OStatus DoStart (const OSystemEvent& event);
00055 virtual OStatus DoStop (const OSystemEvent& event);
00056 virtual OStatus DoDestroy(const OSystemEvent& event);
00057
00058 void Ready(const OReadyEvent& event);
00059
00060 private:
00061 void OpenPrimitives();
00062 void NewCommandVectorData();
00063 void BlinkLED();
00064
00065 static const size_t NUM_COMMAND_VECTOR = 2;
00066
00067 BlinkingHeadLEDState blinkingLEDState;
00068 OPrimitiveID ledID[NUM_LEDS];
00069 RCRegion* region[NUM_COMMAND_VECTOR];
00070 };
00071
00072 #endif // BlinkingHeadLED_h_DEFINED