Classes | Enumerations | Functions | Variables
sdhserial.cpp File Reference

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"
Include dependency graph for sdhserial.cpp:

Go to the source code of this file.

Classes

struct  sSDHBinaryRequest
 data structure with binary data for request from PC to SDH More...
 
struct  sSDHBinaryResponse
 data structure with binary data for response from SDH to PC More...
 

Enumerations

enum  { eNUMBER_OF_ELEMENTS = cSimpleVector::eNUMBER_OF_ELEMENTS }
 

Functions

void CheckCRC16 () const
 check the CRC value in parameter_bytes. Throw an exception if check fails More...
 
tCRCValueCRC16 () const
 return a ptr to the CRC value in parameter_bytes, assuming that nb_data_bytes is correct (including the CRC bytes) More...
 
int GetNbBytesToSend () const
 return the total number of bytes to send More...
 
std::ostream & operator<< (std::ostream &stream, sSDHBinaryRequest const &request)
 helper functions to insert a human readable form of the request into stream More...
 
std::ostream & operator<< (std::ostream &stream, sSDHBinaryResponse const &response)
 helper functions to insert a human readable form of the restore into stream More...
 
struct sSDHBinaryRequest SDH__attribute__ ((packed))
 
 sSDHBinaryRequest (eCommandCode command, double *value, bool use_crc16)
 

Variables

union {
   float   parameter [eNUMBER_OF_ELEMENTS]
 
   unsigned char   parameter_bytes [sizeof(float)
      *eNUMBER_OF_ELEMENTS+sizeof(tCRCValue)]
 
}; 
 
union {
   float   parameter [eNUMBER_OF_ELEMENTS]
 
   unsigned char   parameter_bytes [sizeof(float)
      *eNUMBER_OF_ELEMENTS+sizeof(tCRCValue)]
 
}; 
 
unsigned char cmd_code
 
unsigned char nb_data_bytes
 
unsigned char nb_valid_parameters
 
unsigned char status_code
 

Detailed Description

Interface of class #SDH::cSDHSerial.

General file information

Author
Dirk Osswald
Date
2007-02-19

Copyright


Definition in file sdhserial.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
eNUMBER_OF_ELEMENTS 

Definition at line 57 of file sdhserial.cpp.

Function Documentation

◆ CheckCRC16()

void SDH__attribute__::CheckCRC16 ( ) const

check the CRC value in parameter_bytes. Throw an exception if check fails

◆ 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)

Definition at line 75 of file sdhserial.cpp.

◆ GetNbBytesToSend()

int SDH__attribute__::GetNbBytesToSend ( ) const

return the total number of bytes to send

Definition at line 81 of file sdhserial.cpp.

◆ operator<<() [1/2]

std::ostream &NS_SDH operator<< ( std::ostream &  stream,
sSDHBinaryRequest const &  request 
)

helper functions to insert a human readable form of the request into stream

Definition at line 190 of file sdhserial.cpp.

◆ operator<<() [2/2]

std::ostream &NS_SDH operator<< ( std::ostream &  stream,
sSDHBinaryResponse const &  response 
)

helper functions to insert a human readable form of the restore into stream

Definition at line 213 of file sdhserial.cpp.

◆ SDH__attribute__()

struct sSDHBinaryRequest SDH__attribute__ ( (packed)  )

◆ sSDHBinaryRequest()

SDH__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

Variable Documentation

◆ @5

union { ... }

◆ @9

union { ... }

◆ cmd_code

unsigned char cmd_code

Definition at line 60 of file sdhserial.cpp.

◆ nb_data_bytes

unsigned char nb_data_bytes

Definition at line 61 of file sdhserial.cpp.

◆ nb_valid_parameters

unsigned char nb_valid_parameters

Definition at line 62 of file sdhserial.cpp.

◆ parameter

float parameter[eNUMBER_OF_ELEMENTS]

Definition at line 64 of file sdhserial.cpp.

◆ parameter_bytes

unsigned char parameter_bytes[sizeof(float) *eNUMBER_OF_ELEMENTS+sizeof(tCRCValue)]

Definition at line 65 of file sdhserial.cpp.

◆ status_code

unsigned char status_code

Definition at line 63 of file sdhserial.cpp.



sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:59