parent
6a85108a91
commit
fd4920f70c
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_DCALL_HDR.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_DCALL_HDR class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_DCALL_HDR::MESSAGE_TYPE_DCALL_HDR() : RCCH()
|
||||
{
|
||||
m_messageType = RTCH_MESSAGE_TYPE_DCALL_HDR;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_DCALL_HDR::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
|
||||
m_callType = (rcch[2U] >> 5) & 0x07U; // Call Type
|
||||
m_emergency = (rcch[1U] & 0x80U) == 0x80U; // Emergency Flag
|
||||
m_priority = (rcch[1U] & 0x20U) == 0x20U; // Priority Flag
|
||||
m_duplex = (rcch[2U] & 0x10U) == 0x10U; // Half/Full Duplex Flag
|
||||
m_transmissionMode = (rcch[2U] & 0x07U); // Transmission Mode
|
||||
m_srcId = (uint16_t)((rcch[3U] << 8) | rcch[4U]) & 0xFFFFU; // Source Radio Address
|
||||
m_dstId = (uint16_t)((rcch[5U] << 8) | rcch[6U]) & 0xFFFFU; // Target Radio Address
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_DCALL_HDR::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[1U] = (m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_priority ? 0x20U : 0x00U); // Priority Flag
|
||||
rcch[2U] = ((m_callType & 0x07U) << 5) + // Call Type
|
||||
(m_duplex ? 0x10U : 0x00U) + // Half/Full Duplex Flag
|
||||
(m_transmissionMode & 0x07U); // Transmission Mode
|
||||
|
||||
rcch[3U] = (m_srcId >> 8U) & 0xFFU; // Source Radio Address
|
||||
rcch[4U] = (m_srcId >> 0U) & 0xFFU; // ...
|
||||
rcch[5U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[6U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
|
||||
rcch[7U] = m_causeRsp; // Cause (VD)
|
||||
rcch[9U] = (m_siteData.locId() >> 8) & 0xFFU; // Location ID
|
||||
rcch[10U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_DCALL_HDR_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_DCALL_HDR_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements VCALL_CONN - Voice Call Connection Request (ISP) and
|
||||
// Voice Call Connection Response (OSP)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_DCALL_HDR : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_DCALL_HDR class.</summary>
|
||||
MESSAGE_TYPE_DCALL_HDR();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_DCALL_HDR_H__
|
||||
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_DST_ID_INFO.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_DST_ID_INFO class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_DST_ID_INFO::MESSAGE_TYPE_DST_ID_INFO() : RCCH()
|
||||
{
|
||||
m_messageType = nxdn::MESSAGE_TYPE_DST_ID_INFO;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_DST_ID_INFO::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_DST_ID_INFO::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[1U] = 0xC0U + NXDN_CALLSIGN_LENGTH_BYTES; // Station ID Option - Start / End / Character Count
|
||||
rcch[2U] = (m_siteCallsign[0]); // Character 0
|
||||
for (uint8_t i = 1; i < NXDN_CALLSIGN_LENGTH_BYTES; i++) {
|
||||
rcch[i + 2U] = m_siteCallsign[i]; // Character 1 - 7
|
||||
}
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_DST_ID_INFO_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_DST_ID_INFO_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements DST_ID_INFO - Digital Station ID
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_DST_ID_INFO : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_DST_ID_INFO class.</summary>
|
||||
MESSAGE_TYPE_DST_ID_INFO();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_DST_ID_INFO_H__
|
||||
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_GRP_REG.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_GRP_REG class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_GRP_REG::MESSAGE_TYPE_GRP_REG() : RCCH()
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_GRP_REG;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_GRP_REG::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
|
||||
m_regOption = rcch[1U]; // Group Registration Option
|
||||
m_srcId = (uint16_t)((rcch[2U] << 8) | rcch[3U]) & 0xFFFFU; // Source Radio Address
|
||||
m_dstId = (uint16_t)((rcch[4U] << 8) | rcch[5U]) & 0xFFFFU; // Target Radio Address
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_GRP_REG::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[2U] = (m_srcId >> 8U) & 0xFFU; // Source Radio Address
|
||||
rcch[3U] = (m_srcId >> 0U) & 0xFFU; // ...
|
||||
rcch[4U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[5U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
rcch[6U] = m_causeRsp; // Cause (MM)
|
||||
rcch[8U] = (m_siteData.locId() >> 8) & 0xFFU; // Location ID
|
||||
rcch[9U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_GRP_REG_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_GRP_REG_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements GRP_REG - Group Registration Request (ISP) and
|
||||
// Group Registration Response (OSP)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_GRP_REG : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_GRP_REG class.</summary>
|
||||
MESSAGE_TYPE_GRP_REG();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_GRP_REG_H__
|
||||
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_IDLE.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_IDLE class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_IDLE::MESSAGE_TYPE_IDLE() : RCCH()
|
||||
{
|
||||
m_messageType = nxdn::MESSAGE_TYPE_IDLE;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_IDLE::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_IDLE::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_IDLE_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_IDLE_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements IDLE - Idle
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_IDLE : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_IDLE class.</summary>
|
||||
MESSAGE_TYPE_IDLE();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_IDLE_H__
|
||||
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_REG.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_REG class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_REG::MESSAGE_TYPE_REG() : RCCH()
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_REG;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_REG::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
|
||||
m_regOption = rcch[1U] >> 3; // Registration Option
|
||||
m_locId = (uint16_t)((rcch[2U] << 8) | rcch[3U]) & 0xFFFFU; // Location ID
|
||||
m_srcId = (uint16_t)((rcch[4U] << 8) | rcch[5U]) & 0xFFFFU; // Source Radio Address
|
||||
m_dstId = (uint16_t)((rcch[6U] << 8) | rcch[7U]) & 0xFFFFU; // Target Radio Address
|
||||
// bryanb: maybe process subscriber type? (byte 8 and 9)
|
||||
m_version = rcch[10U]; // Version
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_REG::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[2U] = (m_siteData.locId() >> 8) & 0xFFU; // ...
|
||||
rcch[3U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
rcch[4U] = (m_srcId >> 8U) & 0xFFU; // Source Radio Address
|
||||
rcch[5U] = (m_srcId >> 0U) & 0xFFU; // ...
|
||||
rcch[6U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[7U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
rcch[8U] = m_causeRsp; // Cause (MM)
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_REG_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_REG_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements REG - Registration Request (ISP) and
|
||||
// Registration Response (OSP)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_REG : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_REG class.</summary>
|
||||
MESSAGE_TYPE_REG();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_REG_H__
|
||||
@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_REG_C.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_REG_C class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_REG_C::MESSAGE_TYPE_REG_C() : RCCH()
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_REG_C;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_REG_C::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
|
||||
m_regOption = rcch[1U] >> 3; // Registration Option
|
||||
m_locId = (uint16_t)((rcch[2U] << 8) | rcch[3U]) & 0xFFFFU; // Location ID
|
||||
m_srcId = (uint16_t)((rcch[4U] << 8) | rcch[5U]) & 0xFFFFU; // Source Radio Address
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_REG_C::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[2U] = (m_siteData.locId() >> 8) & 0xFFU; // Location ID
|
||||
rcch[3U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
rcch[4U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[5U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
rcch[6U] = m_causeRsp; // Cause (MM)
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_REG_C_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_REG_C_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements REG_C - Registration Clear Request (ISP) and
|
||||
// Registration Clear Response (OSP)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_REG_C : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_REG_C class.</summary>
|
||||
MESSAGE_TYPE_REG_C();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_REG_C_H__
|
||||
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_REG_COMM.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_REG_COMM class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_REG_COMM::MESSAGE_TYPE_REG_COMM() : RCCH()
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_REG_COMM;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_REG_COMM::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_REG_COMM::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[2U] = (m_siteData.locId() >> 8) & 0xFFU; // Location ID
|
||||
rcch[3U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
rcch[4U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[5U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_REG_COMM_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_REG_COMM_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements REG_COMM - Registration Command
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_REG_COMM : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_REG_COMM class.</summary>
|
||||
MESSAGE_TYPE_REG_COMM();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_REG_COMM_H__
|
||||
@ -0,0 +1,131 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_SITE_INFO class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_SITE_INFO::MESSAGE_TYPE_SITE_INFO() : RCCH(),
|
||||
m_bcchCnt(1U),
|
||||
m_rcchGroupingCnt(1U),
|
||||
m_ccchPagingCnt(2U),
|
||||
m_ccchMultiCnt(2U),
|
||||
m_rcchIterateCnt(2U)
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_SITE_INFO;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_SITE_INFO::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_SITE_INFO::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[1U] = (m_siteData.locId() >> 16) & 0xFFU; // Location ID
|
||||
rcch[2U] = (m_siteData.locId() >> 8) & 0xFFU; // ...
|
||||
rcch[3U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
rcch[4U] = ((m_bcchCnt & 0x03U) << 6) + // Channel Structure - Number of BCCH
|
||||
((m_rcchGroupingCnt & 0x07U) << 3) + // ... - Number of Grouping
|
||||
(((m_ccchPagingCnt >> 1) & 0x07U) << 0); // ... - Number of Paging Frames
|
||||
rcch[5U] = ((m_ccchPagingCnt & 0x01U) << 7) + // ... - Number of Paging Frames
|
||||
((m_ccchMultiCnt & 0x07U) << 4) + // ... - Number of Multipurpose Frames
|
||||
((m_rcchIterateCnt & 0x0FU) << 0); // ... - Number of Iteration
|
||||
|
||||
rcch[6U] = m_siteData.serviceClass(); // Service Information
|
||||
rcch[7U] = (m_siteData.netActive() ? NXDN_SIF2_IP_NETWORK : 0x00U); // ...
|
||||
|
||||
// bryanb: this is currently fixed -- maybe dynamic in the future
|
||||
rcch[8U] = 0U; // Restriction Information - No access restriction / No cycle restriction
|
||||
rcch[9U] = 0x08U; // ... - No group restriction / GMS; Location Registration Restriction
|
||||
rcch[10U] = (!m_siteData.netActive() ? 0x01U : 0x00U); // ... - No group ratio restriction / No delay time extension / ISO
|
||||
|
||||
// bryanb: this is currently fixed -- maybe dynamic in the future
|
||||
rcch[11U] = NXDN_CH_ACCESS_BASE_FREQ_SYS_DEFINED; // Channel Access Information - Channel Version / Sys Defined Step / Sys Defined Base Freq
|
||||
|
||||
rcch[14U] = 1U; // Version
|
||||
|
||||
uint16_t channelNo = m_siteData.channelNo() & 0x3FFU;
|
||||
rcch[15U] = (channelNo >> 6) & 0x0FU; // 1st Control Channel
|
||||
rcch[16U] = (channelNo & 0x3FU) << 2; // ...
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void MESSAGE_TYPE_SITE_INFO::copy(const MESSAGE_TYPE_SITE_INFO& data)
|
||||
{
|
||||
RCCH::copy(data);
|
||||
|
||||
m_bcchCnt = data.m_bcchCnt;
|
||||
m_rcchGroupingCnt = data.m_rcchGroupingCnt;
|
||||
m_ccchPagingCnt = data.m_ccchPagingCnt;
|
||||
m_ccchMultiCnt = data.m_ccchMultiCnt;
|
||||
m_rcchIterateCnt = data.m_rcchIterateCnt;
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_SITE_INFO_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_SITE_INFO_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements SITE_INFO - Site Information
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_SITE_INFO : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_SITE_INFO class.</summary>
|
||||
MESSAGE_TYPE_SITE_INFO();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
|
||||
public:
|
||||
/** Channel Structure Data */
|
||||
/// <summary>Count of BCCH frames per RCCH superframe.</summary>
|
||||
__PROPERTY(uint8_t, bcchCnt, BcchCnt);
|
||||
/// <summary>Count of RCCH frame groupings per RCCH superframe.</summary>
|
||||
__PROPERTY(uint8_t, rcchGroupingCnt, RcchGroupingCnt);
|
||||
/// <summary>Count of CCCH/UPCH paging frames per RCCH superframe.</summary>
|
||||
__PROPERTY(uint8_t, ccchPagingCnt, CcchPagingCnt);
|
||||
/// <summary>Count of CCCH/UPCH multi-purpose frames per RCCH superframe.</summary>
|
||||
__PROPERTY(uint8_t, ccchMultiCnt, CcchMultiCnt);
|
||||
/// <summary>Count of group iterations per RCCH superframe.</summary>
|
||||
__PROPERTY(uint8_t, rcchIterateCnt, RcchIterateCount);
|
||||
|
||||
__COPY(MESSAGE_TYPE_SITE_INFO);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_SITE_INFO_H__
|
||||
@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_SRV_INFO class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_SRV_INFO::MESSAGE_TYPE_SRV_INFO() : RCCH()
|
||||
{
|
||||
m_messageType = nxdn::MESSAGE_TYPE_SRV_INFO;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_SRV_INFO::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_SRV_INFO::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[1U] = (m_siteData.locId() >> 16) & 0xFFU; // Location ID
|
||||
rcch[2U] = (m_siteData.locId() >> 8) & 0xFFU; // ...
|
||||
rcch[3U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
rcch[4U] = m_siteData.serviceClass(); // Service Information
|
||||
rcch[5U] = (m_siteData.netActive() ? NXDN_SIF2_IP_NETWORK : 0x00U); // ...
|
||||
|
||||
// bryanb: this is currently fixed -- maybe dynamic in the future
|
||||
rcch[6U] = 0U; // Restriction Information - No access restriction / No cycle restriction
|
||||
rcch[7U] = 0x08U; // ... - No group restriction / GMS; Location Registration Restriction
|
||||
rcch[8U] = (!m_siteData.netActive() ? 0x01U : 0x00U); // ... - No group ratio restriction / No delay time extension / ISO
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_SRV_INFO_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_SRV_INFO_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements SRV_INFO - Service Information
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_SRV_INFO : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_SRV_INFO class.</summary>
|
||||
MESSAGE_TYPE_SRV_INFO();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_SRV_INFO_H__
|
||||
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_VCALL_ASSGN.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_VCALL_ASSGN class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_VCALL_ASSGN::MESSAGE_TYPE_VCALL_ASSGN() : RCCH()
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_VCALL_ASSGN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_VCALL_ASSGN::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_VCALL_ASSGN::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[1U] = (m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_priority ? 0x20U : 0x00U); // Priority Flag
|
||||
rcch[2U] = ((m_callType & 0x07U) << 5) + // Call Type
|
||||
(m_duplex ? 0x10U : 0x00U) + // Half/Full Duplex Flag
|
||||
(m_transmissionMode & 0x07U); // Transmission Mode
|
||||
|
||||
rcch[3U] = (m_srcId >> 8U) & 0xFFU; // Source Radio Address
|
||||
rcch[4U] = (m_srcId >> 0U) & 0xFFU; // ...
|
||||
rcch[5U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[6U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
|
||||
rcch[7U] = (m_grpVchNo >> 10) & 0x03U; // Channel
|
||||
rcch[8U] = (m_grpVchNo & 0xFFU); // ...
|
||||
|
||||
rcch[10U] = (m_siteData.locId() >> 8) & 0xFFU; // Location ID
|
||||
rcch[11U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_VCALL_ASSGN_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_VCALL_ASSGN_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements VCALL_ASSGN - Voice Call Assignment
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_VCALL_ASSGN : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_VCALL_ASSGN class.</summary>
|
||||
MESSAGE_TYPE_VCALL_ASSGN();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_VCALL_ASSGN_H__
|
||||
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_VCALL_CONN.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MESSAGE_TYPE_VCALL_CONN class.
|
||||
/// </summary>
|
||||
MESSAGE_TYPE_VCALL_CONN::MESSAGE_TYPE_VCALL_CONN() : RCCH()
|
||||
{
|
||||
m_messageType = RCCH_MESSAGE_TYPE_VCALL_CONN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode layer 3 data.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_VCALL_CONN::decode(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
RCCH::decode(data, rcch, length, offset);
|
||||
|
||||
m_callType = (rcch[2U] >> 5) & 0x07U; // Call Type
|
||||
m_emergency = (rcch[1U] & 0x80U) == 0x80U; // Emergency Flag
|
||||
m_priority = (rcch[1U] & 0x20U) == 0x20U; // Priority Flag
|
||||
m_duplex = (rcch[2U] & 0x10U) == 0x10U; // Half/Full Duplex Flag
|
||||
m_transmissionMode = (rcch[2U] & 0x07U); // Transmission Mode
|
||||
m_srcId = (uint16_t)((rcch[3U] << 8) | rcch[4U]) & 0xFFFFU; // Source Radio Address
|
||||
m_dstId = (uint16_t)((rcch[5U] << 8) | rcch[6U]) & 0xFFFFU; // Target Radio Address
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
void MESSAGE_TYPE_VCALL_CONN::encode(uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
rcch[1U] = (m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_priority ? 0x20U : 0x00U); // Priority Flag
|
||||
rcch[2U] = ((m_callType & 0x07U) << 5) + // Call Type
|
||||
(m_duplex ? 0x10U : 0x00U) + // Half/Full Duplex Flag
|
||||
(m_transmissionMode & 0x07U); // Transmission Mode
|
||||
|
||||
rcch[3U] = (m_srcId >> 8U) & 0xFFU; // Source Radio Address
|
||||
rcch[4U] = (m_srcId >> 0U) & 0xFFU; // ...
|
||||
rcch[5U] = (m_dstId >> 8U) & 0xFFU; // Target Radio Address
|
||||
rcch[6U] = (m_dstId >> 0U) & 0xFFU; // ...
|
||||
|
||||
rcch[7U] = m_causeRsp; // Cause (VD)
|
||||
rcch[9U] = (m_siteData.locId() >> 8) & 0xFFU; // Location ID
|
||||
rcch[10U] = (m_siteData.locId() >> 0) & 0xFFU; // ...
|
||||
|
||||
RCCH::encode(data, rcch, length, offset);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC_RCCH__MESSAGE_TYPE_VCALL_CONN_H__)
|
||||
#define __NXDN_LC_RCCH__MESSAGE_TYPE_VCALL_CONN_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements VCALL_CONN - Voice Call Connection Request (ISP) and
|
||||
// Voice Call Connection Response (OSP)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API MESSAGE_TYPE_VCALL_CONN : public RCCH {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the MESSAGE_TYPE_VCALL_CONN class.</summary>
|
||||
MESSAGE_TYPE_VCALL_CONN();
|
||||
|
||||
/// <summary>Decode layer 3 data.</summary>
|
||||
virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
/// <summary>Encode layer 3 data.</summary>
|
||||
virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC_RCCH__MESSAGE_TYPE_VCALL_CONN_H__
|
||||
@ -0,0 +1,120 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "nxdn/lc/rcch/RCCHFactory.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace nxdn::lc::rcch;
|
||||
using namespace nxdn::lc;
|
||||
using namespace nxdn;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the RCCHFactory class.
|
||||
/// </summary>
|
||||
RCCHFactory::RCCHFactory()
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes a instance of RCCHFactory class.
|
||||
/// </summary>
|
||||
RCCHFactory::~RCCHFactory()
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of a RCCH.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <returns>True, if RCCH was decoded, otherwise false.</returns>
|
||||
std::unique_ptr<RCCH> RCCHFactory::createRCCH(const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
uint8_t rcch[22U];
|
||||
::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U);
|
||||
|
||||
for (uint32_t i = 0U; i < length; i++, offset++) {
|
||||
bool b = READ_BIT(data, offset);
|
||||
WRITE_BIT(rcch, i, b);
|
||||
}
|
||||
|
||||
uint8_t messageType = data[0U] & 0x3FU; // Message Type
|
||||
|
||||
// message type opcodes
|
||||
switch (messageType) {
|
||||
case RTCH_MESSAGE_TYPE_VCALL:
|
||||
case RCCH_MESSAGE_TYPE_VCALL_CONN:
|
||||
return decode(new MESSAGE_TYPE_VCALL_CONN(), data, length, offset);
|
||||
case RTCH_MESSAGE_TYPE_DCALL_HDR:
|
||||
return decode(new MESSAGE_TYPE_DCALL_HDR(), data, length, offset);
|
||||
case nxdn::MESSAGE_TYPE_IDLE:
|
||||
return decode(new MESSAGE_TYPE_IDLE(), data, length, offset);
|
||||
case RCCH_MESSAGE_TYPE_REG:
|
||||
return decode(new MESSAGE_TYPE_REG(), data, length, offset);
|
||||
case RCCH_MESSAGE_TYPE_REG_C:
|
||||
return decode(new MESSAGE_TYPE_REG_C(), data, length, offset);
|
||||
case RCCH_MESSAGE_TYPE_GRP_REG:
|
||||
return decode(new MESSAGE_TYPE_GRP_REG(), data, length, offset);
|
||||
default:
|
||||
LogError(LOG_NXDN, "RCCH::decodeRCCH(), unknown RCCH value, messageType = $%02X", messageType);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="rcch"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <returns></returns>
|
||||
std::unique_ptr<RCCH> RCCHFactory::decode(RCCH* rcch, const uint8_t* data, uint32_t length, uint32_t offset)
|
||||
{
|
||||
assert(rcch != nullptr);
|
||||
assert(data != nullptr);
|
||||
|
||||
rcch->decode(data, length, offset);
|
||||
return std::unique_ptr<RCCH>(rcch);
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__NXDN_LC__RCCH_FACTORY_H__)
|
||||
#define __NXDN_LC__RCCH_FACTORY_H__
|
||||
|
||||
#include "Defines.h"
|
||||
|
||||
#include "nxdn/lc/RCCH.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_DCALL_HDR.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_DST_ID_INFO.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_GRP_REG.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_IDLE.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_REG_C.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_REG_COMM.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_REG.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_VCALL_ASSGN.h"
|
||||
#include "nxdn/lc/rcch/MESSAGE_TYPE_VCALL_CONN.h"
|
||||
|
||||
namespace nxdn
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace rcch
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Helper class to instantiate an instance of a RCCH.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API RCCHFactory {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the RCCHFactory class.</summary>
|
||||
RCCHFactory();
|
||||
/// <summary>Finalizes a instance of the RCCHFactory class.</summary>
|
||||
~RCCHFactory();
|
||||
|
||||
/// <summary>Create an instance of a RCCH.</summary>
|
||||
static std::unique_ptr<RCCH> createRCCH(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
|
||||
private:
|
||||
/// <summary></summary>
|
||||
static std::unique_ptr<RCCH> decode(RCCH* rcch, const uint8_t* data, uint32_t length, uint32_t offset = 0U);
|
||||
};
|
||||
} // namespace rcch
|
||||
} // namespace lc
|
||||
} // namespace nxdn
|
||||
|
||||
#endif // __NXDN_LC__RCCH_FACTORY_H__
|
||||
Loading…
Reference in new issue