beautypg.com

PNI TCM User Manual

Page 75

background image

PNI Sensor Corporation

DOC#1014688 r06

TCM User Manual

– July 2013

Page 70

}

/ / l oop t hr ough and c ol l ect t he el ement s

whi l e( count )

{

/ / The el ement s ar e r ec ei ved as { t y pe ( i e. k Headi ng) , dat a}

s wi t ch( dat a[ pnt r ++] )

/ / r ead t he t y pe and go t o t he f i r s t by t 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

c ase CommPr ot ocol : : k Headi ng:

{

/ / Mov e( sour ce, dest i nat i on, si ze ( by t es ) ) . Mov e copi es t he

/ / s peci f i ed number of by t es f r om t he s our ce poi nt er t o t he

/ / des t i nat i on poi nt er . St or e t he headi ng.

Move( &( dat a[ pnt r ] ) , &headi ng,

s i zeof ( headi ng) ) ;

/ / i nc r eas e 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;

}


c ase CommPr ot ocol : : k Pi t ch:

{

/ / Mov e( sour ce, dest i nat i on, si ze ( by t es ) ) . Mov e copi es t he

/ / s peci f i ed number of by t es f r om t he s our ce poi nt er t o t he

/ / des t i nat i on poi nt er . St or e t he pi t c h.

Move( &( dat a[ pnt r ] ) , &pi t c h,

s i zeof ( pi t ch) ) ;

/ / i nc r eas e 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;

}


c ase CommPr ot ocol : : k Rol l :

{

/ / Mov e( sour ce, dest i nat i on, si ze ( by t es ) ) . Mov e copi es t he

/ / s peci f i ed number of by t es f r om t he s our ce poi nt er t o t he

/ / des t i nat i on poi nt er . St or e t he r ol l .

Move( &( dat a[ pnt r ] ) , &r ol l ,

s i zeof ( r ol l ) ) ;

/ / i nc r eas e 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;

}

c ase CommPr ot ocol : : k Temper at ur e:

{

/ / Mov e( sour ce, dest i nat i on, si ze ( by t es ) ) . Mov e copi es t he

/ / s peci f i ed number of by t es f r om t he s our ce poi nt er t o t he

/ / des t i nat i on poi nt er . St or e t he headi ng.

Move( &( dat a[ pnt r ] ) , &t emper at ur e,

s i zeof ( t emper at ur e) ) ;

/ / i nc r eas e 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;

}