/usr/include/libzia/zserial.h is in libzia-dev 4.09-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /*
zserial - portable serial port api
Copyright (C) 2011 Ladislav Vaiz <ok1zia@nagano.cz>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
#ifndef __ZSERIAL_H
#define __ZSERIAL_H
#include <libziaint.h>
#include <glib.h>
#ifdef Z_HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef Z_HAVE_WINDOWS_H
#include <windows.h>
#endif
enum zserial_type{
ZSERTYPE_TTY,
ZSERTYPE_FTDI,
ZSERTYPE_WIN32,
ZSERTYPE_TCP,
ZSERTYPE_PROC_WIN32,
ZSERTYPE_PROC_PTY,
ZSERTYPE_PROC_PIPE
};
struct zserial_port{
char *filename;
char *desc;
};
struct zserial{
enum zserial_type type;
GString *errorstr;
char *id;
int baudrate;
int bits;
char parity;
int stopbits;
#ifdef Z_HAVE_TERMIOS_H
int fd;
int locked;
#endif
#ifdef Z_HAVE_LIBFTDI
int vid;
struct ftdi_context *ftdi;
char *serial;
#endif
#ifdef Z_MSC_MINGW
HANDLE handle;
HANDLE prochandle, procstdin, procstdout;
#endif
#if defined(Z_HAVE_TERMIOS_H) || defined(WIN32) || defined(Z_ANDROID)
char *filename;
#endif
GThread *thread;
int thread_break;
int pipefds[2];
char *cmd, *arg;
int pid;
#ifdef Z_HAVE_PTY_H
int master;
#endif
int read_fd; // stdout and stderr of child
int write_fd; // stdin of child
char *hostname;
int port;
int sock;
int (*zs_open)(struct zserial *zser);
int (*zs_read)(struct zserial *zser, void *data, int len, int timeout_ms);
int (*zs_write)(struct zserial *zser, void *data, int len);
int (*zs_close)(struct zserial *zser);
int (*zs_dtr)(struct zserial *zser, int on);
int (*zs_rts)(struct zserial *zser, int on);
int (*zs_detect)(struct zserial *zser);
int nolocks;
GPtrArray *ports; // detected zserial_ports
};
struct zserial *zserial_init(void);
struct zserial *zserial_init_tty(const char *filename);
struct zserial *zserial_init_ftdi(const int vid, const int pid, char *serial);
struct zserial *zserial_init_win32(const char *filename);
struct zserial *zserial_init_tcp(const char *hostname, const int tcpport);
struct zserial *zserial_init_proc_win32(const char *cmd, const char *arg);
struct zserial *zserial_init_proc_pty(const char *cmd, const char *arg);
struct zserial *zserial_init_proc_pipe(const char *cmd, const char *arg);
struct zserial *zserial_init_serial(const char *device);
struct zserial *zserial_init_process(const char *cmd, const char *arg);
void zserial_set_line(struct zserial *zser, int baudrate, int bits, char parity, int stopbits);
int zserial_open(struct zserial *zser);
int zserial_read(struct zserial *zser, void *data, int len, int timeout_ms);
int zserial_write(struct zserial *zser, void *data, int len);
int zserial_close(struct zserial *zser);
void zserial_free(struct zserial *zser);
const char *zserial_errorstr(struct zserial *zser);
/* nastavĂ DTR (DB9 = pin 4) */
int zserial_dtr(struct zserial *zser, int on);
/* nastavĂ RTS (DB9 = pin 7) */
int zserial_rts(struct zserial *zser, int on);
int zserial_fd(struct zserial *zser);
const char *zserial_id(struct zserial *zser);
int zserial_prot(struct zserial *zser, char saddr, char fce, char *data, int *len, int timeout);
void zserial_nolocks(struct zserial *zser, int nolocks);
int zserial_detect(struct zserial *zser);
#endif
|