FACT++  1.0
demo_server.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <dis.h>
3 
4 int dev_data;
5 int serv_id;
6 
7 void do_cmnd(tag, cmnd, size)
8 int *tag, *size;
9 char *cmnd;
10 {
11  printf("Got Command: %s\n",cmnd);
12  if(!strcmp(cmnd,"RESET"))
13  dev_data = 0;
14  if(!strcmp(cmnd,"CONFIGURE"))
15  dev_data = 1;
16  if(!strcmp(cmnd,"START"))
17  dev_data = 2;
18  if(!strcmp(cmnd,"STOP"))
19  dev_data = 1;
21 }
22 
23 main(argc,argv)
24 int argc;
25 char **argv;
26 {
27  char aux[80];
28 
29  dev_data = 0;
30  sprintf(aux,"DEVICE/%s/DATA",argv[1]);
31  serv_id = dis_add_service(aux, "I", &dev_data, sizeof(int), 0, 0);
32 
33  sprintf(aux,"DEVICE/%s/CMD",argv[1]);
34  dis_add_cmnd(aux, "C", do_cmnd, 0);
35 
36  dis_start_serving( argv[1] );
37  while(1)
38  pause();
39 }
main(int argc, char **argv)
Definition: demo_server.c:23
void do_cmnd(int *tag, char *cmnd, int *size)
Definition: demo_server.c:7
int dev_data
Definition: demo_server.c:4
#define dis_add_cmnd
Definition: dis.h:13
#define dis_start_serving
Definition: dis.h:8
#define dis_update_service
Definition: dis.h:18
int serv_id
Definition: demo_server.c:5
int size
Definition: db_dim_server.c:17
#define dis_add_service
Definition: dis.h:12
sprintf(name1,"NewService%d", i)