source: branches/testFACT++branch/dim/src/examples/test_server_ccpc.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: 719 bytes
Line 
1#include <stdio.h>
2#include <dis.h>
3
4int registers[10];
5int ids[10];
6
7void set_register(tag, data, size)
8int *tag, *data, *size;
9{
10int index, value;
11
12 index = data[0];
13 value = data[1];
14 printf("Setting register %d to value %d\n", index, value);
15/* here we set the register, read it back and update the service*/
16 registers[index] = value;
17 dis_update_service(ids[index]);
18
19}
20
21main(argc,argv)
22int argc;
23char **argv;
24{
25 int i;
26 char aux[80];
27
28 for(i = 0; i< 10; i++)
29 {
30 sprintf(aux,"Register%03d",i);
31 ids[i] = dis_add_service( aux, "I", &registers[i], sizeof(int),
32 (void *)0, 0 );
33 }
34
35 dis_add_cmnd("SET_REGISTER","I:2",set_register, 0);
36
37 dis_start_serving( "TEST_REGISTERS" );
38
39 while(1)
40 {
41 pause();
42 }
43}
44
Note: See TracBrowser for help on using the repository browser.