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

iostream-private.h (2823B)


      1 /*
      2  * libdivecomputer
      3  *
      4  * Copyright (C) 2016 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_IOSTREAM_PRIVATE_H
     23 #define DC_IOSTREAM_PRIVATE_H
     24 
     25 #include <libdivecomputer/common.h>
     26 #include <libdivecomputer/context.h>
     27 #include <libdivecomputer/iostream.h>
     28 
     29 #ifdef __cplusplus
     30 extern "C" {
     31 #endif /* __cplusplus */
     32 
     33 typedef struct dc_iostream_vtable_t dc_iostream_vtable_t;
     34 
     35 struct dc_iostream_t {
     36 	const dc_iostream_vtable_t *vtable;
     37 	dc_context_t *context;
     38 	dc_transport_t transport;
     39 };
     40 
     41 struct dc_iostream_vtable_t {
     42 	size_t size;
     43 
     44 	dc_status_t (*set_timeout) (dc_iostream_t *iostream, int timeout);
     45 
     46 	dc_status_t (*set_break) (dc_iostream_t *iostream, unsigned int value);
     47 
     48 	dc_status_t (*set_dtr) (dc_iostream_t *iostream, unsigned int value);
     49 
     50 	dc_status_t (*set_rts) (dc_iostream_t *iostream, unsigned int value);
     51 
     52 	dc_status_t (*get_lines) (dc_iostream_t *iostream, unsigned int *value);
     53 
     54 	dc_status_t (*get_available) (dc_iostream_t *iostream, size_t *value);
     55 
     56 	dc_status_t (*configure) (dc_iostream_t *iostream, unsigned int baudrate, unsigned int databits, dc_parity_t parity, dc_stopbits_t stopbits, dc_flowcontrol_t flowcontrol);
     57 
     58 	dc_status_t (*poll) (dc_iostream_t *iostream, int timeout);
     59 
     60 	dc_status_t (*read) (dc_iostream_t *iostream, void *data, size_t size, size_t *actual);
     61 
     62 	dc_status_t (*write) (dc_iostream_t *iostream, const void *data, size_t size, size_t *actual);
     63 
     64 	dc_status_t (*ioctl) (dc_iostream_t *iostream, unsigned int request, void *data, size_t size);
     65 
     66 	dc_status_t (*flush) (dc_iostream_t *iostream);
     67 
     68 	dc_status_t (*purge) (dc_iostream_t *iostream, dc_direction_t direction);
     69 
     70 	dc_status_t (*sleep) (dc_iostream_t *iostream, unsigned int milliseconds);
     71 
     72 	dc_status_t (*close) (dc_iostream_t *iostream);
     73 };
     74 
     75 dc_iostream_t *
     76 dc_iostream_allocate (dc_context_t *context, const dc_iostream_vtable_t *vtable, dc_transport_t transport);
     77 
     78 void
     79 dc_iostream_deallocate (dc_iostream_t *iostream);
     80 
     81 int
     82 dc_iostream_isinstance (dc_iostream_t *iostream, const dc_iostream_vtable_t *vtable);
     83 
     84 #ifdef __cplusplus
     85 }
     86 #endif /* __cplusplus */
     87 #endif /* DC_IOSTREAM_PRIVATE_H */