parent
79f00524ba
commit
9806ece4f5
@ -0,0 +1,79 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMDeregistrationCommand.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMDeregistrationCommand class. */
|
||||
|
||||
KMMDeregistrationCommand::KMMDeregistrationCommand() : KMMFrame(),
|
||||
m_bodyFormat(0U),
|
||||
m_kmfRSI(9999999U)
|
||||
{
|
||||
m_messageId = KMM_MessageType::DEREG_CMD;
|
||||
m_respKind = KMM_ResponseKind::IMMEDIATE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMDeregistrationCommand class. */
|
||||
|
||||
KMMDeregistrationCommand::~KMMDeregistrationCommand() = default;
|
||||
|
||||
/* Decode a KMM modify key. */
|
||||
|
||||
bool KMMDeregistrationCommand::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
m_bodyFormat = data[10U]; // Body Format
|
||||
m_kmfRSI = __GET_UINT16(data, 11U); // KMF RSI
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM modify key. */
|
||||
|
||||
void KMMDeregistrationCommand::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_DEREGISTRATION_CMD_LENGTH;
|
||||
m_bodyFormat = 0U; // reset this to none -- we don't support warm start right now
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
|
||||
data[10U] = m_bodyFormat; // Body Format
|
||||
__SET_UINT16(m_kmfRSI, data, 11U); // KMF RSI
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMDeregistrationCommand::copy(const KMMDeregistrationCommand& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
|
||||
m_bodyFormat = data.m_bodyFormat;
|
||||
m_kmfRSI = data.m_kmfRSI;
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMDeregistrationCommand.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMDeregistrationCommand.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_DEREGISTRATION_CMD_H__)
|
||||
#define __P25_KMM__KMM_DEREGISTRATION_CMD_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_DEREGISTRATION_CMD_LENGTH = KMM_FRAME_LENGTH + 4U;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMDeregistrationCommand : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMDeregistrationCommand class.
|
||||
*/
|
||||
KMMDeregistrationCommand();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMDeregistrationCommand class.
|
||||
*/
|
||||
~KMMDeregistrationCommand();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM deregistration command.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM deregistration command.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint8_t, bodyFormat, BodyFormat);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint32_t, kmfRSI, KMFRSI);
|
||||
|
||||
__COPY(KMMDeregistrationCommand);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_DEREGISTRATION_CMD_H__
|
||||
@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMDeregistrationResponse.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMDeregistrationResponse class. */
|
||||
|
||||
KMMDeregistrationResponse::KMMDeregistrationResponse() : KMMFrame(),
|
||||
m_status(KMM_Status::CMD_PERFORMED)
|
||||
{
|
||||
m_messageId = KMM_MessageType::DEREG_RSP;
|
||||
m_respKind = KMM_ResponseKind::IMMEDIATE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMDeregistrationResponse class. */
|
||||
|
||||
KMMDeregistrationResponse::~KMMDeregistrationResponse() = default;
|
||||
|
||||
/* Decode a KMM modify key. */
|
||||
|
||||
bool KMMDeregistrationResponse::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
m_status = data[10U]; // Status
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM modify key. */
|
||||
|
||||
void KMMDeregistrationResponse::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_DEREGISTRATION_RSP_LENGTH;
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
|
||||
data[10U] = m_status; // Status
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMDeregistrationResponse::copy(const KMMDeregistrationResponse& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
|
||||
m_status = data.m_status;
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMDeregistrationResponse.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMDeregistrationResponse.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_DEREGISTRATION_RSP_H__)
|
||||
#define __P25_KMM__KMM_DEREGISTRATION_RSP_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_DEREGISTRATION_RSP_LENGTH = KMM_FRAME_LENGTH + 1U;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMDeregistrationResponse : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMDeregistrationResponse class.
|
||||
*/
|
||||
KMMDeregistrationResponse();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMDeregistrationResponse class.
|
||||
*/
|
||||
~KMMDeregistrationResponse();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM deregistration response.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM deregistration response.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint8_t, status, Status);
|
||||
|
||||
__COPY(KMMDeregistrationResponse);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_DEREGISTRATION_RSP_H__
|
||||
@ -0,0 +1,82 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMNegativeAck.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMNegativeAck class. */
|
||||
|
||||
KMMNegativeAck::KMMNegativeAck() : KMMFrame(),
|
||||
m_messageId(0U),
|
||||
m_messageNo(0U),
|
||||
m_status(KMM_Status::CMD_NOT_PERFORMED)
|
||||
{
|
||||
m_messageId = KMM_MessageType::NAK;
|
||||
m_respKind = KMM_ResponseKind::IMMEDIATE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMNegativeAck class. */
|
||||
|
||||
KMMNegativeAck::~KMMNegativeAck() = default;
|
||||
|
||||
/* Decode a KMM NAK. */
|
||||
|
||||
bool KMMNegativeAck::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
m_messageId = data[10U]; // Message ID
|
||||
m_messageNo = __GET_UINT16B(data, 11U); // Message Number
|
||||
m_status = data[13U]; // Status
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM NAK. */
|
||||
|
||||
void KMMNegativeAck::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_NEGATIVE_ACK_LENGTH;
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
|
||||
data[10U] = m_messageId; // Message ID
|
||||
__SET_UINT16B(m_messageNo, data, 11U); // Message Number
|
||||
data[13U] = m_status;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMNegativeAck::copy(const KMMNegativeAck& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
|
||||
m_messageId = data.m_messageId;
|
||||
m_messageNo = data.m_messageNo;
|
||||
m_status = data.m_status;
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMNegativeAck.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMNegativeAck.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_NEGATIVE_ACK_H__)
|
||||
#define __P25_KMM__KMM_NEGATIVE_ACK_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_NEGATIVE_ACK_LENGTH = KMM_FRAME_LENGTH + 4U;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMNegativeAck : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMNegativeAck class.
|
||||
*/
|
||||
KMMNegativeAck();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMNegativeAck class.
|
||||
*/
|
||||
~KMMNegativeAck();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM NAK.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM NAK.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint8_t, messageId, MessageId);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint16_t, messageNo, MessageNumber);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint8_t, status, Status);
|
||||
|
||||
__COPY(KMMNegativeAck);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_NEGATIVE_ACK_H__
|
||||
@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMNoService.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMNoService class. */
|
||||
|
||||
KMMNoService::KMMNoService() : KMMFrame()
|
||||
{
|
||||
m_messageId = KMM_MessageType::NO_SERVICE;
|
||||
m_respKind = KMM_ResponseKind::NONE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMNoService class. */
|
||||
|
||||
KMMNoService::~KMMNoService() = default;
|
||||
|
||||
/* Decode a KMM modify key. */
|
||||
|
||||
bool KMMNoService::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM modify key. */
|
||||
|
||||
void KMMNoService::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_NO_SERVICE_LENGTH;
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMNoService::copy(const KMMNoService& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMNoService.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMNoService.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_NO_SERVICE_H__)
|
||||
#define __P25_KMM__KMM_NO_SERVICE_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_NO_SERVICE_LENGTH = KMM_FRAME_LENGTH;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMNoService : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMNoService class.
|
||||
*/
|
||||
KMMNoService();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMNoService class.
|
||||
*/
|
||||
~KMMNoService();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM hello.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM hello.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
__COPY(KMMNoService);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_NO_SERVICE_H__
|
||||
@ -0,0 +1,79 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMRegistrationCommand.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMRegistrationCommand class. */
|
||||
|
||||
KMMRegistrationCommand::KMMRegistrationCommand() : KMMFrame(),
|
||||
m_bodyFormat(0U),
|
||||
m_kmfRSI(9999999U)
|
||||
{
|
||||
m_messageId = KMM_MessageType::REG_CMD;
|
||||
m_respKind = KMM_ResponseKind::IMMEDIATE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMRegistrationCommand class. */
|
||||
|
||||
KMMRegistrationCommand::~KMMRegistrationCommand() = default;
|
||||
|
||||
/* Decode a KMM modify key. */
|
||||
|
||||
bool KMMRegistrationCommand::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
m_bodyFormat = data[10U]; // Body Format
|
||||
m_kmfRSI = __GET_UINT16(data, 11U); // KMF RSI
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM modify key. */
|
||||
|
||||
void KMMRegistrationCommand::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_REGISTRATION_CMD_LENGTH;
|
||||
m_bodyFormat = 0U; // reset this to none -- we don't support warm start right now
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
|
||||
data[10U] = m_bodyFormat; // Body Format
|
||||
__SET_UINT16(m_kmfRSI, data, 11U); // KMF RSI
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMRegistrationCommand::copy(const KMMRegistrationCommand& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
|
||||
m_bodyFormat = data.m_bodyFormat;
|
||||
m_kmfRSI = data.m_kmfRSI;
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMRegistrationCommand.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMRegistrationCommand.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_REGISTRATION_CMD_H__)
|
||||
#define __P25_KMM__KMM_REGISTRATION_CMD_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_REGISTRATION_CMD_LENGTH = KMM_FRAME_LENGTH + 4U;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMRegistrationCommand : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMRegistrationCommand class.
|
||||
*/
|
||||
KMMRegistrationCommand();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMRegistrationCommand class.
|
||||
*/
|
||||
~KMMRegistrationCommand();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM deregistration command.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM deregistration command.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint8_t, bodyFormat, BodyFormat);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint32_t, kmfRSI, KMFRSI);
|
||||
|
||||
__COPY(KMMRegistrationCommand);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_REGISTRATION_CMD_H__
|
||||
@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMRegistrationResponse.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMRegistrationResponse class. */
|
||||
|
||||
KMMRegistrationResponse::KMMRegistrationResponse() : KMMFrame(),
|
||||
m_status(KMM_Status::CMD_PERFORMED)
|
||||
{
|
||||
m_messageId = KMM_MessageType::DEREG_RSP;
|
||||
m_respKind = KMM_ResponseKind::IMMEDIATE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMRegistrationResponse class. */
|
||||
|
||||
KMMRegistrationResponse::~KMMRegistrationResponse() = default;
|
||||
|
||||
/* Decode a KMM modify key. */
|
||||
|
||||
bool KMMRegistrationResponse::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
m_status = data[10U]; // Status
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM modify key. */
|
||||
|
||||
void KMMRegistrationResponse::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_REGISTRATION_RSP_LENGTH;
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
|
||||
data[10U] = m_status; // Status
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMRegistrationResponse::copy(const KMMRegistrationResponse& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
|
||||
m_status = data.m_status;
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMRegistrationResponse.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMRegistrationResponse.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_REGISTRATION_RSP_H__)
|
||||
#define __P25_KMM__KMM_REGISTRATION_RSP_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_REGISTRATION_RSP_LENGTH = KMM_FRAME_LENGTH + 1U;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMRegistrationResponse : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMRegistrationResponse class.
|
||||
*/
|
||||
KMMRegistrationResponse();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMRegistrationResponse class.
|
||||
*/
|
||||
~KMMRegistrationResponse();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM deregistration response.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM deregistration response.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
__PROPERTY(uint8_t, status, Status);
|
||||
|
||||
__COPY(KMMRegistrationResponse);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_REGISTRATION_RSP_H__
|
||||
@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/P25Defines.h"
|
||||
#include "p25/kmm/KMMZeroize.h"
|
||||
#include "Log.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::kmm;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the KMMZeroize class. */
|
||||
|
||||
KMMZeroize::KMMZeroize() : KMMFrame()
|
||||
{
|
||||
m_messageId = KMM_MessageType::ZEROIZE_CMD;
|
||||
m_respKind = KMM_ResponseKind::NONE;
|
||||
}
|
||||
|
||||
/* Finalizes a instance of the KMMZeroize class. */
|
||||
|
||||
KMMZeroize::~KMMZeroize() = default;
|
||||
|
||||
/* Decode a KMM modify key. */
|
||||
|
||||
bool KMMZeroize::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
KMMFrame::decodeHeader(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a KMM modify key. */
|
||||
|
||||
void KMMZeroize::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
m_messageLength = KMM_ZEROIZE_LENGTH;
|
||||
|
||||
KMMFrame::encodeHeader(data);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Internal helper to copy the the class. */
|
||||
|
||||
void KMMZeroize::copy(const KMMZeroize& data)
|
||||
{
|
||||
KMMFrame::copy(data);
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* 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) 2025 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file KMMZeroize.h
|
||||
* @ingroup p25_kmm
|
||||
* @file KMMZeroize.cpp
|
||||
* @ingroup p25_kmm
|
||||
*/
|
||||
#if !defined(__P25_KMM__KMM_ZEROIZE_H__)
|
||||
#define __P25_KMM__KMM_ZEROIZE_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/kmm/KMMFrame.h"
|
||||
#include "common/Utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace kmm
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @addtogroup p25_kmm
|
||||
* @{
|
||||
*/
|
||||
|
||||
const uint32_t KMM_ZEROIZE_LENGTH = KMM_FRAME_LENGTH;
|
||||
|
||||
/** @} */
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API KMMZeroize : public KMMFrame {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the KMMZeroize class.
|
||||
*/
|
||||
KMMZeroize();
|
||||
/**
|
||||
* @brief Finalizes a instance of the KMMZeroize class.
|
||||
*/
|
||||
~KMMZeroize();
|
||||
|
||||
/**
|
||||
* @brief Decode a KMM hello.
|
||||
* @param[in] data Buffer containing KMM frame data to decode.
|
||||
* @returns bool True, if decoded, otherwise false.
|
||||
*/
|
||||
bool decode(const uint8_t* data) override;
|
||||
/**
|
||||
* @brief Encode a KMM hello.
|
||||
* @param[out] data Buffer to encode KMM frame data to.
|
||||
*/
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
__COPY(KMMZeroize);
|
||||
};
|
||||
} // namespace kmm
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_KMM__KMM_ZEROIZE_H__
|
||||
Loading…
Reference in new issue