
PNI Sensor Corporation
DOC#1014688 r09.2
TCM User Manual
Page 71
7.5.5
TCM.cpp File
#include "TCM.h"
#include "TickGenerator.h"
const UInt8 kDataCount = 4;
// We will be requesting 4 components (heading, pitch, roll, and
// temperature)
//
// This object polls the TCM module once a second for
// heading, pitch, roll and temperature.
//
TCM::TCM(SerPort * serPort)
: Process("TCM")
{
// Let the CommProtocol know this object will handle any
// serial data returned by the module
mComm = new CommProtocol(this, serPort);
mTime = 0;
mStep = 1;
}
TCM::~TCM()
{
}
//
// Called by the CommProtocol object when a frame is completel y //
received
//
void TCM::HandleComm(UInt8 frameType, void * dataPtr, UInt16
dataLen)
{
UInt8 * data = (UInt8 *)dataPtr;
switch(frameType)
{
case CommProtocol::kGetDataResp:
{
// Parse the data response
UInt8 count = data[0];
// The number of data elements returned
UInt32 pntr = 1;
// Used to retrieve the returned elements
// The data elements we requested
Float32 heading, pitch, roll, temperature;