User Manual
Appendix B - Sample Programs
________________________________
Boomer II User Manual & Integrator’s Guide
Wavenet Technology 132 BM210012WT09
The following pseudo code gives an overview of the implementation of
zHandleMessage().
z Ha ndl e Me s s a ge ( ms g)
{
s c r _De c ode s c r _De c ode ( ms g) ; / * d e c od e t he me s s a g e * /
i f ( e r r o r de c od i ng) {
Re por t SCR d e c odi ng e r r o r
r e t ur n
}
s wi t c h ( Me s s a g e Type ) { / * e xa mi ne t he me s s a g e t yp e */
c a s e SCR_LR: / * l o opb a c k r e qu e s t */
/ * t hi s me s s a g e i s on l y a pp l i c a bl e */
Pr e p a r e me s s a g e " LC" / * t o Da t a TAC 500 0 n e t wor k s */
br e a k;
c a s e SCR_ACK: / * Hos t ms g d e l i ve r y Con f i r ma t i on* /
s c r _Na kRe as o nTe x t ( )s c r _Na kRe as o nTe x t ( ) ; / * r e t ur ns NULL i f n o e r r o r
oc c ur r e d * /
i f ( a n e r r o r o c c ur r e d) {
Pr i nt r e a s on t e xt
}
e l s e {
Re por t s uc c e s s f u l d e l i ve r y of me s s a g e
}
br e a k;
c a s e SCR_FROM_NET: / * Re c e i v e d i nb ou n d me s s a ge * /
pr e pa r e me s s a g e " TO_ NET"
/ *e c ho da t a b a c k t o t he c l i e nt */
br e a k;
c a s e SCR_CI : / * Co nn e c t i nd i c a t i o n Da t a TAC 50 0 0 onl y * /
Re por t ' LLI x ha s c onn e c t e d'
br e a k;
c a s e SCR_DI : / * Di s c on ne c t i ndi c a t i on Da t a TAC 50 0 0 onl y
*/
Re por t ' LLI x ha s d i s c on ne c t e d '
br e a k;
de f a ul t : / * Unk nown me s s a g e t ype * /
Re por t ' Unh a nd l e d me s s a ge t yp e '
br e a k;
}
s c r _ Fr e e De c o d i ng ( ) ;
/ *f r e e dy na mi c a l l y a l l oc a t e d bu f f e r s i n API * /
/ *wh e n i t de c ode d t h e c ur r e nt me s s a ge */
i f ( a Re s po ns e ha s t o b e s e nt ) {
s c r _ Enc o de ( ) ; / * e nc o de t he r e s po ns e me s s a g e */
I f ( e n c od e d s uc c e s s f u l l y) {
Se nd da t a t o t he ne t wor k
}
e l s e {
Re por t ' SCR e n c od i ng e r r or '
}
}
}