/** * 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) 2018-2019 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(__IDEN_TABLE_LOOKUP_H__) #define __IDEN_TABLE_LOOKUP_H__ #include "Defines.h" #include "lookups/LookupTable.h" #include "Thread.h" #include "Mutex.h" #include #include #include namespace lookups { // --------------------------------------------------------------------------- // Class Declaration // Represents an individual entry in the bandplan identity table. // --------------------------------------------------------------------------- class HOST_SW_API IdenTable { public: /// Initializes a new insatnce of the IdenTable class. IdenTable() : m_channelId(0U), m_baseFrequency(0U), m_chSpaceKhz(0.0F), m_txOffsetMhz(0.0F), m_chBandwidthKhz(0.0F) { /* stub */ } /// Initializes a new insatnce of the IdenTable class. /// /// /// /// /// IdenTable(uint8_t channelId, uint32_t baseFrequency, float chSpaceKhz, float txOffsetMhz, float chBandwidthKhz) : m_channelId(channelId), m_baseFrequency(baseFrequency), m_chSpaceKhz(chSpaceKhz), m_txOffsetMhz(txOffsetMhz), m_chBandwidthKhz(chBandwidthKhz) { /* stub */ } /// Equals operator. /// /// IdenTable& operator=(const IdenTable& data) { if (this != &data) { m_channelId = data.m_channelId; m_baseFrequency = data.m_baseFrequency; m_chSpaceKhz = data.m_chSpaceKhz; m_txOffsetMhz = data.m_txOffsetMhz; m_chBandwidthKhz = data.m_chBandwidthKhz; } return *this; } public: /// Channel ID for this entry. __READONLY_PROPERTY_PLAIN(uint8_t, channelId, channelId); /// Base frequency for this entry. __READONLY_PROPERTY_PLAIN(uint32_t, baseFrequency, baseFrequency); /// Channel spacing in kHz for this entry. __READONLY_PROPERTY_PLAIN(float, chSpaceKhz, chSpaceKhz); /// Channel transmit offset in MHz for this entry. __READONLY_PROPERTY_PLAIN(float, txOffsetMhz, txOffsetMhz); /// Channel bandwith in kHz for this entry. __READONLY_PROPERTY_PLAIN(float, chBandwidthKhz, chBandwidthKhz); }; // --------------------------------------------------------------------------- // Class Declaration // Implements a threading lookup table class that contains the bandplan // identity table. // --------------------------------------------------------------------------- class HOST_SW_API IdenTableLookup : public LookupTable { public: /// Initializes a new instance of the IdenTableLookup class. IdenTableLookup(const std::string& filename, uint32_t reloadTime); /// Finalizes a instance of the IdenTableLookup class. virtual ~IdenTableLookup(); /// Finds a table entry in this lookup table. virtual IdenTable find(uint32_t id); /// Returns the list of entries in this lookup table. std::vector list(); private: /// Parses a table entry from the passed comma delimited string. IdenTable parse(std::string tableEntry); }; } // namespace lookups #endif // __IDEN_TABLE_LOOKUP_H__