beautypg.com

PNI SeaTRAX User Manual

Page 74

background image

PNI Sensor Corporation

DOC#1018154 r02

SeaTRAX User Manual

Page 69

// Message is a function that displays a C formatted string

// (similar to printf)

Message("Received %u data elements instead of

the %u requested\r\n", (UInt16)count,

(UInt16)kDataCount);

return;

}

// loop through and collect the elements

while(count)

{

// The elements are received as {type (ie. kHeading), data}

switch(data[pntr++])

// read the type and go to the first byte of the data

{

// Only handling the 4 elements we are looking for

case CommProtocol::kHeading:

{

// Move(source, destination, size (bytes)). Move copies the

// specified number of bytes from the source pointer to the

// destination pointer. Store the heading.

Move(&(data[pntr]), &heading,

sizeof(heading));

// increase the pointer to point to the next data element type

pntr += sizeof(heading);

break;

}


case CommProtocol::kPitch:

{

// Move(source, destination, size (bytes)). Move copies the

// specified number of bytes from the source pointer to the

// destination pointer. Store the pitch.

Move(&(data[pntr]), &pitch,

sizeof(pitch));

// increase the pointer to point to the next data element type

pntr += sizeof(pitch);

break;

}


case CommProtocol::kRoll:

{

// Move(source, destination, size (bytes)). Move copies the

// specified number of bytes from the source pointer to the

// destination pointer. Store the roll.

Move(&(data[pntr]), &roll,

sizeof(roll));

// increase the pointer to point to the next data element type

pntr += sizeof(roll);

break;

}