2 * Copyright © 2010 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
27 # define PUBLIC __declspec(dllexport)
29 # define PUBLIC __declspec(dllimport)
31 # endif /* BUILD_STATIC */
48 struct altos_bt_device {
60 #define LIBALTOS_SUCCESS 0
61 #define LIBALTOS_ERROR -1
62 #define LIBALTOS_TIMEOUT -2
64 /* Returns 0 for success, < 0 on error */
72 altos_get_last_error(struct altos_error *error);
74 PUBLIC struct altos_list *
75 altos_list_start(void);
77 PUBLIC struct altos_list *
78 altos_ftdi_list_start(void);
80 /* Returns 1 for success, zero on end of list */
82 altos_list_next(struct altos_list *list, struct altos_device *device);
85 altos_list_finish(struct altos_list *list);
87 PUBLIC struct altos_file *
88 altos_open(struct altos_device *device);
91 altos_close(struct altos_file *file);
94 altos_free(struct altos_file *file);
96 /* Returns < 0 for error */
98 altos_putchar(struct altos_file *file, char c);
100 /* Returns < 0 for error */
102 altos_flush(struct altos_file *file);
104 /* Returns < 0 for error or timeout. timeout of 0 == wait forever */
106 altos_getchar(struct altos_file *file, int timeout);
108 PUBLIC struct altos_bt_list *
109 altos_bt_list_start(int inquiry_time);
112 altos_bt_list_next(struct altos_bt_list *list, struct altos_bt_device *device);
115 altos_bt_list_finish(struct altos_bt_list *list);
118 altos_bt_fill_in(char *name, char *addr, struct altos_bt_device *device);
120 PUBLIC struct altos_file *
121 altos_bt_open(struct altos_bt_device *device);
123 #endif /* _LIBALTOS_H_ */