FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
test_client_ccpc.c
Go to the documentation of this file.
1
#include <
dic.h
>
2
3
int
no_link
= -1;
4
int
RegisterSet
;
5
int
RegisterValue
;
6
7
void
register_callback
( tag,
data
,
size
)
8
int *tag, *
data
, *
size
;
9
{
10
RegisterValue
= *
data
;
11
RegisterSet
= *tag;
12
/* In linux this is not necessary */
13
#ifdef WIN32
14
dim_wake_up();
15
#endif
16
}
17
18
int
set_register_wait
(index, value)
19
int index, value;
20
{
21
int
pars[2];
22
23
pars[0] = index;
24
pars[1] = value;
25
RegisterSet
= -1;
26
dic_cmnd_service
(
"SET_REGISTER"
,pars,
sizeof
(pars));
27
while
(
RegisterSet
== -1)
28
{
29
dim_wait
();
30
}
31
if
(
RegisterSet
== index)
32
return
(
RegisterValue
);
33
return
(-1);
34
}
35
36
main
(argc,argv)
37
int argc;
38
char
**argv;
39
{
40
int
i
, index = 0, value;
41
char
aux[80];
42
43
for
(i = 0; i< 10; i++)
44
{
45
sprintf
(aux,
"Register%03d"
,i);
46
dic_info_service
( aux,
MONIT_ONLY
, 0, 0, 0,
47
register_callback
, i, &
no_link
,
sizeof
(
int
) );
48
}
49
50
while
(1)
51
{
52
value =
set_register_wait
(index%10, index);
53
printf(
"Register %d: wrote %d, readback = %d\n"
,
54
index%10, index, value);
55
index ++;
56
sleep(1);
57
}
58
}
dic_info_service
unsigned dic_info_service(char *serv_name, int req_type, int req_timeout, void *serv_address, int serv_size, void(*usr_routine)(), dim_long tag, void *fill_addr, int fill_size)
Definition:
dic.c:601
dim_wait
int dim_wait(void)
Definition:
dim_thr.c:409
register_callback
void register_callback(int *tag, int *data, int *size)
Definition:
test_client_ccpc.c:7
i
int i
Definition:
db_dim_client.c:21
RegisterSet
int RegisterSet
Definition:
test_client_ccpc.c:4
set_register_wait
int set_register_wait(int index, int value)
Definition:
test_client_ccpc.c:18
RegisterValue
int RegisterValue
Definition:
test_client_ccpc.c:5
dic.h
dic_cmnd_service
int dic_cmnd_service(char *serv_name, void *serv_address, int serv_size)
Definition:
dic.c:694
main
main(int argc, char **argv)
Definition:
test_client_ccpc.c:36
no_link
int no_link
Definition:
test_client_ccpc.c:3
size
int size
Definition:
db_dim_server.c:17
data
float data[4 *1440]
Definition:
EventBuilderWrapper.h:95
sprintf
sprintf(name1,"NewService%d", i)
MONIT_ONLY
#define MONIT_ONLY
Definition:
dim_common.h:12
dim
src
examples
test_client_ccpc.c
Generated on Sun Sep 18 2016 20:50:18 for FACT++ by
1.8.11