Leosac  0.8.0
Open Source Access Control
Leosac::Module::Rpleth::RplethProtocol Class Reference

#include <rplethprotocol.hpp>

Public Types

enum  TypeCode { Rpleth = 0x00, HID = 0x01, LCD = 0x02, MaxType }
 
enum  RplethCommands {
  DHCPState = 0x01, SetDHCP = 0x02, SetMAC = 0x03, SetIP = 0x04,
  SetSubnet = 0x05, SetGateway = 0x06, SetPort = 0x07, Message = 0x08,
  Reset = 0x09, Ping = 0x0a
}
 
enum  HIDCommands {
  Beep = 0x00, Greenled = 0x01, Redled = 0x02, Nop = 0x03,
  Badge = 0x04, Com = 0x05, Wait_insertion = 0x06, Wait_removal = 0x07,
  Connect = 0x08, Disconnect = 0x09, GetReaderType = 0x0a, GetCSN = 0x0b,
  SetCardType = 0x0c, SendCards = 0x0d, ReceiveCardsWaited = 0x0e
}
 
enum  StatusCode {
  Success = 0x00, Failed = 0x01, BadChecksum = 0x02, Timeout = 0x03,
  BadSize = 0x04, BadType = 0x05, MaxStatus
}
 

Static Public Member Functions

static RplethPacket decodeCommand (CircularBuffer &buffer, bool from_server=false)
 Decode a packet from a circular buffer object. More...
 
static std::size_t encodeCommand (const RplethPacket &packet, Byte *buffer, std::size_t size)
 

Private Member Functions

 RplethProtocol ()=delete
 

Static Private Attributes

static const std::size_t TypeByteIdx = 0
 
static const std::size_t CommandByteIdx = 1
 
static const std::size_t SizeByteIdx = 2
 
static const std::size_t PacketMinSize = 4
 

Detailed Description

Definition at line 41 of file rplethprotocol.hpp.

Member Enumeration Documentation

◆ HIDCommands

Enumerator
Beep 
Greenled 
Redled 
Nop 
Badge 
Com 
Wait_insertion 
Wait_removal 
Connect 
Disconnect 
GetReaderType 
GetCSN 
SetCardType 
SendCards 
ReceiveCardsWaited 

Definition at line 72 of file rplethprotocol.hpp.

◆ RplethCommands

Enumerator
DHCPState 
SetDHCP 
SetMAC 
SetIP 
SetSubnet 
SetGateway 
SetPort 
Message 
Reset 
Ping 

Definition at line 58 of file rplethprotocol.hpp.

◆ StatusCode

Enumerator
Success 
Failed 
BadChecksum 
Timeout 
BadSize 
BadType 
MaxStatus 

Definition at line 91 of file rplethprotocol.hpp.

◆ TypeCode

Enumerator
Rpleth 
HID 
LCD 
MaxType 

Definition at line 51 of file rplethprotocol.hpp.

Constructor & Destructor Documentation

◆ RplethProtocol()

Leosac::Module::Rpleth::RplethProtocol::RplethProtocol ( )
privatedelete

Member Function Documentation

◆ decodeCommand()

RplethPacket RplethProtocol::decodeCommand ( CircularBuffer buffer,
bool  from_server = false 
)
static

Decode a packet from a circular buffer object.

If from_server is true that means the packet comes from a Rpleth server: this is used by unit testing code.

Definition at line 32 of file rplethprotocol.cpp.

◆ encodeCommand()

std::size_t RplethProtocol::encodeCommand ( const RplethPacket packet,
Byte buffer,
std::size_t  size 
)
static

Definition at line 72 of file rplethprotocol.cpp.

Member Data Documentation

◆ CommandByteIdx

const std::size_t Leosac::Module::Rpleth::RplethProtocol::CommandByteIdx = 1
staticprivate

Definition at line 44 of file rplethprotocol.hpp.

◆ PacketMinSize

const std::size_t Leosac::Module::Rpleth::RplethProtocol::PacketMinSize = 4
staticprivate

Definition at line 46 of file rplethprotocol.hpp.

◆ SizeByteIdx

const std::size_t Leosac::Module::Rpleth::RplethProtocol::SizeByteIdx = 2
staticprivate

Definition at line 45 of file rplethprotocol.hpp.

◆ TypeByteIdx

const std::size_t Leosac::Module::Rpleth::RplethProtocol::TypeByteIdx = 0
staticprivate

Definition at line 43 of file rplethprotocol.hpp.


The documentation for this class was generated from the following files: