From c77821d0b4b3ae09e47ce6d6ca9d6b21dbb56d30 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 4 Nov 2013 08:59:15 +0000 Subject: LCDFramework project removed, integrated to MirandaG15 project git-svn-id: http://svn.miranda-ng.org/main/trunk@6767 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../src/LCDFramework/CLCDConnectionLogitech.h | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.h (limited to 'plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.h') diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.h b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.h new file mode 100644 index 0000000000..631c74121c --- /dev/null +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.h @@ -0,0 +1,148 @@ +#ifndef _CLCDCONNECTIONLOGITECH_H_ +#define _CLCDCONNECTIONLOGITECH_H_ + +#include "CLCDDevice.h" +#include "CLCDConnection.h" +#include "g15sdk/lglcd.h" + +#define G15_M1_LIGHT 0x01 +#define G15_M2_LIGHT 0x02 +#define G15_M3_LIGHT 0x04 +#define G15_MR_LIGHT 0x08 + +enum ELCDBrightness {LCD_ON=0x20,LCD_MEDIUM=0x10,LCD_OFF=0x00}; +enum EKBDBrightness {KBD_ON=0x02,KBD_MEDIUM=0x01,KBD_OFF=0x00}; + + +struct SG15LightStatus +{ + bool bMKey[3]; + bool bMRKey; + ELCDBrightness eLCDBrightness; + EKBDBrightness eKBDBrightness; +}; + +class CLCDConnectionLogitech : public CLCDConnection +{ +public: + // returns the connection type + int GetConnectionType(); + + // Constructor / Destructor + CLCDConnectionLogitech(); + ~CLCDConnectionLogitech(); + + // returns the name of the attached device + tstring GetDeviceName(); + + // returns a pointer to the device with that index + CLgLCDDevice* GetAttachedDevice(int iIndex); + // returns a pointer to the connected device + CLgLCDDevice* GetConnectedDevice(); + + // returns the connection state + int GetConnectionState(); + + // Initializes the connection to the LCD + bool Initialize(tstring strAppletName,bool bAutostart = false, bool bConfigDialog = false); + // connects to the device + bool Connect(int iIndex = 0); + // disconnects to the device + bool Disconnect(); + + // Closes the connection with the LCD + bool Shutdown(); + // Update function + bool Update(); + // Hides the applet + bool HideApplet(); + // Draws the specified bitmap on the LCD + bool Draw(); + + // returns the id of the specified button + int GetButtonId(int iButton); + // Returns the state of the specified button + bool GetButtonState(int iButton); + // Temporarily brings the applet to foreground + void SetAlert(bool bAlert); + // Activates the applet on the LCD + void SetAsForeground(bool bSetAsForeground); + // returns wether the applet is currently activated + bool IsForeground(); + + // Returns the display size + SIZE GetDisplaySize(); + // Returns the number of buttons for the display + int GetButtonCount(); + // Returns the number of available colors + int GetColorCount(); + + // Returns a pointer to the pixel buffer + PBYTE GetPixelBuffer(); + + //---------------------------------------------- + // Special functions to control the lights + SG15LightStatus GetLightStatus(); + + void SetMKeyLight(bool bM1,bool bM2,bool bM3,bool bMR); + void SetLCDBacklight(ELCDBrightness eBrightness); + void SetKBDBacklight(EKBDBrightness eBrightness); + //---------------------------------------------- + //---------------------------------------------- + // Special functions for callbacks + void OnSoftButtonCB(DWORD state); + void OnNotificationCB( DWORD notificationCode, DWORD notifyParm1, DWORD notifyParm2, DWORD notifyParm3, DWORD notifyParm4); + //---------------------------------------------- + // Special functions for the volume wheel hook + // Activates/Deactivates the volumewheel hook + void SetVolumeWheelHook(bool bEnable); + // the keyboard hook callback + static LRESULT CALLBACK KeyboardHook(int Code, WPARAM wParam, LPARAM lParam); + //---------------------------------------------- + void runDrawingThread(); +private: + PBYTE m_pDrawingBuffer; + + CLgLCDDevice *m_pConnectedDevice; + // the connection instance + static CLCDConnectionLogitech *m_pInstance; + + // HID variables + HANDLE m_hHIDDeviceHandle; + HIDP_CAPS m_HIDCapabilities; + + // HID functions + bool HIDInit(); + bool HIDDeInit(); + bool HIDReadData(BYTE* data); + + // Keyboard hook + HHOOK m_hKeyboardHook; + bool m_bVolumeWheelHook; + + // handles API Errors + void HandleErrorFromAPI(DWORD dwRes); + + int m_iNumQVGADevices; + int m_iNumBWDevices; + + bool m_bIsForeground; + lgLcdConnectContextExW m_connectContext; + tstring m_strAppletName; + bool m_bConnected; + lgLcdBitmap m_lcdBitmap; + BYTE *m_pPixels; + int m_iPixels; + int m_hDevice; + int m_hConnection; + DWORD m_dwButtonState; + int m_iPriority; + + DWORD m_dwForegroundCheck; + bool m_bSetAsForeground; + std::vector m_lcdDevices; + + HANDLE m_hDrawingThread; + HANDLE m_hStopEvent,m_hDrawEvent; +}; +#endif \ No newline at end of file -- cgit v1.2.3