source: branches/testFACT++branch/dim/src/examples/demo_server.c@ 19366

Last change on this file since 19366 was 11071, checked in by tbretz, 14 years ago
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
File size: 681 bytes
Line 
1#include <stdio.h>
2#include <dis.h>
3
4int dev_data;
5int serv_id;
6
7void do_cmnd(tag, cmnd, size)
8int *tag, *size;
9char *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;
20 dis_update_service(serv_id);
21}
22
23main(argc,argv)
24int argc;
25char **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}
Note: See TracBrowser for help on using the repository browser.