Class that implements the communication protocol between the SmartCard & the Terminal.
More...
#include <communication.h>
|
class | IOPin |
| Class that provides functionality for the ATmega644's PinB6, such as an ISR. More...
|
|
class | Timer |
| Class that provides functionality for the ATmega644's on-board 16-bit timer, such as an ISR. More...
|
|
|
friend | Timer |
| 16-bit Timer/Counter
|
|
friend | IOPin |
| IOPin (PinB6)
|
|
Logger | mLog |
| Logger.
|
|
volatile PinDir | mDirection = PinDir::OUTPUT |
| Current direction of the IOPin.
|
|
volatile bool | mBitSent = true |
| Whether the last bit of a transmission was sent.
|
|
volatile bit_t | mOutputBit = 0 |
| The next bit to output.
|
|
volatile bool | mByteReceived = 0 |
| Whether a byte was received successfully.
|
|
volatile uint8_t | mInputBitCounter = 0 |
| Number of input bits in the current transfer.
|
|
volatile byte_t | mInputByte = 0x00 |
| The currently received input byte.
|
|
volatile bool | mCheckErrors = false |
| Whether to check for errors after sending a byte.
|
|
volatile bit_t | mErrorBit = 0 |
| Error bit that is set to 0/1 during the stop bit indicating failure/success.
|
|
volatile bool | mParityError = false |
| Whether a parity error occurred while receiving a byte.
|
|
|
static constexpr bit_t | START_BIT = 0 |
| The start bit of a transfer.
|
|
static constexpr bit_t | STOP_BIT = 1 |
| The stop bit of a transfer.
|
|
Class that implements the communication protocol between the SmartCard & the Terminal.
- Authors
- Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
- Date
- 05.06.2022
- Copyright
- Philipp Karg 2022
◆ Communication()
Communication::Communication |
( |
| ) |
|
◆ getParity()
static bit_t Communication::getParity |
( |
byte_t |
byte | ) |
|
|
staticprivate |
◆ receiveByte()
byte_t Communication::receiveByte |
( |
| ) |
|
|
private |
◆ receiveDataToDecrypt()
void Communication::receiveDataToDecrypt |
( |
byte_t * |
data | ) |
|
◆ receiveProtocolHeader()
void Communication::receiveProtocolHeader |
( |
const byte_t * |
header | ) |
|
|
private |
Receive a protocol header, which contains 5 bytes.
- Parameters
-
[in] | header | (const byte_t*): Header to expect. |
◆ sampleBit()
static bit_t Communication::sampleBit |
( |
| ) |
|
|
staticprivate |
Sample the IOPin 3-times for a more reliable result.
- Returns
- (bit_t): The sample value of the bit.
◆ sendATR()
void Communication::sendATR |
( |
| ) |
|
|
inline |
Send the Answer-To-Reset sequence to the Terminal.
After the Reset-Pin is set to 1, send this sequence to initiate the transfer.
◆ sendBit()
void Communication::sendBit |
( |
const bit_t |
bit | ) |
|
|
private |
Send a single bit
to the Terminal.
- Wait for the last bit to be sent, (mBitSent to be true).
- Set mOutputBit to
bit
.
- Set mBitSent to false.
- Parameters
-
[in] | bit | (const bit_t): The bit to send. |
◆ sendByte()
void Communication::sendByte |
( |
const byte_t |
byte | ) |
|
|
private |
◆ sendBytes()
void Communication::sendBytes |
( |
const byte_t * |
bytes, |
|
|
const uint8_t |
len |
|
) |
| |
|
inlineprivate |
Send an array of bytes
byte by byte.
- Parameters
-
[in] | bytes | (const byte_t*): Array of bytes. |
[in] | len | (const uint8_t): Length of the array. |
◆ sendDecryptedData()
void Communication::sendDecryptedData |
( |
const byte_t * |
data | ) |
|
The documentation for this class was generated from the following file: