/**
* 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
*
*/
//
// Based on code from the MMDVMHost project. (https://github.com/g4klx/MMDVMHost)
// Licensed under the GPLv2 License (https://opensource.org/licenses/GPL-2.0)
//
/*
* 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_H__)
#define __NXDN_LC__RCCH_H__
#include "Defines.h"
#include "nxdn/lc/PacketInformation.h"
#include "nxdn/SiteData.h"
#include "lookups/IdenTableLookup.h"
namespace nxdn
{
namespace lc
{
// ---------------------------------------------------------------------------
// Class Declaration
// Represents link control data for control channel NXDN calls.
// ---------------------------------------------------------------------------
class HOST_SW_API RCCH {
public:
/// Initializes a copy instance of the RCCH class.
RCCH(const RCCH& data);
/// Initializes a new instance of the TSBK class.
RCCH(SiteData siteData, lookups::IdenTable entry);
/// Initializes a new instance of the TSBK class.
RCCH(SiteData siteData, lookups::IdenTable entry, bool verbose);
/// Finalizes a instance of the RCCH class.
~RCCH();
/// Equals operator.
RCCH& operator=(const RCCH& data);
/// Decode layer 3 data.
void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U);
/// Encode layer 3 data.
void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U);
///
void reset();
/// Gets the raw layer 3 data.
void getData(uint8_t* data) const;
/// Sets the raw layer 3 data.
void setData(const uint8_t* data, uint32_t length);
/// Sets the callsign.
void setCallsign(std::string callsign);
public:
/// Flag indicating verbose log output.
__PROPERTY(bool, verbose, Verbose);
/** Common Data */
/// Message Type
__PROPERTY(uint8_t, messageType, MessageType);
/// Source ID.
__PROPERTY(uint16_t, srcId, SrcId);
/// Destination ID.
__PROPERTY(uint16_t, dstId, DstId);
/// Location ID.
__PROPERTY(uint32_t, locId, LocId);
/// Registration Option.
__PROPERTY(uint8_t, regOption, RegOption);
/// Version Number.
__PROPERTY(uint8_t, version, Version);
/// Cause Response.
__PROPERTY(uint8_t, causeRsp, CauseResponse);
/// Voice channel number.
__PROPERTY(uint32_t, grpVchNo, GrpVchNo);
/** Call Data */
/// Call Type
__PROPERTY(uint8_t, callType, CallType);
/** Common Call Options */
/// Flag indicating the emergency bits are set.
__PROPERTY(bool, emergency, Emergency);
/// Flag indicating that encryption is enabled.
__PROPERTY(bool, encrypted, Encrypted);
/// Flag indicating priority paging.
__PROPERTY(bool, priority, Priority);
/// Flag indicating a group/talkgroup operation.
__PROPERTY(bool, group, Group);
/// Flag indicating a half/full duplex operation.
__PROPERTY(bool, duplex, Duplex);
/// Transmission mode.
__PROPERTY(uint8_t, transmissionMode, TransmissionMode);
/** Local Site data */
/// Local Site Data.
__PROPERTY_PLAIN(SiteData, siteData, siteData);
/// Local Site Identity Entry.
__PROPERTY_PLAIN(lookups::IdenTable, siteIdenEntry, siteIdenEntry);
private:
/// Initializes a new instance of the RCCH class.
RCCH();
/// Initializes a new instance of the RCCH class.
RCCH(SiteData siteData);
uint8_t* m_data;
/** Local Site data */
uint8_t* m_siteCallsign;
/// Decode link control.
bool decodeLC(const uint8_t* data);
/// Encode link control.
void encodeLC(uint8_t* data);
/// Internal helper to copy the class.
void copy(const RCCH& data);
};
} // namespace lc
} // namespace nxdn
#endif // __NXDN_LC__RCCH_H__