subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

serial.h (2783B)


      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_SERIAL_H
     23 #define DC_SERIAL_H
     24 
     25 #include "common.h"
     26 #include "context.h"
     27 #include "iostream.h"
     28 #include "iterator.h"
     29 #include "descriptor.h"
     30 #include "ioctl.h"
     31 
     32 #ifdef __cplusplus
     33 extern "C" {
     34 #endif /* __cplusplus */
     35 
     36 /**
     37  * Opaque object representing a serial device.
     38  */
     39 typedef struct dc_serial_device_t dc_serial_device_t;
     40 
     41 /**
     42  * Get the device node of the serial device.
     43  *
     44  * @param[in]  device  A valid serial device.
     45  */
     46 const char *
     47 dc_serial_device_get_name (dc_serial_device_t *device);
     48 
     49 /**
     50  * Destroy the serial device and free all resources.
     51  *
     52  * @param[in]  device  A valid serial device.
     53  */
     54 void
     55 dc_serial_device_free (dc_serial_device_t *device);
     56 
     57 /**
     58  * Create an iterator to enumerate the serial devices.
     59  *
     60  * @param[out] iterator    A location to store the iterator.
     61  * @param[in]  context     A valid context object.
     62  * @param[in]  descriptor  A valid device descriptor or NULL.
     63  * @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
     64  * on failure.
     65  */
     66 dc_status_t
     67 dc_serial_iterator_new (dc_iterator_t **iterator, dc_context_t *context, dc_descriptor_t *descriptor);
     68 
     69 /**
     70  * Open a serial connection.
     71  *
     72  * @param[out]  iostream A location to store the serial connection.
     73  * @param[in]   context  A valid context object.
     74  * @param[in]   name     The name of the device node.
     75  * @returns #DC_STATUS_SUCCESS on success, or another #dc_status_t code
     76  * on failure.
     77  */
     78 dc_status_t
     79 dc_serial_open (dc_iostream_t **iostream, dc_context_t *context, const char *name);
     80 
     81 /**
     82  * Set the receive latency in milliseconds.
     83  *
     84  * The effect of this setting is highly platform and driver specific. On
     85  * Windows it does nothing at all, on Linux it controls the low latency
     86  * flag (e.g. only zero vs non-zero latency), and on Mac OS X it sets
     87  * the receive latency as requested.
     88  */
     89 #define DC_IOCTL_SERIAL_SET_LATENCY DC_IOCTL_IOW('s', 0, sizeof(unsigned int))
     90 
     91 #ifdef __cplusplus
     92 }
     93 #endif /* __cplusplus */
     94 #endif /* DC_SERIAL_H */