Manual

PNI Sensor Corporation DOC#1014688 r06
TCM User Manual July 2013 Page 70
}
/ / l oop t hr ough and col l ect t he el ement s
whi l e( count )
{
/ / The el ement s ar e r ecei ved as { t ype ( i e. kHeadi ng) , dat a}
swi t ch( dat a[ pnt r ++] )
/ / r ead t he t ype and go t o t he f i r st byt e of t he dat a
{
/ / Onl y handl i ng t he 4 el ement s we ar e l ooki ng f or
case CommPr ot ocol : : kHeadi ng:
{
/ / Move( sour ce, dest i nat i on, si ze ( byt es) ) . Move copi es t he
// speci f i ed number of byt es f r om t he sour ce poi nt er t o t he
// dest i nat i on poi nt er . St or e t he headi ng.
Move( &( dat a[ pnt r ] ) , &headi ng,
si zeof ( headi ng) ) ;
/ / i ncr ease t he poi nt er t o poi nt t o t he next dat a el ement t ype
pnt r += si zeof ( headi ng) ;
br eak;
}
case CommPr ot ocol : : kPi t ch:
{
/ / Move( sour ce, dest i nat i on, si ze ( byt es) ) . Move copi es t he
// speci f i ed number of byt es f r om t he sour ce poi nt er t o t he
// dest i nat i on poi nt er . St or e t he pi t ch.
Move( &( dat a[ pnt r ] ) , &pi t ch,
si zeof ( pi t ch) ) ;
/ / i ncr ease t he poi nt er t o poi nt t o t he next dat a el ement t ype
pnt r += si zeof ( pi t ch) ;
br eak;
}
case CommPr ot ocol : : kRol l :
{
/ / Move( sour ce, dest i nat i on, si ze ( byt es) ) . Move copi es t he
// speci f i ed number of byt es f r om t he sour ce poi nt er t o t he
// dest i nat i on poi nt er . St or e t he r ol l .
Move( &( dat a[ pnt r ] ) , &r ol l ,
si zeof ( r ol l ) ) ;
/ / i ncr ease t he poi nt er t o poi nt t o t he next dat a el ement t ype
pnt r += si zeof ( r ol l ) ;
br eak;
}
case CommPr ot ocol : : kTemper at ur e:
{
/ / Move( sour ce, dest i nat i on, si ze ( byt es) ) . Move copi es t he
// speci f i ed number of byt es f r om t he sour ce poi nt er t o t he
// dest i nat i on poi nt er . St or e t he headi ng.
Move( &( dat a[ pnt r ] ) , &t emper at ur e,
si zeof ( t emper at ur e) ) ;
/ / i ncr ease t he poi nt er t o poi nt t o t he next dat a el ement t ype
pnt r += si zeof ( t emper at ur e) ;
br eak;
}