Interface of class SDH::cSDHSerial. More...
#include "sdhlibrary_settings.h"
#include <assert.h>
#include <unistd.h>
#include "util.h"
#include "sdhserial.h"
#include "crc.h"
#include "sdh_codes.h"
Classes | |
struct | SDH::sSDHBinaryRequest |
data structure with binary data for request from PC to SDH More... | |
struct | SDH::sSDHBinaryResponse |
data structure with binary data for response from SDH to PC More... | |
Namespaces | |
namespace | SDH |
Enumerations | |
enum | { SDH::eNUMBER_OF_ELEMENTS = cSimpleVector::eNUMBER_OF_ELEMENTS } |
Functions | |
struct SDH::sSDHBinaryRequest | SDH::__attribute__ ((packed)) |
sSDHBinaryRequest (eCommandCode command, double *value, bool use_crc16) | |
tCRCValue * | CRC16 () const |
return a ptr to the CRC value in parameter_bytes, assuming that nb_data_bytes is correct (including the CRC bytes) | |
int | GetNbBytesToSend () const |
return the total number of bytes to send | |
void | CheckCRC16 () const throw (cSDHErrorCommunication*) |
check the CRC value in parameter_bytes. Throw an exception if check fails | |
std::ostream & | SDH::operator<< (std::ostream &stream, sSDHBinaryRequest const &request) |
helper functions to insert a human readable form of the request into stream | |
std::ostream & | SDH::operator<< (std::ostream &stream, sSDHBinaryResponse const &response) |
helper functions to insert a human readable form of the restore into stream | |
Variables | |
unsigned char | cmd_code |
unsigned char | nb_data_bytes |
unsigned char | nb_valid_parameters |
union { | |
float parameter [eNUMBER_OF_ELEMENTS] | |
unsigned char parameter_bytes [sizeof(float)*eNUMBER_OF_ELEMENTS+sizeof(tCRCValue)] | |
}; | |
unsigned char | status_code |
union { | |
float parameter [eNUMBER_OF_ELEMENTS] | |
unsigned char parameter_bytes [sizeof(float)*eNUMBER_OF_ELEMENTS+sizeof(tCRCValue)] | |
}; |
Interface of class SDH::cSDHSerial.
void __attribute__::CheckCRC16 | ( | ) | const throw (cSDHErrorCommunication*) |
check the CRC value in parameter_bytes. Throw an exception if check fails
tCRCValue * CRC16 | ( | ) | const |
return a ptr to the CRC value in parameter_bytes, assuming that nb_data_bytes is correct (including the CRC bytes)
int __attribute__::GetNbBytesToSend | ( | ) | const |
return the total number of bytes to send
__attribute__::sSDHBinaryRequest | ( | eCommandCode | command, |
double * | value, | ||
bool | use_crc16 | ||
) |
ctor, create a request with cmd_code command and eNUMBER_OF_ELEMENTS parameter from value or no parameters if value is NULL. Add crc if use_crc16 is true and set nb_data_bytes appropriately
union { ... } |
union { ... } |
unsigned char cmd_code |
unsigned char nb_data_bytes |
unsigned char nb_valid_parameters |
float parameter[eNUMBER_OF_ELEMENTS] |
unsigned char parameter_bytes[sizeof(float)*eNUMBER_OF_ELEMENTS+sizeof(tCRCValue)] |
unsigned char status_code |