context.h (1743B)
1 /* 2 * libdivecomputer 3 * 4 * Copyright (C) 2012 Jef Driesen 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library 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 GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301 USA 20 */ 21 22 #ifndef DC_CONTEXT_H 23 #define DC_CONTEXT_H 24 25 #include "common.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif /* __cplusplus */ 30 31 typedef struct dc_context_t dc_context_t; 32 33 typedef enum dc_loglevel_t { 34 DC_LOGLEVEL_NONE, 35 DC_LOGLEVEL_ERROR, 36 DC_LOGLEVEL_WARNING, 37 DC_LOGLEVEL_INFO, 38 DC_LOGLEVEL_DEBUG, 39 DC_LOGLEVEL_ALL 40 } dc_loglevel_t; 41 42 typedef void (*dc_logfunc_t) (dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsigned int line, const char *function, const char *message, void *userdata); 43 44 dc_status_t 45 dc_context_new (dc_context_t **context); 46 47 dc_status_t 48 dc_context_free (dc_context_t *context); 49 50 dc_status_t 51 dc_context_set_loglevel (dc_context_t *context, dc_loglevel_t loglevel); 52 53 dc_status_t 54 dc_context_set_logfunc (dc_context_t *context, dc_logfunc_t logfunc, void *userdata); 55 56 unsigned int 57 dc_context_get_transports (dc_context_t *context); 58 59 #ifdef __cplusplus 60 } 61 #endif /* __cplusplus */ 62 #endif /* DC_CONTEXT_H */