MCP2210 Library
An Open Source MCP2210 Library for Linux.
hidapi.h
Go to the documentation of this file.
00001 /*******************************************************
00002  HIDAPI - Multi-Platform library for
00003  communication with HID devices.
00004 
00005  Alan Ott
00006  Signal 11 Software
00007 
00008  8/22/2009
00009 
00010  Copyright 2009, All Rights Reserved.
00011 
00012  At the discretion of the user of this library,
00013  this software may be licensed under the terms of the
00014  GNU Public License v3, a BSD-Style license, or the
00015  original HIDAPI license as outlined in the LICENSE.txt,
00016  LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
00017  files located at the root of the source distribution.
00018  These files may also be found in the public source
00019  code repository located at:
00020         http://github.com/signal11/hidapi .
00021 ********************************************************/
00022 
00027 #ifndef HIDAPI_H__
00028 #define HIDAPI_H__
00029 
00030 #include <wchar.h>
00031 
00032 #ifdef _WIN32
00033       #define HID_API_EXPORT __declspec(dllexport)
00034       #define HID_API_CALL
00035 #else
00036       #define HID_API_EXPORT 
00037       #define HID_API_CALL 
00038 #endif
00039 
00040 #define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045           struct hid_device_;
00046           typedef struct hid_device_ hid_device; 
00049           struct hid_device_info {
00051                char *path;
00053                unsigned short vendor_id;
00055                unsigned short product_id;
00057                wchar_t *serial_number;
00060                unsigned short release_number;
00062                wchar_t *manufacturer_string;
00064                wchar_t *product_string;
00067                unsigned short usage_page;
00070                unsigned short usage;
00075                int interface_number;
00076 
00078                struct hid_device_info *next;
00079           };
00080 
00081 
00096           int HID_API_EXPORT HID_API_CALL hid_init(void);
00097 
00109           int HID_API_EXPORT HID_API_CALL hid_exit(void);
00110 
00130           struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
00131 
00140           void  HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs);
00141 
00158           HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
00159 
00173           HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path);
00174 
00201           int  HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length);
00202 
00221           int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
00222 
00240           int  HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
00241 
00260           int  HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock);
00261 
00288           int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length);
00289 
00309           int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length);
00310 
00316           void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device);
00317 
00328           int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen);
00329 
00340           int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen);
00341 
00352           int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen);
00353 
00365           int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen);
00366 
00376           HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device);
00377 
00378 #ifdef __cplusplus
00379 }
00380 #endif
00381 
00382 #endif
00383 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines