BlinkingHeadLED.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 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", // Head light (color)
00027     "PRM:/r1/c1/c2/c3/l2-LED2:l2", // Head light (white)
00028     "PRM:/r1/c1/c2/c3/l3-LED2:l3", // Mode Indicator (red)
00029     "PRM:/r1/c1/c2/c3/l4-LED2:l4", // Mode Indicator (green)
00030     "PRM:/r1/c1/c2/c3/l5-LED2:l5", // Mode Indicator (blue)
00031     "PRM:/r1/c1/c2/c3/l6-LED2:l6", // Wireless light
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

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