You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.7 KiB
64 lines
1.7 KiB
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Digital Voice Modem - Common Library
|
|
* GPLv2 Open Source. Use is subject to license terms.
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* Copyright (C) 2024,2026 Bryan Biedenkapp, N2PLL
|
|
*
|
|
*/
|
|
#include "Defines.h"
|
|
#include "p25/P25Defines.h"
|
|
#include "p25/sndcp/SNDCPCtxDeactivation.h"
|
|
#include "Log.h"
|
|
|
|
using namespace p25;
|
|
using namespace p25::defines;
|
|
using namespace p25::sndcp;
|
|
|
|
#include <cassert>
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Public Class Members
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/* Initializes a new instance of the SNDCPCtxDeactivation class. */
|
|
|
|
SNDCPCtxDeactivation::SNDCPCtxDeactivation() : SNDCPPacket(),
|
|
m_deactType(SNDCPDeactivationType::DEACT_ALL)
|
|
{
|
|
m_pduType = SNDCP_PDUType::DEACT_TDS_CTX_REQ;
|
|
}
|
|
|
|
/* Decode a SNDCP context deactivation packet. */
|
|
|
|
bool SNDCPCtxDeactivation::decode(const uint8_t* data, uint32_t length)
|
|
{
|
|
if (data == nullptr || length < 2U)
|
|
return false;
|
|
|
|
SNDCPPacket::decodeHeader(data, false);
|
|
|
|
m_deactType = data[1U]; // Deactivation Type
|
|
|
|
return true;
|
|
}
|
|
|
|
/* Encode a SNDCP context deactivation packet. */
|
|
|
|
void SNDCPCtxDeactivation::encode(uint8_t* data)
|
|
{
|
|
assert(data != nullptr);
|
|
|
|
SNDCPPacket::encodeHeader(data, true);
|
|
|
|
data[1U] = m_deactType; // Deactivation Type
|
|
}
|
|
|
|
/* Internal helper to copy the the class. */
|
|
|
|
void SNDCPCtxDeactivation::copy(const SNDCPCtxDeactivation& data)
|
|
{
|
|
m_deactType = data.m_deactType;
|
|
}
|