Exemplo n.º 1
0
static int read_handler(attrib * a, void *owner, struct storage *store)
{
    char zText[128];
    handler_info *hi = (handler_info *)a->data.v;

    READ_TOK(store, zText, sizeof(zText));
    hi->event = _strdup(zText);
    read_triggers(store, &hi->triggers);
    if (hi->triggers != NULL) {
        return AT_READ_OK;
    }
    return AT_READ_FAIL;
}
Exemplo n.º 2
0
void setup_triggers(void)
{
  Serial.println("setting up triggers");

  in_rfid = new input_trigger();
  in_rfid_auth = new input_trigger();
  in_button1 = new input_trigger();
  in_button2 = new input_trigger();
  in_opto = new input_trigger();

  out_opto = new output_trigger();
  
  in_rfid->set_name("input/rfid");
  in_rfid_auth->set_name("input/rfid/auth");

  in_button1->set_name("input/button1");
  in_button2->set_name("input/button2");
  in_opto->set_name("input/opto");

  out_opto->set_name("output/opto");

  // todo - set output actions.
  if (true) {
    trigger_run_all(dump_trigger);
  }

  /* we run through the configuration files in several passes. As we need
   * unique section names, we need to work through until weve read all
   * the lines */

  Serial.println("reading triggers");
  read_triggers();
  read_depends();

  if (true) {
    trigger_run_all(dump_trigger);
  }
}