chiark / gitweb /
5380a6c59b42c9c085c3e9ec2b4fc1ac83589416
[trains.git] / hostside / hidrawconv.h
1 #ifndef HIDRAWCONV_H
2 #define HIDRAWCONV_H
3
4 #include <stdio.h>
5 #include <stdint.h>
6
7 #include "common.h"
8
9 #define MAXREPORTLEN 256
10 #define MAXREPORTS 256
11
12 typedef void ProcessReport(const uint8_t *msg, int msglen, const uint8_t *last);
13
14 extern const char *const descriptor;
15 extern ProcessReport *const report_processors[MAXREPORTS];
16
17 typedef struct {
18   const char *str;
19   int pos;
20   uint8_t mask;
21 } KeyBit;
22
23 typedef struct {
24   const char *str;
25   int pos, rshift, sign; /* mask is applied before rshift */
26   uint8_t mask, zero;
27 } ValLoc;
28
29 void reportbits(const uint8_t msg[], const uint8_t last[],
30                 int len, const KeyBit bits[]);
31
32 void reportlocs(const uint8_t msg[], const uint8_t last[],
33                 int len, const ValLoc locs[]);
34
35 #endif /*HIDRAWCONV_H*/