mirror of https://github.com/g4klx/MMDVM.git
Handle extended packet lengths.
This commit is contained in:
parent
6dbda2795a
commit
114c2bcb15
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -125,7 +125,7 @@ void CCWIdTX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CCWIdTX::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCWIdTX::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
::memset(m_poBuffer, 0x00U, 1000U * sizeof(uint8_t));
|
||||
|
||||
|
|
4
CWIdTX.h
4
CWIdTX.h
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2016,2020 by Colin Durbridge G4EML
|
||||
*
|
||||
* 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
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void process();
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
void reset();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2015,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -208,7 +208,7 @@ void CCalDMR::dmrdmo1k()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CCalDMR::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCalDMR::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
4
CalDMR.h
4
CalDMR.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2015,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
void createData1k(uint8_t n);
|
||||
void createDataDMO1k(uint8_t n);
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
private:
|
||||
bool m_transmit;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2016,2020 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
|
||||
|
@ -162,7 +162,7 @@ void CCalDStarTX::process()
|
|||
m_count = (m_count + 1U) % (30U * 21U);
|
||||
}
|
||||
|
||||
uint8_t CCalDStarTX::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCalDStarTX::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2020 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
|
||||
|
@ -26,7 +26,7 @@ class CCalDStarTX {
|
|||
public:
|
||||
CCalDStarTX();
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
void process();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2015,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2020 by Phil Taylor M0VSE
|
||||
*
|
||||
|
@ -116,7 +116,7 @@ void CCalFM::process()
|
|||
}
|
||||
|
||||
|
||||
uint8_t CCalFM::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCalFM::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
4
CalFM.h
4
CalFM.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2015,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2020 by Phil Taylor M0VSE
|
||||
*
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
void fm25kcal();
|
||||
void fm30kcal();
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
private:
|
||||
uint16_t m_frequency;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||
* Copyright (C) 2020 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
|
||||
|
@ -79,7 +80,7 @@ void CCalNXDN::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CCalNXDN::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCalNXDN::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||
* Copyright (C) 2020 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
|
||||
|
@ -32,7 +33,7 @@ public:
|
|||
|
||||
void process();
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
private:
|
||||
bool m_transmit;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||
* Copyright (C) 2020 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
|
||||
|
@ -82,7 +83,7 @@ void CCalP25::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CCalP25::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCalP25::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
3
CalP25.h
3
CalP25.h
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||
* Copyright (C) 2020 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
|
||||
|
@ -34,7 +35,7 @@ public:
|
|||
|
||||
void process();
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
private:
|
||||
bool m_transmit;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||
* Copyright (C) 2020 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
|
||||
|
@ -38,7 +39,7 @@ void CCalPOCSAG::process()
|
|||
pocsagTX.writeByte(0xAAU);
|
||||
}
|
||||
|
||||
uint8_t CCalPOCSAG::write(const uint8_t* data, uint8_t length)
|
||||
uint8_t CCalPOCSAG::write(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||
* Copyright (C) 2020 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
|
||||
|
@ -32,7 +33,7 @@ public:
|
|||
|
||||
void process();
|
||||
|
||||
uint8_t write(const uint8_t* data, uint8_t length);
|
||||
uint8_t write(const uint8_t* data, uint16_t length);
|
||||
|
||||
private:
|
||||
POCSAGCAL m_state;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||
*
|
||||
|
@ -104,7 +104,7 @@ void CDMRDMOTX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CDMRDMOTX::writeData(const uint8_t* data, uint8_t length)
|
||||
uint8_t CDMRDMOTX::writeData(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != (DMR_FRAME_LENGTH_BYTES + 1U))
|
||||
return 4U;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -29,7 +29,7 @@ class CDMRDMOTX {
|
|||
public:
|
||||
CDMRDMOTX();
|
||||
|
||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint16_t length);
|
||||
|
||||
void process();
|
||||
|
||||
|
|
10
DMRTX.cpp
10
DMRTX.cpp
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||
*
|
||||
|
@ -144,7 +144,7 @@ void CDMRTX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CDMRTX::writeData1(const uint8_t* data, uint8_t length)
|
||||
uint8_t CDMRTX::writeData1(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != (DMR_FRAME_LENGTH_BYTES + 1U))
|
||||
return 4U;
|
||||
|
@ -168,7 +168,7 @@ uint8_t CDMRTX::writeData1(const uint8_t* data, uint8_t length)
|
|||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CDMRTX::writeData2(const uint8_t* data, uint8_t length)
|
||||
uint8_t CDMRTX::writeData2(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != (DMR_FRAME_LENGTH_BYTES + 1U))
|
||||
return 4U;
|
||||
|
@ -192,7 +192,7 @@ uint8_t CDMRTX::writeData2(const uint8_t* data, uint8_t length)
|
|||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CDMRTX::writeShortLC(const uint8_t* data, uint8_t length)
|
||||
uint8_t CDMRTX::writeShortLC(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 9U)
|
||||
return 4U;
|
||||
|
@ -208,7 +208,7 @@ uint8_t CDMRTX::writeShortLC(const uint8_t* data, uint8_t length)
|
|||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CDMRTX::writeAbort(const uint8_t* data, uint8_t length)
|
||||
uint8_t CDMRTX::writeAbort(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
return 4U;
|
||||
|
|
10
DMRTX.h
10
DMRTX.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -38,11 +38,11 @@ class CDMRTX {
|
|||
public:
|
||||
CDMRTX();
|
||||
|
||||
uint8_t writeData1(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData2(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData1(const uint8_t* data, uint16_t length);
|
||||
uint8_t writeData2(const uint8_t* data, uint16_t length);
|
||||
|
||||
uint8_t writeShortLC(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeAbort(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeShortLC(const uint8_t* data, uint16_t length);
|
||||
uint8_t writeAbort(const uint8_t* data, uint16_t length);
|
||||
|
||||
void setStart(bool start);
|
||||
void setCal(bool start);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -277,7 +277,7 @@ void CDStarTX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CDStarTX::writeHeader(const uint8_t* header, uint8_t length)
|
||||
uint8_t CDStarTX::writeHeader(const uint8_t* header, uint16_t length)
|
||||
{
|
||||
if (length != DSTAR_HEADER_LENGTH_BYTES)
|
||||
return 4U;
|
||||
|
@ -296,7 +296,7 @@ uint8_t CDStarTX::writeHeader(const uint8_t* header, uint8_t length)
|
|||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CDStarTX::writeData(const uint8_t* data, uint8_t length)
|
||||
uint8_t CDStarTX::writeData(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != DSTAR_DATA_LENGTH_BYTES)
|
||||
return 4U;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017,2020 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
|
||||
|
@ -27,8 +27,8 @@ class CDStarTX {
|
|||
public:
|
||||
CDStarTX();
|
||||
|
||||
uint8_t writeHeader(const uint8_t* header, uint8_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeHeader(const uint8_t* header, uint16_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint16_t length);
|
||||
uint8_t writeEOT();
|
||||
|
||||
void process();
|
||||
|
|
|
@ -122,7 +122,7 @@ void CNXDNTX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CNXDNTX::writeData(const uint8_t* data, uint8_t length)
|
||||
uint8_t CNXDNTX::writeData(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != (NXDN_FRAME_LENGTH_BYTES + 1U))
|
||||
return 4U;
|
||||
|
|
2
NXDNTX.h
2
NXDNTX.h
|
@ -27,7 +27,7 @@ class CNXDNTX {
|
|||
public:
|
||||
CNXDNTX();
|
||||
|
||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint16_t length);
|
||||
|
||||
void process();
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void CP25TX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CP25TX::writeData(const uint8_t* data, uint8_t length)
|
||||
uint8_t CP25TX::writeData(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length < (P25_TERM_FRAME_LENGTH_BYTES + 1U))
|
||||
return 4U;
|
||||
|
|
2
P25TX.h
2
P25TX.h
|
@ -27,7 +27,7 @@ class CP25TX {
|
|||
public:
|
||||
CP25TX();
|
||||
|
||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint16_t length);
|
||||
|
||||
void process();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2018,2020 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
|
||||
|
@ -95,7 +95,7 @@ bool CPOCSAGTX::busy()
|
|||
return false;
|
||||
}
|
||||
|
||||
uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length)
|
||||
uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != POCSAG_FRAME_LENGTH_BYTES)
|
||||
return 4U;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015-2020 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
|
||||
|
@ -27,7 +27,7 @@ class CPOCSAGTX {
|
|||
public:
|
||||
CPOCSAGTX();
|
||||
|
||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint16_t length);
|
||||
|
||||
void writeByte(uint8_t c);
|
||||
|
||||
|
|
111
SerialPort.cpp
111
SerialPort.cpp
|
@ -266,7 +266,7 @@ void CSerialPort::getVersion()
|
|||
writeInt(1U, reply, count);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||
uint8_t CSerialPort::setConfig(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length < 21U)
|
||||
return 4U;
|
||||
|
@ -376,7 +376,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setFMParams1(const uint8_t* data, uint8_t length)
|
||||
uint8_t CSerialPort::setFMParams1(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length < 8U)
|
||||
return 4U;
|
||||
|
@ -401,7 +401,7 @@ uint8_t CSerialPort::setFMParams1(const uint8_t* data, uint8_t length)
|
|||
return fm.setCallsign(callsign, speed, frequency, time, holdoff, highLevel, lowLevel, callAtStart, callAtEnd, callAtLatch);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint8_t length)
|
||||
uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length < 6U)
|
||||
return 4U;
|
||||
|
@ -421,7 +421,7 @@ uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint8_t length)
|
|||
return fm.setAck(ack, speed, frequency, minTime, delay, level);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length)
|
||||
uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length < 12U)
|
||||
return 4U;
|
||||
|
@ -447,7 +447,7 @@ uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length)
|
|||
return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, cosInvert, rfAudioBoost, maxDev, rxLevel);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
||||
uint8_t CSerialPort::setMode(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length < 1U)
|
||||
return 4U;
|
||||
|
@ -598,22 +598,63 @@ void CSerialPort::process()
|
|||
m_buffer[0U] = c;
|
||||
m_ptr = 1U;
|
||||
m_len = 0U;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
m_ptr = 0U;
|
||||
m_len = 0U;
|
||||
}
|
||||
} else if (m_ptr == 1U) {
|
||||
// Handle the frame length
|
||||
// Handle the frame length, 1/2
|
||||
m_len = m_buffer[m_ptr] = c;
|
||||
m_ptr = 2U;
|
||||
} else if (m_ptr == 2U) {
|
||||
// Handle the frame length, 2/2
|
||||
m_buffer[m_ptr] = c;
|
||||
m_ptr = 3U;
|
||||
|
||||
if (m_len == 0U)
|
||||
m_len = c + 255U;
|
||||
|
||||
// The full packet has been received, process it
|
||||
if (m_ptr == m_len)
|
||||
processMessage();
|
||||
} else {
|
||||
// Any other bytes are added to the buffer
|
||||
m_buffer[m_ptr] = c;
|
||||
m_ptr++;
|
||||
|
||||
// The full packet has been received, process it
|
||||
if (m_ptr == m_len) {
|
||||
if (m_ptr == m_len)
|
||||
processMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (io.getWatchdog() >= 48000U) {
|
||||
m_ptr = 0U;
|
||||
m_len = 0U;
|
||||
}
|
||||
|
||||
#if defined(SERIAL_REPEATER)
|
||||
// Write any outgoing serial data
|
||||
uint16_t space = m_repeat.getData();
|
||||
if (space > 0U) {
|
||||
int avail = availableForWriteInt(3U);
|
||||
if (avail < space)
|
||||
space = avail;
|
||||
|
||||
for (uint16_t i = 0U; i < space; i++) {
|
||||
uint8_t c = m_repeat.get();
|
||||
writeInt(3U, &c, 1U);
|
||||
}
|
||||
}
|
||||
|
||||
// Read any incoming serial data
|
||||
while (availableInt(3U))
|
||||
readInt(3U);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSerialPort::processMessage()
|
||||
{
|
||||
uint8_t err = 2U;
|
||||
|
||||
switch (m_buffer[2U]) {
|
||||
|
@ -913,33 +954,6 @@ void CSerialPort::process()
|
|||
m_ptr = 0U;
|
||||
m_len = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (io.getWatchdog() >= 48000U) {
|
||||
m_ptr = 0U;
|
||||
m_len = 0U;
|
||||
}
|
||||
|
||||
#if defined(SERIAL_REPEATER)
|
||||
// Write any outgoing serial data
|
||||
uint16_t space = m_repeat.getData();
|
||||
if (space > 0U) {
|
||||
int avail = availableForWriteInt(3U);
|
||||
if (avail < space)
|
||||
space = avail;
|
||||
|
||||
for (uint16_t i = 0U; i < space; i++) {
|
||||
uint8_t c = m_repeat.get();
|
||||
writeInt(3U, &c, 1U);
|
||||
}
|
||||
}
|
||||
|
||||
// Read any incoming serial data
|
||||
while (availableInt(3U))
|
||||
readInt(3U);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length)
|
||||
{
|
||||
|
@ -1203,7 +1217,7 @@ void CSerialPort::writeNXDNLost()
|
|||
writeInt(1U, reply, 3);
|
||||
}
|
||||
|
||||
void CSerialPort::writeAX25Data(const uint8_t* data, uint8_t length)
|
||||
void CSerialPort::writeAX25Data(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (m_modemState != STATE_FM && m_modemState != STATE_IDLE)
|
||||
return;
|
||||
|
@ -1211,19 +1225,28 @@ void CSerialPort::writeAX25Data(const uint8_t* data, uint8_t length)
|
|||
if (!m_ax25Enable)
|
||||
return;
|
||||
|
||||
uint8_t reply[300U];
|
||||
uint8_t reply[512U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
|
||||
if (length > 252U) {
|
||||
reply[1U] = 0U;
|
||||
reply[2U] = (length + 4U) - 255U;
|
||||
reply[3U] = MMDVM_AX25_DATA;
|
||||
|
||||
for (uint8_t i = 0U; i < length; i++)
|
||||
reply[i + 4U] = data[i];
|
||||
|
||||
writeInt(1U, reply, length + 4U);
|
||||
} else {
|
||||
reply[1U] = length + 3U;
|
||||
reply[2U] = MMDVM_AX25_DATA;
|
||||
|
||||
uint8_t count = 3U;
|
||||
for (uint8_t i = 0U; i < length; i++, count++)
|
||||
reply[count] = data[i];
|
||||
for (uint8_t i = 0U; i < length; i++)
|
||||
reply[i + 3U] = data[i];
|
||||
|
||||
reply[1U] = count;
|
||||
|
||||
writeInt(1U, reply, count);
|
||||
writeInt(1U, reply, length + 3U);
|
||||
}
|
||||
}
|
||||
|
||||
void CSerialPort::writeCalData(const uint8_t* data, uint8_t length)
|
||||
|
|
19
SerialPort.h
19
SerialPort.h
|
@ -50,7 +50,7 @@ public:
|
|||
void writeNXDNData(const uint8_t* data, uint8_t length);
|
||||
void writeNXDNLost();
|
||||
|
||||
void writeAX25Data(const uint8_t* data, uint8_t length);
|
||||
void writeAX25Data(const uint8_t* data, uint16_t length);
|
||||
|
||||
void writeCalData(const uint8_t* data, uint8_t length);
|
||||
void writeRSSIData(const uint8_t* data, uint8_t length);
|
||||
|
@ -62,9 +62,9 @@ public:
|
|||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
||||
|
||||
private:
|
||||
uint8_t m_buffer[256U];
|
||||
uint8_t m_ptr;
|
||||
uint8_t m_len;
|
||||
uint8_t m_buffer[512U];
|
||||
uint16_t m_ptr;
|
||||
uint16_t m_len;
|
||||
bool m_debug;
|
||||
CSerialRB m_repeat;
|
||||
|
||||
|
@ -72,12 +72,13 @@ private:
|
|||
void sendNAK(uint8_t err);
|
||||
void getStatus();
|
||||
void getVersion();
|
||||
uint8_t setConfig(const uint8_t* data, uint8_t length);
|
||||
uint8_t setMode(const uint8_t* data, uint8_t length);
|
||||
uint8_t setConfig(const uint8_t* data, uint16_t length);
|
||||
uint8_t setMode(const uint8_t* data, uint16_t length);
|
||||
void setMode(MMDVM_STATE modemState);
|
||||
uint8_t setFMParams1(const uint8_t* data, uint8_t length);
|
||||
uint8_t setFMParams2(const uint8_t* data, uint8_t length);
|
||||
uint8_t setFMParams3(const uint8_t* data, uint8_t length);
|
||||
uint8_t setFMParams1(const uint8_t* data, uint16_t length);
|
||||
uint8_t setFMParams2(const uint8_t* data, uint16_t length);
|
||||
uint8_t setFMParams3(const uint8_t* data, uint16_t length);
|
||||
void processMessage();
|
||||
|
||||
// Hardware versions
|
||||
void beginInt(uint8_t n, int speed);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -116,7 +116,7 @@ void CYSFTX::process()
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CYSFTX::writeData(const uint8_t* data, uint8_t length)
|
||||
uint8_t CYSFTX::writeData(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != (YSF_FRAME_LENGTH_BYTES + 1U))
|
||||
return 4U;
|
||||
|
|
4
YSFTX.h
4
YSFTX.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017,2020 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
|
||||
|
@ -27,7 +27,7 @@ class CYSFTX {
|
|||
public:
|
||||
CYSFTX();
|
||||
|
||||
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||
uint8_t writeData(const uint8_t* data, uint16_t length);
|
||||
|
||||
void process();
|
||||
|
||||
|
|
Loading…
Reference in New Issue