Last change
on this file since 19779 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 |
|
---|
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;
|
---|
20 | dis_update_service(serv_id);
|
---|
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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.