75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
//****************************************************************************
|
|
// Copyright (C) 2007
|
|
// Nissan North America
|
|
// All Rights Reserved. Proprietary and Confidential.
|
|
//============================================================================
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __CanMessage__
|
|
#define __CanMessage__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include <sys/types.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "CanSignal.h"
|
|
#include "CanSocket.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
// based on .dbc data
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
//
|
|
// Uses the Peak Systems CAN Linux driver and Nissan CAN data
|
|
//
|
|
class CanMessage {
|
|
// public data
|
|
public:
|
|
std::string Name; // Signal Name
|
|
std::string Module; // Module Name
|
|
u_int32_t Address; // 29 bits (standard or extended)
|
|
u_int8_t Data[64]; // Data
|
|
u_int Size; // DLC (CAN-FD > 8)
|
|
|
|
|
|
// list of signals in the message
|
|
std::vector<CanSignal *> Signals;
|
|
|
|
// private data
|
|
private:
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
CanMessage();
|
|
|
|
// destructor
|
|
virtual ~CanMessage();
|
|
|
|
// virtual functions
|
|
|
|
// public methods
|
|
int Read(CanFrame *frame);
|
|
int Write(CanFrame *frame);
|
|
int Convert(CanFrame *frame) {return Read(frame);};
|
|
int Subscribe(void);
|
|
int Unsubscribe(void);
|
|
|
|
// static methods
|
|
|
|
// private methods
|
|
private:
|
|
};
|
|
|
|
#endif
|