MMDVMHost-Private/P25Control.h
Ryan Butler aae96a1caf This adds the ability to override the UID checking in P25 code to force 7 digit IDs.
Jonathan added this code due to a lack of CRC on P25 checking but some parties desire the ability to have any id.

It's understood that on networked connections, the need to use a 7 digit unique ID like the DMR ID is necessary.

This change is affected by adding a new parameter to the [P25 Network] section called OverrideUIDCheck and it defaults to 0.

The logic is, if the network is enabled, or if the network is disabled and the override is disabled, the check is made, otherwise it is not.

This has been field tested for all 4 configuration cases and found to work as described above.
2017-03-29 10:18:54 -05:00

110 lines
3.4 KiB
C++

/*
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
*
* 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(P25Control_H)
#define P25Control_H
#include "RSSIInterpolator.h"
#include "P25LowSpeedData.h"
#include "RingBuffer.h"
#include "P25Network.h"
#include "DMRLookup.h"
#include "P25Audio.h"
#include "Defines.h"
#include "Display.h"
#include "P25Data.h"
#include "P25NID.h"
#include "Modem.h"
#include "Timer.h"
#include <cstdio>
class CP25Control {
public:
CP25Control(unsigned int nac, bool uidoverride, CP25Network* network, CDisplay* display, unsigned int timeout, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper);
~CP25Control();
bool writeModem(unsigned char* data, unsigned int len);
unsigned int readModem(unsigned char* data);
void clock(unsigned int ms);
private:
unsigned int m_nac;
bool m_uidoverride;
CP25Network* m_network;
CDisplay* m_display;
bool m_duplex;
CDMRLookup* m_lookup;
CRingBuffer<unsigned char> m_queue;
RPT_RF_STATE m_rfState;
RPT_NET_STATE m_netState;
CTimer m_rfTimeout;
CTimer m_netTimeout;
CTimer m_networkWatchdog;
unsigned int m_rfFrames;
unsigned int m_rfBits;
unsigned int m_rfErrs;
unsigned int m_netFrames;
unsigned int m_netLost;
CP25NID m_nid;
unsigned char m_lastDUID;
CP25Audio m_audio;
CP25Data m_rfData;
CP25Data m_netData;
CP25LowSpeedData m_rfLSD;
CP25LowSpeedData m_netLSD;
unsigned char* m_netLDU1;
unsigned char* m_netLDU2;
unsigned char* m_lastIMBE;
unsigned char* m_rfLDU;
CRSSIInterpolator* m_rssiMapper;
unsigned char m_rssi;
unsigned char m_maxRSSI;
unsigned char m_minRSSI;
unsigned int m_aveRSSI;
unsigned int m_rssiCount;
FILE* m_fp;
void writeQueueRF(const unsigned char* data, unsigned int length);
void writeQueueNet(const unsigned char* data, unsigned int length);
void writeNetwork(const unsigned char *data, unsigned char type, bool end);
void writeNetwork();
void addBusyBits(unsigned char* data, unsigned int length, bool b1, bool b2);
void checkNetLDU1();
void checkNetLDU2();
void insertMissingAudio(unsigned char* data);
void createRFHeader();
void createNetHeader();
void createNetLDU1();
void createNetLDU2();
void createNetTerminator();
bool openFile();
bool writeFile(const unsigned char* data, unsigned char length);
void closeFile();
};
#endif