beautypg.com

Commprotocol.h file, 2 commprotocol.h file – PNI SeaTRAX User Manual

Page 66

background image

PNI Sensor Corporation

DOC#1018154 r02

SeaTRAX User Manual

Page 61

7.4.2

CommProtocol.h File


#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 the actual serial communication with the //
module.
// 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

kGetModInfoResp,

// 2

kSetDataComponents,

// 3

kGetData,

// 4

kGetDataResp,

// 5


// Data Component IDs

kHeading = 5,

// 5 - type Float32

kTemperature = 7,

// 7 - type Float32

kAccelX = 21,

// 21 - type Float32

kAccelY,

// 22 - type Float32

kAccelZ,

// 23 - type Float32

kPitch,

// 24 - type Float32

kRoll,

// 25 - type Float32

};


enum

{

kBufferSize = 512,

// max size of input buffer