NAME
EZ_LCD.cpp
COPYRIGHT
The Logitech EZ LCD SDK Wrapper, including all accompanying documentation, is protected by intellectual property laws. All rights not expressly granted by Logitech are reserved.
PURPOSE
The EZ LCD SDK Wrapper is aimed at developers wanting to make use of the LCD
display on Logitech G-series keyboard. It comes with a very intuitive
and easy to use interface which enables one to easily display static
strings, scrolling strings, progress bars, and icons.
See the following to get started:
- readme.txt: Describes how to get started
- Use one of the samples included to see how things work.
AUTHOR
Christophe Juncker (cj@wingmanteam.com)
CREATION DATE
06/13/2005
MODIFICATION HISTORY
03/01/2006 - Vahid Afshar. Added the concept of pages to the API. A
client can now have multiple pages, each with its own
controls. A page can be shown, while another is modified.
- Introduced the InitYourself() method.
NAME
CEzLcd::CEzLcd() -- Basic constructor. The user must call the
InitYourself(...) method after calling this constructor.
FUNCTION
Object is created.
INPUTS
NAME
CEzLcd::CEzLcd(LPCTSTR pFriendlyName, INT iWidth, INT iHeight).
FUNCTION
Does necessary initialization. If you are calling this constructor, then you should NOT call the InitYourself(...) method.
INPUTS
pFriendlyName - friendly name of the applet/game. This name will be
displayed in the Logitech G-series LCD Manager.
iWidth - width in pixels of the LCD.
iHeight - height in pixels of the LCD.
NAME
HRESULT CEzLcd::InitYourself(LPCTSTR pFriendlyName, BOOL IsAutoStartable,
BOOL IsPersistent, lgLcdOnConfigureCB callbackFunction ,width ,
height)
FUNCTION
Does necessary initialization. This method SHOULD ONLY be called if the empty constructor is used: CEzLcd::CEzLcd()
INPUTS
pFriendlyName - friendly name of the applet/game. This name will be
displayed in the Logitech G-series LCD Manager.
IsAutoStartable - Determines if the applet is to be started
automatically every time by the LCD manager software
(Part of G15 software package)
IsPersistent - Determines if the applet's friendlyName will remain
in the list of applets seen by the LCD manager
software after the applet terminates
pConfigContext - Pointer to the lgLcdConfigContext structure used
during callback into the applet
width - width in pixels of the LCD.
height - height in pixels of the LCD.
RETURN VALUE
S_OK if it can connect to the LCD Manager E_FAIL otherwise
NAME
BOOL CEzLcd::AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamily) -- Tells
whether a device of the specified family is currently connected. Multiple
families can be specified using the bitwise or operator (|).
INPUTS
dwDeviceFamily - Family ID to check for. IDs are:
LGLCD_DEVICE_FAMILY_KEYBOARD_G15, LGLCD_DEVICE_FAMILY_SPEAKERS_Z10,
LGLCD_DEVICE_FAMILY_JACKBOX, LGLCD_DEVICE_FAMILY_LCDEMULATOR_G15,
LGLCD_DEVICE_FAMILY_OTHER
RETURN VALUE
TRUE if a device of the specified family is present. FALSE otherwise.
SEE ALSO
CEzLcd::SetDeviceFamilyToUse CEzLcd::SetPreferredDisplayFamily
NAME
HRESULT CEzLcd::SetDeviceFamilyToUse(DWORD dwDeviceFamily) -- Call this
method to set the device family to be used. This method is exclusive,
which means that in case no device of the specified family is present,
the current applet will not be shown anywhere else.
INPUTS
dwDeviceFamily - Family ID to be used. IDs are:
LGLCD_DEVICE_FAMILY_KEYBOARD_G15, LGLCD_DEVICE_FAMILY_SPEAKERS_Z10,
LGLCD_DEVICE_FAMILY_JACKBOX, LGLCD_DEVICE_FAMILY_LCDEMULATOR_G15,
LGLCD_DEVICE_FAMILY_OTHER
RETURN VALUE
S_OK if there is a device of the family specified. E_FAIL otherwise.
SEE ALSO
CEzLcd::AnyDeviceOfThisFamilyPresent CEzLcd::SetPreferredDisplayFamily
NAME
HRESULT CEzLcd::SetPreferredDisplayFamily(DWORD dwDeviceFamily) -- Call
this method to set the preferred device family to be used. If a device
of the specified family is not connected, another family will be
selected according to devices connected.
INPUTS
dwDeviceFamily - Family ID to be used. IDs are:
LGLCD_DEVICE_FAMILY_KEYBOARD_G15, LGLCD_DEVICE_FAMILY_SPEAKERS_Z10,
LGLCD_DEVICE_FAMILY_JACKBOX, LGLCD_DEVICE_FAMILY_LCDEMULATOR_G15,
LGLCD_DEVICE_FAMILY_OTHER
RETURN VALUE
S_OK if there is a device of the family specified. E_FAIL otherwise.
SEE ALSO
CEzLcd::AnyDeviceOfThisFamilyPresent CEzLcd::SetDeviceFamilyToUse
NAME
INT CEzLcd::AddNewPage(VOID) -- Call this method to create a new page
to be displayed on the LCD. The method returns the current number
of pages, after the page is added.
RETURN VALUE
The method returns the current number of pages, after the page is added.
NAME
INT CEzLcd::RemovePage(INT iPageNumber) -- Call this method to remove
a page from the pages you've created to be displayed on the LCD.
The method returns the current number of pages, after the page is
deleted.
INPUTS
iPageNumber - The number for the page that is to be removed.
RETURN VALUE
The method returns the current number of pages, after the page is removed.
NAME
INT CEzLcd::GetPageCount(VOID) returns the current number of pages.
RETURN VALUE
The method returns the current number of pages.
NAME
INT CEzLcd::AddNumberOfPages(INT iNumberOfPages) - Adds iNumberOfPages
to the total of pages you've created.
INPUTS
iNumberOfPages - Count of pages to add in.
RETURN VALUE
The method returns the current number of pages, after the pages are added.
NAME
INT CEzLcd::ModifyControlsOnPage(INT iPageNumber) - Call this method
in order to modify the controls on specified page. This method must
be called first prior to any modifications on that page.
INPUTS
iPageNumber - The page number that the controls will be modified on.
RETURN VALUE
TRUE - If succeeded. FALSE - If encountered an error.
NAME
INT CEzLcd::ShowPage(INT iPageNumber) Call this method in order to
make the page shown on the LCD.
INPUTS
iPageNumber - The page that will be shown among your pages on the LCD.
RETURN VALUE
TRUE - If succeeded. FALSE - If encountered an error.
NAME
HANDLE CEzLcd::AddText(LGObjectType type, LGTextSize size,
INT iAlignment, INT iMaxLengthPixels) -- Add a text object to the
page you are working on.
INPUTS
type - specifies whether the text is static or
scrolling. Possible types are: LG_SCROLLING_TEXT,
LG_STATIC_TEXT
size - size of the text. Choose between these three:
LG_SMALL, LG_MEDIUM or LG_BIG.
iAlignment - alignment of the text. Values are: DT_LEFT,
DT_CENTER, DT_RIGHT.
iMaxLengthPixels - max length in pixels of the text. If the text is
longer and of type LG_STATIC_TEXT, it will be cut
off. If the text is longer and of type
LG_SCROLLING_TEXT, it will scroll.
RETURN VALUE
Handle for this object.
SEE ALSO
CEzLcd::AddIcon CEzLcd::AddProgressBar
NAME
HANDLE CEzLcd::AddText(LGObjectType type, LGTextSize size,
INT iAlignment, INT iMaxLengthPixels, INT iNumberOfLines) -- Add a
text object to the page you are working on.
INPUTS
type - specifies whether the text is static or
scrolling. Possible types are: LG_SCROLLING_TEXT,
LG_STATIC_TEXT
size - size of the text. Choose between these three:
LG_SMALL, LG_MEDIUM or LG_BIG.
iAlignment - alignment of the text. Values are: DT_LEFT,
DT_CENTER, DT_RIGHT.
iMaxLengthPixels - max length in pixels of the text. If the text is
longer and of type LG_STATIC_TEXT, it will be cut
off. If the text is longer and of type
LG_SCROLLING_TEXT, it will scroll.
iNumberOfLines - number of lines the text can use. For static text
only. If number bigger than 1 and static text is
too long to fit on LCD, the text will be displayed
on multiple lines as necessary.
RETURN VALUE
Handle for this object.
SEE ALSO
CEzLcd::AddIcon CEzLcd::AddProgressBar
NAME
HRESULT CEzLcd::SetText -- Sets the text in the control on the page
that you are working on.
INPUTS
hHandle - handle to the object. pText - text string.
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
HRESULT CEzLcd::SetText -- Sets the text in the control on the page
that you are working on.
INPUTS
hHandle - handle to the object.
pText - text string.
resetScrollingTextPosition - indicates if position of scrolling text
needs to be reset
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
HRESULT CEzLcd::SetTextAlignment -- Sets the text alignment.
INPUTS
hHandle - handle to the object.
iAlignment - alignment of the text. Values are: DT_LEFT,
DT_CENTER, DT_RIGHT.
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
HANDLE CEzLcd::AddIcon -- Add an icon object to the page that
you are working on.
INPUTS
hIcon - icon to be displayed on the page. Should be 1 bpp
bitmap.
iSizeX - x-axis size of the bitmap.
iSizeY - y-axis size of the bitmap.
RETURN VALUE
Handle for this object.
SEE ALSO
CEzLcd::AddText CEzLcd::AddProgressBar
NAME
HANDLE CEzLcd::AddProgressBar -- Add a progress bar object to the
page that you are working on.
INPUTS
type - type of the progress bar. Types are: LG_CURSOR,
LG_FILLED, LG_DOT_CURSOR.
RETURN VALUE
Handle for this object.
SEE ALSO
CEzLcd::AddText CEzLcd::AddIcon
NAME
HRESULT CEzLcd::SetProgressBarPosition -- Set position of the
progress bar's cursor.
INPUTS
hHandle - handle to the object. fPercentage - percentage of progress (0 to 100).
RETURN VALUE
E_FAIL if there was an error or if handle does not correspond to a progress bar. S_OK if no error.
NAME
HRESULT CEzLcd::SetProgressBarSize -- Set size of progress bar.
INPUTS
hHandle - handle to the object. iWidth - x-axis part of the size iHeight - y-axis part of the size (a good default value is 5).
RETURN VALUE
E_FAIL if there was an error or if handle does not correspond to a progress bar. S_OK if no error.
NAME
HANDLE CEzLcd::AddBitmap() -- Add a bitmap object to the page that
you are working on.
NOTES
A bitmap's size currently must always be 160x43 pixels.
RETURN VALUE
Handle for this object.
SEE ALSO
CEzLcd::AddText CEzLcd::AddIcon
NAME
HRESULT CEzLcd::SetBitmap(HANDLE hHandle, HBITMAP hBitmap) -- Set the
bitmap.
INPUTS
hHandle - handle to the object. hBitmap - 1bpp bitmap.
RETURN VALUE
E_FAIL if there was an error or if handle does not correspond to a bitmap. S_OK if no error.
NAME
HRESULT CEzLcd::SetOrigin -- Set the origin of an object. The origin
corresponds to the furthest pixel on the upper left corner of an
object.
INPUTS
hHandle - handle to the object. iXOrigin - x-axis part of the origin. iYOrigin - y-axis part of the origin.
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
HRESULT CEzLcd::SetVisible -- set corresponding object to be
visible or invisible on the page that you are working on.
INPUTS
hHandle - handle to the object.
bVisible - set to FALSE to make object invisible, TRUE to
make it visible (default).
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
BOOL CEzLcd::ButtonTriggered -- Check if a button was triggered.
INPUTS
iButton - name of the button to be checked. Possible names are:
LG_BUTTON_1, LG_BUTTON_2, LG_BUTTON_3, LG_BUTTON_4
RETURN VALUE
TRUE if the specific button was triggered FALSE otherwise
SEE ALSO
CEzLcd::ButtonReleased CEzLcd::ButtonIsPressed
NAME
BOOL CEzLcd::ButtonReleased -- Check if a button was released.
INPUTS
iButton - name of the button to be checked. Possible names are:
LG_BUTTON_1, LG_BUTTON_2, LG_BUTTON_3, LG_BUTTON_4
RETURN VALUE
TRUE if the specific button was released FALSE otherwise
SEE ALSO
CEzLcd::ButtonTriggered CEzLcd::ButtonIsPressed
NAME
BOOL CEzLcd::ButtonIsPressed -- Check if a button is being pressed.
INPUTS
iButton - name of the button to be checked. Possible names are:
LG_BUTTON_1, LG_BUTTON_2, LG_BUTTON_3, LG_BUTTON_4
RETURN VALUE
TRUE if the specific button is being pressed FALSE otherwise
SEE ALSO
CEzLcd::ButtonTriggered CEzLcd::ButtonReleased
NAME
BOOL CEzLcd::IsConnected -- Check if a Logitech G-series LCD is
connected.
RETURN VALUE
TRUE if an LCD is connected FALSE otherwise
NAME
HRESULT CEzLcd::SetAsForeground(BOOL bSetAsForeground) -- Become
foreground applet on LCD, or remove yourself as foreground applet.
INPUTS
bSetAsForeground - Determines whether to be foreground or not.
Possible values are:
- TRUE implies foreground
- FALSE implies no longer foreground
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
HRESULT CEzLcd::SetScreenPriority(DWORD priority) -- Set screen
priority.
INPUTS
dwPriority - priority of the screen. Possible values are:
- LGLCD_PRIORITY_IDLE_NO_SHOW
- LGLCD_PRIORITY_BACKGROUND
- LGLCD_PRIORITY_NORMAL
- LGLCD_PRIORITY_ALERT.
Default is LGLCD_PRIORITY_NORMAL.
RETURN VALUE
E_FAIL if there was an error. S_OK if no error.
NAME
DWORD CEzLcd::GetScreenPriority() -- Get screen priority.
RETURN VALUE
LGLCD_PRIORITY_IDLE_NO_SHOW, LGLCD_PRIORITY_BACKGROUND, LGLCD_PRIORITY_NORMAL, or LGLCD_PRIORITY_ALERT
NAME
VOID CEzLcd::Update -- Update LCD display
FUNCTION
Updates the display. Must be called every loop.