Project

General

Profile

Statistics
| Branch: | Revision:

root / mainbox / tool.h @ 2dde134c

History | View | Annotate | Download (682 Bytes)

1 7bdb98c5 Tom Mullins
#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 15fa09f7 Tom Mullins
  int address;
14
  int connected;
15 7bdb98c5 Tom Mullins
  enum toolstate_t state;
16
  unsigned int user;
17 75cef49f Tom Mullins
  struct event_t *event;
18 7bdb98c5 Tom Mullins
};
19
20 75cef49f Tom Mullins
#define TOOL_DECL(name, addr) {name, addr, 1, TS_INIT, 0, NULL}
21 15fa09f7 Tom Mullins
22 7bdb98c5 Tom Mullins
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 2dde134c Tom Mullins
/* 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 7bdb98c5 Tom Mullins
#endif