@@ -10,6 +10,18 typedef int rs232speed_t; | |||||
10 | typedef enum {rs232OneStop,rs232One5Stop,rs232TwoStop}rs232stop; |
|
10 | typedef enum {rs232OneStop,rs232One5Stop,rs232TwoStop}rs232stop; | |
11 | typedef enum {rs232parityNo,rs232parityOdd,rs232parityEven}rs232parity; |
|
11 | typedef enum {rs232parityNo,rs232parityOdd,rs232parityEven}rs232parity; | |
12 |
|
12 | |||
|
13 | #ifdef __cplusplus | |||
|
14 | extern "C" { | |||
|
15 | #endif | |||
|
16 | typedef struct rs232portslist_t | |||
|
17 | { | |||
|
18 | char* name; | |||
|
19 | struct rs232portslist_t* next; | |||
|
20 | }rs232portslist_t; | |||
|
21 | #ifdef __cplusplus | |||
|
22 | } | |||
|
23 | #endif | |||
|
24 | ||||
13 |
|
25 | |||
14 | #ifdef __cplusplus |
|
26 | #ifdef __cplusplus | |
15 | #define rs232extern extern "C" |
|
27 | #define rs232extern extern "C" | |
@@ -17,6 +29,8 typedef enum {rs232parityNo,rs232parityO | |||||
17 | #define rs232extern extern |
|
29 | #define rs232extern extern | |
18 | #endif |
|
30 | #endif | |
19 | rs232extern rs232port_t rs232open(char* psPortName); |
|
31 | rs232extern rs232port_t rs232open(char* psPortName); | |
|
32 | rs232extern rs232portslist_t* rs232getportlist(); | |||
|
33 | rs232extern void rs232deleteportlist(rs232portslist_t* list); | |||
20 | rs232extern int rs232close(rs232port_t fd); |
|
34 | rs232extern int rs232close(rs232port_t fd); | |
21 | rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop); |
|
35 | rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop); | |
22 | rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize); |
|
36 | rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize); |
@@ -3,6 +3,7 | |||||
3 | #include <fcntl.h> |
|
3 | #include <fcntl.h> | |
4 | #include <string.h> |
|
4 | #include <string.h> | |
5 | #include <errno.h> |
|
5 | #include <errno.h> | |
|
6 | #include <malloc.h> | |||
6 | #include "rs232config.h" |
|
7 | #include "rs232config.h" | |
7 | #ifdef HAVE_TERMIOS_H |
|
8 | #ifdef HAVE_TERMIOS_H | |
8 | #include <termios.h> |
|
9 | #include <termios.h> | |
@@ -42,6 +43,16 int rs232close(rs232port_t fd) | |||||
42 | } |
|
43 | } | |
43 | } |
|
44 | } | |
44 |
|
45 | |||
|
46 | rs232portslist_t* rs232getportlist() | |||
|
47 | { | |||
|
48 | ||||
|
49 | ||||
|
50 | } | |||
|
51 | ||||
|
52 | void rs232deleteportlist(rs232portslist_t* list) | |||
|
53 | { | |||
|
54 | ||||
|
55 | } | |||
45 |
|
56 | |||
46 | int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop) |
|
57 | int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop) | |
47 | { |
|
58 | { |
@@ -4,6 +4,7 | |||||
4 | #include <fcntl.h> |
|
4 | #include <fcntl.h> | |
5 | #include <string.h> |
|
5 | #include <string.h> | |
6 | #include <errno.h> |
|
6 | #include <errno.h> | |
|
7 | #include <malloc.h> | |||
7 |
|
8 | |||
8 | #ifdef HAVE_WINDOWS_H |
|
9 | #ifdef HAVE_WINDOWS_H | |
9 | #include <windows.h> |
|
10 | #include <windows.h> | |
@@ -123,6 +124,17 int rs232close(rs232port_t fd) | |||||
123 | } |
|
124 | } | |
124 | } |
|
125 | } | |
125 |
|
126 | |||
|
127 | rs232portslist_t* rs232getportlist() | |||
|
128 | { | |||
|
129 | ||||
|
130 | } | |||
|
131 | ||||
|
132 | void rs232deleteportlist(rs232portslist_t* list) | |||
|
133 | { | |||
|
134 | ||||
|
135 | } | |||
|
136 | ||||
|
137 | ||||
126 | int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop) |
|
138 | int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop) | |
127 | { |
|
139 | { | |
128 | if (fd == (rs232port_t)INVALID_HANDLE_VALUE) |
|
140 | if (fd == (rs232port_t)INVALID_HANDLE_VALUE) |
General Comments 0
You need to be logged in to leave comments.
Login now