Initial transport abstraction layer implementation.
[libjaylink.git] / libjaylink / libjaylink.h
blob134b36afe8d2f883542b0e0df1f38c750a4e9577
1 /*
2 * This file is part of the libjaylink project.
4 * Copyright (C) 2014 Marc Schink <jaylink-dev@marcschink.de>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef LIBJAYLINK_LIBJAYLINK_H
21 #define LIBJAYLINK_LIBJAYLINK_H
23 #include <stdlib.h>
24 #include <stdint.h>
26 enum jaylink_error {
27 JAYLINK_OK = 0,
28 JAYLINK_ERR = -1,
29 JAYLINK_ERR_MALLOC = -2,
30 JAYLINK_ERR_ARG = -3
33 enum jaylink_log_level {
34 JAYLINK_LOG_LEVEL_NONE = 0,
35 JAYLINK_LOG_LEVEL_ERROR = 1,
36 JAYLINK_LOG_LEVEL_WARNING = 2,
37 JAYLINK_LOG_LEVEL_INFO = 3,
38 JAYLINK_LOG_LEVEL_DEBUG = 4
41 struct jaylink_context;
42 struct jaylink_device;
43 struct jaylink_device_handle;
45 int jaylink_init(struct jaylink_context **ctx);
46 void jaylink_exit(struct jaylink_context *ctx);
48 int jaylink_log_set_level(struct jaylink_context *ctx, int level);
49 int jaylink_log_get_level(const struct jaylink_context *ctx);
51 ssize_t jaylink_get_device_list(struct jaylink_context *ctx,
52 struct jaylink_device ***list);
54 void jaylink_free_device_list(struct jaylink_device **list, int unref_devices);
56 int jaylink_device_get_serial_number(const struct jaylink_device *dev,
57 uint32_t *serial_number);
59 int jaylink_device_get_usb_address(const struct jaylink_device *dev);
61 struct jaylink_device *jaylink_ref_device(struct jaylink_device *dev);
62 void jaylink_unref_device(struct jaylink_device *dev);
64 int jaylink_open(struct jaylink_device *dev,
65 struct jaylink_device_handle **devh);
67 void jaylink_close(struct jaylink_device_handle *devh);
69 #endif /* LIBJAYLINK_LIBJAYLINK_H */