Project

General

Profile

Statistics
| Branch: | Revision:

root / mainbox / tool.h @ master

History | View | Annotate | Download (682 Bytes)

1
#ifndef TOOL_H
2
#define TOOL_H
3

    
4
enum toolstate_t {
5
  TS_INIT,
6
  TS_OFF,
7
  TS_REQ_DIS,
8
  TS_ON
9
};
10

    
11
struct tool_t {
12
  const char *name;
13
  int address;
14
  int connected;
15
  enum toolstate_t state;
16
  unsigned int user;
17
  struct event_t *event;
18
};
19

    
20
#define TOOL_DECL(name, addr) {name, addr, 1, TS_INIT, 0, NULL}
21

    
22
int tool_init_mb(const char *device);
23
void tool_close_mb();
24
void tool_request_disable(struct tool_t *tool);
25
void tool_poll(struct tool_t *tool);
26

    
27
/* Should be less than 1000 (see modbus_set_response_timeout()). Should also be
28
 * high enough to ensure that connected tools will respond. Tools poll their own
29
 * modbus code about every 50ms. */
30
#define MB_TIMEOUT_MS 70
31

    
32
#endif