This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
serial.h
53 lines (38 loc) · 1.68 KB
/
serial.h
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
/******************************************************************************
Copyright © 2008,2009 Brendt Wohlberg
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License at
http://www.gnu.org/licenses/gpl-2.0.txt.
This program 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
General Public License for more details.
Most recent modification: 29 May 2009
******************************************************************************/
#ifndef _SERIAL_H
#define _SERIAL_H
#include <unistd.h>
#include <stdio.h>
#if ENABLE_LINUX_BT-0
#include <bluetooth/bluetooth.h>
typedef struct {
bdaddr_t bdaddr;
char name[128];
} bt_device_t;
int bt_scan(bt_device_t* btdp, unsigned short mndv);
int bt_scan_print(FILE *strm, const bt_device_t* btdp, unsigned short ndv);
int bt_open(const char *addrs, unsigned short chn);
#endif /* ENABLE_LINUX_BT */
int bt_close(int sck);
int dev_speed_valid(unsigned int speed);
int dev_open(const char *devs);
int dev_config_serial(int fd, unsigned int speed);
int dev_close(int fd);
ssize_t serial_read(int fd, char *buf, size_t bsz, long int tmt);
ssize_t serial_write(int fd, const char *buf, size_t bsz);
ssize_t serial_read_repeat(int fd, char *buf, size_t bsz, long int tmt);
ssize_t serial_read_discard(int fd, char *buf, size_t bsz, size_t pos,
const char *str, long int tmt);
ssize_t serial_read_string(int fd, char *buf, size_t bsz, size_t pos,
const char *bgn, const char *end, long int tmt);
#endif