irda.h (2563B)
1 /* 2 * libdivecomputer 3 * 4 * Copyright (C) 2008 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_IRDA_H 23 #define DC_IRDA_H 24 25 #include "common.h" 26 #include "context.h" 27 #include "iostream.h" 28 #include "iterator.h" 29 #include "descriptor.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif /* __cplusplus */ 34 35 /** 36 * Opaque object representing an IrDA device. 37 */ 38 typedef struct dc_irda_device_t dc_irda_device_t; 39 40 /** 41 * Get the address of the IrDA device. 42 * 43 * @param[in] device A valid IrDA device. 44 */ 45 unsigned int 46 dc_irda_device_get_address (dc_irda_device_t *device); 47 48 /** 49 * Get the name of the IrDA device. 50 * 51 * @param[in] device A valid IrDA device. 52 */ 53 const char * 54 dc_irda_device_get_name (dc_irda_device_t *device); 55 56 /** 57 * Destroy the IrDA device and free all resources. 58 * 59 * @param[in] device A valid IrDA device. 60 */ 61 void 62 dc_irda_device_free (dc_irda_device_t *device); 63 64 /** 65 * Create an iterator to enumerate the IrDA devices. 66 * 67 * @param[out] iterator A location to store the iterator. 68 * @param[in] context A valid context object. 69 * @param[in] descriptor A valid device descriptor or NULL. 70 * @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code 71 * on failure. 72 */ 73 dc_status_t 74 dc_irda_iterator_new (dc_iterator_t **iterator, dc_context_t *context, dc_descriptor_t *descriptor); 75 76 /** 77 * Open an IrDA connection. 78 * 79 * @param[out] iostream A location to store the IrDA connection. 80 * @param[in] context A valid context object. 81 * @param[in] address The IrDA device address. 82 * @param[in] lsap The IrDA LSAP number. 83 * @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code 84 * on failure. 85 */ 86 dc_status_t 87 dc_irda_open (dc_iostream_t **iostream, dc_context_t *context, unsigned int address, unsigned int lsap); 88 89 #ifdef __cplusplus 90 } 91 #endif /* __cplusplus */ 92 #endif /* DC_IRDA_H */