/** * 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 RCCH class. RCCH(); /// Finalizes a instance of the RCCH class. virtual ~RCCH(); /// Decode layer 3 data. virtual void decode(const uint8_t* data, uint32_t length, uint32_t offset = 0U) = 0; /// Encode layer 3 data. virtual void encode(uint8_t* data, uint32_t length, uint32_t offset = 0U) = 0; /// Sets the flag indicating verbose log output. static void setVerbose(bool verbose) { m_verbose = verbose; } /** Local Site data */ /// Sets the callsign. static void setCallsign(std::string callsign); /// Gets the local site data. static SiteData getSiteData() { return m_siteData; } /// Sets the local site data. static void setSiteData(SiteData siteData) { m_siteData = siteData; } public: /** Common Data */ /// Message Type __PROTECTED_PROPERTY(uint8_t, messageType, MessageType); /// Source ID. __PROTECTED_PROPERTY(uint16_t, srcId, SrcId); /// Destination ID. __PROTECTED_PROPERTY(uint16_t, dstId, DstId); /// Location ID. __PROTECTED_PROPERTY(uint32_t, locId, LocId); /// Registration Option. __PROTECTED_PROPERTY(uint8_t, regOption, RegOption); /// Version Number. __PROTECTED_PROPERTY(uint8_t, version, Version); /// Cause Response. __PROTECTED_PROPERTY(uint8_t, causeRsp, CauseResponse); /// Voice channel number. __PROTECTED_PROPERTY(uint32_t, grpVchNo, GrpVchNo); /** Call Data */ /// Call Type __PROTECTED_PROPERTY(uint8_t, callType, CallType); /** Common Call Options */ /// Flag indicating the emergency bits are set. __PROTECTED_PROPERTY(bool, emergency, Emergency); /// Flag indicating that encryption is enabled. __PROTECTED_PROPERTY(bool, encrypted, Encrypted); /// Flag indicating priority paging. __PROTECTED_PROPERTY(bool, priority, Priority); /// Flag indicating a group/talkgroup operation. __PROTECTED_PROPERTY(bool, group, Group); /// Flag indicating a half/full duplex operation. __PROTECTED_PROPERTY(bool, duplex, Duplex); /// Transmission mode. __PROTECTED_PROPERTY(uint8_t, transmissionMode, TransmissionMode); /** Local Site data */ /// Local Site Identity Entry. __PROTECTED_PROPERTY_PLAIN(lookups::IdenTable, siteIdenEntry, siteIdenEntry); protected: static bool m_verbose; /** Local Site data */ static uint8_t* m_siteCallsign; static SiteData m_siteData; /// Internal helper to decode a RCCH. void decode(const uint8_t* data, uint8_t* rcch, uint32_t length, uint32_t offset = 0U); /// Internal helper to encode a RCCH. void encode(uint8_t* data, const uint8_t* rcch, uint32_t length, uint32_t offset = 0U); __PROTECTED_COPY(RCCH); }; } // namespace lc } // namespace nxdn #endif // __NXDN_LC__RCCH_H__