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.
62 lines
1.5 KiB
62 lines
1.5 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/SNDCPCtxActReject.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 SNDCPCtxActReject class. */
|
|
|
|
SNDCPCtxActReject::SNDCPCtxActReject() : SNDCPPacket(),
|
|
m_rejectCode(SNDCPRejectReason::ANY_REASON)
|
|
{
|
|
m_pduType = SNDCP_PDUType::ACT_TDS_CTX_REJECT;
|
|
}
|
|
|
|
/* Decode a SNDCP context activation reject packet. */
|
|
|
|
bool SNDCPCtxActReject::decode(const uint8_t* data, uint32_t length)
|
|
{
|
|
if (data == nullptr || length < 2U)
|
|
return false;
|
|
|
|
/* stub */
|
|
|
|
return true;
|
|
}
|
|
|
|
/* Encode a SNDCP context activation reject packet. */
|
|
|
|
void SNDCPCtxActReject::encode(uint8_t* data)
|
|
{
|
|
assert(data != nullptr);
|
|
|
|
SNDCPPacket::encodeHeader(data, true);
|
|
|
|
data[1U] = m_rejectCode; // Reject Code
|
|
}
|
|
|
|
/* Internal helper to copy the the class. */
|
|
|
|
void SNDCPCtxActReject::copy(const SNDCPCtxActReject& data)
|
|
{
|
|
m_rejectCode = data.m_rejectCode;
|
|
}
|