Subversion Repositories spk

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
79 cycrow 1
/*
2
 
3
  lglcd.h
4
 
5
  library definition for lglcd.a
6
  part of lglcd for Microsoft(R) Windows(R)
7
 
8
  The Logitech LCD SDK, including all acompanying documentation,
9
  is protected by intellectual property laws.  All use of the Logitech
10
  LCD SDK is subject to the License Agreement found in the
11
  "ReadMe License Agreement" file and in the Reference Manual.  All rights
12
  not expressly granted by Logitech are reserved.
13
 
14
 
15
  01/14/2005    1.00    initial draft
16
  02/23/2005    1.01    added callbacks, implemented changes as discussed
17
  02/08/2006    1.02    added call to set foreground, sync update with confirmation
18
 
19
*/
20
 
21
#ifndef _LGLCD_H_INCLUDED_
22
#define _LGLCD_H_INCLUDED_
23
 
24
#ifdef __cplusplus
25
extern "C" {
26
#endif
27
 
28
#pragma pack(push, 8)
29
 
30
//// Definitions
31
 
32
// Invalid handle definitions
33
#define LGLCD_INVALID_CONNECTION            (-1)
34
#define LGLCD_INVALID_DEVICE                (-1)
35
 
36
// Soft-Button masks
37
#define LGLCDBUTTON_BUTTON0                 (0x00000001)
38
#define LGLCDBUTTON_BUTTON1                 (0x00000002)
39
#define LGLCDBUTTON_BUTTON2                 (0x00000004)
40
#define LGLCDBUTTON_BUTTON3                 (0x00000008)
41
 
42
 
43
//************************************************************************
44
// lgLcdDeviceDesc
45
//************************************************************************
46
 
47
typedef struct
48
{
49
    DWORD Width;
50
    DWORD Height;
51
    DWORD Bpp;
52
    DWORD NumSoftButtons;
53
} lgLcdDeviceDesc;
54
 
55
 
56
//************************************************************************
57
// lgLcdBitmap
58
//************************************************************************
59
 
60
#define LGLCD_BMP_FORMAT_160x43x1           (0x00000001)
61
#define LGLCD_BMP_WIDTH                     (160)
62
#define LGLCD_BMP_HEIGHT                    (43)
63
 
64
typedef struct
65
{
66
    DWORD Format;
67
} lgLcdBitmapHeader;
68
 
69
typedef struct
70
{
71
    lgLcdBitmapHeader hdr;
72
    BYTE pixels[LGLCD_BMP_WIDTH*LGLCD_BMP_HEIGHT];
73
} lgLcdBitmap160x43x1;
74
 
75
// Priorities
76
#define LGLCD_PRIORITY_IDLE_NO_SHOW                 (0)
77
#define LGLCD_PRIORITY_BACKGROUND                   (64)	
78
#define LGLCD_PRIORITY_NORMAL                       (128)
79
#define LGLCD_PRIORITY_ALERT                        (255)
80
#define LGLCD_SYNC_UPDATE(priority)                 (0x80000000 | (priority))
81
#define LGLCD_SYNC_COMPLETE_WITHIN_FRAME(priority)  (0xC0000000 | (priority))
82
#define LGLCD_ASYNC_UPDATE(priority)                (priority)
83
 
84
// Foreground mode for client applications
85
#define LGLCD_LCD_FOREGROUND_APP_NO         (0)
86
#define LGLCD_LCD_FOREGROUND_APP_YES        (1)
87
 
88
//************************************************************************
89
// Callbacks
90
//************************************************************************
91
 
92
// Callback used to notify client of soft button change
93
typedef DWORD (WINAPI *lgLcdOnSoftButtonsCB)(IN int device,
94
                                             IN DWORD dwButtons,
95
                                             IN const PVOID pContext);
96
 
97
// Callback used to allow client to pop up a "configuration panel"
98
typedef DWORD (WINAPI *lgLcdOnConfigureCB)(IN int connection,
99
                                           IN const PVOID pContext);
100
 
101
 
102
//************************************************************************
103
// lgLcdConnectContext
104
//************************************************************************
105
typedef struct
106
{
107
    // Set to NULL if not configurable
108
    lgLcdOnConfigureCB configCallback;
109
    PVOID configContext;
110
} lgLcdConfigureContext;
111
 
112
typedef struct
113
{
114
    // "Friendly name" display in the listing
115
    LPCWSTR appFriendlyName;
116
    // isPersistent determines whether this connection persists in the list
117
    BOOL isPersistent;
118
    // isAutostartable determines whether the client can be started by
119
    // LCDMon
120
    BOOL isAutostartable;
121
    lgLcdConfigureContext onConfigure;
122
    // --> Connection handle
123
    int connection;
124
} lgLcdConnectContextW;
125
 
126
typedef struct
127
{
128
    // "Friendly name" display in the listing
129
    LPCSTR appFriendlyName;
130
    // isPersistent determines whether this connection persists in the list
131
    BOOL isPersistent;
132
    // isAutostartable determines whether the client can be started by
133
    // LCDMon
134
    BOOL isAutostartable;
135
    lgLcdConfigureContext onConfigure;
136
    // --> Connection handle
137
    int connection;
138
} lgLcdConnectContextA;
139
 
140
#ifdef UNICODE
141
typedef lgLcdConnectContextW lgLcdConnectContext;
142
#else
143
typedef lgLcdConnectContextA lgLcdConnectContext;
144
#endif
145
 
146
//************************************************************************
147
// lgLcdOpenContext
148
//************************************************************************
149
 
150
typedef struct
151
{
152
    // Set to NULL if no softbutton notifications are needed
153
    lgLcdOnSoftButtonsCB softbuttonsChangedCallback;
154
    PVOID softbuttonsChangedContext;
155
} lgLcdSoftbuttonsChangedContext;
156
 
157
typedef struct
158
{
159
    int connection;
160
    // Device index to open
161
    int index;
162
    lgLcdSoftbuttonsChangedContext onSoftbuttonsChanged;
163
    // --> Device handle
164
    int device;
165
} lgLcdOpenContext;
166
 
167
 
168
 
169
//************************************************************************
170
// Prototypes
171
//************************************************************************
172
 
173
// Initialize the library by calling this function.
174
DWORD WINAPI lgLcdInit(void);
175
 
176
// Must be called to release the library and free all allocated structures.
177
DWORD WINAPI lgLcdDeInit(void);
178
 
179
// Connect as a client to the LCD subsystem. Provide name to be
180
// displayed for user when viewing the user interface of the LCD module,
181
// as well as a configuration callback and context, and a flag that states
182
// whether this client is startable by LCDMon
183
DWORD WINAPI lgLcdConnectW(IN OUT lgLcdConnectContextW *ctx);
184
DWORD WINAPI lgLcdConnectA(IN OUT lgLcdConnectContextA *ctx);
185
#ifdef UNICODE
186
#define lgLcdConnect lgLcdConnectW
187
#else
188
#define lgLcdConnect lgLcdConnectA
189
#endif // !UNICODE
190
 
191
// Must be called to release the connection and free all allocated resources
192
DWORD WINAPI lgLcdDisconnect(int connection);
193
 
194
// To determine all connected LCD devices supported by this library, and
195
// their capabilities. Start with index 0, and increment by one, until
196
// the library returns an error (WHICH?).
197
DWORD WINAPI lgLcdEnumerate(IN int connection, IN int index,
198
                            OUT lgLcdDeviceDesc *description);
199
 
200
// Opens the LCD at position=index. Library sets the device parameter to
201
// its internal reference to the device. Calling application provides the
202
// device handle in all calls that access the LCD.
203
DWORD WINAPI lgLcdOpen(IN OUT lgLcdOpenContext *ctx);
204
 
205
// Closes the LCD. Must be paired with lgLcdOpen.
206
DWORD WINAPI lgLcdClose(IN int device);
207
 
208
// Reads the state of the soft buttons for the device.
209
DWORD WINAPI lgLcdReadSoftButtons(IN int device, OUT DWORD *buttons);
210
 
211
// Provides a bitmap to be displayed on the LCD. The priority field
212
// further describes the way in which the bitmap is to be applied.
213
DWORD WINAPI lgLcdUpdateBitmap(IN int device,
214
                               IN const lgLcdBitmapHeader *bitmap,
215
                               IN DWORD priority);
216
 
217
// Sets the calling application as the shown application on the LCD, and stops
218
// any type of rotation among other applications on the LCD.
219
DWORD WINAPI lgLcdSetAsLCDForegroundApp(IN int device, IN int foregroundYesNoFlag);
220
 
221
#pragma pack(pop)
222
 
223
#ifdef __cplusplus
224
}
225
#endif
226
 
227
#endif // _LGLCD_H_INCLUDED_
228
 
229
//** end of lglcd.h ***************************************************