Display.h
author StephaneLenclud
Tue, 10 Feb 2015 15:38:27 +0100
changeset 34 892f755c2612
parent 31 0a2b658e0d56
child 35 638eb0763e20
permissions -rw-r--r--
MDM166AA: Clock and Clear adjustments.
     1 //
     2 //
     3 //
     4 
     5 #ifndef DISPLAY_H
     6 #define DISPLAY_H
     7 
     8 #include "MiniDisplay.h"
     9 #include "HidDevice.h"
    10 const int KMaxDisplayStringLength = 256;
    11 
    12 /**
    13 Define an interface to some basic display functionality
    14 */
    15 class DisplayBase: public HidDevice
    16 	{
    17 public:
    18 	DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false)
    19 		{	    
    20 		iDeviceId[0]=0;
    21 		iFirmwareRevision[0]=0;
    22 		}
    23 
    24 	virtual ~DisplayBase(){};
    25 	//
    26 	virtual int Open()=0;
    27 	virtual void Close()=0;
    28 	//
    29 	virtual int MinBrightness() const=0;
    30 	virtual int MaxBrightness() const=0;
    31 	virtual void SetBrightness(int aBrightness)=0;
    32 	//
    33 	virtual void Clear()=0;
    34 	virtual void Fill()=0;
    35 	//
    36 	virtual void SwapBuffers()=0;
    37 
    38 	//Request management
    39 	virtual void Request(TMiniDisplayRequest /*aRequest*/){ /*No request supported by default*/ };
    40 	virtual TMiniDisplayRequest AttemptRequestCompletion(){return EMiniDisplayRequestNone;};
    41 	
    42 	virtual TMiniDisplayRequest CurrentRequest(){return iRequest;}
    43     virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
    44 	virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
    45 
    46     virtual bool IsPowerOn()	{return iPowerOn;}
    47 	virtual char* DeviceId() {return iDeviceId;}
    48 	virtual char* FirmwareRevision() {return iFirmwareRevision;}
    49 
    50 	virtual void TurnPowerOn(){}
    51 	virtual void TurnPowerOff(){}
    52 	virtual bool SupportPowerOnOff(){return false;}
    53 
    54 	virtual void ShowClock(){}
    55 	virtual void HideClock(){}
    56 	virtual bool SupportClock(){return false;}
    57 
    58 	//Icon management
    59 	//Icon support queries return the number of segments an icon supports.
    60 	virtual int IconCount(TMiniDisplayIconType /*aIcon*/){return 0;}
    61 	virtual int IconStatusCount(TMiniDisplayIconType /*aIcon*/){return 0;}
    62 	virtual void SetIconStatus(TMiniDisplayIconType /*aIcon*/, int /*aIndex*/, int /*aStatus*/){}
    63 
    64 protected:
    65 	void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; }
    66 
    67 protected:
    68 	char iDeviceId[KMaxDisplayStringLength];
    69 	char iFirmwareRevision[KMaxDisplayStringLength];
    70     bool iPowerOn;
    71 
    72 
    73 private:
    74 	TMiniDisplayRequest iRequest;
    75 	};
    76 
    77 
    78 /**
    79 */
    80 class GraphicDisplay : public DisplayBase
    81 	{
    82 public:
    83 	virtual int WidthInPixels() const=0;
    84 	virtual int HeightInPixels() const=0;
    85 	virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel)=0;
    86 	virtual void SetAllPixels(unsigned char aOn)=0;
    87 	virtual int FrameBufferSizeInBytes() const=0;
    88 	//virtual int BitBlit(unsigned char* aSrc, unsigned char aSrcWidth, unsigned char aSrcHeight, unsigned char aTargetX, unsigned char aTargetY) const=0;
    89 
    90 	};
    91 
    92 
    93 
    94 #endif