Currently there is six variations of (IPv4) UDPSocket.cpp.
- FMClients, NXDNClients, P25Clients, YSFClients(YSFParrot)
use ::fprintf() for logging
- YSFClients(YSFReflector)
use LogError() and LogInfo() for logging
special open(string &bindaddr) function
- YSFClients(YSFGateway), DAPNETGateway
use LogError() and LogInfo() for logging
- P25Clients, DMRGateway
use LogError() for logging
no LogInfo("Opening UDP port on") message
- NXDNClients
use LogError() for logging
no LogInfo("Opening UDP port on") message
add #include <ifaddrs.h>
- MMDVMHost
use LogError() for logging
no LogInfo("Opening UDP port on") message
no assert(!address.empty()) at constructor
to avoid explosion, commonized them.
switch ::fprintf()/LogError by #define HAVE_LOG_H
always display LogInfo("Opening UDP port on") message
delete #include <ifaddrs.h>, this is not needed
no assert(!address.empty()) at constructor
and to support YSFReflector, add multiple socket support.
default is #define UDP_SOCKET_MAX 1 so normally this feature is disabled.
added these functions.
CUDPSocket() (constructor without any parameters)
open(index, af, addr, port)
close(index)
CUDPSocket() means CUDPSocket(address = "", port = 0)
index selects socket, address and port is defined at open.
to have compatibility for old codes, these function works as
CUDPSocket(addr, port) store addr and port to index #0
CUDPSocket(port) store addr = "" and port to index #0
open() open with addr and port of index #0, AF_UNSPEC
open(af) open with addr and port of index #0, specified af
close() close *all* sockets
read/write operation is for all opened sockets.
To implement this feature, using strtok() is not enough.
This cannot handle this case:
Key=#value#comment
it will be #value is the contents of Key. And,
Key=value #comment
(there is a space and a tab between value and #comment)
this will be value<space><tab>. Sometimes these trailing spaces and
tabs makes thing wrong.
Whether in-line comment is used or not, delete trailing space/tab after
value.
simply merged upstream code.
following files are conflicted, all fixed
GPSD.h, MobileGPS.cpp, NXDNNetwork.cpp, NXDNNetwork.h, UDPSocket.h
NXDNIcomNetwork and NXDNKenwoodNetwork is still original code,
not support IPv6-UDPSocket yet.
two minor improvements
- ScreenLayout in Nextion section can use hexadecimal (0xXXXXX),
octal (0XXXX) and decimal value
- in-line comment enabled
example:
# conventional comment, the line starts with #
[Section]
Key=value # this is new style comment
Key="quoted value # this is not comment"
Key="quoted value" # this is prohibited (not comment)
Previous implementation uses SSRC as IPv4 address that is same behaviour
of Kenwood's NXDN repeater.
RFC 3350 RTP protocol recommends SSRC uses random number.
So I use MT19937 random number generator instead of IP address.
And if this is no problem, I will do two changes.
- replace rand() in DMRNetwork.cpp and DStarNetwork.cpp to MT19937
- remove getLocalAddress() in UDPSocket.cpp
to add new feature easily, the definition of ScreenLayout in [Nextion]
has changed like this.
ScreenLayout < 8: compatibile setting for old config file
0: G4KLX @ 9600bps
1: (reserved)
2: ON7LDS @ 9600bps
3: ON7LDS-DIY @ 9600bps
4: ON7LDS-DIY @ 115200bps
ScreenLayout >= 8: new world, set the bit to enable each feature
bit3 (8) use 115200bps
bit4 (16) Display DMR Talker Alias
bit5 (32) Colour change when displaying TA
bit6 (64) Font size change when displaying long TA text
bit7 (128) Display DIY status when MMDVM IDLE
old settings are same as:
0 -> 0
2 -> 112 (16+32+64)
3 -> 144 (16+128)
4 -> 152 (8+16+128)
to add new feature easily, the definition of ScreenLayout in [Nextion]
has changed like this.
ScreenLayout < 8: compatibile setting for old config file
0: G4KLX @ 9600bps
1: (reserved)
2: ON7LDS @ 9600bps
3: ON7LDS-DIY @ 9600bps
4: ON7LDS-DIY @ 115200bps
ScreenLayout >= 8: new world, set the bit to enable each feature
bit3 (8) use 115200bps
bit4 (16) Display DMR Talker Alias
bit5 (32) Colour change when displaying TA
bit6 (64) Font size change when displaying long TA text
bit7 (128) Display DIY status when MMDVM IDLE
old settings are same as:
0 -> 0
2 -> 112 (16+32+64)
3 -> 144 (16+128)
4 -> 152 (8+16+128)