7 int main(int argc, char ** argv)
9 EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
10 EVENT_HEADER * heartbeat = NULL;
11 EVENT_FAULT * fault = NULL;
13 printf("\nHello AT&T Vendor Event world!\n");
18 fprintf(stderr, "Usage: %s <FQDN>|<IP address> <port>\n", argv[0]);
22 /***************************************************************************/
24 /***************************************************************************/
25 if (evel_initialize(argv[1], /* FQDN */
26 atoi(argv[2]), /* Port */
27 NULL, /* optional path */
28 NULL, /* optional topic */
32 EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */
33 "EVEL training demo", /* Role */
36 fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n");
41 printf("\nInitialization completed\n");
44 /***************************************************************************/
45 /* Send a heartbeat just to show we're alive! */
46 /***************************************************************************/
47 heartbeat = evel_new_heartbeat();
48 if (heartbeat != NULL)
50 evel_rc = evel_post_event(heartbeat);
51 if (evel_rc != EVEL_SUCCESS)
53 printf("Post failed %d (%s)", evel_rc, evel_error_string());
58 printf("New heartbeat failed");
61 /***************************************************************************/
63 /***************************************************************************/
64 fault = evel_new_fault("My alarm condition",
65 "It broke very badly",
69 EVEL_VF_STATUS_PREP_TERMINATE);
72 printf("New fault created...\n");
73 evel_rc = evel_post_event((EVENT_HEADER *)fault);
74 if (evel_rc == EVEL_SUCCESS)
76 printf("Fault posted OK!\n");
80 printf("Post failed %d (%s)\n", evel_rc, evel_error_string());
85 printf("New fault failed (%s)\n", evel_error_string());
88 /***************************************************************************/
90 /***************************************************************************/
93 printf("Terminated\n");