Request results getters moved to display base.
1.1 --- a/CMakeLists.txt Mon Aug 25 22:05:30 2014 +0200
1.2 +++ b/CMakeLists.txt Tue Aug 26 19:24:57 2014 +0200
1.3 @@ -28,7 +28,9 @@
1.4 FutabaGP1212A02.h
1.5 HidDevice.h
1.6 HidReport.h
1.7 - MiniDisplay.h)
1.8 + MiniDisplay.h
1.9 + Display.h
1.10 + )
1.11
1.12 source_group(Includes FILES ${INCLUDES})
1.13
2.1 --- a/Display.h Mon Aug 25 22:05:30 2014 +0200
2.2 +++ b/Display.h Tue Aug 26 19:24:57 2014 +0200
2.3 @@ -5,13 +5,18 @@
2.4 #ifndef DISPLAY_H
2.5 #define DISPLAY_H
2.6
2.7 +const int KMaxDisplayStringLength = 256;
2.8 +
2.9 /**
2.10 Define an interface to some basic display functionality
2.11 */
2.12 class DisplayBase
2.13 {
2.14 public:
2.15 - DisplayBase():iRequest(EMiniDisplayRequestNone){}
2.16 + DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false){
2.17 + iDeviceId[0]=0;
2.18 + iFirmwareRevision[0]=0;
2.19 +}
2.20 virtual ~DisplayBase(){};
2.21 //
2.22 virtual int Open()=0;
2.23 @@ -33,9 +38,19 @@
2.24 virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
2.25 virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
2.26
2.27 + virtual bool PowerOn() {return iPowerOn;}
2.28 + virtual char* DeviceId() {return iDeviceId;}
2.29 + virtual char* FirmwareRevision() {return iFirmwareRevision;}
2.30 +
2.31 protected:
2.32 void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; }
2.33
2.34 +protected:
2.35 + char iDeviceId[KMaxDisplayStringLength];
2.36 + char iFirmwareRevision[KMaxDisplayStringLength];
2.37 + bool iPowerOn;
2.38 +
2.39 +
2.40 private:
2.41 TMiniDisplayRequest iRequest;
2.42 };
3.1 --- a/FutabaGP1212A01.cpp Mon Aug 25 22:05:30 2014 +0200
3.2 +++ b/FutabaGP1212A01.cpp Tue Aug 26 19:24:57 2014 +0200
3.3 @@ -20,11 +20,8 @@
3.4 iFrameAlpha(NULL),
3.5 iFrameBeta(NULL),
3.6 iFrameGamma(NULL),
3.7 - iNeedFullFrameUpdate(0),
3.8 - iPowerOn(false)
3.9 + iNeedFullFrameUpdate(0)
3.10 {
3.11 - iDeviceId[0]=0;
3.12 - iFirmwareRevision[0]=0;
3.13 //ResetBuffers();
3.14 }
3.15
3.16 @@ -679,23 +676,4 @@
3.17 Write(report);
3.18 }
3.19
3.20 -/**
3.21 -*/
3.22 -bool GP1212A01A::PowerOn()
3.23 - {
3.24 - return iPowerOn;
3.25 - }
3.26
3.27 -/**
3.28 -*/
3.29 -char* GP1212A01A::DeviceId()
3.30 - {
3.31 - return iDeviceId;
3.32 - }
3.33 -
3.34 -/**
3.35 -*/
3.36 -char* GP1212A01A::FirmwareRevision()
3.37 - {
3.38 - return iFirmwareRevision;
3.39 - }
4.1 --- a/FutabaGP1212A01.h Mon Aug 25 22:05:30 2014 +0200
4.2 +++ b/FutabaGP1212A01.h Tue Aug 26 19:24:57 2014 +0200
4.3 @@ -55,9 +55,6 @@
4.4 //
4.5 TMiniDisplayRequest AttemptRequestCompletion();
4.6 FutabaVfdReport& InputReport() {return iInputReport;}
4.7 - bool PowerOn();
4.8 - char* DeviceId();
4.9 - char* FirmwareRevision();
4.10
4.11 private:
4.12 void RequestDeviceId();
4.13 @@ -104,10 +101,6 @@
4.14 //unsigned char *iFrontBuffer;
4.15 //unsigned char *iBackBuffer;
4.16 FutabaVfdReport iInputReport;
4.17 - //
4.18 - char iDeviceId[KFutabaMaxHidReportSize];
4.19 - char iFirmwareRevision[KFutabaMaxHidReportSize];
4.20 - bool iPowerOn;
4.21 };
4.22
4.23
5.1 --- a/MiniDisplay.cpp Mon Aug 25 22:05:30 2014 +0200
5.2 +++ b/MiniDisplay.cpp Tue Aug 26 19:24:57 2014 +0200
5.3 @@ -165,13 +165,13 @@
5.4 //-------------------------------------------------------------
5.5 bool MiniDisplayRequestPending(MiniDisplayDevice aDevice)
5.6 {
5.7 - return ((GP1212A01A*)aDevice)->RequestPending();
5.8 + return ((GraphicDisplay*)aDevice)->RequestPending();
5.9 }
5.10
5.11 //-------------------------------------------------------------
5.12 TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice)
5.13 {
5.14 - return ((GP1212A01A*)aDevice)->CurrentRequest();
5.15 + return ((GraphicDisplay*)aDevice)->CurrentRequest();
5.16 }
5.17
5.18 //-------------------------------------------------------------
5.19 @@ -183,23 +183,23 @@
5.20 //-------------------------------------------------------------
5.21 TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice)
5.22 {
5.23 - return ((GP1212A01A*)aDevice)->AttemptRequestCompletion();
5.24 + return ((GraphicDisplay*)aDevice)->AttemptRequestCompletion();
5.25 }
5.26
5.27 //-------------------------------------------------------------
5.28 char* MiniDisplayDeviceId(MiniDisplayDevice aDevice)
5.29 {
5.30 - return ((GP1212A01A*)aDevice)->DeviceId();
5.31 + return ((GraphicDisplay*)aDevice)->DeviceId();
5.32 }
5.33
5.34 //-------------------------------------------------------------
5.35 char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice)
5.36 {
5.37 - return ((GP1212A01A*)aDevice)->FirmwareRevision();
5.38 + return ((GraphicDisplay*)aDevice)->FirmwareRevision();
5.39 }
5.40
5.41 //-------------------------------------------------------------
5.42 bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice)
5.43 {
5.44 - return ((GP1212A01A*)aDevice)->PowerOn();
5.45 + return ((GraphicDisplay*)aDevice)->PowerOn();
5.46 }
5.47 \ No newline at end of file