1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
/*
lglcd.h
library definition for lglcd.a
part of lglcd for Microsoft(R) Windows(R)
The Logitech LCD SDK, including all acompanying documentation,
is protected by intellectual property laws. All use of the Logitech
LCD SDK is subject to the License Agreement found in the
"ReadMe License Agreement" file and in the Reference Manual. All rights
not expressly granted by Logitech are reserved.
01/14/2005 1.00 initial draft
02/23/2005 1.01 added callbacks, implemented changes as discussed
02/08/2006 1.02 added call to set foreground, sync update with confirmation
05/29/2006 1.03 Added device family feature
12/03/2007 3.00 Added support for color devices and partial event notifications (arrival and removal)
10/03/2008 3.01 Added more event notifications
10/27/2008 3.01 Deprecated enumeration and index-based open; Applets should use lgLcdOpenByType() (and
possibly notifications)
*/
#ifndef _LGLCD_H_INCLUDED_
#define _LGLCD_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 8)
//// Definitions
// Invalid handle definitions
#define LGLCD_INVALID_CONNECTION (-1)
#define LGLCD_INVALID_DEVICE (-1)
// Common Soft-Buttons available through the SDK
#define LGLCDBUTTON_LEFT (0x00000100)
#define LGLCDBUTTON_RIGHT (0x00000200)
#define LGLCDBUTTON_OK (0x00000400)
#define LGLCDBUTTON_CANCEL (0x00000800)
#define LGLCDBUTTON_UP (0x00001000)
#define LGLCDBUTTON_DOWN (0x00002000)
#define LGLCDBUTTON_MENU (0x00004000)
// Soft-Button masks. Kept for backwards compatibility
#define LGLCDBUTTON_BUTTON0 (0x00000001)
#define LGLCDBUTTON_BUTTON1 (0x00000002)
#define LGLCDBUTTON_BUTTON2 (0x00000004)
#define LGLCDBUTTON_BUTTON3 (0x00000008)
#define LGLCDBUTTON_BUTTON4 (0x00000010)
#define LGLCDBUTTON_BUTTON5 (0x00000020)
#define LGLCDBUTTON_BUTTON6 (0x00000040)
#define LGLCDBUTTON_BUTTON7 (0x00000080)
//************************************************************************
// lgLcdDeviceDesc
//************************************************************************
typedef struct
{
DWORD Width;
DWORD Height;
DWORD Bpp;
DWORD NumSoftButtons;
} lgLcdDeviceDesc;
//************************************************************************
// lgLcdDeviceDescEx
//************************************************************************
typedef struct
{
DWORD deviceFamilyId;
WCHAR deviceDisplayName[MAX_PATH];
DWORD Width; // # of pixels (horizontally) on the LCD
DWORD Height; // # of pixels (lines) on the LCD
DWORD Bpp; // # of bits per pixel (1,8,16,24,...)
DWORD NumSoftButtons;
DWORD Reserved1;
DWORD Reserved2;
} lgLcdDeviceDescExW;
typedef struct
{
DWORD deviceFamilyId;
CHAR deviceDisplayName[MAX_PATH];
DWORD Width;
DWORD Height;
DWORD Bpp;
DWORD NumSoftButtons;
DWORD Reserved1;
DWORD Reserved2;
} lgLcdDeviceDescExA;
#ifdef UNICODE
typedef lgLcdDeviceDescExW lgLcdDeviceDescEx;
#else
typedef lgLcdDeviceDescExA lgLcdDeviceDescEx;
#endif
//************************************************************************
// lgLcdBitmap
//************************************************************************
#define LGLCD_BMP_FORMAT_160x43x1 (0x00000001)
#define LGLCD_BMP_FORMAT_QVGAx32 (0x00000003)
#define LGLCD_BMP_WIDTH (160)
#define LGLCD_BMP_HEIGHT (43)
#define LGLCD_BMP_BPP (1)
#define LGLCD_BW_BMP_WIDTH (160)
#define LGLCD_BW_BMP_HEIGHT (43)
#define LGLCD_BW_BMP_BPP (1)
#define LGLCD_QVGA_BMP_WIDTH (320)
#define LGLCD_QVGA_BMP_HEIGHT (240)
#define LGLCD_QVGA_BMP_BPP (4)
typedef struct
{
DWORD Format;
} lgLcdBitmapHeader;
typedef struct
{
lgLcdBitmapHeader hdr;
BYTE pixels[LGLCD_BMP_WIDTH * LGLCD_BMP_HEIGHT * LGLCD_BMP_BPP];
} lgLcdBitmap160x43x1;
typedef struct
{
lgLcdBitmapHeader hdr; // Format = LGLCD_BMP_FORMAT_QVGAx32
BYTE pixels[LGLCD_QVGA_BMP_WIDTH * LGLCD_QVGA_BMP_HEIGHT * LGLCD_QVGA_BMP_BPP];
} lgLcdBitmapQVGAx32;
//
// Generic bitmap for use by both color and BW applets
//
typedef union
{
lgLcdBitmapHeader hdr; // provides easy access to the header
lgLcdBitmap160x43x1 bmp_mono; // B/W bitmap data
lgLcdBitmapQVGAx32 bmp_qvga32; // Color bitmap data
} lgLcdBitmap;
// Priorities
#define LGLCD_PRIORITY_IDLE_NO_SHOW (0)
#define LGLCD_PRIORITY_BACKGROUND (64)
#define LGLCD_PRIORITY_NORMAL (128)
#define LGLCD_PRIORITY_ALERT (255)
#define LGLCD_SYNC_UPDATE(priority) (0x80000000 | (priority))
#define LGLCD_SYNC_COMPLETE_WITHIN_FRAME(priority) (0xC0000000 | (priority))
#define LGLCD_ASYNC_UPDATE(priority) (priority)
// Foreground mode for client applications
#define LGLCD_LCD_FOREGROUND_APP_NO (0)
#define LGLCD_LCD_FOREGROUND_APP_YES (1)
// Device family definitions
#define LGLCD_DEVICE_FAMILY_BW_160x43_GAMING (0x00000001)
#define LGLCD_DEVICE_FAMILY_KEYBOARD_G15 (0x00000001)
#define LGLCD_DEVICE_FAMILY_BW_160x43_AUDIO (0x00000002)
#define LGLCD_DEVICE_FAMILY_SPEAKERS_Z10 (0x00000002)
#define LGLCD_DEVICE_FAMILY_JACKBOX (0x00000004)
#define LGLCD_DEVICE_FAMILY_BW_160x43_BASIC (0x00000008)
#define LGLCD_DEVICE_FAMILY_LCDEMULATOR_G15 (0x00000008)
#define LGLCD_DEVICE_FAMILY_RAINBOW (0x00000010)
#define LGLCD_DEVICE_FAMILY_QVGA_BASIC (0x00000020)
#define LGLCD_DEVICE_FAMILY_QVGA_GAMING (0x00000040)
#define LGLCD_DEVICE_FAMILY_GAMEBOARD_G13 (0x00000080)
#define LGLCD_DEVICE_FAMILY_OTHER (0x80000000)
// Combinations of device families (device clans?)
#define LGLCD_DEVICE_FAMILY_ALL_BW_160x43 (LGLCD_DEVICE_FAMILY_BW_160x43_GAMING \
| LGLCD_DEVICE_FAMILY_BW_160x43_AUDIO \
| LGLCD_DEVICE_FAMILY_JACKBOX \
| LGLCD_DEVICE_FAMILY_BW_160x43_BASIC \
| LGLCD_DEVICE_FAMILY_RAINBOW \
| LGLCD_DEVICE_FAMILY_GAMEBOARD_G13)
#define LGLCD_DEVICE_FAMILY_ALL_QVGA (LGLCD_DEVICE_FAMILY_QVGA_BASIC \
| LGLCD_DEVICE_FAMILY_QVGA_GAMING)
#define LGLCD_DEVICE_FAMILY_ALL (LGLCD_DEVICE_FAMILY_ALL_BW_160x43 \
| LGLCD_DEVICE_FAMILY_ALL_QVGA)
// Capabilities of applets connecting to LCD Manager.
#define LGLCD_APPLET_CAP_BASIC (0x00000000)
#define LGLCD_APPLET_CAP_BW (0x00000001)
#define LGLCD_APPLET_CAP_QVGA (0x00000002)
// Notifications sent by LCD Manager to applets connected to it.
#define LGLCD_NOTIFICATION_DEVICE_ARRIVAL (0x00000001)
#define LGLCD_NOTIFICATION_DEVICE_REMOVAL (0x00000002)
#define LGLCD_NOTIFICATION_CLOSE_CONNECTION (0x00000003)
#define LGLCD_NOTIFICATION_APPLET_DISABLED (0x00000004)
#define LGLCD_NOTIFICATION_APPLET_ENABLED (0x00000005)
#define LGLCD_NOTIFICATION_TERMINATE_APPLET (0x00000006)
// Device types used in notifications
#define LGLCD_DEVICE_BW (0x00000001)
#define LGLCD_DEVICE_QVGA (0x00000002)
//************************************************************************
// Callbacks
//************************************************************************
// Callback used to notify client of soft button change
typedef DWORD (WINAPI *lgLcdOnSoftButtonsCB)(IN int device,
IN DWORD dwButtons,
IN const PVOID pContext);
// Callback used to allow client to pop up a "configuration panel"
typedef DWORD (WINAPI *lgLcdOnConfigureCB)(IN int connection,
IN const PVOID pContext);
// Callback used to notify client of events, such as device arrival, ...
// Arrival, removal, applet enable/disable supported as of version 3.0.
typedef DWORD (WINAPI *lgLcdOnNotificationCB)(IN int connection,
IN const PVOID pContext,
IN DWORD notificationCode,
IN DWORD notifyParm1,
IN DWORD notifyParm2,
IN DWORD notifyParm3,
IN DWORD notifyParm4);
//************************************************************************
// lgLcdConfigureContext
//************************************************************************
typedef struct
{
// Set to NULL if not configurable
lgLcdOnConfigureCB configCallback;
PVOID configContext;
} lgLcdConfigureContext;
//************************************************************************
// lgLcdNotificationContext
//************************************************************************
typedef struct
{
// Set to NULL if not notifiable
lgLcdOnNotificationCB notificationCallback;
PVOID notifyContext;
} lgLcdNotificationContext;
//************************************************************************
// lgLcdConnectContext
//************************************************************************
typedef struct
{
// "Friendly name" display in the listing
LPCWSTR appFriendlyName;
// isPersistent determines whether this connection persists in the list
BOOL isPersistent;
// isAutostartable determines whether the client can be started by
// LCDMon
BOOL isAutostartable;
lgLcdConfigureContext onConfigure;
// --> Connection handle
int connection;
} lgLcdConnectContextW;
typedef struct
{
// "Friendly name" display in the listing
LPCSTR appFriendlyName;
// isPersistent determines whether this connection persists in the list
BOOL isPersistent;
// isAutostartable determines whether the client can be started by
// LCDMon
BOOL isAutostartable;
lgLcdConfigureContext onConfigure;
// --> Connection handle
int connection;
} lgLcdConnectContextA;
//************************************************************************
// lgLcdConnectContextEx
//************************************************************************
typedef struct
{
// "Friendly name" display in the listing
LPCWSTR appFriendlyName;
// isPersistent determines whether this connection persists in the list
BOOL isPersistent;
// isAutostartable determines whether the client can be started by
// LCDMon
BOOL isAutostartable;
lgLcdConfigureContext onConfigure;
// --> Connection handle
int connection;
// New additions added in 1.03 revision
DWORD dwAppletCapabilitiesSupported; // Or'd combination of LGLCD_APPLET_CAP_... defines
DWORD dwReserved1;
lgLcdNotificationContext onNotify;
} lgLcdConnectContextExW;
typedef struct
{
// "Friendly name" display in the listing
LPCSTR appFriendlyName;
// isPersistent determines whether this connection persists in the list
BOOL isPersistent;
// isAutostartable determines whether the client can be started by
// LCDMon
BOOL isAutostartable;
lgLcdConfigureContext onConfigure;
// --> Connection handle
int connection;
// New additions added in 1.03 revision
DWORD dwAppletCapabilitiesSupported; // Or'd combination of LGLCD_APPLET_CAP_... defines
DWORD dwReserved1;
lgLcdNotificationContext onNotify;
} lgLcdConnectContextExA;
#ifdef UNICODE
typedef lgLcdConnectContextW lgLcdConnectContext;
typedef lgLcdConnectContextExW lgLcdConnectContextEx;
#else
typedef lgLcdConnectContextA lgLcdConnectContext;
typedef lgLcdConnectContextExA lgLcdConnectContextEx;
#endif
//************************************************************************
// lgLcdOpenContext & lgLcdOpenByTypeContext
//************************************************************************
typedef struct
{
// Set to NULL if no softbutton notifications are needed
lgLcdOnSoftButtonsCB softbuttonsChangedCallback;
PVOID softbuttonsChangedContext;
} lgLcdSoftbuttonsChangedContext;
typedef struct
{
int connection;
// Device index to open
int index;
lgLcdSoftbuttonsChangedContext onSoftbuttonsChanged;
// --> Device handle
int device;
} lgLcdOpenContext;
typedef struct
{
int connection;
// Device type to open (either LGLCD_DEVICE_BW or LGLCD_DEVICE_QVGA)
int deviceType;
lgLcdSoftbuttonsChangedContext onSoftbuttonsChanged;
// --> Device handle
int device;
} lgLcdOpenByTypeContext;
//************************************************************************
// Prototypes
//************************************************************************
// Initialize the library by calling this function.
DWORD WINAPI lgLcdInit(void);
// Must be called to release the library and free all allocated structures.
DWORD WINAPI lgLcdDeInit(void);
// Connect as a client to the LCD subsystem. Provide name to be
// displayed for user when viewing the user interface of the LCD module,
// as well as a configuration callback and context, and a flag that states
// whether this client is startable by LCDMon
DWORD WINAPI lgLcdConnectW(IN OUT lgLcdConnectContextW *ctx);
DWORD WINAPI lgLcdConnectA(IN OUT lgLcdConnectContextA *ctx);
DWORD WINAPI lgLcdConnectExW(IN OUT lgLcdConnectContextExW *ctx);
DWORD WINAPI lgLcdConnectExA(IN OUT lgLcdConnectContextExA *ctx);
#ifdef UNICODE
#define lgLcdConnect lgLcdConnectW
#define lgLcdConnectEx lgLcdConnectExW
#else
#define lgLcdConnect lgLcdConnectA
#define lgLcdConnectEx lgLcdConnectExA
#endif // !UNICODE
// Must be called to release the connection and free all allocated resources
DWORD WINAPI lgLcdDisconnect(int connection);
// New additions added in 1.03 revision of API. Call this method to setup which device families the applet
// is interested in. After this call, the applet can use lgLcdEnumerateEx to determine
// if a device from the device family wanted is found.
DWORD WINAPI lgLcdSetDeviceFamiliesToUse(IN int connection,
DWORD dwDeviceFamiliesSupported, // Or'd combination of LGLCD_DEVICE_FAMILY_... defines
DWORD dwReserved1);
// To determine all connected LCD devices supported by this library, and
// their capabilities. Start with index 0, and increment by one, until
// the library returns an error (WHICH?).
DWORD WINAPI lgLcdEnumerate(IN int connection, IN int index,
OUT lgLcdDeviceDesc *description);
// To determine all connected LCD devices supported by this library, and
// their capabilities. Start with 0, and increment by one, until
// the library returns an error (WHICH?).
DWORD WINAPI lgLcdEnumerateExW(IN int connection, IN int index,
OUT lgLcdDeviceDescExW *description);
DWORD WINAPI lgLcdEnumerateExA(IN int connection, IN int index,
OUT lgLcdDeviceDescExA *description);
#ifdef UNICODE
#define lgLcdEnumerateEx lgLcdEnumerateExW
#else
#define lgLcdEnumerateEx lgLcdEnumerateExA
#endif // !UNICODE
// Opens the LCD at position=index. Library sets the device parameter to
// its internal reference to the device. Calling application provides the
// device handle in all calls that access the LCD.
DWORD WINAPI lgLcdOpen(IN OUT lgLcdOpenContext *ctx);
// Opens an LCD of the specified type. If no such device is available, returns
// an error.
DWORD WINAPI lgLcdOpenByType(IN OUT lgLcdOpenByTypeContext *ctx);
// Closes the LCD. Must be paired with lgLcdOpen()/lgLcdOpenByType().
DWORD WINAPI lgLcdClose(IN int device);
// Reads the state of the soft buttons for the device.
DWORD WINAPI lgLcdReadSoftButtons(IN int device, OUT DWORD *buttons);
// Provides a bitmap to be displayed on the LCD. The priority field
// further describes the way in which the bitmap is to be applied.
DWORD WINAPI lgLcdUpdateBitmap(IN int device,
IN const lgLcdBitmapHeader *bitmap,
IN DWORD priority);
// Sets the calling application as the shown application on the LCD, and stops
// any type of rotation among other applications on the LCD.
DWORD WINAPI lgLcdSetAsLCDForegroundApp(IN int device, IN int foregroundYesNoFlag);
// These API calls are being deprecated. Consider using lgLcdOpenByType() and
// device arrival/removal notifications instead.
#pragma deprecated(lgLcdEnumerate,lgLcdEnumerateExA,lgLcdEnumerateExW,lgLcdOpen)
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif // _LGLCD_H_INCLUDED_
//** end of lglcd.h ***************************************************
|