/** * 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) 2017-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(__P25_LC__TSBK_H__) #define __P25_LC__TSBK_H__ #include "Defines.h" #include "p25/data/DataHeader.h" #include "p25/data/DataBlock.h" #include "p25/edac/Trellis.h" #include "p25/lc/LC.h" #include "p25/lc/TDULC.h" #include "p25/SiteData.h" #include "edac/RS634717.h" #include "lookups/IdenTableLookup.h" #include namespace p25 { namespace dfsi { // --------------------------------------------------------------------------- // Class Prototypes // --------------------------------------------------------------------------- class HOST_SW_API LC; } namespace lc { // --------------------------------------------------------------------------- // Class Prototypes // --------------------------------------------------------------------------- class HOST_SW_API LC; class HOST_SW_API TDULC; // --------------------------------------------------------------------------- // Class Declaration // Represents link control data for TSDU packets. // --------------------------------------------------------------------------- class HOST_SW_API TSBK { public: /// Initializes a copy instance of the TSBK class. TSBK(const TSBK& data); /// Initializes a new instance of the TSBK class. TSBK(SiteData siteData, lookups::IdenTable entry); /// Initializes a new instance of the TSBK class. TSBK(SiteData siteData, lookups::IdenTable entry, bool verbose); /// Initializes a new instance of the TSBK class. TSBK(SiteData siteData, lookups::IdenTable entry, bool verbose, bool warnCRC); /// Initializes a new instance of the TSBK class. TSBK(LC* lc); /// Finalizes a instance of the TSBK class. ~TSBK(); /// Equals operator. TSBK& operator=(const TSBK& data); /// Decode a alternate trunking signalling block. bool decodeMBT(const data::DataHeader dataHeader, const uint8_t* block); /// Decode a trunking signalling block. bool decode(const uint8_t* data, bool rawTSBK = false); /// Encode a trunking signalling block. void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false); /// Sets the flag to skip vendor opcode processing. void setVendorSkip(bool skip); /// Sets the callsign. void setCallsign(std::string callsign); public: /// Flag indicating verbose log output. __PROPERTY(bool, verbose, Verbose); /// Flag indicating CRC-errors should be warnings and not errors. __PROPERTY(bool, warnCRC, WarnCRC); /** Common Data */ /// Flag indicating the link control data is protected. __PROPERTY(bool, protect, Protect); /// Link control opcode. __PROPERTY(uint8_t, lco, LCO); /// Manufacturer ID. __PROPERTY(uint8_t, mfId, MFId); /// Source ID. __PROPERTY(uint32_t, srcId, SrcId); /// Destination ID. __PROPERTY(uint32_t, dstId, DstId); /// Flag indicating this is the last TSBK in a sequence of TSBKs. __PROPERTY(bool, lastBlock, LastBlock); /// Flag indicating this TSBK contains additional information. __PROPERTY(bool, aivFlag, AIV); /// Flag indicating this TSBK contains extended addressing. __PROPERTY(bool, extendedAddrFlag, EX); /// Service type. __PROPERTY(uint8_t, service, Service); /// Response type. __PROPERTY(uint8_t, response, Response); /// Configured network ID. __READONLY_PROPERTY(uint32_t, netId, NetId); /// Configured system ID. __READONLY_PROPERTY(uint32_t, sysId, SysId); /// Voice channel ID. __PROPERTY(uint32_t, grpVchId, GrpVchId); /// Voice channel number. __PROPERTY(uint32_t, grpVchNo, GrpVchNo); /// Message value. __PROPERTY(uint32_t, messageValue, Message); /// Status value. __PROPERTY(uint8_t, statusValue, Status); /// Extended function opcode. __PROPERTY(uint32_t, extendedFunction, ExtendedFunction); /** SNDCP Channel Request */ /// SNDCP Data Service Options __PROPERTY(uint8_t, dataServiceOptions, DataServiceOptions); /// SNDCP Data Access Control __PROPERTY(uint32_t, dataAccessControl, DataAccessControl); /// SNDCP grant channel number. __PROPERTY(uint32_t, dataChannelNo, DataChnNo); /** Adjacent Site Data */ /// Adjacent site CFVA flags. __PROPERTY(uint8_t, adjCFVA, AdjSiteCFVA); /// Adjacent site system ID. __PROPERTY(uint32_t, adjSysId, AdjSiteSysId); /// Adjacent site RFSS ID. __PROPERTY(uint8_t, adjRfssId, AdjSiteRFSSId); /// Adjacent site ID. __PROPERTY(uint8_t, adjSiteId, AdjSiteId); /// Adjacent site channel ID. __PROPERTY(uint8_t, adjChannelId, AdjSiteChnId); /// Adjacent site channel number. __PROPERTY(uint32_t, adjChannelNo, AdjSiteChnNo); /// Adjacent site service class. __PROPERTY(uint8_t, adjServiceClass, AdjSiteSvcClass); /** SCCB Data */ /// SCCB channel ID 1. __PROPERTY(uint8_t, sccbChannelId1, SCCBChnId1); /// SCCB channel ID 2. __PROPERTY(uint8_t, sccbChannelId2, SCCBChnId2); /// Explicit SCCB channel number. __PROPERTY(uint32_t, sccbChannelNo, SCCBChnNo); /** Location Data */ /// Location registration area. __PROPERTY(uint8_t, lra, LRA); /** Patch Group data */ /// Patch super group ID. __PROPERTY(uint32_t, patchSuperGroupId, PatchSuperGroupId); /// 1st patch group ID. __PROPERTY(uint32_t, patchGroup1Id, PatchGroup1Id); /// 2nd patch group ID. __PROPERTY(uint32_t, patchGroup2Id, PatchGroup2Id); /// 3rd patch group ID. __PROPERTY(uint32_t, patchGroup3Id, PatchGroup3Id); /** Service Options */ /// Flag indicating the emergency bits are set. __PROPERTY(bool, emergency, Emergency); /// Flag indicating that encryption is enabled. __PROPERTY(bool, encrypted, Encrypted); /// Priority level for the traffic. __PROPERTY(uint8_t, priority, Priority); /// Flag indicating a group/talkgroup operation. __PROPERTY(bool, group, Group); /** 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 TSBK class. TSBK(); /// Initializes a new instance of the TSBK class. TSBK(SiteData siteData); friend class dfsi::LC; friend class LC; friend class TDULC; edac::RS634717 m_rs; edac::Trellis m_trellis; bool m_vendorSkip; bool m_sndcpAutoAccess; bool m_sndcpReqAccess; uint16_t m_sndcpDAC; /** Local Site data */ uint8_t* m_siteCallsign; /// Internal helper to copy the class. void copy(const TSBK& data); }; } // namespace lc } // namespace p25 #endif // __P25_LC__TSBK_H__