beautypg.com

Commprotocol.h file, 2 commprotocol.h file – PNI CompassPoint Prime User Manual

Page 58

background image

PNI Sensor Corporation

DOC# 1014177 r08

Prime User Manual

– July 2011

Page 52

8.2

CommProtocol.h File

Note: This file contains objects used to handle the serial communication with the unit. Unfortunately,
these files are not available as the program was written on a non-PC computer. The comments in the
code should explain what is expected to be sent or received from these functions so that you can
write this section for your specific platform. For example, with the TickGenerator.h, you would need
to write a routing that generates 10msec ticks.


#pragma once

#include "SystemSerPort.h"
#include "Processes.h"


//
//CommHandler is a base class that provides a callback for
//incoming messages.
//
class CommHandler
{

public:

// Call back to be implemented in derived class.

virtual void HandleComm(UInt8 frameType, void * dataPtr =

NULL, UInt16 dataLen = 0) {}
};

//
//CommProtocol handles actual serial communication with the unit.
//Process is a base class that provides CommProtocol with
//cooperative parallel processing. The Control method will be
//called by a process manager on a continuous basis.
//
class CommProtocol : public Process
{

public:

enum

{

// Frame IDs (Commands)

kGetModInfo = 1,

// 1

kModInfoResp,

// 2

kSetDataComponents,

// 3

kGetData,

// 4

kDataResp,

// 5


// Data Component IDs

kHeading = 5,

// 5 - type Float32

kPAligned = 21,

// 21 - type Float32

kRAligned,

// 22 - type Float32

kIZAligned,

// 23 - type Float32

kPAngle,

// 24 - type Float32