Revision 38df0012 mainbox/tool.c

View differences:

mainbox/tool.c
57 57
}
58 58

  
59 59
static void tool_grant_access(struct tool_t *tool) {
60

  
60 61
  printf("Granting access to %08x on %s (%d)\n", tool->user, tool->name,
61 62
      tool->address);
63

  
62 64
  tool_write_coil(MB_COIL_EN, 1);
63 65
  tool->state = TS_ON;
66

  
64 67
  tool->event = event_alloc();
65 68
  tool->event->user = tool->user;
66 69
  tool->event->tool_id = tool->address;
67 70
  tool->event->tstart = time(NULL);
71
  tool->event->succ = 1;
68 72
}
69 73

  
70 74
static void tool_deny_access(struct tool_t *tool) {
75
  struct event_t *event;
76

  
71 77
  printf("Denying access to %08x on %s (%d)\n", tool->user, tool->name,
72 78
      tool->address);
79

  
73 80
  tool_write_coil(MB_COIL_EN, 0);
74 81
  tool->state = TS_OFF;
82

  
83
  event = event_alloc();
84
  event->user = tool->user;
85
  event->tool_id = tool->address;
86
  event->tstart = time(NULL);
87
  event->tend = event->tstart;
88
  event->succ = 0;
89
  event_q_push(event);
75 90
}
76 91

  
77 92
static void tool_off(struct tool_t *tool) {

Also available in: Unified diff