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 } WacomStylusType;
00131 
00138 WacomError* libwacom_error_new(void);
00139 
00147 void libwacom_error_free(WacomError **error);
00148 
00152 enum WacomErrorCode libwacom_error_get_code(WacomError *error);
00153 
00157 const char* libwacom_error_get_message(WacomError *error);
00158 
00165 WacomDeviceDatabase* libwacom_database_new(void);
00166 
00175 WacomDeviceDatabase* libwacom_database_new_for_path(const char *datadir);
00176 
00182 void libwacom_database_destroy(WacomDeviceDatabase *db);
00183 
00196 WacomDevice* libwacom_new_from_path(WacomDeviceDatabase *db, const char *path, int fallback, WacomError *error);
00197 
00210 WacomDevice* libwacom_new_from_usbid(WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error);
00211 
00223 WacomDevice* libwacom_new_from_name(WacomDeviceDatabase *db, const char *name, WacomError *error);
00224 
00230 void libwacom_destroy(WacomDevice *device);
00231 
00236 WacomClass libwacom_get_class(WacomDevice *device);
00237 
00242 const char* libwacom_get_vendor(WacomDevice *device);
00243 
00248 int libwacom_get_vendor_id(WacomDevice *device);
00249 
00254 const char* libwacom_get_product(WacomDevice *device);
00255 
00260 const char* libwacom_get_match(WacomDevice *device);
00261 
00266 int libwacom_get_product_id(WacomDevice *device);
00267 
00276 int libwacom_get_width(WacomDevice *device);
00277 
00286 int libwacom_get_height(WacomDevice *device);
00287 
00292 int libwacom_has_stylus(WacomDevice *device);
00293 
00298 int libwacom_has_touch(WacomDevice *device);
00299 
00304 int libwacom_get_num_buttons(WacomDevice *device);
00305 
00311 int *libwacom_get_supported_styli(WacomDevice *device, int *num_styli);
00312 
00317 int libwacom_has_ring(WacomDevice *device);
00318 
00323 int libwacom_has_ring2(WacomDevice *device);
00324 
00330 int libwacom_has_vstrip(WacomDevice *device);
00331 
00337 int libwacom_has_hstrip(WacomDevice *device);
00338 
00344 int libwacom_is_builtin(WacomDevice *device);
00345 
00351 int libwacom_is_reversible(WacomDevice *device);
00352 
00357 WacomBusType libwacom_get_bustype(WacomDevice *device);
00358 
00366 const WacomStylus *libwacom_stylus_get_for_id (WacomDeviceDatabase *db, int id);
00367 
00372 int         libwacom_stylus_get_id (const WacomStylus *stylus);
00373 
00378 const char *libwacom_stylus_get_name (const WacomStylus *stylus);
00379 
00384 int         libwacom_stylus_get_num_buttons (const WacomStylus *stylus);
00385 
00390 int         libwacom_stylus_has_eraser (const WacomStylus *stylus);
00391 
00396 int         libwacom_stylus_is_eraser (const WacomStylus *stylus);
00397 
00402 WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus);
00403 
00404 #endif /* _LIBWACOM_H_ */
00405 
00406 /* vim: set noexpandtab shiftwidth=8: */
 All Files Functions Typedefs Enumerations Enumerator Defines