From ebea3eddb221ed5e67db0c29f3fbaa7213a877f5 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 4 Oct 2024 17:14:36 +0100 Subject: [PATCH] Revert "Amalgamate the two Trellis implementations and small cleanups." This reverts commit ec9f7d74960775f4111184a9fd86bc3286492b4a. --- DMRSlot.cpp | 16 +- DMRTrellis.cpp | 374 ++++++++++++++++++++++++++++++++++ DMRTrellis.h | 36 ++++ DStarNetwork.cpp | 2 +- LCDproc.cpp | 57 +++--- LCDproc.h | 11 +- MMDVMHost.vcxproj | 6 +- MMDVMHost.vcxproj.filters | 18 +- Makefile | 14 +- Makefile.Pi.Adafruit | 15 +- Makefile.Pi.HD44780 | 15 +- Makefile.Pi.I2C | 14 +- Makefile.Pi.OLED | 15 +- Makefile.Pi.PCF8574 | 15 +- P25Control.cpp | 6 +- P25Data.h | 4 +- Trellis.cpp => P25Trellis.cpp | 38 ++-- Trellis.h => P25Trellis.h | 12 +- RemoteCommand.cpp | 2 +- TFTSurenoo.cpp | 2 +- 20 files changed, 538 insertions(+), 134 deletions(-) create mode 100644 DMRTrellis.cpp create mode 100644 DMRTrellis.h rename Trellis.cpp => P25Trellis.cpp (87%) rename Trellis.h => P25Trellis.h (92%) diff --git a/DMRSlot.cpp b/DMRSlot.cpp index bf53ba618..e66e11cf6 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021,2023,2024 Jonathan Naylor, G4KLX + * Copyright (C) 2015-2021,2023 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 @@ -15,10 +15,10 @@ #include "DMRDataHeader.h" #include "DMRSlotType.h" #include "DMRShortLC.h" +#include "DMRTrellis.h" #include "DMRFullLC.h" #include "BPTC19696.h" #include "DMRSlot.h" -#include "Trellis.h" #include "DMRCSBK.h" #include "DMREMB.h" #include "Utils.h" @@ -541,13 +541,13 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) CUtils::dump(1U, title, payload, 12U); bptc.encode(payload, data + 2U); } else if (dataType == DT_RATE_34_DATA) { - CTrellis trellis; + CDMRTrellis trellis; unsigned char payload[18U]; - bool ret = trellis.decode34(data + 2U, payload); + bool ret = trellis.decode(data + 2U, payload); if (ret) { ::sprintf(title, "DMR Slot %u, Data 3/4", m_slotNo); CUtils::dump(1U, title, payload, 18U); - trellis.encode34(payload, data + 2U); + trellis.encode(payload, data + 2U); } else { LogMessage("DMR Slot %u, unfixable RF rate 3/4 data", m_slotNo); CUtils::dump(1U, "Data", data + 2U, DMR_FRAME_LENGTH_BYTES); @@ -1734,13 +1734,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) CUtils::dump(1U, title, payload, 12U); bptc.encode(payload, data + 2U); } else if (dataType == DT_RATE_34_DATA) { - CTrellis trellis; + CDMRTrellis trellis; unsigned char payload[18U]; - bool ret = trellis.decode34(data + 2U, payload); + bool ret = trellis.decode(data + 2U, payload); if (ret) { ::sprintf(title, "DMR Slot %u, Data 3/4", m_slotNo); CUtils::dump(1U, title, payload, 18U); - trellis.encode34(payload, data + 2U); + trellis.encode(payload, data + 2U); } else { LogMessage("DMR Slot %u, unfixable network rate 3/4 data", m_slotNo); CUtils::dump(1U, "Data", data + 2U, DMR_FRAME_LENGTH_BYTES); diff --git a/DMRTrellis.cpp b/DMRTrellis.cpp new file mode 100644 index 000000000..cdf30ed74 --- /dev/null +++ b/DMRTrellis.cpp @@ -0,0 +1,374 @@ +/* +* Copyright (C) 2016 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; version 2 of the License. +* +* 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. +*/ + +#include "DMRTrellis.h" +#include "DMRDefines.h" +#include "Log.h" + +#include +#include + +const unsigned int INTERLEAVE_TABLE[] = { + 0U, 1U, 8U, 9U, 16U, 17U, 24U, 25U, 32U, 33U, 40U, 41U, 48U, 49U, 56U, 57U, 64U, 65U, 72U, 73U, 80U, 81U, 88U, 89U, 96U, 97U, + 2U, 3U, 10U, 11U, 18U, 19U, 26U, 27U, 34U, 35U, 42U, 43U, 50U, 51U, 58U, 59U, 66U, 67U, 74U, 75U, 82U, 83U, 90U, 91U, + 4U, 5U, 12U, 13U, 20U, 21U, 28U, 29U, 36U, 37U, 44U, 45U, 52U, 53U, 60U, 61U, 68U, 69U, 76U, 77U, 84U, 85U, 92U, 93U, + 6U, 7U, 14U, 15U, 22U, 23U, 30U, 31U, 38U, 39U, 46U, 47U, 54U, 55U, 62U, 63U, 70U, 71U, 78U, 79U, 86U, 87U, 94U, 95U}; + +const unsigned char ENCODE_TABLE[] = { + 0U, 8U, 4U, 12U, 2U, 10U, 6U, 14U, + 4U, 12U, 2U, 10U, 6U, 14U, 0U, 8U, + 1U, 9U, 5U, 13U, 3U, 11U, 7U, 15U, + 5U, 13U, 3U, 11U, 7U, 15U, 1U, 9U, + 3U, 11U, 7U, 15U, 1U, 9U, 5U, 13U, + 7U, 15U, 1U, 9U, 5U, 13U, 3U, 11U, + 2U, 10U, 6U, 14U, 0U, 8U, 4U, 12U, + 6U, 14U, 0U, 8U, 4U, 12U, 2U, 10U}; + +const unsigned char BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +#define READ_BIT(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) + +CDMRTrellis::CDMRTrellis() +{ +} + +CDMRTrellis::~CDMRTrellis() +{ +} + +bool CDMRTrellis::decode(const unsigned char* data, unsigned char* payload) +{ + assert(data != NULL); + assert(payload != NULL); + + signed char dibits[98U]; + deinterleave(data, dibits); + + unsigned char points[49U]; + dibitsToPoints(dibits, points); + + // Check the original code + unsigned char tribits[49U]; + unsigned int failPos = checkCode(points, tribits); + if (failPos == 999U) { + tribitsToBits(tribits, payload); + return true; + } + + unsigned char savePoints[49U]; + for (unsigned int i = 0U; i < 49U; i++) + savePoints[i] = points[i]; + + bool ret = fixCode(points, failPos, payload); + if (ret) + return true; + + if (failPos == 0U) + return false; + + // Backtrack one place for a last go + return fixCode(savePoints, failPos - 1U, payload); +} + +void CDMRTrellis::encode(const unsigned char* payload, unsigned char* data) +{ + assert(payload != NULL); + assert(data != NULL); + + unsigned char tribits[49U]; + bitsToTribits(payload, tribits); + + unsigned char points[49U]; + unsigned char state = 0U; + + for (unsigned int i = 0U; i < 49U; i++) { + unsigned char tribit = tribits[i]; + + points[i] = ENCODE_TABLE[state * 8U + tribit]; + + state = tribit; + } + + signed char dibits[98U]; + pointsToDibits(points, dibits); + + interleave(dibits, data); +} + +void CDMRTrellis::deinterleave(const unsigned char* data, signed char* dibits) const +{ + for (unsigned int i = 0U; i < 98U; i++) { + unsigned int n = i * 2U + 0U; + if (n >= 98U) n += 68U; + bool b1 = READ_BIT(data, n) != 0x00U; + + n = i * 2U + 1U; + if (n >= 98U) n += 68U; + bool b2 = READ_BIT(data, n) != 0x00U; + + signed char dibit; + if (!b1 && b2) + dibit = +3; + else if (!b1 && !b2) + dibit = +1; + else if (b1 && !b2) + dibit = -1; + else + dibit = -3; + + n = INTERLEAVE_TABLE[i]; + dibits[n] = dibit; + } +} + +void CDMRTrellis::interleave(const signed char* dibits, unsigned char* data) const +{ + for (unsigned int i = 0U; i < 98U; i++) { + unsigned int n = INTERLEAVE_TABLE[i]; + + bool b1, b2; + switch (dibits[n]) { + case +3: + b1 = false; + b2 = true; + break; + case +1: + b1 = false; + b2 = false; + break; + case -1: + b1 = true; + b2 = false; + break; + default: + b1 = true; + b2 = true; + break; + } + + n = i * 2U + 0U; + if (n >= 98U) n += 68U; + WRITE_BIT(data, n, b1); + + n = i * 2U + 1U; + if (n >= 98U) n += 68U; + WRITE_BIT(data, n, b2); + } +} + +void CDMRTrellis::dibitsToPoints(const signed char* dibits, unsigned char* points) const +{ + for (unsigned int i = 0U; i < 49U; i++) { + if (dibits[i * 2U + 0U] == +1 && dibits[i * 2U + 1U] == -1) + points[i] = 0U; + else if (dibits[i * 2U + 0U] == -1 && dibits[i * 2U + 1U] == -1) + points[i] = 1U; + else if (dibits[i * 2U + 0U] == +3 && dibits[i * 2U + 1U] == -3) + points[i] = 2U; + else if (dibits[i * 2U + 0U] == -3 && dibits[i * 2U + 1U] == -3) + points[i] = 3U; + else if (dibits[i * 2U + 0U] == -3 && dibits[i * 2U + 1U] == -1) + points[i] = 4U; + else if (dibits[i * 2U + 0U] == +3 && dibits[i * 2U + 1U] == -1) + points[i] = 5U; + else if (dibits[i * 2U + 0U] == -1 && dibits[i * 2U + 1U] == -3) + points[i] = 6U; + else if (dibits[i * 2U + 0U] == +1 && dibits[i * 2U + 1U] == -3) + points[i] = 7U; + else if (dibits[i * 2U + 0U] == -3 && dibits[i * 2U + 1U] == +3) + points[i] = 8U; + else if (dibits[i * 2U + 0U] == +3 && dibits[i * 2U + 1U] == +3) + points[i] = 9U; + else if (dibits[i * 2U + 0U] == -1 && dibits[i * 2U + 1U] == +1) + points[i] = 10U; + else if (dibits[i * 2U + 0U] == +1 && dibits[i * 2U + 1U] == +1) + points[i] = 11U; + else if (dibits[i * 2U + 0U] == +1 && dibits[i * 2U + 1U] == +3) + points[i] = 12U; + else if (dibits[i * 2U + 0U] == -1 && dibits[i * 2U + 1U] == +3) + points[i] = 13U; + else if (dibits[i * 2U + 0U] == +3 && dibits[i * 2U + 1U] == +1) + points[i] = 14U; + else if (dibits[i * 2U + 0U] == -3 && dibits[i * 2U + 1U] == +1) + points[i] = 15U; + } +} + +void CDMRTrellis::pointsToDibits(const unsigned char* points, signed char* dibits) const +{ + for (unsigned int i = 0U; i < 49U; i++) { + switch (points[i]) { + case 0U: + dibits[i * 2U + 0U] = +1; + dibits[i * 2U + 1U] = -1; + break; + case 1U: + dibits[i * 2U + 0U] = -1; + dibits[i * 2U + 1U] = -1; + break; + case 2U: + dibits[i * 2U + 0U] = +3; + dibits[i * 2U + 1U] = -3; + break; + case 3U: + dibits[i * 2U + 0U] = -3; + dibits[i * 2U + 1U] = -3; + break; + case 4U: + dibits[i * 2U + 0U] = -3; + dibits[i * 2U + 1U] = -1; + break; + case 5U: + dibits[i * 2U + 0U] = +3; + dibits[i * 2U + 1U] = -1; + break; + case 6U: + dibits[i * 2U + 0U] = -1; + dibits[i * 2U + 1U] = -3; + break; + case 7U: + dibits[i * 2U + 0U] = +1; + dibits[i * 2U + 1U] = -3; + break; + case 8U: + dibits[i * 2U + 0U] = -3; + dibits[i * 2U + 1U] = +3; + break; + case 9U: + dibits[i * 2U + 0U] = +3; + dibits[i * 2U + 1U] = +3; + break; + case 10U: + dibits[i * 2U + 0U] = -1; + dibits[i * 2U + 1U] = +1; + break; + case 11U: + dibits[i * 2U + 0U] = +1; + dibits[i * 2U + 1U] = +1; + break; + case 12U: + dibits[i * 2U + 0U] = +1; + dibits[i * 2U + 1U] = +3; + break; + case 13U: + dibits[i * 2U + 0U] = -1; + dibits[i * 2U + 1U] = +3; + break; + case 14U: + dibits[i * 2U + 0U] = +3; + dibits[i * 2U + 1U] = +1; + break; + default: + dibits[i * 2U + 0U] = -3; + dibits[i * 2U + 1U] = +1; + break; + } + } +} + +void CDMRTrellis::bitsToTribits(const unsigned char* payload, unsigned char* tribits) const +{ + for (unsigned int i = 0U; i < 48U; i++) { + unsigned int n = i * 3U; + + bool b1 = READ_BIT(payload, n) != 0x00U; + n++; + bool b2 = READ_BIT(payload, n) != 0x00U; + n++; + bool b3 = READ_BIT(payload, n) != 0x00U; + + unsigned char tribit = 0U; + tribit |= b1 ? 4U : 0U; + tribit |= b2 ? 2U : 0U; + tribit |= b3 ? 1U : 0U; + + tribits[i] = tribit; + } + + tribits[48U] = 0U; +} + +void CDMRTrellis::tribitsToBits(const unsigned char* tribits, unsigned char* payload) const +{ + for (unsigned int i = 0U; i < 48U; i++) { + unsigned char tribit = tribits[i]; + + bool b1 = (tribit & 0x04U) == 0x04U; + bool b2 = (tribit & 0x02U) == 0x02U; + bool b3 = (tribit & 0x01U) == 0x01U; + + unsigned int n = i * 3U; + + WRITE_BIT(payload, n, b1); + n++; + WRITE_BIT(payload, n, b2); + n++; + WRITE_BIT(payload, n, b3); + } +} + +bool CDMRTrellis::fixCode(unsigned char* points, unsigned int failPos, unsigned char* payload) const +{ + for (unsigned j = 0U; j < 20U; j++) { + unsigned int bestPos = 0U; + unsigned int bestVal = 0U; + + for (unsigned int i = 0U; i < 16U; i++) { + points[failPos] = i; + + unsigned char tribits[49U]; + unsigned int pos = checkCode(points, tribits); + if (pos == 999U) { + tribitsToBits(tribits, payload); + return true; + } + + if (pos > bestPos) { + bestPos = pos; + bestVal = i; + } + } + + points[failPos] = bestVal; + failPos = bestPos; + } + + return false; +} + +unsigned int CDMRTrellis::checkCode(const unsigned char* points, unsigned char* tribits) const +{ + unsigned char state = 0U; + + for (unsigned int i = 0U; i < 49U; i++) { + tribits[i] = 9U; + + for (unsigned int j = 0U; j < 8U; j++) { + if (points[i] == ENCODE_TABLE[state * 8U + j]) { + tribits[i] = j; + break; + } + } + + if (tribits[i] == 9U) + return i; + + state = tribits[i]; + } + + if (tribits[48U] != 0U) + return 48U; + + return 999U; +} diff --git a/DMRTrellis.h b/DMRTrellis.h new file mode 100644 index 000000000..55ed0c022 --- /dev/null +++ b/DMRTrellis.h @@ -0,0 +1,36 @@ +/* +* Copyright (C) 2016 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; version 2 of the License. +* +* 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. +*/ + +#ifndef DMRTrellis_H +#define DMRTrellis_H + +class CDMRTrellis { +public: + CDMRTrellis(); + ~CDMRTrellis(); + + bool decode(const unsigned char* data, unsigned char* payload); + void encode(const unsigned char* payload, unsigned char* data); + +private: + void deinterleave(const unsigned char* in, signed char* dibits) const; + void interleave(const signed char* dibits, unsigned char* out) const; + void dibitsToPoints(const signed char* dibits, unsigned char* points) const; + void pointsToDibits(const unsigned char* points, signed char* dibits) const; + void bitsToTribits(const unsigned char* payload, unsigned char* tribits) const; + void tribitsToBits(const unsigned char* tribits, unsigned char* payload) const; + bool fixCode(unsigned char* points, unsigned int failPos, unsigned char* payload) const; + unsigned int checkCode(const unsigned char* points, unsigned char* tribits) const; +}; + +#endif diff --git a/DStarNetwork.cpp b/DStarNetwork.cpp index e7c527520..67099d6ca 100644 --- a/DStarNetwork.cpp +++ b/DStarNetwork.cpp @@ -166,7 +166,7 @@ bool CDStarNetwork::writePoll(const char* text) buffer[4] = 0x0AU; // Poll with text - unsigned int length = (unsigned int)::strlen(text); + unsigned int length = ::strlen(text); // Include the nul at the end also ::memcpy(buffer + 5U, text, length + 1U); diff --git a/LCDproc.cpp b/LCDproc.cpp index c23a3f3b3..7167eedce 100644 --- a/LCDproc.cpp +++ b/LCDproc.cpp @@ -71,15 +71,14 @@ #include #include #include +#else +#include +#include #endif #define BUFFER_MAX_LEN 128 -#if defined(_WIN32) || defined(_WIN64) -SOCKET m_socketfd; -#else int m_socketfd; -#endif char m_buffer[BUFFER_MAX_LEN]; fd_set m_readfds, m_writefds; struct timeval m_timeout; @@ -132,49 +131,45 @@ bool CLCDproc::open() port = std::to_string(m_port); localPort = std::to_string(m_localPort); - ::memset(&hints, 0, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); /* Lookup the hostname address */ hints.ai_flags = AI_NUMERICSERV; hints.ai_socktype = SOCK_STREAM; - err = ::getaddrinfo(m_address.c_str(), port.c_str(), &hints, &res); + err = getaddrinfo(m_address.c_str(), port.c_str(), &hints, &res); if (err) { LogError("LCDproc, cannot lookup server"); return false; } - - addrlen = (unsigned int)res->ai_addrlen; - ::memcpy(&serverAddress, res->ai_addr, addrlen); - ::freeaddrinfo(res); + memcpy(&serverAddress, res->ai_addr, addrlen = res->ai_addrlen); + freeaddrinfo(res); /* Lookup the client address (random port - need to specify manual port from ini file) */ hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; hints.ai_family = serverAddress.ss_family; - err = ::getaddrinfo(NULL, localPort.c_str(), &hints, &res); + err = getaddrinfo(NULL, localPort.c_str(), &hints, &res); if (err) { LogError("LCDproc, cannot lookup client"); return false; } - - addrlen = (unsigned int)res->ai_addrlen; - ::memcpy(&clientAddress, res->ai_addr, addrlen); - ::freeaddrinfo(res); + memcpy(&clientAddress, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); /* Create TCP socket */ - m_socketfd = ::socket(clientAddress.ss_family, SOCK_STREAM, 0); + m_socketfd = socket(clientAddress.ss_family, SOCK_STREAM, 0); if (m_socketfd == -1) { LogError("LCDproc, failed to create socket"); return false; } /* Bind the address to the socket */ - if (::bind(m_socketfd, (struct sockaddr *)&clientAddress, addrlen) == -1) { + if (bind(m_socketfd, (struct sockaddr *)&clientAddress, addrlen) == -1) { LogError("LCDproc, error whilst binding address"); return false; } /* Connect to server */ - if (::connect(m_socketfd, (struct sockaddr *)&serverAddress, addrlen) == -1) { + if (connect(m_socketfd, (struct sockaddr *)&serverAddress, addrlen) == -1) { LogError("LCDproc, cannot connect to server"); return false; } @@ -676,14 +671,14 @@ void CLCDproc::clockInt(unsigned int ms) * exceptfds = we are not waiting for exception fds */ - if (::select(int(m_socketfd) + 1, &m_readfds, NULL, NULL, &m_timeout) == -1) { + if (select(m_socketfd + 1, &m_readfds, NULL, NULL, &m_timeout) == -1) { LogError("LCDproc, error on select"); return; } // If something was received from the server... if (FD_ISSET(m_socketfd, &m_readfds)) { - m_recvsize = ::recv(m_socketfd, m_buffer, BUFFER_MAX_LEN, 0); + m_recvsize = recv(m_socketfd, m_buffer, BUFFER_MAX_LEN, 0); if (m_recvsize == -1) { LogError("LCDproc, cannot receive information"); @@ -693,7 +688,7 @@ void CLCDproc::clockInt(unsigned int ms) m_buffer[m_recvsize] = '\0'; char *argv[256]; - size_t len = ::strlen(m_buffer); + size_t len = strlen(m_buffer); // Now split the string into tokens... int argc = 0; @@ -714,14 +709,14 @@ void CLCDproc::clockInt(unsigned int ms) case '\n': m_buffer[i] = 0; if (argc > 0) { - if (0 == ::strcmp(argv[0], "listen")) { + if (0 == strcmp(argv[0], "listen")) { LogDebug("LCDproc, the %s screen is displayed", argv[1]); - } else if (0 == ::strcmp(argv[0], "ignore")) { + } else if (0 == strcmp(argv[0], "ignore")) { LogDebug("LCDproc, the %s screen is hidden", argv[1]); - } else if (0 == ::strcmp(argv[0], "key")) { + } else if (0 == strcmp(argv[0], "key")) { LogDebug("LCDproc, Key %s", argv[1]); - } else if (0 == ::strcmp(argv[0], "menu")) { - } else if (0 == ::strcmp(argv[0], "connect")) { + } else if (0 == strcmp(argv[0], "menu")) { + } else if (0 == strcmp(argv[0], "connect")) { // connect LCDproc 0.5.7 protocol 0.3 lcd wid 16 hgt 2 cellwid 5 cellhgt 8 int a; @@ -772,11 +767,7 @@ void CLCDproc::close() { } -#if defined(_WIN32) || defined(_WIN64) -int CLCDproc::socketPrintf(SOCKET fd, const char* format, ...) -#else -int CLCDproc::socketPrintf(int fd, const char* format, ...) -#endif +int CLCDproc::socketPrintf(int fd, const char *format, ...) { char buf[BUFFER_MAX_LEN]; va_list ap; @@ -799,11 +790,11 @@ int CLCDproc::socketPrintf(int fd, const char* format, ...) m_timeout.tv_sec = 0; m_timeout.tv_usec = 0; - if (::select(int(m_socketfd) + 1, NULL, &m_writefds, NULL, &m_timeout) == -1) + if (select(m_socketfd + 1, NULL, &m_writefds, NULL, &m_timeout) == -1) LogError("LCDproc, error on select"); if (FD_ISSET(m_socketfd, &m_writefds)) { - if (::send(m_socketfd, buf, int(strlen(buf) + 1U), 0) == -1) { + if (send(m_socketfd, buf, int(strlen(buf) + 1U), 0) == -1) { LogError("LCDproc, cannot send data"); return -1; } diff --git a/LCDproc.h b/LCDproc.h index 9b7544e27..b702493d9 100644 --- a/LCDproc.h +++ b/LCDproc.h @@ -23,11 +23,6 @@ #include "Display.h" #include "Timer.h" -#if defined(_WIN32) || defined(_WIN64) -#include -#include -#endif - #include class CLCDproc : public CDisplay @@ -94,11 +89,7 @@ class CLCDproc : public CDisplay unsigned int m_rssiCount1; unsigned int m_rssiCount2; -#if defined(_WIN32) || defined(_WIN64) - int socketPrintf(SOCKET fd, const char* format, ...); -#else - int socketPrintf(int fd, const char* format, ...); -#endif + int socketPrintf(int fd, const char *format, ...); void defineScreens(); }; diff --git a/MMDVMHost.vcxproj b/MMDVMHost.vcxproj index 8a162a5b3..230e6e5cb 100644 --- a/MMDVMHost.vcxproj +++ b/MMDVMHost.vcxproj @@ -192,6 +192,7 @@ + @@ -241,6 +242,7 @@ + @@ -254,7 +256,6 @@ - @@ -305,6 +306,7 @@ + @@ -350,6 +352,7 @@ + @@ -359,7 +362,6 @@ - diff --git a/MMDVMHost.vcxproj.filters b/MMDVMHost.vcxproj.filters index c9f44915b..33b1adb6b 100644 --- a/MMDVMHost.vcxproj.filters +++ b/MMDVMHost.vcxproj.filters @@ -155,6 +155,9 @@ Header Files + + Header Files + Header Files @@ -206,6 +209,9 @@ Header Files + + Header Files + Header Files @@ -347,9 +353,6 @@ Header Files - - Header Files - @@ -478,6 +481,9 @@ Source Files + + Source Files + Source Files @@ -526,6 +532,9 @@ Source Files + + Source Files + Source Files @@ -652,8 +661,5 @@ Source Files - - Source Files - \ No newline at end of file diff --git a/Makefile b/Makefile index 6eeae789f..9132bc240 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,13 @@ LDFLAGS = -g -L/usr/local/lib OBJECTS = \ AMBEFEC.o BCH.o AX25Control.o AX25Network.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o \ DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \ - DMRAccessControl.o DMRTA.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o \ - I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o Modem.o \ - ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \ - NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o \ - P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \ - RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o Trellis.o UARTController.o \ - UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o + DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o \ + Hamming.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o \ + Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o \ + NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \ + NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o \ + POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o \ + Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o all: MMDVMHost RemoteCommand diff --git a/Makefile.Pi.Adafruit b/Makefile.Pi.Adafruit index 18813ecd6..5442c425f 100644 --- a/Makefile.Pi.Adafruit +++ b/Makefile.Pi.Adafruit @@ -12,13 +12,14 @@ LDFLAGS = -g -L/usr/local/lib OBJECTS = \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o \ DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \ - DMRAccessControl.o DMRTA.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o \ - HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o \ - Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o NXDNConvolution.o \ - NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o \ - P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \ - RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o Trellis.o \ - UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o + DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o \ + Hamming.o HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o \ + MMDVMHost.o Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o \ + NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ + NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o \ + POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o \ + TFTSurenoo.o Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o \ + YSFNetwork.o YSFPayload.o all: MMDVMHost RemoteCommand diff --git a/Makefile.Pi.HD44780 b/Makefile.Pi.HD44780 index 354480441..f857e52bc 100644 --- a/Makefile.Pi.HD44780 +++ b/Makefile.Pi.HD44780 @@ -11,13 +11,14 @@ LDFLAGS = -g -L/usr/local/lib OBJECTS = \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o \ DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \ - DMRAccessControl.o DMRTA.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o \ - HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o \ - Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o NXDNConvolution.o \ - NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o \ - P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \ - RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o Trellis.o \ - UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o + DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o \ + Hamming.o HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o \ + MMDVMHost.o Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o \ + NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ + NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o \ + POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o \ + TFTSurenoo.o Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o \ + YSFNetwork.o YSFPayload.o all: MMDVMHost RemoteCommand diff --git a/Makefile.Pi.I2C b/Makefile.Pi.I2C index 0af481512..43e1d4361 100644 --- a/Makefile.Pi.I2C +++ b/Makefile.Pi.I2C @@ -11,13 +11,13 @@ LDFLAGS = -g -L/usr/local/lib OBJECTS = \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o \ DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \ - DMRAccessControl.o DMRTA.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o \ - I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o Modem.o \ - ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \ - NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o \ - P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \ - RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o Trellis.o UARTController.o \ - UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o + DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o \ + Hamming.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o \ + Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o \ + NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \ + NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o \ + POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o \ + Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o all: MMDVMHost RemoteCommand diff --git a/Makefile.Pi.OLED b/Makefile.Pi.OLED index 72eab9521..ab93d3f86 100644 --- a/Makefile.Pi.OLED +++ b/Makefile.Pi.OLED @@ -15,13 +15,14 @@ LDFLAGS = -g -L/usr/local/lib OBJECTS = \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o \ DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \ - DMRAccessControl.o DMRTA.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o \ - I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o Modem.o \ - ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \ - NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o OLED.o P25Audio.o \ - P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \ - RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o Trellis.o \ - UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o + DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o \ + Hamming.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o \ + Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o \ + NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o \ + NXDNUDCH.o OLED.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o \ + POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o \ + TFTSurenoo.o Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o \ + YSFNetwork.o YSFPayload.o all: MMDVMHost RemoteCommand diff --git a/Makefile.Pi.PCF8574 b/Makefile.Pi.PCF8574 index 95df1c2ca..6e478ffb2 100644 --- a/Makefile.Pi.PCF8574 +++ b/Makefile.Pi.PCF8574 @@ -12,13 +12,14 @@ LDFLAGS = -g -L/usr/local/lib OBJECTS = \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o \ DMRDirectNetwork.o DMREMB.o DMREmbeddedData.o DMRFullLC.o DMRGatewayNetwork.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o \ - DMRAccessControl.o DMRTA.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o \ - HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o MMDVMHost.o \ - Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o NXDNControl.o NXDNConvolution.o \ - NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o \ - P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \ - RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o TFTSurenoo.o Thread.o Timer.o Trellis.o \ - UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o + DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o \ + Hamming.o HD44780.o I2CController.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LSF.o M17Network.o M17Utils.o \ + MMDVMHost.o Modem.o ModemPort.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullController.o NullDisplay.o NXDNAudio.o \ + NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o \ + NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o \ + POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS634717.o RSSIInterpolator.o SerialPort.o SMeter.o StopWatch.o Sync.o SHA256.o \ + TFTSurenoo.o Thread.o Timer.o UARTController.o UDPController.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o \ + YSFNetwork.o YSFPayload.o all: MMDVMHost RemoteCommand diff --git a/P25Control.cpp b/P25Control.cpp index abd80ac6f..b7682cd2c 100644 --- a/P25Control.cpp +++ b/P25Control.cpp @@ -19,8 +19,8 @@ #include "P25Control.h" #include "P25Defines.h" +#include "P25Trellis.h" #include "P25Utils.h" -#include "Trellis.h" #include "Utils.h" #include "Sync.h" #include "CRC.h" @@ -541,7 +541,7 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len) } if (m_rfPDUCount == 0U) { - CTrellis trellis; + CP25Trellis trellis; unsigned char header[P25_PDU_HEADER_LENGTH_BYTES]; bool valid = trellis.decode12(m_rfPDU + P25_SYNC_LENGTH_BYTES + P25_NID_LENGTH_BYTES, header); if (valid) @@ -570,7 +570,7 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len) unsigned int offset = P25_SYNC_LENGTH_BYTES + P25_NID_LENGTH_BYTES; // Regenerate the PDU header - CTrellis trellis; + CP25Trellis trellis; unsigned char header[P25_PDU_HEADER_LENGTH_BYTES]; trellis.decode12(m_rfPDU + offset, header); trellis.encode12(header, m_rfPDU + offset); diff --git a/P25Data.h b/P25Data.h index 0cb69e884..ff5e8073f 100644 --- a/P25Data.h +++ b/P25Data.h @@ -21,7 +21,7 @@ #define P25Data_H #include "RS634717.h" -#include "Trellis.h" +#include "P25Trellis.h" class CP25Data { public: @@ -82,7 +82,7 @@ class CP25Data { unsigned int m_dstId; unsigned char m_serviceType; CRS634717 m_rs; - CTrellis m_trellis; + CP25Trellis m_trellis; void decodeLDUHamming(const unsigned char* raw, unsigned char* data); void encodeLDUHamming(unsigned char* data, const unsigned char* raw); diff --git a/Trellis.cpp b/P25Trellis.cpp similarity index 87% rename from Trellis.cpp rename to P25Trellis.cpp index 37a7be02b..9b92ce70f 100644 --- a/Trellis.cpp +++ b/P25Trellis.cpp @@ -11,7 +11,7 @@ * GNU General Public License for more details. */ -#include "Trellis.h" +#include "P25Trellis.h" #include "Log.h" #include @@ -44,15 +44,15 @@ const unsigned char BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U #define WRITE_BIT(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) #define READ_BIT(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) -CTrellis::CTrellis() +CP25Trellis::CP25Trellis() { } -CTrellis::~CTrellis() +CP25Trellis::~CP25Trellis() { } -bool CTrellis::decode34(const unsigned char* data, unsigned char* payload) +bool CP25Trellis::decode34(const unsigned char* data, unsigned char* payload) { assert(data != NULL); assert(payload != NULL); @@ -86,7 +86,7 @@ bool CTrellis::decode34(const unsigned char* data, unsigned char* payload) return fixCode34(savePoints, failPos - 1U, payload); } -void CTrellis::encode34(const unsigned char* payload, unsigned char* data) +void CP25Trellis::encode34(const unsigned char* payload, unsigned char* data) { assert(payload != NULL); assert(data != NULL); @@ -111,7 +111,7 @@ void CTrellis::encode34(const unsigned char* payload, unsigned char* data) interleave(dibits, data); } -bool CTrellis::decode12(const unsigned char* data, unsigned char* payload) +bool CP25Trellis::decode12(const unsigned char* data, unsigned char* payload) { assert(data != NULL); assert(payload != NULL); @@ -145,7 +145,7 @@ bool CTrellis::decode12(const unsigned char* data, unsigned char* payload) return fixCode12(savePoints, failPos - 1U, payload); } -void CTrellis::encode12(const unsigned char* payload, unsigned char* data) +void CP25Trellis::encode12(const unsigned char* payload, unsigned char* data) { assert(payload != NULL); assert(data != NULL); @@ -170,7 +170,7 @@ void CTrellis::encode12(const unsigned char* payload, unsigned char* data) interleave(dibits, data); } -void CTrellis::deinterleave(const unsigned char* data, signed char* dibits) const +void CP25Trellis::deinterleave(const unsigned char* data, signed char* dibits) const { for (unsigned int i = 0U; i < 98U; i++) { unsigned int n = i * 2U + 0U; @@ -194,7 +194,7 @@ void CTrellis::deinterleave(const unsigned char* data, signed char* dibits) cons } } -void CTrellis::interleave(const signed char* dibits, unsigned char* data) const +void CP25Trellis::interleave(const signed char* dibits, unsigned char* data) const { for (unsigned int i = 0U; i < 98U; i++) { unsigned int n = INTERLEAVE_TABLE[i]; @@ -227,7 +227,7 @@ void CTrellis::interleave(const signed char* dibits, unsigned char* data) const } } -void CTrellis::dibitsToPoints(const signed char* dibits, unsigned char* points) const +void CP25Trellis::dibitsToPoints(const signed char* dibits, unsigned char* points) const { for (unsigned int i = 0U; i < 49U; i++) { if (dibits[i * 2U + 0U] == +1 && dibits[i * 2U + 1U] == -1) @@ -265,7 +265,7 @@ void CTrellis::dibitsToPoints(const signed char* dibits, unsigned char* points) } } -void CTrellis::pointsToDibits(const unsigned char* points, signed char* dibits) const +void CP25Trellis::pointsToDibits(const unsigned char* points, signed char* dibits) const { for (unsigned int i = 0U; i < 49U; i++) { switch (points[i]) { @@ -337,7 +337,7 @@ void CTrellis::pointsToDibits(const unsigned char* points, signed char* dibits) } } -void CTrellis::bitsToTribits(const unsigned char* payload, unsigned char* tribits) const +void CP25Trellis::bitsToTribits(const unsigned char* payload, unsigned char* tribits) const { for (unsigned int i = 0U; i < 48U; i++) { unsigned int n = i * 3U; @@ -359,7 +359,7 @@ void CTrellis::bitsToTribits(const unsigned char* payload, unsigned char* tribit tribits[48U] = 0U; } -void CTrellis::bitsToDibits(const unsigned char* payload, unsigned char* dibits) const +void CP25Trellis::bitsToDibits(const unsigned char* payload, unsigned char* dibits) const { for (unsigned int i = 0U; i < 48U; i++) { unsigned int n = i * 2U; @@ -378,7 +378,7 @@ void CTrellis::bitsToDibits(const unsigned char* payload, unsigned char* dibits) dibits[48U] = 0U; } -void CTrellis::tribitsToBits(const unsigned char* tribits, unsigned char* payload) const +void CP25Trellis::tribitsToBits(const unsigned char* tribits, unsigned char* payload) const { for (unsigned int i = 0U; i < 48U; i++) { unsigned char tribit = tribits[i]; @@ -397,7 +397,7 @@ void CTrellis::tribitsToBits(const unsigned char* tribits, unsigned char* payloa } } -void CTrellis::dibitsToBits(const unsigned char* dibits, unsigned char* payload) const +void CP25Trellis::dibitsToBits(const unsigned char* dibits, unsigned char* payload) const { for (unsigned int i = 0U; i < 48U; i++) { unsigned char dibit = dibits[i]; @@ -413,7 +413,7 @@ void CTrellis::dibitsToBits(const unsigned char* dibits, unsigned char* payload) } } -bool CTrellis::fixCode34(unsigned char* points, unsigned int failPos, unsigned char* payload) const +bool CP25Trellis::fixCode34(unsigned char* points, unsigned int failPos, unsigned char* payload) const { for (unsigned j = 0U; j < 20U; j++) { unsigned int bestPos = 0U; @@ -442,7 +442,7 @@ bool CTrellis::fixCode34(unsigned char* points, unsigned int failPos, unsigned c return false; } -unsigned int CTrellis::checkCode34(const unsigned char* points, unsigned char* tribits) const +unsigned int CP25Trellis::checkCode34(const unsigned char* points, unsigned char* tribits) const { unsigned char state = 0U; @@ -469,7 +469,7 @@ unsigned int CTrellis::checkCode34(const unsigned char* points, unsigned char* t } -bool CTrellis::fixCode12(unsigned char* points, unsigned int failPos, unsigned char* payload) const +bool CP25Trellis::fixCode12(unsigned char* points, unsigned int failPos, unsigned char* payload) const { for (unsigned j = 0U; j < 20U; j++) { unsigned int bestPos = 0U; @@ -498,7 +498,7 @@ bool CTrellis::fixCode12(unsigned char* points, unsigned int failPos, unsigned c return false; } -unsigned int CTrellis::checkCode12(const unsigned char* points, unsigned char* dibits) const +unsigned int CP25Trellis::checkCode12(const unsigned char* points, unsigned char* dibits) const { unsigned char state = 0U; diff --git a/Trellis.h b/P25Trellis.h similarity index 92% rename from Trellis.h rename to P25Trellis.h index aa5ffec2b..47e7c1d07 100644 --- a/Trellis.h +++ b/P25Trellis.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2016,2018,2024 by Jonathan Naylor, G4KLX +* Copyright (C) 2016,2018 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 @@ -11,13 +11,13 @@ * GNU General Public License for more details. */ -#ifndef Trellis_H -#define Trellis_H +#ifndef P25Trellis_H +#define P25Trellis_H -class CTrellis { +class CP25Trellis { public: - CTrellis(); - ~CTrellis(); + CP25Trellis(); + ~CP25Trellis(); bool decode34(const unsigned char* data, unsigned char* payload); void encode34(const unsigned char* payload, unsigned char* data); diff --git a/RemoteCommand.cpp b/RemoteCommand.cpp index 76c44f43d..0e8918d33 100644 --- a/RemoteCommand.cpp +++ b/RemoteCommand.cpp @@ -85,7 +85,7 @@ int CRemoteCommand::send(const std::string& command) if (!ret) return 1; - ret = socket.write((unsigned char*)command.c_str(), (unsigned int)command.length(), addr, addrLen); + ret = socket.write((unsigned char*)command.c_str(), command.length(), addr, addrLen); if (!ret) { socket.close(); return 1; diff --git a/TFTSurenoo.cpp b/TFTSurenoo.cpp index 3a384943c..7d8f5f750 100644 --- a/TFTSurenoo.cpp +++ b/TFTSurenoo.cpp @@ -477,7 +477,7 @@ void CTFTSurenoo::refreshDisplay(void) // clear display ::snprintf(m_temp, sizeof(m_temp), "BOXF(%d,%d,%d,%d,%d);", 0, 0, X_WIDTH - 1, Y_WIDTH - 1, BG_COLOUR); - m_serial->write((unsigned char*)m_temp, (unsigned int)::strlen(m_temp)); + m_serial->write((unsigned char*)m_temp, ::strlen(m_temp)); // mode line ::snprintf(m_temp, sizeof(m_temp), "DCV%d(%d,%d,'%s',%d);",