Commprotocol.h file, 2 commprotocol.h file – PNI TCM User Manual
Page 67
PNI Sensor Corporation
DOC#1014688 r06
TCM User Manual
– July 2013
Page 62
7.4.2
CommProtocol.h File
#pr agma once
#i nc l ude " Sy st emSer Por t . h"
#i nc l ude " Pr oc es ses. h"
/ /
/ / CommHandl er i s a base c l ass t hat pr ov i des a cal l back f or
/ / i ncomi ng mes sages.
/ /
c l as s CommHandl er
{
publ i c :
/ / Cal l back t o be i mpl ement ed i n der i v ed cl as s.
v i r t ual voi d Handl eComm( UI nt 8 f r ameTy pe, v oi d * dat aPt r =
NULL, UI nt 16 dat aLen = 0) { }
} ;
/ /
/ / CommPr ot oc ol handl es t he ac t ual s er i al c ommuni cat i on wi t h t he / /
modul e.
/ / Pr oc es s i s a bas e c l ass t hat pr ov i des CommPr ot oc ol wi t h
/ / cooper at i v e par al l el pr oc es si ng. The Cont r ol met hod wi l l be
/ / cal l ed by a pr oc ess manager on a cont i nuous basi s.
/ /
c l as s CommPr ot oc ol : publ i c Pr ocess
{
publ i c :
enum
{
/ / Fr ame I Ds ( Commands)
k Get ModI nf o
/ / 1
k Get ModI nf oRes p,
/ / 2
k Set Dat aComponent s ,
/ / 3
k Get Dat a,
/ / 4
k Get Dat aResp,
/ / 5
/ / Dat a Component I Ds
k Headi ng = 5,
/ / 5 - t ype Fl oat 32
k Temper at ur e = 7,
/ / 7 - t ype Fl oat 32
k Acc el X = 21,
/ / 21 - t y pe Fl oat 32
k Acc el Y,
/ / 22 - t y pe Fl oat 32
k Acc el Z,
/ / 23 - t y pe Fl oat 32
k Pi t ch,
/ / 24 - t y pe Fl oat 32
k Rol l ,
/ / 25 - t y pe Fl oat 32
} ;
enum
{
k Buf f er Si z e = 512,
/ / max s i z e of i nput buf f er
k Pac ket Mi nSi ze = 5
/ / mi n s i z e of s er i al pac ket
} ;
/ / Ser Por t i s a ser i al communi c at i on obj ec t abst r act i ng
/ / t he har dwar e i mpl ement at i on