From e3f851ef6d49c302b83320fad8a1109f836f7f4d Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 12 May 2024 19:49:28 +0100 Subject: [PATCH] [AX.25] Added assignment operator overload --- src/protocols/AX25/AX25.cpp | 14 ++++++++++++++ src/protocols/AX25/AX25.h | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/src/protocols/AX25/AX25.cpp b/src/protocols/AX25/AX25.cpp index 53679049..7e7d475e 100644 --- a/src/protocols/AX25/AX25.cpp +++ b/src/protocols/AX25/AX25.cpp @@ -213,6 +213,20 @@ AX25Client::AX25Client(const AX25Client& ax25) #endif } +AX25Client& AX25Client::operator=(const AX25Client& ax25) { + this->phyLayer = ax25.phyLayer; + this->sourceSSID = ax25.sourceSSID; + this->preambleLen = ax25.preambleLen; + strncpy(sourceCallsign, ax25.sourceCallsign, RADIOLIB_AX25_MAX_CALLSIGN_LEN); + #if !RADIOLIB_EXCLUDE_AFSK + if(ax25.bellModem) { + this->audio = ax25.audio; + this->bellModem = new BellClient(ax25.audio); + } + #endif + return(*this); +} + int16_t AX25Client::setCorrection(int16_t mark, int16_t space, float length) { BellModem_t modem; modem.freqMark = Bell202.freqMark + mark; diff --git a/src/protocols/AX25/AX25.h b/src/protocols/AX25/AX25.h index a34b3173..3f258320 100644 --- a/src/protocols/AX25/AX25.h +++ b/src/protocols/AX25/AX25.h @@ -255,6 +255,12 @@ class AX25Client { \param ax25 AX25Client instance to copy. */ AX25Client(const AX25Client& ax25); + + /*! + \brief Overload for assignment operator. + \param ax25 rvalue AX25Client. + */ + AX25Client& operator=(const AX25Client& ax25); /*! \brief Set AFSK tone correction offset. On some platforms, this is required to get the audio produced