File: serial.h

package info (click to toggle)
libusbgx 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 992 kB
  • sloc: ansic: 13,134; xml: 176; makefile: 73; sh: 64; cpp: 14
file content (52 lines) | stat: -rw-r--r-- 1,622 bytes parent folder | download | duplicates (3)
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
/*
 * 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.
 */

#ifndef USBG_FUNCTION_SERIAL__
#define USBG_FUNCTION_SERIAL__

#include <usbg/usbg.h>

#ifdef __cplusplus
extern "C" {
#endif

struct usbg_f_serial;
typedef struct usbg_f_serial usbg_f_serial;

/**
 * @brief Convert from generic function to serial function
 * @param[in] f function to be converted to serial funciton.
 *         Function should be one of types: serial, ACM, OBEX.
 * @return Converted serial function or NULL if function hasn't suitable type
 */
usbg_f_serial *usbg_to_serial_function(usbg_function *f);

/**
 * @brief Convert form serial function to generic one
 * @param[in] sf function to be converted to generic one
 * @return Generic usbg function
 */
usbg_function *usbg_from_serial_function(usbg_f_serial *sf);

/**
 * @brief Get the id of device side tty port (/dev/ttyGS<port_num>)
 * @param[in] sf Pointer to serial function
 * @param[out] port_num the id of device side tty port
 * @return 0 on success usbg_error if error occurred.
 */
int usbg_f_serial_get_port_num(usbg_f_serial *sf, int *port_num);

#ifdef __cplusplus
}
#endif

#endif /* USBG_FUNCTION_SERIAL__ */