Added error checking to functions called from Communication

This commit is contained in:
EricLiu2000
2019-06-13 16:01:35 -04:00
parent a16f2843d8
commit 519e64fb17
12 changed files with 77 additions and 28 deletions
+5 -1
View File
@@ -56,11 +56,15 @@ public:
LSFTCANSettingsNotAvailable = 0x2011,
SWCANSettingsNotAvailable = 0x2012,
BaudrateNotFound = 0x2013,
BadNetworkType = 0x2014,
UnexpectedNetworkType = 0x2014,
DeviceFirmwareOutOfDate = 0x2015,
SettingsStructureMismatch = 0x2016,
SettingsStructureTruncated = 0x2017,
NoDeviceResponse = 0x2018,
MessageFormattingError = 0x2019,
MessageDataOverCapacity = 0x2020,
CANFDNotSupported = 0x2021,
RTRNotSupported = 0x2022,
// Transport Errors
FailedToRead = 0x3000,
@@ -2,6 +2,7 @@
#define __CANPACKET_H__
#include "icsneo/communication/message/canmessage.h"
#include "icsneo/api/errormanager.h"
#include <cstdint>
#include <memory>
@@ -11,7 +12,7 @@ typedef uint16_t icscm_bitfield;
struct HardwareCANPacket {
static std::shared_ptr<CANMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
static bool EncodeFromMessage(const CANMessage& message, std::vector<uint8_t>& bytestream);
static bool EncodeFromMessage(const CANMessage& message, std::vector<uint8_t>& bytestream, const device_errorhandler_t& err);
struct {
icscm_bitfield IDE : 1;
@@ -2,6 +2,7 @@
#define __ETHERNETPACKET_H__
#include "icsneo/communication/message/ethernetmessage.h"
#include "icsneo/api/errormanager.h"
#include <cstdint>
#include <memory>
@@ -11,7 +12,7 @@ typedef uint16_t icscm_bitfield;
struct HardwareEthernetPacket {
static std::shared_ptr<EthernetMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
static bool EncodeFromMessage(const EthernetMessage& message, std::vector<uint8_t>& bytestream);
static bool EncodeFromMessage(const EthernetMessage& message, std::vector<uint8_t>& bytestream, const device_errorhandler_t& err);
struct {
icscm_bitfield FCS_AVAIL : 1;
-1
View File
@@ -84,7 +84,6 @@ public:
protected:
uint16_t productId = 0;
bool online = false;
bool opened = false;
int messagePollingCallbackID = 0;
int internalHandlerCallbackID = 0;
device_errorhandler_t err;