parent
81ef9129b6
commit
e512fd388f
@ -0,0 +1,107 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCACK.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCACK class.
|
||||
/// </summary>
|
||||
FSCACK::FSCACK() : FSCMessage(),
|
||||
m_ackMessageId(FSC_INVALID),
|
||||
m_ackVersion(1U),
|
||||
m_ackCorrelationTag(0U),
|
||||
m_responseCode(CONTROL_ACK),
|
||||
m_respLength(0U)
|
||||
{
|
||||
m_messageId = FSC_ACK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCACK class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCACK::FSCACK(uint8_t* data) : FSCMessage(data),
|
||||
m_ackMessageId(FSC_INVALID),
|
||||
m_ackVersion(1U),
|
||||
m_ackCorrelationTag(0U),
|
||||
m_responseCode(CONTROL_ACK),
|
||||
m_respLength(0U)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a FSC ACK frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool FSCACK::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
FSCMessage::decode(data);
|
||||
|
||||
m_ackMessageId = (FSCMessageType)(data[2U]); // Ack Message ID
|
||||
m_ackVersion = data[3U]; // Ack Message Version
|
||||
m_ackCorrelationTag = data[4U]; // Ack Message Correlation Tag
|
||||
m_responseCode = (FSCAckResponseCode)(data[5U]); // Response Code
|
||||
m_respLength = data[6U]; // Response Data Length
|
||||
|
||||
if (m_respLength > 0) {
|
||||
if (responseData != nullptr)
|
||||
delete responseData;
|
||||
responseData = new uint8_t[m_respLength];
|
||||
::memset(responseData, 0x00U, m_respLength);
|
||||
::memcpy(responseData, data, m_respLength);
|
||||
}
|
||||
else {
|
||||
if (responseData != nullptr)
|
||||
delete responseData;
|
||||
responseData = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a FSC ACK frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void FSCACK::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
FSCMessage::encode(data);
|
||||
|
||||
data[2U] = (uint8_t)(m_ackMessageId); // Ack Message ID
|
||||
data[3U] = m_ackVersion; // Ack Message Version
|
||||
data[4U] = m_ackCorrelationTag; // Ack Message Correlation Tag
|
||||
data[5U] = (uint8_t)(m_responseCode); // Response Code
|
||||
data[6U] = m_respLength; // Response Data Length
|
||||
|
||||
if (m_respLength > 0U && responseData != nullptr) {
|
||||
::memcpy(data, responseData, m_respLength);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_ACK_H__)
|
||||
#define __FSC_ACK_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
#include "frames/fsc/FSCMessage.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCACK : public FSCMessage {
|
||||
public:
|
||||
static const uint8_t LENGTH = 6;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCACK class.</summary>
|
||||
FSCACK();
|
||||
/// <summary>Initializes a copy instance of the FSCACK class.</summary>
|
||||
FSCACK(uint8_t* data);
|
||||
|
||||
/// <summary>Decode a FSC ACK frame.</summary>
|
||||
bool decode(const uint8_t* data) override;
|
||||
/// <summary>Encode a FSC ACK frame.</summary>
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
uint8_t* responseData; // ?? - this should probably be private with getters/setters
|
||||
|
||||
/// <summary>Acknowledged Message ID.</summary>
|
||||
__PROPERTY(FSCMessageType, ackMessageId, AckMessageId);
|
||||
/// <summary>Acknowledged Message Version.</summary>
|
||||
__READONLY_PROPERTY(uint8_t, ackVersion, AckVersion);
|
||||
/// <summary></summary>
|
||||
__READONLY_PROPERTY(uint8_t, ackCorrelationTag, AckCorrelationTag);
|
||||
/// <summary>Response code.</summary>
|
||||
__PROPERTY(FSCAckResponseCode, responseCode, ResponseCode);
|
||||
/// <summary>Response Data Length.</summary>
|
||||
__PROPERTY(uint8_t, respLength, ResponseLength);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_ACK_H__
|
||||
@ -0,0 +1,86 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCConnect.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCConnect class.
|
||||
/// </summary>
|
||||
FSCConnect::FSCConnect() : FSCMessage(),
|
||||
m_vcBasePort(0U),
|
||||
m_vcSSRC(0U),
|
||||
m_fsHeartbeatPeriod(5U),
|
||||
m_hostHeartbeatPeriod(5U)
|
||||
{
|
||||
m_messageId = FSC_CONNECT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCConnect class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCConnect::FSCConnect(uint8_t* data) : FSCMessage(data),
|
||||
m_vcBasePort(0U),
|
||||
m_vcSSRC(0U),
|
||||
m_fsHeartbeatPeriod(5U),
|
||||
m_hostHeartbeatPeriod(5U)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a FSC connect frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool FSCConnect::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
FSCMessage::decode(data);
|
||||
|
||||
m_vcBasePort = __GET_UINT16B(data, 3U); // Voice Conveyance RTP Port
|
||||
m_vcSSRC = __GET_UINT32(data, 5U); // Voice Conveyance SSRC
|
||||
m_fsHeartbeatPeriod = data[9U]; // Fixed Station Heartbeat Period
|
||||
m_hostHeartbeatPeriod = data[10U]; // Host Heartbeat Period
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a FSC connect frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void FSCConnect::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
FSCMessage::encode(data);
|
||||
|
||||
__SET_UINT16B(m_vcBasePort, data, 3U); // Voice Conveyance RTP Port
|
||||
__SET_UINT32(m_vcSSRC, data, 5U); // Voice Conveyance SSRC
|
||||
data[9U] = m_fsHeartbeatPeriod; // Fixed Station Heartbeat Period
|
||||
data[10U] = m_hostHeartbeatPeriod; // Host Heartbeat Period
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_CONNECT_H__)
|
||||
#define __FSC_CONNECT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
#include "frames/fsc/FSCMessage.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCConnect : public FSCMessage {
|
||||
public:
|
||||
static const uint8_t LENGTH = 11;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCConnect class.</summary>
|
||||
FSCConnect();
|
||||
/// <summary>Initializes a copy instance of the FSCConnect class.</summary>
|
||||
FSCConnect(uint8_t* data);
|
||||
|
||||
/// <summary>Decode a FSC connect frame.</summary>
|
||||
bool decode(const uint8_t* data) override;
|
||||
/// <summary>Encode a FSC connect frame.</summary>
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/// <summary>Voice Conveyance RTP Port.</summary>
|
||||
__PROPERTY(uint16_t, vcBasePort, VCBasePort);
|
||||
/// <summary>SSRC Identifier for all RTP transmissions.</summary>
|
||||
__PROPERTY(uint32_t, vcSSRC, VCSSRC);
|
||||
/// <summary>Fixed Station Heartbeat Period.</summary>
|
||||
__PROPERTY(uint8_t, fsHeartbeatPeriod, FSHeartbeatPeriod);
|
||||
/// <summary>Host Heartbeat Period.</summary>
|
||||
__PROPERTY(uint8_t, hostHeartbeatPeriod, HostHeartbeatPeriod);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_CONNECT_H__
|
||||
@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCConnectResponse.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCConnectResponse class.
|
||||
/// </summary>
|
||||
FSCConnectResponse::FSCConnectResponse() : FSCResponse(),
|
||||
m_vcBasePort(0U)
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCConnectResponse class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCConnectResponse::FSCConnectResponse(uint8_t* data) : FSCResponse(data),
|
||||
m_vcBasePort(0U)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a FSC connect frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool FSCConnectResponse::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
FSCResponse::decode(data);
|
||||
|
||||
m_vcBasePort = __GET_UINT16B(data, 1U); // Voice Conveyance RTP Port
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a FSC connect frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void FSCConnectResponse::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
FSCResponse::encode(data);
|
||||
|
||||
__SET_UINT16B(m_vcBasePort, data, 1U); // Voice Conveyance RTP Port
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_CONNECT_RESPONSE_H__)
|
||||
#define __FSC_CONNECT_RESPONSE_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
#include "frames/fsc/FSCResponse.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCConnectResponse : public FSCResponse {
|
||||
public:
|
||||
static const uint8_t LENGTH = 3;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCConnectResponse class.</summary>
|
||||
FSCConnectResponse();
|
||||
/// <summary>Initializes a copy instance of the FSCConnectResponse class.</summary>
|
||||
FSCConnectResponse(uint8_t* data);
|
||||
|
||||
/// <summary>Decode a FSC connect response frame.</summary>
|
||||
bool decode(const uint8_t* data) override;
|
||||
/// <summary>Encode a FSC connect response frame.</summary>
|
||||
void encode(uint8_t* data) override;
|
||||
|
||||
public:
|
||||
/// <summary>Voice Conveyance RTP Port.</summary>
|
||||
__PROPERTY(uint16_t, vcBasePort, VCBasePort);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_CONNECT_RESPONSE_H__
|
||||
@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCDisconnect.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCDisconnect class.
|
||||
/// </summary>
|
||||
FSCDisconnect::FSCDisconnect() : FSCMessage()
|
||||
{
|
||||
m_messageId = FSC_DISCONNECT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCDisconnect class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCDisconnect::FSCDisconnect(uint8_t* data) : FSCMessage(data)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_DISCONNECT_H__)
|
||||
#define __FSC_DISCONNECT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
#include "frames/fsc/FSCMessage.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCDisconnect : public FSCMessage {
|
||||
public:
|
||||
static const uint8_t LENGTH = 3;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCDisconnect class.</summary>
|
||||
FSCDisconnect();
|
||||
/// <summary>Initializes a copy instance of the FSCDisconnect class.</summary>
|
||||
FSCDisconnect(uint8_t* data);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_DISCONNECT_H__
|
||||
@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCHeartbeat.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCHeartbeat class.
|
||||
/// </summary>
|
||||
FSCHeartbeat::FSCHeartbeat() : FSCMessage()
|
||||
{
|
||||
m_messageId = FSC_HEARTBEAT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCHeartbeat class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCHeartbeat::FSCHeartbeat(uint8_t* data) : FSCMessage(data)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_HEARTBEAT_H__)
|
||||
#define __FSC_HEARTBEAT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
#include "frames/fsc/FSCMessage.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCHeartbeat : public FSCMessage {
|
||||
public:
|
||||
static const uint8_t LENGTH = 3;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCHeartbeat class.</summary>
|
||||
FSCHeartbeat();
|
||||
/// <summary>Initializes a copy instance of the FSCHeartbeat class.</summary>
|
||||
FSCHeartbeat(uint8_t* data);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_HEARTBEAT_H__
|
||||
@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCMessage.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCMessage class.
|
||||
/// </summary>
|
||||
FSCMessage::FSCMessage() :
|
||||
m_messageId(FSC_INVALID),
|
||||
m_version(1U),
|
||||
m_correlationTag(0U)
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCMessage class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCMessage::FSCMessage(uint8_t* data) :
|
||||
m_messageId(FSC_INVALID),
|
||||
m_version(1U),
|
||||
m_correlationTag(0U)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a FSC message frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool FSCMessage::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
m_messageId = (FSCMessageType)(data[0U]); // Message ID
|
||||
m_version = data[1U]; // Message Version
|
||||
|
||||
if (m_messageId != FSCMessageType::FSC_HEARTBEAT && m_messageId != FSCMessageType::FSC_ACK)
|
||||
m_correlationTag = data[2U]; // Message Correlation Tag
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a FSC message frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void FSCMessage::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
data[0U] = (uint8_t)m_messageId; // Message ID
|
||||
data[1U] = m_version; // Message Version
|
||||
|
||||
if (m_messageId != FSCMessageType::FSC_HEARTBEAT && m_messageId != FSCMessageType::FSC_ACK)
|
||||
data[2U] = m_correlationTag; // Message Correlation Tag
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_MESSAGE_H__)
|
||||
#define __FSC_MESSAGE_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCMessage {
|
||||
public:
|
||||
static const uint8_t LENGTH = 3;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCMessage class.</summary>
|
||||
FSCMessage();
|
||||
/// <summary>Initializes a copy instance of the FSCMessage class.</summary>
|
||||
FSCMessage(uint8_t* data);
|
||||
|
||||
/// <summary>Decode a FSC message frame.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a FSC message frame.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Message ID.</summary>
|
||||
__PROTECTED_PROPERTY(FSCMessageType, messageId, MessageId);
|
||||
/// <summary>Message Version.</summary>
|
||||
__PROTECTED_READONLY_PROPERTY(uint8_t, version, Version);
|
||||
/// <summary></summary>
|
||||
__PROTECTED_READONLY_PROPERTY(uint8_t, correlationTag, CorrelationTag);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_MESSAGE_H__
|
||||
@ -0,0 +1,72 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frames/fsc/FSCResponse.h"
|
||||
#include "common/p25/dfsi/DFSIDefines.h"
|
||||
#include "common/Utils.h"
|
||||
#include "common/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace p25::dfsi;
|
||||
using namespace p25::dfsi::fsc;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCResponse class.
|
||||
/// </summary>
|
||||
FSCResponse::FSCResponse() :
|
||||
m_version(1U)
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a instance of the FSCResponse class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
FSCResponse::FSCResponse(uint8_t* data) :
|
||||
m_version(1U)
|
||||
{
|
||||
decode(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a FSC message frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool FSCResponse::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
m_version = data[0U]; // Response Version
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a FSC message frame.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void FSCResponse::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
data[0U] = m_version; // Response Version
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/**
|
||||
* Digital Voice Modem - DFSI Peer Application
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / DFSI Peer Application
|
||||
* @derivedfrom MMDVMHost (https://github.com/g4klx/MMDVMHost)
|
||||
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||
*
|
||||
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||
*
|
||||
*/
|
||||
#if !defined(__FSC_RESPONSE_H__)
|
||||
#define __FSC_RESPONSE_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "common/Defines.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Utils.h"
|
||||
#include "frames/FrameDefines.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace dfsi
|
||||
{
|
||||
namespace fsc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API FSCResponse {
|
||||
public:
|
||||
static const uint8_t LENGTH = 1;
|
||||
|
||||
/// <summary>Initializes a copy instance of the FSCResponse class.</summary>
|
||||
FSCResponse();
|
||||
/// <summary>Initializes a copy instance of the FSCResponse class.</summary>
|
||||
FSCResponse(uint8_t* data);
|
||||
|
||||
/// <summary>Decode a FSC message frame.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a FSC message frame.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Response Version.</summary>
|
||||
__PROTECTED_READONLY_PROPERTY(uint8_t, version, Version);
|
||||
};
|
||||
} // namespace fsc
|
||||
} // namespace dfsi
|
||||
} // namespace p25
|
||||
|
||||
#endif // __FSC_RESPONSE_H__
|
||||
Loading…
Reference in new issue