Adding C# interop project and NuGet package.
2 // Copyright (C) 2014-2015 Stéphane Lenclud.
4 // This file is part of MiniDisplay.
6 // MiniDisplay is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // MiniDisplay is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with MiniDisplay. If not, see <http://www.gnu.org/licenses/>.
23 #include "MiniDisplay.h"
24 #include "HidDevice.h"
25 const int KMaxDisplayStringLength = 256;
28 Define an interface to some basic display functionality
30 class DisplayBase: public HidDevice
33 DisplayBase():iRequest(EMiniDisplayRequestNone),iPowerOn(false)
36 iFirmwareRevision[0]=0;
39 virtual ~DisplayBase(){};
42 virtual void Close()=0;
44 virtual int MinBrightness() const=0;
45 virtual int MaxBrightness() const=0;
46 virtual void SetBrightness(int aBrightness)=0;
48 virtual void Clear()=0;
49 virtual void Fill()=0;
51 virtual void SwapBuffers()=0;
54 virtual void Request(TMiniDisplayRequest /*aRequest*/){ /*No request supported by default*/ };
55 virtual TMiniDisplayRequest AttemptRequestCompletion(){return EMiniDisplayRequestNone;};
57 virtual TMiniDisplayRequest CurrentRequest(){return iRequest;}
58 virtual void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
59 virtual bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
61 virtual bool IsPowerOn() {return iPowerOn;}
62 virtual char* DeviceId() {return iDeviceId;}
63 virtual char* FirmwareRevision() {return iFirmwareRevision;}
65 virtual void TurnPowerOn(){}
66 virtual void TurnPowerOff(){}
67 virtual bool SupportPowerOnOff(){return false;}
69 virtual void ShowClock(){}
70 virtual void HideClock(){}
71 virtual bool SupportClock(){return false;}
74 //Icon support queries return the number of segments an icon supports.
75 virtual int IconCount(TMiniDisplayIconType /*aIcon*/){return 0;}
76 virtual int IconStatusCount(TMiniDisplayIconType /*aIcon*/){return 0;}
77 virtual void SetIconStatus(TMiniDisplayIconType /*aIcon*/, int /*aIndex*/, int /*aStatus*/){}
80 void SetRequest(TMiniDisplayRequest aRequest) { iRequest=aRequest; }
83 char iDeviceId[KMaxDisplayStringLength];
84 char iFirmwareRevision[KMaxDisplayStringLength];
89 TMiniDisplayRequest iRequest;
95 class GraphicDisplay : public DisplayBase
98 virtual int WidthInPixels() const=0;
99 virtual int HeightInPixels() const=0;
100 virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel)=0;
101 virtual void SetAllPixels(unsigned char aOn)=0;
102 virtual int FrameBufferSizeInBytes() const=0;
103 //virtual int BitBlit(unsigned char* aSrc, unsigned char aSrcWidth, unsigned char aSrcHeight, unsigned char aTargetX, unsigned char aTargetY) const=0;