-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcommon.h
More file actions
49 lines (39 loc) · 730 Bytes
/
common.h
File metadata and controls
49 lines (39 loc) · 730 Bytes
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
#ifndef COMMON_H
#define COMMON_H
#include "err.h"
#define VERSION "0.0.3"
#define max(a,b) ((a) > (b) ? (a) : (b))
typedef enum {
// part of the spec
RESPONSE_ACK,
RESPONSE_NAK,
RESPONSE_CANCEL,
RESPONSE_WAIT,
// not part of the spec
RESPONSE_TIMEOUT,
RESPONSE_NULL
} response_type;
typedef struct _response_t {
unsigned int packet_num;
response_type type;
} response_t;
int
convert_channel_num(
char *s,
unsigned int *channel_num,
err_t err
);
int
convert_sample_num(
char *s,
unsigned int *channel_num,
err_t err
);
int
convert_string_to_unsigned_int(
char *s,
unsigned int *ui
);
const char *
response_to_string(response_type response);
#endif