libwacom
Wacom model identification library
/home/hadess/Projects/jhbuild/libwacom/libwacom/libwacom.h
Go to the documentation of this file.
00001 /*
00002  * Copyright © 2011 Red Hat, Inc.
00003  *
00004  * Permission to use, copy, modify, distribute, and sell this software
00005  * and its documentation for any purpose is hereby granted without
00006  * fee, provided that the above copyright notice appear in all copies
00007  * and that both that copyright notice and this permission notice
00008  * appear in supporting documentation, and that the name of Red Hat
00009  * not be used in advertising or publicity pertaining to distribution
00010  * of the software without specific, written prior permission.  Red
00011  * Hat makes no representations about the suitability of this software
00012  * for any purpose.  It is provided "as is" without express or implied
00013  * warranty.
00014  *
00015  * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00016  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
00017  * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
00018  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
00019  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
00020  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00021  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00022  *
00023  * Authors:
00024  *      Peter Hutterer (peter.hutterer@redhat.com)
00025  */
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #include "config.h"
00029 #endif
00030 
00031 
00032 #ifndef _LIBWACOM_H_
00033 #define _LIBWACOM_H_
00034 
00073 typedef struct _WacomDevice WacomDevice;
00074 
00075 typedef struct _WacomStylus WacomStylus;
00076 
00077 typedef struct _WacomError WacomError;
00078 
00079 typedef struct _WacomDeviceDatabase WacomDeviceDatabase;
00080 
00081 #define WACOM_STYLUS_FALLBACK_ID 0xfffff
00082 #define WACOM_ERASER_FALLBACK_ID 0xffffe
00083 
00087 enum WacomErrorCode {
00088     WERROR_NONE,                
00089     WERROR_BAD_ALLOC,           
00090     WERROR_INVALID_PATH,        
00091     WERROR_INVALID_DB,          
00092     WERROR_BAD_ACCESS,          
00093     WERROR_UNKNOWN_MODEL,       
00094 };
00095 
00099 typedef enum {
00100     WBUSTYPE_UNKNOWN,           
00101     WBUSTYPE_USB,               
00102     WBUSTYPE_SERIAL,            
00103     WBUSTYPE_BLUETOOTH          
00104 } WacomBusType;
00105 
00109 typedef enum {
00110     WCLASS_UNKNOWN,             
00111     WCLASS_INTUOS3,             
00112     WCLASS_INTUOS4,             
00113     WCLASS_CINTIQ,              
00114     WCLASS_BAMBOO,              
00115     WCLASS_GRAPHIRE,            
00116     WCLASS_ISDV4,               
00117 } WacomClass;
00118 
00122 typedef enum {
00123     WSTYLUS_UNKNOWN,
00124     WSTYLUS_GENERAL,
00125     WSTYLUS_INKING,
00126     WSTYLUS_AIRBRUSH,
00127     WSTYLUS_CLASSIC,
00128     WSTYLUS_MARKER,
00129     WSTYLUS_STROKE,
00130     WSTYLUS_PUCK
00131 } WacomStylusType;
00132 
00136 typedef enum {
00137         WACOM_BUTTON_NONE                   = 0,
00138         WACOM_BUTTON_POSITION_LEFT          = (1 << 1),
00139         WACOM_BUTTON_POSITION_RIGHT         = (1 << 2),
00140         WACOM_BUTTON_POSITION_TOP           = (1 << 3),
00141         WACOM_BUTTON_POSITION_BOTTOM        = (1 << 4),
00142         WACOM_BUTTON_RING_MODESWITCH        = (1 << 5),
00143         WACOM_BUTTON_RING2_MODESWITCH       = (1 << 6),
00144         WACOM_BUTTON_TOUCHSTRIP_MODESWITCH  = (1 << 7),
00145         WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH = (1 << 8),
00146         WACOM_BUTTON_OLED                   = (1 << 9),
00147         WACOM_BUTTON_MODESWITCH             = (WACOM_BUTTON_RING_MODESWITCH | WACOM_BUTTON_RING2_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH),
00148         WACOM_BUTTON_DIRECTION              = (WACOM_BUTTON_POSITION_LEFT | WACOM_BUTTON_POSITION_RIGHT | WACOM_BUTTON_POSITION_TOP | WACOM_BUTTON_POSITION_BOTTOM),
00149         WACOM_BUTTON_RINGS_MODESWITCH       = (WACOM_BUTTON_RING_MODESWITCH | WACOM_BUTTON_RING2_MODESWITCH),
00150         WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH = (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH),
00151 } WacomButtonFlags;
00152 
00159 WacomError* libwacom_error_new(void);
00160 
00168 void libwacom_error_free(WacomError **error);
00169 
00173 enum WacomErrorCode libwacom_error_get_code(WacomError *error);
00174 
00178 const char* libwacom_error_get_message(WacomError *error);
00179 
00186 WacomDeviceDatabase* libwacom_database_new(void);
00187 
00196 WacomDeviceDatabase* libwacom_database_new_for_path(const char *datadir);
00197 
00203 void libwacom_database_destroy(WacomDeviceDatabase *db);
00204 
00217 WacomDevice* libwacom_new_from_path(WacomDeviceDatabase *db, const char *path, int fallback, WacomError *error);
00218 
00231 WacomDevice* libwacom_new_from_usbid(WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error);
00232 
00244 WacomDevice* libwacom_new_from_name(WacomDeviceDatabase *db, const char *name, WacomError *error);
00245 
00251 void libwacom_destroy(WacomDevice *device);
00252 
00257 WacomClass libwacom_get_class(WacomDevice *device);
00258 
00263 const char* libwacom_get_name(WacomDevice *device);
00264 
00269 int libwacom_get_vendor_id(WacomDevice *device);
00270 
00275 const char* libwacom_get_match(WacomDevice *device);
00276 
00281 int libwacom_get_product_id(WacomDevice *device);
00282 
00291 int libwacom_get_width(WacomDevice *device);
00292 
00301 int libwacom_get_height(WacomDevice *device);
00302 
00307 int libwacom_has_stylus(WacomDevice *device);
00308 
00313 int libwacom_has_touch(WacomDevice *device);
00314 
00319 int libwacom_get_num_buttons(WacomDevice *device);
00320 
00326 int *libwacom_get_supported_styli(WacomDevice *device, int *num_styli);
00327 
00332 int libwacom_has_ring(WacomDevice *device);
00333 
00338 int libwacom_has_ring2(WacomDevice *device);
00339 
00344 int libwacom_get_ring_num_modes(WacomDevice *device);
00345 
00350 int libwacom_get_ring2_num_modes(WacomDevice *device);
00351 
00357 int libwacom_get_num_strips(WacomDevice *device);
00358 
00363 int libwacom_get_strips_num_modes(WacomDevice *device);
00364 
00370 int libwacom_is_builtin(WacomDevice *device);
00371 
00377 int libwacom_is_reversible(WacomDevice *device);
00378 
00383 WacomBusType libwacom_get_bustype(WacomDevice *device);
00384 
00385 /*
00386  * @param device The tablet to query
00387  * @param button The ID of the button to check for, between 'A' and 'Z'
00388  * @return a WacomButtonFlags with information about the button
00389  */
00390 WacomButtonFlags libwacom_get_button_flag(WacomDevice *device,
00391                                           char         button);
00392 
00400 const WacomStylus *libwacom_stylus_get_for_id (WacomDeviceDatabase *db, int id);
00401 
00406 int         libwacom_stylus_get_id (const WacomStylus *stylus);
00407 
00412 const char *libwacom_stylus_get_name (const WacomStylus *stylus);
00413 
00418 int         libwacom_stylus_get_num_buttons (const WacomStylus *stylus);
00419 
00424 int         libwacom_stylus_has_eraser (const WacomStylus *stylus);
00425 
00430 int         libwacom_stylus_is_eraser (const WacomStylus *stylus);
00431 
00436 int         libwacom_stylus_has_lens (const WacomStylus *stylus);
00437 
00442 WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus);
00443 
00444 #endif /* _LIBWACOM_H_ */
00445 
00446 /* vim: set noexpandtab shiftwidth=8: */
 All Files Functions Typedefs Enumerations Enumerator Defines