libdc/src/irda.h
2017-11-25 10:26:49 +01:00

95 lines
2.9 KiB
C

/*
* libdivecomputer
*
* Copyright (C) 2008 Jef Driesen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#ifndef DC_IRDA_H
#define DC_IRDA_H
#include <libdivecomputer/common.h>
#include <libdivecomputer/context.h>
#include <libdivecomputer/iostream.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* IrDA enumeration callback.
*
* @param[in] address The IrDA device address.
* @param[in] name The IrDA device name.
* @param[in] charset The IrDA device character set.
* @param[in] hints The IrDA device hints.
* @param[in] userdata The user data pointer.
*/
typedef void (*dc_irda_callback_t) (unsigned int address, const char *name, unsigned int charset, unsigned int hints, void *userdata);
/**
* Open an IrDA connection.
*
* @param[out] iostream A location to store the IrDA connection.
* @param[in] context A valid context object.
* @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
* on failure.
*/
dc_status_t
dc_irda_open (dc_iostream_t **iostream, dc_context_t *context);
/**
* Enumerate the IrDA devices.
*
* @param[in] iostream A valid IrDA connection.
* @param[in] callback The callback function to call.
* @param[in] userdata User data to pass to the callback function.
* @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
* on failure.
*/
dc_status_t
dc_irda_discover (dc_iostream_t *iostream, dc_irda_callback_t callback, void *userdata);
/**
* Connect to an IrDA device.
*
* @param[in] iostream A valid IrDA connection.
* @param[in] address The IrDA device address.
* @param[in] name The IrDA service name.
* @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
* on failure.
*/
dc_status_t
dc_irda_connect_name (dc_iostream_t *iostream, unsigned int address, const char *name);
/**
* Connect to an IrDA device.
*
* @param[in] iostream A valid IrDA connection.
* @param[in] address The IrDA device address.
* @param[in] lsap The IrDA LSAP number.
* @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
* on failure.
*/
dc_status_t
dc_irda_connect_lsap (dc_iostream_t *iostream, unsigned int address, unsigned int lsap);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* DC_IRDA_H */