[AX.25] Added assignment operator overload

This commit is contained in:
jgromes 2024-05-12 19:49:28 +01:00
parent 0e28810bb0
commit e3f851ef6d
2 changed files with 20 additions and 0 deletions

View file

@ -213,6 +213,20 @@ AX25Client::AX25Client(const AX25Client& ax25)
#endif #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) { int16_t AX25Client::setCorrection(int16_t mark, int16_t space, float length) {
BellModem_t modem; BellModem_t modem;
modem.freqMark = Bell202.freqMark + mark; modem.freqMark = Bell202.freqMark + mark;

View file

@ -256,6 +256,12 @@ class AX25Client {
*/ */
AX25Client(const AX25Client& ax25); 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 \brief Set AFSK tone correction offset. On some platforms, this is required to get the audio produced
by the setup to match the expected 1200/2200 Hz tones. by the setup to match the expected 1200/2200 Hz tones.