49
50
i f
(
n d i g o c o n f i g u r e
(
ndgo
, &
c o n f i g
) !=
NDIGO OK
)
{
51
p r i n t f
(
”
\
n F a t a l
c o n f i g u r a t i o n
e r r o r .
A b o r t i n g . . .
\
n ”
) ;
52
e x i t
(
−
1) ;
53
}
54
55
n d i g o s t a r t c a p t u r e
(
ndgo
) ;
56
57
// c o u n t s t h e number o f p a c k e t s r e c e i v e d
58
i n t
c o u n t
= 0 ;
59
60
w h i l e
(
c o u n t
<
10 )
{
61
n d i g o r e a d i n
i n
;
62
// Do n o t w a i t f o r d a t a
63
// ( i f
s e t t o 1 t h e n d i g o a c k n o w l e d g e f u n c t i o n has t o be removed )
64
i n
.
a c k n o w l e d g e l a s t r e a d
= 0 ;
65
n d i g o r e a d o u t o u t
;
66
i n t
r e s u l t
=
n d i g o r e a d
(
ndgo
, &
i n
, &
o u t
) ;
67
i f
( !
r e s u l t
)
{
68
// b u f f e r
r e c e i v e d w i t h one o r more p a c k e t s
69
n d i g o p a c k e t
*
p a c k e t
=
o u t
.
f i r s t p a c k e t
;
70
w h i l e
(
p a c k e t
<
=
o u t
.
l a s t p a c k e t
)
{
71
i n t
l e n g t h
= 0 ;
72
i f
( ! (
p a c k e t
−
>
t y p e
&
NDIGO PACKET TYPE TIMESTAMP ONLY
) )
73
l e n g t h
=
p a c k e t
−
>
l e n g t h
;
74
75
p r i n t f
(
” Card %02x , C h a n n e l %02x ,
F l a g s %02x , L e n g t h %6d , Timestamp
←
-
%l l u
\
n ”
,
p a c k e t
−
>
c a r d
,
p a c k e t
−
>
c h a n n e l
,
p a c k e t
−
>
f l a g s
,
←
-
l e n g t h
,
p a c k e t
−
>
t i m e s t a m p
) ;
76
i f
( ! (
p a c k e t
−
>
t y p e
&
NDIGO PACKET TYPE TIMESTAMP ONLY
) )
{
77
s h o r t
*
d a t a
= (
s h o r t
*
)
p a c k e t
−
>
d a t a
;
78
f o r
(
i n t i
= 0 ;
i
<
p a c k e t
−
>
l e n g t h
*
4 ;
i
++ )
79
p r i n t f
(
”%6d , ”
,
*
(
d a t a
++)) ;
80
p r i n t f
(
”
\
n
\
n ”
) ;
81
}
82
// c u r r e n t p a c k e t p o i n t e r
i s
i n v a l i d
a f t e r
c a l l t o
←
-
n d i g o a c k n o w l e d g e
83
n d i g o p a c k e t
*
n e x t p a c k e t
=
n d i g o n e x t p a c k e t
(
p a c k e t
) ;
84
n d i g o a c k n o w l e d g e
(
ndgo
,
p a c k e t
) ;
85
p a c k e t
=
n e x t p a c k e t
;
86
c o u n t
++;
87
}
88
}
89
}
90
n d i g o c l o s e
(
ndgo
) ;
91
r e t u r n 0
;
92
}
cronologic GmbH & Co. KG
44
Ndigo5G User Guide
Summary of Contents for Ndigo5G-10
Page 2: ......
Page 3: ......
Page 7: ......
Page 45: ...cronologic GmbH Co KG 40 Ndigo5G User Guide...
Page 54: ...on page 47 cronologic GmbH Co KG 49 Ndigo5G User Guide...