Compare commits

..

35 Commits

Author SHA1 Message Date
Hibby c171c18db9
Continue the build fixes 2024-11-07 00:23:01 +00:00
Hibby d09db428cc
Add ax25_l2 fix too 2024-11-06 01:55:20 +00:00
Hibby d1a275ea56
First attempt at build 2024-11-06 01:30:24 +00:00
Hibby 6c8e7093c0 Update upstream source from tag 'upstream/0.0.0.73_rc1'
Update to upstream version '0.0.0.73~rc1'
with Debian dir 676c658072
2024-10-29 22:45:25 +00:00
Hibby d0709a1e0a New upstream version 0.0.0.73~rc1 2024-10-29 22:45:21 +00:00
Hibby a724b7ca21
Release - hibbian 2024-09-06 18:50:44 +01:00
Hibby b515b719f3
Release 2024-09-06 18:42:13 +01:00
Hibby aa1cb2b414
Start patching build issues 2024-09-06 18:39:12 +01:00
Hibby e567985320
First build 2024-07-23 21:31:17 +01:00
Hibby 4172fa5fdb Update upstream source from tag 'upstream/0.0.0.72.1'
Update to upstream version '0.0.0.72.1'
with Debian dir 3be9dd1ec6
2024-07-23 21:26:34 +01:00
Hibby b1d1488de6 New upstream version 0.0.0.72.1 2024-07-23 21:26:30 +01:00
Hibby e67baf26b1
Release 2024-04-13 19:01:30 +01:00
Hibby 85fbd886bf
patch out implicit declaration warnings 2024-04-13 18:59:09 +01:00
Hibby adcc58da78
Upstream refresh! 2024-04-13 17:49:59 +01:00
Hibby 0aa062f7c3 Update upstream source from tag 'upstream/0.72'
Update to upstream version '0.72'
with Debian dir b3e2cee65c
2024-04-13 17:49:01 +01:00
Hibby 0804f4a994 New upstream version 0.72 2024-04-13 17:48:58 +01:00
Dave Hibberd d071d9c22c
Release 2023-12-17 14:08:17 +00:00
Dave Hibberd 54db88482a Update upstream source from tag 'upstream/0.0.0.71'
Update to upstream version '0.0.0.71'
with Debian dir a161df0a9b
2023-12-17 13:53:36 +00:00
Dave Hibberd c264c0c638 New upstream version 0.0.0.71 2023-12-17 13:53:32 +00:00
Dave Hibberd 28348e0eac
updates to make it install to the right place 2023-10-10 23:35:52 +01:00
Dave Hibberd 564edb8d5b
New package location, get rid of the old one 2023-10-10 23:03:48 +01:00
Dave Hibberd fecac3d40f
First updates for 0.68 release 2023-10-07 12:27:09 +01:00
Dave Hibberd fd7bb5bb74 Update upstream source from tag 'upstream/0.0.0.68'
Update to upstream version '0.0.0.68'
with Debian dir 160466285e
2023-10-07 12:21:51 +01:00
Dave Hibberd 1407d7b686 New upstream version 0.0.0.68 2023-10-07 12:21:48 +01:00
Dave Hibberd 8cdb5d85be
Release! 2023-09-14 22:01:43 +01:00
Dave Hibberd b69f04d9ef
Add a fix for libpulse errors 2023-09-14 21:31:03 +01:00
Dave Hibberd 9906b15b9e
Release 2023-09-12 21:49:34 +01:00
Dave Hibberd a6eea3f598
Update to new upstream, 0.0.0.67 finally! 2023-09-12 21:40:43 +01:00
Dave Hibberd 51667f3056 Update upstream source from tag 'upstream/0.67'
Update to upstream version '0.67'
with Debian dir d407fa0579
2023-09-12 21:38:19 +01:00
Dave Hibberd 3cdcbeea3e New upstream version 0.67 2023-09-12 21:38:15 +01:00
Dave Hibberd cc15266411
Update version number, release 2023-09-05 21:13:54 +01:00
Dave Hibberd 6c42a38ec5
Add desktop file, tidy up loose ends 2023-09-05 00:00:32 +01:00
Dave Hibberd ccbbec9854
Make the package install 2023-09-04 23:04:58 +01:00
Dave Hibberd 68d240b141
Start to patch the build 2023-09-04 23:00:40 +01:00
Dave Hibberd 25967ba33c
New debian folder time! 2023-09-04 22:59:17 +01:00
81 changed files with 15749 additions and 20632 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.pc/

377
6pack.cpp Normal file
View File

@ -0,0 +1,377 @@
/*
Using code from 6pack Linux Kernel driver with the following licence and credits
* 6pack driver version 0.4.2, 1999/08/22
*
* This module:
* This module 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 module implements the AX.25 protocol for kernel-based
* devices like TTYs. It interfaces between a raw TTY, and the
* kernel's AX.25 protocol layers, just like slip.c.
* AX.25 needs to be separated from slip.c while slip.c is no
* longer a static kernel device since it is a module.
*
* Author: Andreas Könsgen <ajk@ccac.rwth-aachen.de>
*
* Lots of stuff has been taken from mkiss.c, written by
* Hans Alblas <hans@esrac.ele.tue.nl>
*
* with the fixes from
*
* Jonathan (G4KLX) Fixed to match Linux networking changes - 2.1.15.
* Matthias (DG2FEF) Fixed bug in ax25_close(): dev_lock_wait() was
* called twice, causing a deadlock.
*/
// 6pack needs fast response to received characters, and I want to be able to operate over TCP links as well as serial.
// So I think the character level stuff may need to run in a separate thread, probably using select.
//
// I also need to support multiple 6pack ports.
// ?? Do we add this as a backend to KISS driver or a separate Driver. KISS Driver is already quite messy. Not decided yet.
// ?? If using serial/real TNC we need to be able to interleave control and data bytes, but I think with TCP/QtSM it won't be necessary
// ?? Also a don't see any point in running multiple copies of QtSM on one port, but maybe should treat the QtSM channels as
// multidropped ports for scheduling (?? only if on same radio ??)
// ?? I think it needs to look like a KISS (L2) driver but will need a transmit scheduler level to do DCD/CSMA/PTT processing,
// ideally with an interlock to other drivers on same port. This needs some thought with QtSM KISS with multiple modems on one channel
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
/****************************************************************************
* Defines for the 6pack driver.
****************************************************************************/
#define TRUE 1
#define FALSE 0
#define AX25_MAXDEV 16 /* MAX number of AX25 channels;
This can be overridden with
insmod -oax25_maxdev=nnn */
#define AX_MTU 236
/* 6pack protocol bytes/masks. */
#define SIXP_INIT_CMD 0xE8
#define SIXP_TNC_FOUND 0xE9
#define SIXP_CMD_MASK 0xC0
#define SIXP_PRIO_CMD_MASK 0x80
#define SIXP_PRIO_DATA_MASK 0x38
#define SIXP_STD_CMD_MASK 0x40
#define SIXP_DCD_MASK 0x08
#define SIXP_RX_DCD_MASK 0x18
#define SIXP_CHN_MASK 0x07
#define SIXP_TX_MASK 0x20
#define SIXP_CON_LED_ON 0x68
#define SIXP_STA_LED_ON 0x70
#define SIXP_LED_OFF 0x60
/* checksum for a valid 6pack encapsulated packet */
#define SIXP_CHKSUM 0xFF
/* priority commands */
#define SIXP_SEOF 0x40 /* TX underrun */
#define SIXP_TX_URUN 0x48 /* TX underrun */
#define SIXP_RX_ORUN 0x50 /* RX overrun */
#define SIXP_RX_BUF_OVL 0x58 /* RX overrun */
struct ax_disp {
int magic;
char * name;
/* Various fields. */
// struct tty_struct *tty; /* ptr to TTY structure */
// struct device *dev; /* easy for intr handling */
struct ax_disp *sixpack; /* mkiss txport if mkiss channel*/
/* These are pointers to the malloc()ed frame buffers. */
unsigned char *rbuff; /* receiver buffer */
int rcount; /* received chars counter */
unsigned char *xbuff; /* transmitter buffer */
unsigned char *xhead; /* pointer to next byte to XMIT */
int xleft; /* bytes left in XMIT queue */
/* SLIP interface statistics. */
unsigned long rx_packets; /* inbound frames counter */
unsigned long tx_packets; /* outbound frames counter */
unsigned long rx_errors; /* Parity, etc. errors */
unsigned long tx_errors; /* Planned stuff */
unsigned long rx_dropped; /* No memory for skb */
unsigned long tx_dropped; /* When MTU change */
unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */
/* Detailed SLIP statistics. */
int mtu; /* Our mtu (to spot changes!) */
int buffsize; /* Max buffers sizes */
unsigned char flags; /* Flag values/ mode etc */
#define AXF_INUSE 0 /* Channel in use */
#define AXF_ESCAPE 1 /* ESC received */
#define AXF_ERROR 2 /* Parity, etc. error */
#define AXF_KEEPTEST 3 /* Keepalive test flag */
#define AXF_OUTWAIT 4 /* is outpacket was flag */
int mode;
/* variables for the state machine */
unsigned char tnc_ok;
unsigned char status;
unsigned char status1;
unsigned char status2;
unsigned char duplex;
unsigned char led_state;
unsigned char tx_enable;
unsigned char raw_buf[4]; /* receive buffer */
unsigned char cooked_buf[400]; /* receive buffer after 6pack decoding */
unsigned int rx_count; /* counter for receive buffer */
unsigned int rx_count_cooked; /* counter for receive buffer after 6pack decoding */
unsigned char tx_delay;
unsigned char persistance;
unsigned char slottime;
};
struct sixpack_channel {
int magic; /* magic word */
int init; /* channel exists? */
struct tty_struct *tty; /* link to tty control structure */
};
#define AX25_MAGIC 0x5316
#define SIXP_DRIVER_MAGIC 0x5304
#define SIXP_INIT_RESYNC_TIMEOUT 150 /* in 10 ms */
#define SIXP_RESYNC_TIMEOUT 500 /* in 10 ms */
/* default radio channel access parameters */
#define SIXP_TXDELAY 25 /* in 10 ms */
#define SIXP_PERSIST 50
#define SIXP_SLOTTIME 10 /* in 10 ms */
static int sixpack_encaps(unsigned char *tx_buf, unsigned char *tx_buf_raw, int length, unsigned char tx_delay);
static void sixpack_decaps(struct ax_disp *, unsigned char);
static void decode_prio_command(unsigned char, struct ax_disp *);
static void decode_std_command(unsigned char, struct ax_disp *);
static void decode_data(unsigned char, struct ax_disp *);
static void resync_tnc(unsigned long);
static void xmit_on_air(struct ax_disp *ax);
static void start_tx_timer(struct ax_disp *ax);
extern "C" void Debugprintf(const char * format, ...);
void Process6PackByte(unsigned char inbyte);
struct ax_disp axdisp;
/* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
static void ax_bump(struct ax_disp *ax)
{
}
void Process6PackData(unsigned char * Bytes, int Len)
{
while(Len--)
Process6PackByte(Bytes++[0]);
}
void Process6PackByte(unsigned char inbyte)
{
struct ax_disp *ax = &axdisp;
if (inbyte == SIXP_INIT_CMD)
{
Debugprintf("6pack: SIXP_INIT_CMD received.\n");
{
// Reset state machine and allocate a 6pack struct for each modem.
// reply with INIT_CMD with the channel no of last modem
}
return;
}
if ((inbyte & SIXP_PRIO_CMD_MASK) != 0)
decode_prio_command(inbyte, ax);
else if ((inbyte & SIXP_STD_CMD_MASK) != 0)
decode_std_command(inbyte, ax);
else {
if ((ax->status & SIXP_RX_DCD_MASK) == SIXP_RX_DCD_MASK)
decode_data(inbyte, ax);
} /* else */
}
/* identify and execute a 6pack priority command byte */
void decode_prio_command(unsigned char cmd, struct ax_disp *ax)
{
unsigned char channel;
channel = cmd & SIXP_CHN_MASK;
if ((cmd & SIXP_PRIO_DATA_MASK) != 0) { /* idle ? */
/* RX and DCD flags can only be set in the same prio command,
if the DCD flag has been set without the RX flag in the previous
prio command. If DCD has not been set before, something in the
transmission has gone wrong. In this case, RX and DCD are
cleared in order to prevent the decode_data routine from
reading further data that might be corrupt. */
if (((ax->status & SIXP_DCD_MASK) == 0) &&
((cmd & SIXP_RX_DCD_MASK) == SIXP_RX_DCD_MASK)) {
if (ax->status != 1)
Debugprintf("6pack: protocol violation\n");
else
ax->status = 0;
cmd &= !SIXP_RX_DCD_MASK;
}
ax->status = cmd & SIXP_PRIO_DATA_MASK;
} /* if */
/* if the state byte has been received, the TNC is present,
so the resync timer can be reset. */
if (ax->tnc_ok == 1) {
// del_timer(&(ax->resync_t));
// ax->resync_t.data = (unsigned long) ax;
// ax->resync_t.function = resync_tnc;
// ax->resync_t.expires = jiffies + SIXP_INIT_RESYNC_TIMEOUT;
// add_timer(&(ax->resync_t));
}
ax->status1 = cmd & SIXP_PRIO_DATA_MASK;
}
/* try to resync the TNC. Called by the resync timer defined in
decode_prio_command */
static void
resync_tnc(unsigned long channel)
{
static char resync_cmd = SIXP_INIT_CMD;
struct ax_disp *ax = (struct ax_disp *) channel;
Debugprintf("6pack: resyncing TNC\n");
/* clear any data that might have been received */
ax->rx_count = 0;
ax->rx_count_cooked = 0;
/* reset state machine */
ax->status = 1;
ax->status1 = 1;
ax->status2 = 0;
ax->tnc_ok = 0;
/* resync the TNC */
ax->led_state = SIXP_LED_OFF;
// ax->tty->driver.write(ax->tty, 0, &(ax->led_state), 1);
// ax->tty->driver.write(ax->tty, 0, &resync_cmd, 1);
/* Start resync timer again -- the TNC might be still absent */
// del_timer(&(ax->resync_t));
// ax->resync_t.data = (unsigned long) ax;
// ax->resync_t.function = resync_tnc;
// ax->resync_t.expires = jiffies + SIXP_RESYNC_TIMEOUT;
// add_timer(&(ax->resync_t));
}
/* identify and execute a standard 6pack command byte */
void decode_std_command(unsigned char cmd, struct ax_disp *ax)
{
unsigned char checksum = 0, channel;
unsigned int i;
channel = cmd & SIXP_CHN_MASK;
switch (cmd & SIXP_CMD_MASK) { /* normal command */
case SIXP_SEOF:
if ((ax->rx_count == 0) && (ax->rx_count_cooked == 0)) {
if ((ax->status & SIXP_RX_DCD_MASK) ==
SIXP_RX_DCD_MASK) {
ax->led_state = SIXP_CON_LED_ON;
// ax->tty->driver.write(ax->tty, 0, &(ax->led_state), 1);
} /* if */
}
else {
ax->led_state = SIXP_LED_OFF;
// ax->tty->driver.write(ax->tty, 0, &(ax->led_state), 1);
/* fill trailing bytes with zeroes */
if (ax->rx_count == 2) {
decode_data(0, ax);
decode_data(0, ax);
ax->rx_count_cooked -= 2;
}
else if (ax->rx_count == 3) {
decode_data(0, ax);
ax->rx_count_cooked -= 1;
}
for (i = 0; i < ax->rx_count_cooked; i++)
checksum += ax->cooked_buf[i];
if (checksum != SIXP_CHKSUM) {
Debugprintf("6pack: bad checksum %2.2x\n", checksum);
}
else {
ax->rcount = ax->rx_count_cooked - 1;
ax_bump(ax);
} /* else */
ax->rx_count_cooked = 0;
} /* else */
break;
case SIXP_TX_URUN:
Debugprintf("6pack: TX underrun\n");
break;
case SIXP_RX_ORUN:
Debugprintf("6pack: RX overrun\n");
break;
case SIXP_RX_BUF_OVL:
Debugprintf("6pack: RX buffer overflow\n");
} /* switch */
} /* function */
/* decode 4 sixpack-encoded bytes into 3 data bytes */
void decode_data(unsigned char inbyte, struct ax_disp *ax)
{
unsigned char *buf;
if (ax->rx_count != 3)
ax->raw_buf[ax->rx_count++] = inbyte;
else {
buf = ax->raw_buf;
ax->cooked_buf[ax->rx_count_cooked++] =
buf[0] | ((buf[1] << 2) & 0xc0);
ax->cooked_buf[ax->rx_count_cooked++] =
(buf[1] & 0x0f) | ((buf[2] << 2) & 0xf0);
ax->cooked_buf[ax->rx_count_cooked++] =
(buf[2] & 0x03) | (inbyte << 2);
ax->rx_count = 0;
}
}

View File

@ -42,10 +42,19 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
#define VOID void #define VOID void
char * strlop(char * buf, char delim);
int gethints();
struct timespec pttclk;
extern int Closing; extern int Closing;
int SoundMode = 0; int SoundMode = 0;
int stdinMode = 0; int stdinMode = 0;
int onlyMixSnoop = 0;
int txLatency;
//#define SHARECAPTURE // if defined capture device is opened and closed for each transission //#define SHARECAPTURE // if defined capture device is opened and closed for each transission
@ -93,6 +102,22 @@ extern BOOL UseKISS; // Enable Packet (KISS) interface
extern short * DMABuffer; extern short * DMABuffer;
#define MaxReceiveSize 2048 // Enough for 9600
#define MaxSendSize 4096
short buffer[2][MaxSendSize * 2]; // Two Transfer/DMA buffers of 0.1 Sec (x2 for Stereo)
short inbuffer[MaxReceiveSize * 2]; // Input Transfer/ buffers of 0.1 Sec (x2 for Stereo)
extern short * DMABuffer;
extern int Number;
int ReceiveSize = 512;
int SendSize = 1024;
int using48000 = 0;
int SampleRate = 12000;
BOOL UseLeft = TRUE; BOOL UseLeft = TRUE;
BOOL UseRight = TRUE; BOOL UseRight = TRUE;
@ -123,8 +148,6 @@ void Sleep(int mS)
// Windows and ALSA work with signed samples +- 32767 // Windows and ALSA work with signed samples +- 32767
// STM32 and Teensy DAC uses unsigned 0 - 4095 // STM32 and Teensy DAC uses unsigned 0 - 4095
short buffer[2][1200 * 2]; // Two Transfer/DMA buffers of 0.1 Sec
short inbuffer[1200 * 2]; // Two Transfer/DMA buffers of 0.1 Sec
BOOL Loopback = FALSE; BOOL Loopback = FALSE;
//BOOL Loopback = TRUE; //BOOL Loopback = TRUE;
@ -277,11 +300,11 @@ void platformInit()
void txSleep(int mS) void txSleep(int mS)
{ {
// called while waiting for next TX buffer or to delay response.
// Run background processes
// called while waiting for next TX buffer. Run background processes // called while waiting for next TX buffer. Run background processes
if (mS < 0)
return;
while (mS > 50) while (mS > 50)
{ {
PollReceivedSamples(); // discard any received samples PollReceivedSamples(); // discard any received samples
@ -612,7 +635,8 @@ int OpenSoundPlayback(char * PlaybackDevice, int m_sampleRate, int channels, int
{ {
int err = 0; int err = 0;
char buf1[100]; char buf1[256];
char buf2[256];
char * ptr; char * ptr;
if (playhandle) if (playhandle)
@ -624,18 +648,20 @@ int OpenSoundPlayback(char * PlaybackDevice, int m_sampleRate, int channels, int
strcpy(SavedPlaybackDevice, PlaybackDevice); // Saved so we can reopen in error recovery strcpy(SavedPlaybackDevice, PlaybackDevice); // Saved so we can reopen in error recovery
SavedPlaybackRate = m_sampleRate; SavedPlaybackRate = m_sampleRate;
if (strstr(PlaybackDevice, "plug") == 0 && strchr(PlaybackDevice, ':')) strcpy(buf2, PlaybackDevice);
sprintf(buf1, "plug%s", PlaybackDevice);
ptr = strchr(buf2, ' ');
if (ptr) *ptr = 0; // Get Device part of name
if (strstr(buf2, "plug") == 0 && strchr(buf2, ':'))
sprintf(buf1, "plug%s", buf2);
else else
strcpy(buf1, PlaybackDevice); strcpy(buf1, buf2);
if (Report) if (Report)
Debugprintf("Real Device %s", buf1); Debugprintf("Real Device %s", buf1);
ptr = strchr(buf1, ' ');
if (ptr) *ptr = 0; // Get Device part of name
snd_pcm_hw_params_t *hw_params; snd_pcm_hw_params_t *hw_params;
if ((err = snd_pcm_open(&playhandle, buf1, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) if ((err = snd_pcm_open(&playhandle, buf1, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0)
@ -720,7 +746,9 @@ int OpenSoundCapture(char * CaptureDevice, int m_sampleRate, int Report)
{ {
int err = 0; int err = 0;
char buf1[100]; char buf1[256];
char buf2[256];
char * ptr; char * ptr;
snd_pcm_hw_params_t *hw_params; snd_pcm_hw_params_t *hw_params;
@ -741,16 +769,19 @@ int OpenSoundCapture(char * CaptureDevice, int m_sampleRate, int Report)
strcpy(SavedCaptureDevice, CaptureDevice); // Saved so we can reopen in error recovery strcpy(SavedCaptureDevice, CaptureDevice); // Saved so we can reopen in error recovery
SavedCaptureRate = m_sampleRate; SavedCaptureRate = m_sampleRate;
if (strstr(CaptureDevice, "plug") == 0 && strchr(CaptureDevice, ':')) strcpy(buf2, CaptureDevice);
sprintf(buf1, "plug%s", CaptureDevice);
ptr = strchr(buf2, ' ');
if (ptr) *ptr = 0; // Get Device part of name
if (strstr(buf2, "plug") == 0 && strchr(buf2, ':'))
sprintf(buf1, "plug%s", buf2);
else else
strcpy(buf1, CaptureDevice); strcpy(buf1, buf2);
if (Report) if (Report)
Debugprintf("Real Device %s", buf1); Debugprintf("Real Device %s", buf1);
ptr = strchr(buf1, ' ');
if (ptr) *ptr = 0; // Get Device part of name
if ((err = snd_pcm_open (&rechandle, buf1, SND_PCM_STREAM_CAPTURE, 0)) < 0) { if ((err = snd_pcm_open (&rechandle, buf1, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
Debugprintf("cannot open capture audio device %s (%s)", buf1, snd_strerror(err)); Debugprintf("cannot open capture audio device %s (%s)", buf1, snd_strerror(err));
@ -785,6 +816,7 @@ int OpenSoundCapture(char * CaptureDevice, int m_sampleRate, int Report)
if ((err = snd_pcm_hw_params_set_channels(rechandle, hw_params, m_recchannels)) < 0) if ((err = snd_pcm_hw_params_set_channels(rechandle, hw_params, m_recchannels)) < 0)
{ {
if (Report)
Debugprintf("cannot set rec channel count to 2 (%s)", snd_strerror(err)); Debugprintf("cannot set rec channel count to 2 (%s)", snd_strerror(err));
m_recchannels = 1; m_recchannels = 1;
@ -840,10 +872,10 @@ int OpenSoundCapture(char * CaptureDevice, int m_sampleRate, int Report)
snd_pcm_hw_params_set_rate(rechandle, hw_params, m_sampleRate, 0); snd_pcm_hw_params_set_rate(rechandle, hw_params, m_sampleRate, 0);
snd_pcm_hw_params_set_channels(rechandle, hw_params, m_recchannels); snd_pcm_hw_params_set_channels(rechandle, hw_params, m_recchannels);
err = snd_pcm_hw_params_set_buffer_size(rechandle, hw_params, 65536); // err = snd_pcm_hw_params_set_buffer_size(rechandle, hw_params, 65536);
if (err) // if (err)
Debugprintf("cannot set buffer size (%s)", snd_strerror(err)); // Debugprintf("cannot set buffer size (%s)", snd_strerror(err));
err = snd_pcm_hw_params_set_period_size(rechandle, hw_params, (snd_pcm_uframes_t) { 1024 }, (int) { 0 }); err = snd_pcm_hw_params_set_period_size(rechandle, hw_params, (snd_pcm_uframes_t) { 1024 }, (int) { 0 });
@ -867,16 +899,13 @@ int OpenSoundCapture(char * CaptureDevice, int m_sampleRate, int Report)
if (Report) if (Report)
Debugprintf("Capture using %d channels", m_recchannels); Debugprintf("Capture using %d channels", m_recchannels);
int i;
short buf[256]; short buf[256];
for (i = 0; i < 10; ++i) if ((err = snd_pcm_readi(rechandle, buf, 12)) != 12)
{
if ((err = snd_pcm_readi (rechandle, buf, 128)) != 128)
{ {
Debugprintf("read from audio interface failed (%s)", snd_strerror(err)); Debugprintf("read from audio interface failed (%s)", snd_strerror(err));
} }
}
// Debugprintf("Read got %d", err); // Debugprintf("Read got %d", err);
@ -942,11 +971,11 @@ int SoundCardWrite(short * input, int nSamples)
// Stop Capture // Stop Capture
if (rechandle) // if (rechandle)
{ // {
snd_pcm_close(rechandle); // snd_pcm_close(rechandle);
rechandle = NULL; // rechandle = NULL;
} // }
avail = snd_pcm_avail_update(playhandle); avail = snd_pcm_avail_update(playhandle);
// Debugprintf("avail before play returned %d", (int)avail); // Debugprintf("avail before play returned %d", (int)avail);
@ -967,7 +996,7 @@ int SoundCardWrite(short * input, int nSamples)
// Debugprintf("Tosend %d Avail %d", nSamples, (int)avail); // Debugprintf("Tosend %d Avail %d", nSamples, (int)avail);
while (avail < nSamples || (MaxAvail - avail) > 12000) // Limit to 1 sec of audio while (avail < nSamples || (MaxAvail - avail) > SampleRate) // Limit to 1 sec of audio
{ {
txSleep(10); txSleep(10);
avail = snd_pcm_avail_update(playhandle); avail = snd_pcm_avail_update(playhandle);
@ -1173,6 +1202,12 @@ short loopbuff[1200]; // Temp for testing - loop sent samples to decoder
short * SoundInit(); short * SoundInit();
void GetSoundDevices() void GetSoundDevices()
{
if (onlyMixSnoop)
{
gethints();
}
else
{ {
if (SoundMode == 0) if (SoundMode == 0)
{ {
@ -1200,18 +1235,33 @@ void GetSoundDevices()
listpulse(); listpulse();
} }
} }
}
int InitSound(BOOL Quiet) int InitSound(BOOL Quiet)
{ {
if (using48000)
{
ReceiveSize = 2048;
SendSize = 4096; // 100 mS for now
SampleRate = 48000;
}
else
{
ReceiveSize = 512;
SendSize = 1024;
SampleRate = 12000;
}
GetSoundDevices(); GetSoundDevices();
switch (SoundMode) switch (SoundMode)
{ {
case 0: // ALSA case 0: // ALSA
if (!OpenSoundCard(CaptureDevice, PlaybackDevice, 12000, 12000, Quiet)) if (!OpenSoundCard(CaptureDevice, PlaybackDevice, SampleRate, SampleRate, Quiet))
return FALSE; return FALSE;
break; break;
case 1: // OSS case 1: // OSS
@ -1238,6 +1288,7 @@ int InitSound(BOOL Quiet)
int min = 0, max = 0, lastlevelreport = 0, lastlevelGUI = 0; int min = 0, max = 0, lastlevelreport = 0, lastlevelGUI = 0;
UCHAR CurrentLevel = 0; // Peak from current samples UCHAR CurrentLevel = 0; // Peak from current samples
UCHAR CurrentLevelR = 0; // Peak from current samples
void PollReceivedSamples() void PollReceivedSamples()
{ {
@ -1270,7 +1321,18 @@ void PollReceivedSamples()
// if still not enough, too bad! // if still not enough, too bad!
if (bytes != ReceiveSize * 2) if (bytes != ReceiveSize * 2)
{
// This seems to happen occasionally even when we shouldn't be in stdin mode. Exit
Debugprintf("Short Read %d", bytes); Debugprintf("Short Read %d", bytes);
closeTraceLog();
Closing = TRUE;
sleep(1);
exit(1);
}
// convert to stereo // convert to stereo
@ -1308,7 +1370,7 @@ void PollReceivedSamples()
{ {
lastlevelGUI = Now; lastlevelGUI = Now;
if ((Now - lastlevelreport) > 10000) // 10 Secs if ((Now - lastlevelreport) > 60000) // 60 Secs
{ {
char HostCmd[64]; char HostCmd[64];
lastlevelreport = Now; lastlevelreport = Now;
@ -1373,6 +1435,11 @@ short * SoundInit()
// Called at end of transmission // Called at end of transmission
int useTimedPTT = 1;
extern int SampleNo;
int pttOnTime();
void SoundFlush() void SoundFlush()
{ {
// Append Trailer then send remaining samples // Append Trailer then send remaining samples
@ -1388,9 +1455,34 @@ void SoundFlush()
// Wait for tx to complete // Wait for tx to complete
Debugprintf("Flush Soundmode = %d", SoundMode); // Debugprintf("Flush Soundmode = %d", SoundMode);
if (SoundMode == 0) // ALSA if (SoundMode == 0) // ALSA
{
if (useTimedPTT)
{
// Calulate PTT Time from Number of samples and samplerate
// samples sent is is in SampleNo, Time PTT was raised in timeval pttclk
// txLatency is extra ptt time to compenstate for time soundcard takes to start outputting samples
struct timespec pttnow;
clock_gettime(CLOCK_MONOTONIC, &pttnow);
time_t pttontimemS = (pttclk.tv_sec * 1000) + (pttclk.tv_nsec / 1000000);
time_t nowtimemS = (pttnow.tv_sec * 1000) + (pttnow.tv_nsec / 1000000);
// We have already added latency to tail, so don't add again
int txlenMs = (1000 * SampleNo / TX_Samplerate); // 12000 samples per sec.
Debugprintf("Tx Time %d Time till end = %d", txlenMs, (nowtimemS - pttontimemS));
txSleep(txlenMs - (nowtimemS - pttontimemS));
}
else
{ {
usleep(100000); usleep(100000);
@ -1426,6 +1518,9 @@ void SoundFlush()
lastavail = avail; lastavail = avail;
usleep(50000); usleep(50000);
} }
}
// I think we should turn round the link here. I dont see the point in // I think we should turn round the link here. I dont see the point in
// waiting for MainPoll // waiting for MainPoll
@ -1694,32 +1789,6 @@ int gpioInitialise(void)
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2)
{
unsigned char c1, c2;
int v;
if (pStr1 == NULL)
{
if (pStr2)
Debugprintf("stricmp called with NULL 1st param - 2nd %s ", pStr2);
else
Debugprintf("stricmp called with two NULL params");
return 1;
}
do {
c1 = *pStr1++;
c2 = *pStr2++;
/* The casts are necessary when pStr1 is shorter & char is signed */
v = tolower(c1) - tolower(c2);
} while ((v == 0) && (c1 != '\0') && (c2 != '\0') );
return v;
}
char Leds[8]= {0}; char Leds[8]= {0};
unsigned int PKTLEDTimer = 0; unsigned int PKTLEDTimer = 0;
@ -1789,7 +1858,7 @@ VOID COMClearRTS(HANDLE fd)
HANDLE OpenCOMPort(char * Port, int speed, BOOL SetDTR, BOOL SetRTS, BOOL Quiet, int Stopbits) HANDLE OpenCOMPort(char * Port, int speed, BOOL SetDTR, BOOL SetRTS, BOOL Quiet, int Stopbits)
{ {
char buf[100]; char buf[256];
// Linux Version. // Linux Version.
@ -1898,3 +1967,177 @@ VOID CloseCOMPort(HANDLE fd)
close(fd); close(fd);
} }
// "hints" processing for looking for SNOOP/MIX devices
int gethints()
{
const char *iface = "pcm";
void **hints;
char **n;
int err;
char hwdev[256];
snd_pcm_t *pcm = NULL;
char NameString[256];
CloseSoundCard();
Debugprintf("Available Mix/Snoop Devices\n");
PlaybackCount = 0;
CaptureCount = 0;
err = snd_device_name_hint(-1, iface, &hints);
if (err < 0)
Debugprintf("snd_device_name_hint error: %s", snd_strerror(err));
n = (char **)hints;
while (*n != NULL)
{
if (memcmp(*n, "NAMEmix", 7) == 0) //NAMEmix00|DESCQtSM Mix for hw0:0
{
char Hint[256];
char * ptr;
snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
strcpy(Hint, *n);
ptr = strchr(Hint, '|');
if (ptr)
{
*ptr++ = 0;
}
strcpy(hwdev, &Hint[4]);
err = snd_pcm_open(&pcm, hwdev, stream, SND_PCM_NONBLOCK);
if (err)
{
Debugprintf("Error %d opening output device %s ", err, hwdev);
goto nextdevice;
}
// Add device to list
if (ptr)
sprintf(NameString, "%s %s", hwdev, &ptr[4]);
else
strcpy(NameString, hwdev);
Debugprintf(NameString);
strcpy(PlaybackNames[PlaybackCount++], NameString);
snd_pcm_close(pcm);
pcm = NULL;
}
else if (memcmp(*n, "NAMEsnoop", 9) == 0)
{
char Hint[256];
char * ptr;
snd_pcm_stream_t stream = SND_PCM_STREAM_CAPTURE;
strcpy(Hint, *n);
ptr = strchr(Hint, '|');
if (ptr)
{
*ptr++ = 0;
}
strcpy(hwdev, &Hint[4]);
err = snd_pcm_open(&pcm, hwdev, stream, SND_PCM_NONBLOCK);
if (err)
{
Debugprintf("Error %d opening input device %s ", err, hwdev);
goto nextdevice;
}
// Add device to list
if (ptr)
sprintf(NameString, "%s %s", hwdev, &ptr[4]);
else
strcpy(NameString, hwdev);
Debugprintf(NameString);
strcpy(CaptureNames[CaptureCount++], NameString);
snd_pcm_close(pcm);
pcm = NULL;
}
nextdevice:
n++;
}
snd_device_name_free_hint(hints);
return 0;
}
// Microsoft routines not available in gcc
int memicmp(unsigned char *a, unsigned char *b, int n)
{
if (n)
{
while (n && (toupper(*a) == toupper(*b)))
n--, a++, b++;
if (n)
return toupper(*a) - toupper(*b);
}
return 0;
}
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2)
{
unsigned char c1, c2;
int v;
if (pStr1 == NULL)
{
if (pStr2)
Debugprintf("stricmp called with NULL 1st param - 2nd %s ", pStr2);
else
Debugprintf("stricmp called with two NULL params");
return 1;
}
do {
c1 = *pStr1++;
c2 = *pStr2++;
/* The casts are necessary when pStr1 is shorter & char is signed */
v = tolower(c1) - tolower(c2);
} while ((v == 0) && (c1 != '\0') && (c2 != '\0'));
return v;
}
char * strupr(char* s)
{
char* p = s;
if (s == 0)
return 0;
while (*p = toupper(*p)) p++;
return s;
}
char * strlwr(char* s)
{
char* p = s;
while (*p = tolower(*p)) p++;
return s;
}

189
ARDOPC.c
View File

@ -1025,195 +1025,6 @@ BOOL blnErrorsCorrected;
#define NEWRS #define NEWRS
BOOL xRSDecode(UCHAR * bytRcv, int Length, int CheckLen, BOOL * blnRSOK)
{
#ifdef NEWRS
// Using a modified version of Henry Minsky's code
//Copyright Henry Minsky (hqm@alum.mit.edu) 1991-2009
// Rick's Implementation processes the byte array in reverse. and also
// has the check bytes in the opposite order. I've modified the encoder
// to allow for this, but so far haven't found a way to mske the decoder
// work, so I have to reverse the data and checksum to decode G8BPQ Nov 2015
// returns TRUE if was ok or correction succeeded, FALSE if correction impossible
UCHAR intTemp[256]; // WOrk Area to pass to Decoder
int i;
UCHAR * ptr2 = intTemp;
UCHAR * ptr1 = &bytRcv[Length - CheckLen -1]; // Last Byte of Data
int DataLen = Length - CheckLen;
int PadLength = 255 - Length; // Padding bytes needed for shortened RS codes
*blnRSOK = FALSE;
if (Length > 255 || Length < (1 + CheckLen)) //Too long or too short
return FALSE;
if (NPAR != CheckLen) // Changed RS Len, so recalc constants;
{
NPAR = CheckLen;
MaxErrors = NPAR /2;
initialize_ecc();
}
// We reverse the data while zero padding it to speed things up
// We Need (Data Reversed) (Zero Padding) (Checkbytes Reversed)
// Reverse Data
for (i = 0; i < DataLen; i++)
{
*(ptr2++) = *(ptr1--);
}
// Clear padding
memset(ptr2, 0, PadLength);
ptr2+= PadLength;
// Error Bits
ptr1 = &bytRcv[Length - 1]; // End of check bytes
for (i = 0; i < CheckLen; i++)
{
*(ptr2++) = *(ptr1--);
}
decode_data(intTemp, 255);
// check if syndrome is all zeros
if (check_syndrome() == 0)
{
// RS ok, so no need to correct
*blnRSOK = TRUE;
return TRUE; // No Need to Correct
}
if (correct_errors_erasures (intTemp, 255, 0, 0) == 0) // Dont support erasures at the momnet
// Uncorrectable
return FALSE;
// Data has been corrected, so need to reverse again
ptr1 = &intTemp[DataLen - 1];
ptr2 = bytRcv; // Last Byte of Data
for (i = 0; i < DataLen; i++)
{
*(ptr2++) = *(ptr1--);
}
// ?? Do we need to return the check bytes ??
// Yes, so we can redo RS Check on supposedly connected frame
ptr1 = &intTemp[254]; // End of Check Bytes
for (i = 0; i < CheckLen; i++)
{
*(ptr2++) = *(ptr1--);
}
return TRUE;
}
#else
// Old (Rick's) code
// Sets blnRSOK if OK without correction
// Returns TRUE if OK oe Corrected
// False if Can't correct
UCHAR intTemp[256]; // Work Area to pass to Decoder
int i;
int intStartIndex;
UCHAR * ptr2 = intTemp;
UCHAR * ptr1 = bytRcv;
BOOL RSWasOK;
int DataLen = Length - CheckLen;
int PadLength = 255 - Length; // Padding bytes needed for shortened RS codes
*blnRSOK = FALSE;
if (Length > 255 || Length < (1 + CheckLen)) //Too long or too short
return FALSE;
if (NPAR != CheckLen) // Changed RS Len, so recalc constants;
{
NPAR = CheckLen;
tt = sqrt(NPAR);
kk = 255-CheckLen;
generate_gf();
gen_poly();
}
intStartIndex = 255 - Length; // set the start point for shortened RS codes
// We always work on a 255 byte buffer, prepending zeros if neccessary
// Clear padding
memset(ptr2, 0, PadLength);
ptr2 += PadLength;
memcpy(ptr2, ptr1, Length);
// convert to indexed form
for(i = 0; i < 256; i++)
{
// intIsave = i;
// intIndexSave = index_of[intTemp[i]];
recd[i] = index_of[intTemp[i]];
}
// printtick("entering decode_rs");
blnErrorsCorrected = FALSE;
RSWasOK = decode_rs();
// printtick("decode_rs Done");
*blnRSOK = RSWasOK;
if (RSWasOK)
return TRUE;
if(blnErrorsCorrected)
{
for (i = 0; i < DataLen; i++)
{
bytRcv[i] = recd[i + intStartIndex];
}
return TRUE;
}
return FALSE;
}
#endif
// Function to encode ConnectRequest frame // Function to encode ConnectRequest frame
// ' Function to encode an ACK control frame (2 bytes total) ...with 5 bit Quality code // ' Function to encode an ACK control frame (2 bytes total) ...with 5 bit Quality code

View File

@ -45,156 +45,28 @@ VOID ClearBusy()
intLastStop = 0; // This will force the busy detector to ignore old averages and initialze the rolling average filters intLastStop = 0; // This will force the busy detector to ignore old averages and initialze the rolling average filters
} }
/* extern int FFTSize;
// Function to implement a busy detector based on 1024 point FFT
BOOL BusyDetect2(float * dblMag, int intStart, int intStop) // this only called while searching for leader ...once leader detected, no longer called. BOOL BusyDetect3(float * dblMag, int StartFreq, int EndFreq)
{ {
// each bin is about 12000/1024 or 11.72 Hz
// this only called while searching for leader ...once leader detected, no longer called. // Based on code from ARDOP, but using diffferent FFT size
// QtSM is using an FFT size based on waterfall settings.
// First sort signals and look at highes signals:baseline ratio.. // First sort signals and look at highes signals:baseline ratio..
float dblAVGSignalPerBinNarrow, dblAVGSignalPerBinWide, dblAVGBaselineNarrow, dblAVGBaselineWide; // Start and Stop are in Hz. Convert to bin numbers
float dblFastAlpha = 0.4f;
float dblSlowAlpha = 0.2f;
float dblAvgStoNNarrow, dblAvgStoNWide;
int intNarrow = 8; // 8 x 11.72 Hz about 94 z
int intWide = ((intStop - intStart) * 2) / 3; //* 0.66);
int blnBusy = FALSE;
float dblAvgStoNSlowNarrow = 0;
float dblAvgStoNFastNarrow = 0;
float dblAvgStoNSlowWide = 0;
float dblAvgStoNFastWide = 0;
// First narrow band (~94Hz)
SortSignals(dblMag, intStart, intStop, intNarrow, &dblAVGSignalPerBinNarrow, &dblAVGBaselineNarrow);
if (intLastStart == intStart && intLastStop == intStop)
{
dblAvgStoNSlowNarrow = (1 - dblSlowAlpha) * dblAvgStoNSlowNarrow + dblSlowAlpha * dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
dblAvgStoNFastNarrow = (1 - dblFastAlpha) * dblAvgStoNFastNarrow + dblFastAlpha * dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
}
else
{
dblAvgStoNSlowNarrow = dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
dblAvgStoNFastNarrow = dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
intLastStart = intStart;
intLastStop = intStop;
}
dblAvgStoNNarrow = max(dblAvgStoNSlowNarrow, dblAvgStoNFastNarrow); // computes fast attack, slow release
// Wide band (66% ofr current bandwidth)
SortSignals(dblMag, intStart, intStop, intWide, &dblAVGSignalPerBinWide, &dblAVGBaselineWide);
if (intLastStart == intStart && intLastStop == intStop)
{
dblAvgStoNSlowWide = (1 - dblSlowAlpha) * dblAvgStoNSlowWide + dblSlowAlpha * dblAVGSignalPerBinWide / dblAVGBaselineWide;
dblAvgStoNFastWide = (1 - dblFastAlpha) * dblAvgStoNFastWide + dblFastAlpha * dblAVGSignalPerBinWide / dblAVGBaselineWide;
}
else
{
dblAvgStoNSlowWide = dblAVGSignalPerBinWide / dblAVGBaselineWide;
dblAvgStoNFastWide = dblAVGSignalPerBinWide / dblAVGBaselineWide;
intLastStart = intStart;
intLastStop = intStop;
}
dblAvgStoNNarrow = max(dblAvgStoNSlowNarrow, dblAvgStoNFastNarrow); // computes fast attack, slow release
dblAvgStoNWide = max(dblAvgStoNSlowWide, dblAvgStoNFastWide); // computes fast attack, slow release
// Preliminary calibration...future a function of bandwidth and BusyDet.
switch (ARQBandwidth)
{
case B200MAX:
case B200FORCED:
if (dblAvgStoNNarrow > 1.5 * BusyDet|| dblAvgStoNWide > 2.5 * BusyDet)
blnBusy = True;
break;
case B500MAX:
case B500FORCED:
if (dblAvgStoNNarrow > 1.5 * BusyDet || dblAvgStoNWide > 2.5 * BusyDet)
blnBusy = True;
break;
case B1000MAX:
case B1000FORCED:
if (dblAvgStoNNarrow > 1.4 * BusyDet || dblAvgStoNWide > 2 * BusyDet)
blnBusy = True;
break;
case B2000MAX:
case B2000FORCED:
if (dblAvgStoNNarrow > 1.4 * BusyDet || dblAvgStoNWide > 2 * BusyDet)
blnBusy = True;
}
if (blnBusy) // This used to skip over one call busy nuisance trips. Busy must be present at least 2 consecutive times to be reported
{
intBusyOnCnt += 1;
intBusyOffCnt = 0;
if (intBusyOnCnt > 1)
blnBusy = True;
else if (!blnBusy)
{
intBusyOffCnt += 1;
intBusyOnCnt = 0;
if (intBusyOffCnt > 3)
blnBusy = False;
}
}
if (blnLastBusy == False && blnBusy)
{
int x = round(dblAvgStoNNarrow); // odd, but PI doesnt print floats properly
int y = round(dblAvgStoNWide);
blnLastBusy = True;
LastBusyOn = Now;
#ifdef __ARM_ARCH
WriteDebugLog(LOGDEBUG, "[BusyDetect2: BUSY ON StoN Narrow = %d StoN Wide %d", x, y);
#else
WriteDebugLog(LOGDEBUG, "[BusyDetect2: BUSY ON StoN Narrow = %f StoN Wide %f", dblAvgStoNNarrow, dblAvgStoNWide);
#endif
}
else if (blnLastBusy == True && !blnBusy)
{
int x = round(dblAvgStoNNarrow); // odd, but PI doesnt print floats properly
int y = round(dblAvgStoNWide);
blnLastBusy = False;
LastBusyOff = Now;
#ifdef __ARM_ARCH
WriteDebugLog(LOGDEBUG, "[BusyDetect2: BUSY OFF StoN Narrow = %d StoN Wide %d", x, y);
#else
WriteDebugLog(LOGDEBUG, "[BusyDetect2: BUSY OFF StoN Narrow = %f StoN Wide %f", dblAvgStoNNarrow, dblAvgStoNWide);
#endif
}
return blnLastBusy;
}
*/ float BinSize = 12000.0 / FFTSize;
int StartBin = StartFreq / BinSize;
int EndBin = EndFreq / BinSize;
BOOL BusyDetect3(float * dblMag, int intStart, int intStop) // this only called while searching for leader ...once leader detected, no longer called.
{
// each bin is about 12000/1024 or 11.72 Hz
// this only called while searching for leader ...once leader detected, no longer called.
// First sort signals and look at highes signals:baseline ratio..
float dblAVGSignalPerBinNarrow, dblAVGSignalPerBinWide, dblAVGBaselineNarrow, dblAVGBaselineWide; float dblAVGSignalPerBinNarrow, dblAVGSignalPerBinWide, dblAVGBaselineNarrow, dblAVGBaselineWide;
float dblSlowAlpha = 0.2f; float dblSlowAlpha = 0.2f;
float dblAvgStoNNarrow = 0, dblAvgStoNWide = 0; float dblAvgStoNNarrow = 0, dblAvgStoNWide = 0;
int intNarrow = 8; // 8 x 11.72 Hz about 94 z int intNarrow = 100 / BinSize; // 8 x 11.72 Hz about 94 z
int intWide = ((intStop - intStart) * 2) / 3; //* 0.66); int intWide = ((EndBin - StartBin) * 2) / 3; //* 0.66);
int blnBusy = FALSE; int blnBusy = FALSE;
int BusyDet4th = BusyDet * BusyDet * BusyDet * BusyDet; int BusyDet4th = BusyDet * BusyDet * BusyDet * BusyDet;
@ -202,32 +74,32 @@ BOOL BusyDetect3(float * dblMag, int intStart, int intStop) // this only
// First sort signals and look at highest signals:baseline ratio.. // First sort signals and look at highest signals:baseline ratio..
// First narrow band (~94Hz) // First narrow band (~94Hz)
SortSignals2(dblMag, intStart, intStop, intNarrow, &dblAVGSignalPerBinNarrow, &dblAVGBaselineNarrow); SortSignals2(dblMag, StartBin, EndBin, intNarrow, &dblAVGSignalPerBinNarrow, &dblAVGBaselineNarrow);
if (intLastStart == intStart && intLastStop == intStop) if (intLastStart == StartBin && intLastStop == EndBin)
dblAvgStoNNarrow = (1 - dblSlowAlpha) * dblAvgStoNNarrow + dblSlowAlpha * dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow; dblAvgStoNNarrow = (1 - dblSlowAlpha) * dblAvgStoNNarrow + dblSlowAlpha * dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
else else
{ {
// This initializes the Narrow average after a bandwidth change // This initializes the Narrow average after a bandwidth change
dblAvgStoNNarrow = dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow; dblAvgStoNNarrow = dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
intLastStart = intStart; intLastStart = StartBin;
intLastStop = intStop; intLastStop = EndBin;
} }
// Wide band (66% of current bandwidth) // Wide band (66% of current bandwidth)
SortSignals2(dblMag, intStart, intStop, intWide, &dblAVGSignalPerBinWide, &dblAVGBaselineWide); SortSignals2(dblMag, StartBin, EndBin, intWide, &dblAVGSignalPerBinWide, &dblAVGBaselineWide);
if (intLastStart == intStart && intLastStop == intStop) if (intLastStart == StartBin && intLastStop == EndBin)
dblAvgStoNWide = (1 - dblSlowAlpha) * dblAvgStoNWide + dblSlowAlpha * dblAVGSignalPerBinWide / dblAVGBaselineWide; dblAvgStoNWide = (1 - dblSlowAlpha) * dblAvgStoNWide + dblSlowAlpha * dblAVGSignalPerBinWide / dblAVGBaselineWide;
else else
{ {
// This initializes the Wide average after a bandwidth change // This initializes the Wide average after a bandwidth change
dblAvgStoNWide = dblAVGSignalPerBinWide / dblAVGBaselineWide; dblAvgStoNWide = dblAVGSignalPerBinWide / dblAVGBaselineWide;
intLastStart = intStart; intLastStart = StartBin;
intLastStop = intStop; intLastStop = EndBin;
} }
// Preliminary calibration...future a function of bandwidth and BusyDet. // Preliminary calibration...future a function of bandwidth and BusyDet.

View File

@ -1,444 +0,0 @@
/*
Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO
This file is part of QtSoundModem
QtSoundModem 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 3 of the License, or
(at your option) any later version.
QtSoundModem 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 QtSoundModem. If not, see http://www.gnu.org/licenses
*/
// UZ7HO Soundmodem Port by John Wiseman G8BPQ
#include <QSettings>
#include "UZ7HOStuff.h"
extern "C" void get_exclude_list(char * line, TStringList * list);
extern "C" void get_exclude_frm(char * line, TStringList * list);
extern "C" int SoundMode;
extern "C" int RX_SR;
extern "C" int TX_SR;
extern "C" int multiCore;
extern "C" char * Wisdom;
extern "C" word MEMRecovery[5];
extern int MintoTray;
extern "C" int UDPClientPort;
extern "C" int UDPServerPort;
extern "C" int TXPort;
extern char UDPHost[64];
extern char CWIDCall[128];
extern int CWIDInterval;
extern int CWIDLeft;
extern int CWIDRight;
extern int CWIDType;
extern "C" int RSID_SABM[4];
extern "C" int RSID_UI[4];
extern "C" int RSID_SetModem[4];
QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
// This makes geting settings for more channels easier
char Prefix[16] = "AX25_A";
void GetPortSettings(int Chan);
QVariant getAX25Param(const char * key, QVariant Default)
{
char fullKey[64];
sprintf(fullKey, "%s/%s", Prefix, key);
return settings->value(fullKey, Default);
}
void getAX25Params(int chan)
{
Prefix[5] = chan + 'A';
GetPortSettings(chan);
}
void GetPortSettings(int Chan)
{
tx_hitoneraisedb[Chan] = getAX25Param("HiToneRaise", 0).toInt();
maxframe[Chan] = getAX25Param("Maxframe", 3).toInt();
fracks[Chan] = getAX25Param("Retries", 15).toInt();
frack_time[Chan] = getAX25Param("FrackTime", 5).toInt();
idletime[Chan] = getAX25Param("IdleTime", 180).toInt();
slottime[Chan] = getAX25Param("SlotTime", 100).toInt();
persist[Chan] = getAX25Param("Persist", 128).toInt();
resptime[Chan] = getAX25Param("RespTime", 1500).toInt();
TXFrmMode[Chan] = getAX25Param("TXFrmMode", 1).toInt();
max_frame_collector[Chan] = getAX25Param("FrameCollector", 6).toInt();
//exclude_callsigns[Chan]= getAX25Param("ExcludeCallsigns/");
//exclude_APRS_frm[Chan]= getAX25Param("ExcludeAPRSFrmType/");
KISS_opt[Chan] = getAX25Param("KISSOptimization", false).toInt();;
dyn_frack[Chan] = getAX25Param("DynamicFrack", false).toInt();;
recovery[Chan] = getAX25Param("BitRecovery", 0).toInt();
NonAX25[Chan] = getAX25Param("NonAX25Frm", false).toInt();;
MEMRecovery[Chan]= getAX25Param("MEMRecovery", 200).toInt();
IPOLL[Chan] = getAX25Param("IPOLL", 80).toInt();
strcpy(MyDigiCall[Chan], getAX25Param("MyDigiCall", "").toString().toUtf8());
fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).toInt();
il2p_mode[Chan] = getAX25Param("IL2P", IL2P_MODE_NONE).toInt();
RSID_UI[Chan] = getAX25Param("RSID_UI", 0).toInt();
RSID_SABM[Chan] = getAX25Param("RSID_SABM", 0).toInt();
RSID_SetModem[Chan] = getAX25Param("RSID_SetModem", 0).toInt();
}
void getSettings()
{
int snd_ch;
QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
settings->sync();
SoundMode = settings->value("Init/SoundMode", 0).toInt();
UDPClientPort = settings->value("Init/UDPClientPort", 8888).toInt();
UDPServerPort = settings->value("Init/UDPServerPort", 8884).toInt();
TXPort = settings->value("Init/TXPort", UDPServerPort).toInt();
strcpy(UDPHost, settings->value("Init/UDPHost", "192.168.1.255").toString().toUtf8());
UDPServ = settings->value("Init/UDPServer", FALSE).toBool();
RX_SR = settings->value("Init/RXSampleRate", 12000).toInt();
TX_SR = settings->value("Init/TXSampleRate", 12000).toInt();
strcpy(CaptureDevice, settings->value("Init/SndRXDeviceName", "hw:1,0").toString().toUtf8());
strcpy(PlaybackDevice, settings->value("Init/SndTXDeviceName", "hw:1,0").toString().toUtf8());
raduga = settings->value("Init/DispMode", DISP_RGB).toInt();
strcpy(PTTPort, settings->value("Init/PTT", "").toString().toUtf8());
PTTMode = settings->value("Init/PTTMode", 19200).toInt();
PTTBAUD = settings->value("Init/PTTBAUD", 19200).toInt();
strcpy(PTTOnString, settings->value("Init/PTTOnString", "").toString().toUtf8());
strcpy(PTTOffString, settings->value("Init/PTTOffString", "").toString().toUtf8());
pttGPIOPin = settings->value("Init/pttGPIOPin", 17).toInt();
pttGPIOPinR = settings->value("Init/pttGPIOPinR", 17).toInt();
#ifdef WIN32
strcpy(CM108Addr, settings->value("Init/CM108Addr", "0xD8C:0x08").toString().toUtf8());
#else
strcpy(CM108Addr, settings->value("Init/CM108Addr", "/dev/hidraw0").toString().toUtf8());
#endif
HamLibPort = settings->value("Init/HamLibPort", 4532).toInt();
strcpy(HamLibHost, settings->value("Init/HamLibHost", "127.0.0.1").toString().toUtf8());
DualPTT = settings->value("Init/DualPTT", 1).toInt();
TX_rotate = settings->value("Init/TXRotate", 0).toInt();
multiCore = settings->value("Init/multiCore", 0).toInt();
Wisdom = strdup(settings->value("Init/Wisdom", "").toString().toUtf8());
rx_freq[0] = settings->value("Modem/RXFreq1", 1700).toInt();
rx_freq[1] = settings->value("Modem/RXFreq2", 1700).toInt();
rx_freq[2] = settings->value("Modem/RXFreq3", 1700).toInt();
rx_freq[3] = settings->value("Modem/RXFreq4", 1700).toInt();
rcvr_offset[0] = settings->value("Modem/RcvrShift1", 30).toInt();
rcvr_offset[1] = settings->value("Modem/RcvrShift2", 30).toInt();
rcvr_offset[2] = settings->value("Modem/RcvrShift3", 30).toInt();
rcvr_offset[3] = settings->value("Modem/RcvrShift4", 30).toInt();
speed[0] = settings->value("Modem/ModemType1", SPEED_1200).toInt();
speed[1] = settings->value("Modem/ModemType2", SPEED_1200).toInt();
speed[2] = settings->value("Modem/ModemType3", SPEED_1200).toInt();
speed[3] = settings->value("Modem/ModemType4", SPEED_1200).toInt();
RCVR[0] = settings->value("Modem/NRRcvrPairs1", 0).toInt();;
RCVR[1] = settings->value("Modem/NRRcvrPairs2", 0).toInt();;
RCVR[2] = settings->value("Modem/NRRcvrPairs3", 0).toInt();;
RCVR[3] = settings->value("Modem/NRRcvrPairs4", 0).toInt();;
soundChannel[0] = settings->value("Modem/soundChannel1", 1).toInt();
soundChannel[1] = settings->value("Modem/soundChannel2", 0).toInt();
soundChannel[2] = settings->value("Modem/soundChannel3", 0).toInt();
soundChannel[3] = settings->value("Modem/soundChannel4", 0).toInt();
SCO = settings->value("Init/SCO", 0).toInt();
dcd_threshold = settings->value("Modem/DCDThreshold", 40).toInt();
rxOffset = settings->value("Modem/rxOffset", 0).toInt();
AGWServ = settings->value("AGWHost/Server", TRUE).toBool();
AGWPort = settings->value("AGWHost/Port", 8000).toInt();
KISSServ = settings->value("KISS/Server", FALSE).toBool();
KISSPort = settings->value("KISS/Port", 8105).toInt();
RX_Samplerate = RX_SR + RX_SR * 0.000001*RX_PPM;
TX_Samplerate = TX_SR + TX_SR * 0.000001*TX_PPM;
emph_all[0] = settings->value("Modem/PreEmphasisAll1", FALSE).toBool();
emph_all[1] = settings->value("Modem/PreEmphasisAll2", FALSE).toBool();
emph_all[2] = settings->value("Modem/PreEmphasisAll3", FALSE).toBool();
emph_all[3] = settings->value("Modem/PreEmphasisAll4", FALSE).toBool();
emph_db[0] = settings->value("Modem/PreEmphasisDB1", 0).toInt();
emph_db[1] = settings->value("Modem/PreEmphasisDB2", 0).toInt();
emph_db[2] = settings->value("Modem/PreEmphasisDB3", 0).toInt();
emph_db[3] = settings->value("Modem/PreEmphasisDB4", 0).toInt();
Firstwaterfall = settings->value("Window/Waterfall1", TRUE).toInt();
Secondwaterfall = settings->value("Window/Waterfall2", TRUE).toInt();
txdelay[0] = settings->value("Modem/TxDelay1", 250).toInt();
txdelay[1] = settings->value("Modem/TxDelay2", 250).toInt();
txdelay[2] = settings->value("Modem/TxDelay3", 250).toInt();
txdelay[3] = settings->value("Modem/TxDelay4", 250).toInt();
strcpy(CWIDCall, settings->value("Modem/CWIDCall", "").toString().toUtf8().toUpper());
CWIDInterval = settings->value("Modem/CWIDInterval", 0).toInt();
CWIDLeft = settings->value("Modem/CWIDLeft", 0).toInt();
CWIDRight = settings->value("Modem/CWIDRight", 0).toInt();
CWIDType = settings->value("Modem/CWIDType", 1).toInt(); // on/off
getAX25Params(0);
getAX25Params(1);
getAX25Params(2);
getAX25Params(3);
// Validate and process settings
UsingLeft = 0;
UsingRight = 0;
UsingBothChannels = 0;
for (int i = 0; i < 4; i++)
{
if (soundChannel[i] == LEFT)
{
UsingLeft = 1;
modemtoSoundLR[i] = 0;
}
else if (soundChannel[i] == RIGHT)
{
UsingRight = 1;
modemtoSoundLR[i] = 1;
}
}
if (UsingLeft && UsingRight)
UsingBothChannels = 1;
for (snd_ch = 0; snd_ch < 4; snd_ch++)
{
tx_hitoneraise[snd_ch] = powf(10.0f, -abs(tx_hitoneraisedb[snd_ch]) / 20.0f);
if (IPOLL[snd_ch] < 0)
IPOLL[snd_ch] = 0;
else if (IPOLL[snd_ch] > 65535)
IPOLL[snd_ch] = 65535;
if (MEMRecovery[snd_ch] < 1)
MEMRecovery[snd_ch] = 1;
// if (MEMRecovery[snd_ch]> 65535)
// MEMRecovery[snd_ch]= 65535;
/*
if resptime[snd_ch] < 0 then resptime[snd_ch]= 0;
if resptime[snd_ch] > 65535 then resptime[snd_ch]= 65535;
if persist[snd_ch] > 255 then persist[snd_ch]= 255;
if persist[snd_ch] < 32 then persist[snd_ch]= 32;
if fracks[snd_ch] < 1 then fracks[snd_ch]= 1;
if frack_time[snd_ch] < 1 then frack_time[snd_ch]= 1;
if idletime[snd_ch] < frack_time[snd_ch] then idletime[snd_ch]= 180;
*/
if (emph_db[snd_ch] < 0 || emph_db[snd_ch] > nr_emph)
emph_db[snd_ch] = 0;
if (max_frame_collector[snd_ch] > 6) max_frame_collector[snd_ch] = 6;
if (maxframe[snd_ch] == 0 || maxframe[snd_ch] > 7) maxframe[snd_ch] = 3;
if (qpsk_set[snd_ch].mode > 1) qpsk_set[snd_ch].mode = 0;
}
delete(settings);
}
void SavePortSettings(int Chan);
void saveAX25Param(const char * key, QVariant Value)
{
char fullKey[64];
sprintf(fullKey, "%s/%s", Prefix, key);
settings->setValue(fullKey, Value);
}
void saveAX25Params(int chan)
{
Prefix[5] = chan + 'A';
SavePortSettings(chan);
}
void SavePortSettings(int Chan)
{
saveAX25Param("Retries", fracks[Chan]);
saveAX25Param("HiToneRaise", tx_hitoneraisedb[Chan]);
saveAX25Param("Maxframe",maxframe[Chan]);
saveAX25Param("Retries", fracks[Chan]);
saveAX25Param("FrackTime", frack_time[Chan]);
saveAX25Param("IdleTime", idletime[Chan]);
saveAX25Param("SlotTime", slottime[Chan]);
saveAX25Param("Persist", persist[Chan]);
saveAX25Param("RespTime", resptime[Chan]);
saveAX25Param("TXFrmMode", TXFrmMode[Chan]);
saveAX25Param("FrameCollector", max_frame_collector[Chan]);
saveAX25Param("ExcludeCallsigns", exclude_callsigns[Chan]);
saveAX25Param("ExcludeAPRSFrmType", exclude_APRS_frm[Chan]);
saveAX25Param("KISSOptimization", KISS_opt[Chan]);
saveAX25Param("DynamicFrack", dyn_frack[Chan]);
saveAX25Param("BitRecovery", recovery[Chan]);
saveAX25Param("NonAX25Frm", NonAX25[Chan]);
saveAX25Param("MEMRecovery", MEMRecovery[Chan]);
saveAX25Param("IPOLL", IPOLL[Chan]);
saveAX25Param("MyDigiCall", MyDigiCall[Chan]);
saveAX25Param("FX25", fx25_mode[Chan]);
saveAX25Param("IL2P", il2p_mode[Chan]);
saveAX25Param("RSID_UI", RSID_UI[Chan]);
saveAX25Param("RSID_SABM", RSID_SABM[Chan]);
saveAX25Param("RSID_SetModem", RSID_SetModem[Chan]);
}
void saveSettings()
{
QSettings * settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
settings->setValue("Init/SoundMode", SoundMode);
settings->setValue("Init/UDPClientPort", UDPClientPort);
settings->setValue("Init/UDPServerPort", UDPServerPort);
settings->setValue("Init/TXPort", TXPort);
settings->setValue("Init/UDPServer", UDPServ);
settings->setValue("Init/UDPHost", UDPHost);
settings->setValue("Init/TXSampleRate", TX_SR);
settings->setValue("Init/RXSampleRate", RX_SR);
settings->setValue("Init/SndRXDeviceName", CaptureDevice);
settings->setValue("Init/SndTXDeviceName", PlaybackDevice);
settings->setValue("Init/SCO", SCO);
settings->setValue("Init/DualPTT", DualPTT);
settings->setValue("Init/TXRotate", TX_rotate);
settings->setValue("Init/DispMode", raduga);
settings->setValue("Init/PTT", PTTPort);
settings->setValue("Init/PTTBAUD", PTTBAUD);
settings->setValue("Init/PTTMode", PTTMode);
settings->setValue("Init/PTTOffString", PTTOffString);
settings->setValue("Init/PTTOnString", PTTOnString);
settings->setValue("Init/pttGPIOPin", pttGPIOPin);
settings->setValue("Init/pttGPIOPinR", pttGPIOPinR);
settings->setValue("Init/CM108Addr", CM108Addr);
settings->setValue("Init/HamLibPort", HamLibPort);
settings->setValue("Init/HamLibHost", HamLibHost);
settings->setValue("Init/MinimizetoTray", MintoTray);
settings->setValue("Init/multiCore", multiCore);
settings->setValue("Init/Wisdom", Wisdom);
// Don't save freq on close as it could be offset by multiple decoders
settings->setValue("Modem/NRRcvrPairs1", RCVR[0]);
settings->setValue("Modem/NRRcvrPairs2", RCVR[1]);
settings->setValue("Modem/NRRcvrPairs3", RCVR[2]);
settings->setValue("Modem/NRRcvrPairs4", RCVR[3]);
settings->setValue("Modem/RcvrShift1", rcvr_offset[0]);
settings->setValue("Modem/RcvrShift2", rcvr_offset[1]);
settings->setValue("Modem/RcvrShift3", rcvr_offset[2]);
settings->setValue("Modem/RcvrShift4", rcvr_offset[3]);
settings->setValue("Modem/ModemType1", speed[0]);
settings->setValue("Modem/ModemType2", speed[1]);
settings->setValue("Modem/ModemType3", speed[2]);
settings->setValue("Modem/ModemType4", speed[3]);
settings->setValue("Modem/soundChannel1", soundChannel[0]);
settings->setValue("Modem/soundChannel2", soundChannel[1]);
settings->setValue("Modem/soundChannel3", soundChannel[2]);
settings->setValue("Modem/soundChannel4", soundChannel[3]);
settings->setValue("Modem/DCDThreshold", dcd_threshold);
settings->setValue("Modem/rxOffset", rxOffset);
settings->setValue("AGWHost/Server", AGWServ);
settings->setValue("AGWHost/Port", AGWPort);
settings->setValue("KISS/Server", KISSServ);
settings->setValue("KISS/Port", KISSPort);
settings->setValue("Modem/PreEmphasisAll1", emph_all[0]);
settings->setValue("Modem/PreEmphasisAll2", emph_all[1]);
settings->setValue("Modem/PreEmphasisAll3", emph_all[2]);
settings->setValue("Modem/PreEmphasisAll4", emph_all[3]);
settings->setValue("Modem/PreEmphasisDB1", emph_db[0]);
settings->setValue("Modem/PreEmphasisDB2", emph_db[1]);
settings->setValue("Modem/PreEmphasisDB3", emph_db[2]);
settings->setValue("Modem/PreEmphasisDB4", emph_db[3]);
settings->setValue("Window/Waterfall1", Firstwaterfall);
settings->setValue("Window/Waterfall2", Secondwaterfall);
settings->setValue("Modem/TxDelay1", txdelay[0]);
settings->setValue("Modem/TxDelay2", txdelay[1]);
settings->setValue("Modem/TxDelay3", txdelay[2]);
settings->setValue("Modem/TxDelay4", txdelay[3]);
settings->setValue("Modem/TxTail1", txtail[0]);
settings->setValue("Modem/TxTail2", txtail[1]);
settings->setValue("Modem/TxTail3", txtail[2]);
settings->setValue("Modem/TxTail4", txtail[3]);
settings->setValue("Modem/CWIDCall", CWIDCall);
settings->setValue("Modem/CWIDInterval", CWIDInterval);
settings->setValue("Modem/CWIDLeft", CWIDLeft);
settings->setValue("Modem/CWIDRight", CWIDRight);
settings->setValue("Modem/CWIDType", CWIDType);
saveAX25Params(0);
saveAX25Params(1);
saveAX25Params(2);
saveAX25Params(3);
settings->sync();
delete(settings);
}

View File

@ -1,4 +1,4 @@
/*extern "C" /*
Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO
This file is part of QtSoundModem This file is part of QtSoundModem
@ -21,6 +21,7 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
// UZ7HO Soundmodem Port by John Wiseman G8BPQ // UZ7HO Soundmodem Port by John Wiseman G8BPQ
#include <QSettings> #include <QSettings>
#include <QDialog>
#include "UZ7HOStuff.h" #include "UZ7HOStuff.h"
@ -28,8 +29,12 @@ extern "C" void get_exclude_list(char * line, TStringList * list);
extern "C" void get_exclude_frm(char * line, TStringList * list); extern "C" void get_exclude_frm(char * line, TStringList * list);
extern "C" int SoundMode; extern "C" int SoundMode;
extern "C" int RX_SR; extern "C" bool onlyMixSnoop;
extern "C" int TX_SR;
//extern "C" int RX_SR;
//extern "C" int TX_SR;
extern "C" int txLatency;
extern "C" int multiCore; extern "C" int multiCore;
extern "C" char * Wisdom; extern "C" char * Wisdom;
extern int WaterfallMin; extern int WaterfallMin;
@ -43,17 +48,31 @@ extern "C" int UDPServerPort;
extern "C" int TXPort; extern "C" int TXPort;
extern char UDPHost[64]; extern char UDPHost[64];
extern QDialog * constellationDialog;
extern QRect PSKRect;
extern char CWIDCall[128]; extern char CWIDCall[128];
extern "C" char CWIDMark[32];
extern int CWIDInterval; extern int CWIDInterval;
extern int CWIDLeft; extern int CWIDLeft;
extern int CWIDRight; extern int CWIDRight;
extern int CWIDType; extern int CWIDType;
extern bool afterTraffic;
extern bool darkTheme;
extern "C" bool useKISSControls;
extern "C" int RSID_SABM[4]; extern "C" int RSID_SABM[4];
extern "C" int RSID_UI[4]; extern "C" int RSID_UI[4];
extern "C" int RSID_SetModem[4]; extern "C" int RSID_SetModem[4];
extern "C" int nonGUIMode;
extern char SixPackDevice[256];
extern int SixPackPort;
extern int SixPackEnable;
extern int MgmtPort;
extern QFont Font;
QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat); QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
@ -108,6 +127,7 @@ void GetPortSettings(int Chan)
fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).toInt(); fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).toInt();
il2p_mode[Chan] = getAX25Param("IL2P", IL2P_MODE_NONE).toInt(); il2p_mode[Chan] = getAX25Param("IL2P", IL2P_MODE_NONE).toInt();
il2p_crc[Chan] = getAX25Param("IL2PCRC", 0).toInt();
RSID_UI[Chan] = getAX25Param("RSID_UI", 0).toInt(); RSID_UI[Chan] = getAX25Param("RSID_UI", 0).toInt();
RSID_SABM[Chan] = getAX25Param("RSID_SABM", 0).toInt(); RSID_SABM[Chan] = getAX25Param("RSID_SABM", 0).toInt();
RSID_SetModem[Chan] = getAX25Param("RSID_SetModem", 0).toInt(); RSID_SetModem[Chan] = getAX25Param("RSID_SetModem", 0).toInt();
@ -120,6 +140,8 @@ void getSettings()
QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat); QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
settings->sync(); settings->sync();
PSKRect = settings->value("PSKWindow").toRect();
SoundMode = settings->value("Init/SoundMode", 0).toInt(); SoundMode = settings->value("Init/SoundMode", 0).toInt();
UDPClientPort = settings->value("Init/UDPClientPort", 8888).toInt(); UDPClientPort = settings->value("Init/UDPClientPort", 8888).toInt();
UDPServerPort = settings->value("Init/UDPServerPort", 8884).toInt(); UDPServerPort = settings->value("Init/UDPServerPort", 8884).toInt();
@ -128,8 +150,12 @@ void getSettings()
strcpy(UDPHost, settings->value("Init/UDPHost", "192.168.1.255").toString().toUtf8()); strcpy(UDPHost, settings->value("Init/UDPHost", "192.168.1.255").toString().toUtf8());
UDPServ = settings->value("Init/UDPServer", FALSE).toBool(); UDPServ = settings->value("Init/UDPServer", FALSE).toBool();
RX_SR = settings->value("Init/RXSampleRate", 12000).toInt(); // RX_SR = settings->value("Init/RXSampleRate", 12000).toInt();
TX_SR = settings->value("Init/TXSampleRate", 12000).toInt(); // TX_SR = settings->value("Init/TXSampleRate", 12000).toInt();
txLatency = settings->value("Init/txLatency", 50).toInt();
onlyMixSnoop = settings->value("Init/onlyMixSnoop", 0).toInt();
strcpy(CaptureDevice, settings->value("Init/SndRXDeviceName", "hw:1,0").toString().toUtf8()); strcpy(CaptureDevice, settings->value("Init/SndRXDeviceName", "hw:1,0").toString().toUtf8());
strcpy(PlaybackDevice, settings->value("Init/SndTXDeviceName", "hw:1,0").toString().toUtf8()); strcpy(PlaybackDevice, settings->value("Init/SndTXDeviceName", "hw:1,0").toString().toUtf8());
@ -155,6 +181,10 @@ void getSettings()
HamLibPort = settings->value("Init/HamLibPort", 4532).toInt(); HamLibPort = settings->value("Init/HamLibPort", 4532).toInt();
strcpy(HamLibHost, settings->value("Init/HamLibHost", "127.0.0.1").toString().toUtf8()); strcpy(HamLibHost, settings->value("Init/HamLibHost", "127.0.0.1").toString().toUtf8());
FLRigPort = settings->value("Init/FLRigPort", 12345).toInt();
strcpy(FLRigHost, settings->value("Init/FLRigHost", "127.0.0.1").toString().toUtf8());
DualPTT = settings->value("Init/DualPTT", 1).toInt(); DualPTT = settings->value("Init/DualPTT", 1).toInt();
TX_rotate = settings->value("Init/TXRotate", 0).toInt(); TX_rotate = settings->value("Init/TXRotate", 0).toInt();
multiCore = settings->value("Init/multiCore", 0).toInt(); multiCore = settings->value("Init/multiCore", 0).toInt();
@ -189,6 +219,7 @@ void getSettings()
soundChannel[3] = settings->value("Modem/soundChannel4", 0).toInt(); soundChannel[3] = settings->value("Modem/soundChannel4", 0).toInt();
SCO = settings->value("Init/SCO", 0).toInt(); SCO = settings->value("Init/SCO", 0).toInt();
useKISSControls = settings->value("Init/useKISSControls", 0).toBool();
dcd_threshold = settings->value("Modem/DCDThreshold", 40).toInt(); dcd_threshold = settings->value("Modem/DCDThreshold", 40).toInt();
rxOffset = settings->value("Modem/rxOffset", 0).toInt(); rxOffset = settings->value("Modem/rxOffset", 0).toInt();
@ -197,9 +228,14 @@ void getSettings()
AGWPort = settings->value("AGWHost/Port", 8000).toInt(); AGWPort = settings->value("AGWHost/Port", 8000).toInt();
KISSServ = settings->value("KISS/Server", FALSE).toBool(); KISSServ = settings->value("KISS/Server", FALSE).toBool();
KISSPort = settings->value("KISS/Port", 8105).toInt(); KISSPort = settings->value("KISS/Port", 8105).toInt();
MgmtPort = settings->value("MGMT/Port", 0).toInt();
RX_Samplerate = RX_SR + RX_SR * 0.000001*RX_PPM; SixPackEnable = settings->value("SixPack/Enable", FALSE).toBool();
TX_Samplerate = TX_SR + TX_SR * 0.000001*TX_PPM; SixPackPort = settings->value("SixPack/Port", 0).toInt();
strcpy(SixPackDevice, settings->value("SixPack/Device", "").toString().toUtf8());
// RX_Samplerate = RX_SR + RX_SR * 0.000001*RX_PPM;
// TX_Samplerate = TX_SR + TX_SR * 0.000001*TX_PPM;
emph_all[0] = settings->value("Modem/PreEmphasisAll1", FALSE).toBool(); emph_all[0] = settings->value("Modem/PreEmphasisAll1", FALSE).toBool();
emph_all[1] = settings->value("Modem/PreEmphasisAll2", FALSE).toBool(); emph_all[1] = settings->value("Modem/PreEmphasisAll2", FALSE).toBool();
@ -219,12 +255,18 @@ void getSettings()
txdelay[2] = settings->value("Modem/TxDelay3", 250).toInt(); txdelay[2] = settings->value("Modem/TxDelay3", 250).toInt();
txdelay[3] = settings->value("Modem/TxDelay4", 250).toInt(); txdelay[3] = settings->value("Modem/TxDelay4", 250).toInt();
txtail[0] = settings->value("Modem/TxTail1", 50).toInt();
txtail[1] = settings->value("Modem/TxTail2", 50).toInt();
txtail[2] = settings->value("Modem/TxTail3", 50).toInt();
txtail[3] = settings->value("Modem/TxTail4", 50).toInt();
strcpy(CWIDCall, settings->value("Modem/CWIDCall", "").toString().toUtf8().toUpper()); strcpy(CWIDCall, settings->value("Modem/CWIDCall", "").toString().toUtf8().toUpper());
strcpy(CWIDMark, settings->value("Modem/CWIDMark", "").toString().toUtf8().toUpper());
CWIDInterval = settings->value("Modem/CWIDInterval", 0).toInt(); CWIDInterval = settings->value("Modem/CWIDInterval", 0).toInt();
CWIDLeft = settings->value("Modem/CWIDLeft", 0).toInt(); CWIDLeft = settings->value("Modem/CWIDLeft", 0).toInt();
CWIDRight = settings->value("Modem/CWIDRight", 0).toInt(); CWIDRight = settings->value("Modem/CWIDRight", 0).toInt();
CWIDType = settings->value("Modem/CWIDType", 1).toInt(); // on/off CWIDType = settings->value("Modem/CWIDType", 1).toInt(); // on/off
afterTraffic = settings->value("Modem/afterTraffic", false).toBool();
getAX25Params(0); getAX25Params(0);
getAX25Params(1); getAX25Params(1);
@ -288,6 +330,8 @@ void getSettings()
} }
darkTheme = settings->value("Init/darkTheme", false).toBool();
delete(settings); delete(settings);
} }
@ -332,6 +376,7 @@ void SavePortSettings(int Chan)
saveAX25Param("MyDigiCall", MyDigiCall[Chan]); saveAX25Param("MyDigiCall", MyDigiCall[Chan]);
saveAX25Param("FX25", fx25_mode[Chan]); saveAX25Param("FX25", fx25_mode[Chan]);
saveAX25Param("IL2P", il2p_mode[Chan]); saveAX25Param("IL2P", il2p_mode[Chan]);
saveAX25Param("IL2PCRC", il2p_crc[Chan]);
saveAX25Param("RSID_UI", RSID_UI[Chan]); saveAX25Param("RSID_UI", RSID_UI[Chan]);
saveAX25Param("RSID_SABM", RSID_SABM[Chan]); saveAX25Param("RSID_SABM", RSID_SABM[Chan]);
saveAX25Param("RSID_SetModem", RSID_SetModem[Chan]); saveAX25Param("RSID_SetModem", RSID_SetModem[Chan]);
@ -341,6 +386,13 @@ void saveSettings()
{ {
QSettings * settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat); QSettings * settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
settings->setValue("FontFamily", Font.family());
settings->setValue("PointSize", Font.pointSize());
settings->setValue("Weight", Font.weight());
if (nonGUIMode == 0)
settings->setValue("PSKWindow", constellationDialog->geometry());
settings->setValue("Init/SoundMode", SoundMode); settings->setValue("Init/SoundMode", SoundMode);
settings->setValue("Init/UDPClientPort", UDPClientPort); settings->setValue("Init/UDPClientPort", UDPClientPort);
settings->setValue("Init/UDPServerPort", UDPServerPort); settings->setValue("Init/UDPServerPort", UDPServerPort);
@ -350,12 +402,16 @@ void saveSettings()
settings->setValue("Init/UDPHost", UDPHost); settings->setValue("Init/UDPHost", UDPHost);
settings->setValue("Init/TXSampleRate", TX_SR); // settings->setValue("Init/TXSampleRate", TX_SR);
settings->setValue("Init/RXSampleRate", RX_SR); // settings->setValue("Init/RXSampleRate", RX_SR);
settings->setValue("Init/txLatency", txLatency);
settings->setValue("Init/onlyMixSnoop", onlyMixSnoop);
settings->setValue("Init/SndRXDeviceName", CaptureDevice); settings->setValue("Init/SndRXDeviceName", CaptureDevice);
settings->setValue("Init/SndTXDeviceName", PlaybackDevice); settings->setValue("Init/SndTXDeviceName", PlaybackDevice);
settings->setValue("Init/useKISSControls", useKISSControls);
settings->setValue("Init/SCO", SCO); settings->setValue("Init/SCO", SCO);
settings->setValue("Init/DualPTT", DualPTT); settings->setValue("Init/DualPTT", DualPTT);
settings->setValue("Init/TXRotate", TX_rotate); settings->setValue("Init/TXRotate", TX_rotate);
@ -375,6 +431,9 @@ void saveSettings()
settings->setValue("Init/CM108Addr", CM108Addr); settings->setValue("Init/CM108Addr", CM108Addr);
settings->setValue("Init/HamLibPort", HamLibPort); settings->setValue("Init/HamLibPort", HamLibPort);
settings->setValue("Init/HamLibHost", HamLibHost); settings->setValue("Init/HamLibHost", HamLibHost);
settings->setValue("Init/FLRigPort", FLRigPort);
settings->setValue("Init/FLRigHost", FLRigHost);
settings->setValue("Init/MinimizetoTray", MintoTray); settings->setValue("Init/MinimizetoTray", MintoTray);
settings->setValue("Init/multiCore", multiCore); settings->setValue("Init/multiCore", multiCore);
settings->setValue("Init/Wisdom", Wisdom); settings->setValue("Init/Wisdom", Wisdom);
@ -411,6 +470,12 @@ void saveSettings()
settings->setValue("AGWHost/Port", AGWPort); settings->setValue("AGWHost/Port", AGWPort);
settings->setValue("KISS/Server", KISSServ); settings->setValue("KISS/Server", KISSServ);
settings->setValue("KISS/Port", KISSPort); settings->setValue("KISS/Port", KISSPort);
settings->setValue("MGMT/Port", MgmtPort);
settings->setValue("SixPack/Enable", SixPackEnable);
settings->setValue("SixPack/Port", SixPackPort);
settings->setValue("SixPack/Device", SixPackDevice);
settings->setValue("Modem/PreEmphasisAll1", emph_all[0]); settings->setValue("Modem/PreEmphasisAll1", emph_all[0]);
settings->setValue("Modem/PreEmphasisAll2", emph_all[1]); settings->setValue("Modem/PreEmphasisAll2", emph_all[1]);
@ -436,10 +501,14 @@ void saveSettings()
settings->setValue("Modem/TxTail4", txtail[3]); settings->setValue("Modem/TxTail4", txtail[3]);
settings->setValue("Modem/CWIDCall", CWIDCall); settings->setValue("Modem/CWIDCall", CWIDCall);
settings->setValue("Modem/CWIDMark", CWIDMark);
settings->setValue("Modem/CWIDInterval", CWIDInterval); settings->setValue("Modem/CWIDInterval", CWIDInterval);
settings->setValue("Modem/CWIDLeft", CWIDLeft); settings->setValue("Modem/CWIDLeft", CWIDLeft);
settings->setValue("Modem/CWIDRight", CWIDRight); settings->setValue("Modem/CWIDRight", CWIDRight);
settings->setValue("Modem/CWIDType", CWIDType); settings->setValue("Modem/CWIDType", CWIDType);
settings->setValue("Modem/afterTraffic", afterTraffic);
settings->setValue("Init/darkTheme", darkTheme);
saveAX25Params(0); saveAX25Params(0);
saveAX25Params(1); saveAX25Params(1);

View File

@ -1,4 +1,4 @@
/* /*extern "C"
Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO
This file is part of QtSoundModem This file is part of QtSoundModem
@ -21,6 +21,7 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
// UZ7HO Soundmodem Port by John Wiseman G8BPQ // UZ7HO Soundmodem Port by John Wiseman G8BPQ
#include <QSettings> #include <QSettings>
#include <QDialog>
#include "UZ7HOStuff.h" #include "UZ7HOStuff.h"
@ -31,6 +32,9 @@ extern "C" int SoundMode;
extern "C" int RX_SR; extern "C" int RX_SR;
extern "C" int TX_SR; extern "C" int TX_SR;
extern "C" int multiCore; extern "C" int multiCore;
extern "C" char * Wisdom;
extern int WaterfallMin;
extern int WaterfallMax;
extern "C" word MEMRecovery[5]; extern "C" word MEMRecovery[5];
@ -40,17 +44,24 @@ extern "C" int UDPServerPort;
extern "C" int TXPort; extern "C" int TXPort;
extern char UDPHost[64]; extern char UDPHost[64];
extern QDialog * constellationDialog;
extern QRect PSKRect;
extern char CWIDCall[128]; extern char CWIDCall[128];
extern "C" char CWIDMark[32];
extern int CWIDInterval; extern int CWIDInterval;
extern int CWIDLeft; extern int CWIDLeft;
extern int CWIDRight; extern int CWIDRight;
extern int CWIDType; extern int CWIDType;
extern bool afterTraffic;
extern bool darkTheme;
extern "C" int RSID_SABM[4]; extern "C" int RSID_SABM[4];
extern "C" int RSID_UI[4]; extern "C" int RSID_UI[4];
extern "C" int RSID_SetModem[4]; extern "C" int RSID_SetModem[4];
extern QFont Font;
QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat); QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
@ -63,9 +74,13 @@ void GetPortSettings(int Chan);
QVariant getAX25Param(const char * key, QVariant Default) QVariant getAX25Param(const char * key, QVariant Default)
{ {
char fullKey[64]; char fullKey[64];
QVariant Q;
QByteArray x;
sprintf(fullKey, "%s/%s", Prefix, key); sprintf(fullKey, "%s/%s", Prefix, key);
return settings->value(fullKey, Default); Q = settings->value(fullKey, Default);
x = Q.toString().toUtf8();
return Q;
} }
void getAX25Params(int chan) void getAX25Params(int chan)
@ -89,8 +104,6 @@ void GetPortSettings(int Chan)
resptime[Chan] = getAX25Param("RespTime", 1500).toInt(); resptime[Chan] = getAX25Param("RespTime", 1500).toInt();
TXFrmMode[Chan] = getAX25Param("TXFrmMode", 1).toInt(); TXFrmMode[Chan] = getAX25Param("TXFrmMode", 1).toInt();
max_frame_collector[Chan] = getAX25Param("FrameCollector", 6).toInt(); max_frame_collector[Chan] = getAX25Param("FrameCollector", 6).toInt();
//exclude_callsigns[Chan]= getAX25Param("ExcludeCallsigns/");
//exclude_APRS_frm[Chan]= getAX25Param("ExcludeAPRSFrmType/");
KISS_opt[Chan] = getAX25Param("KISSOptimization", false).toInt();; KISS_opt[Chan] = getAX25Param("KISSOptimization", false).toInt();;
dyn_frack[Chan] = getAX25Param("DynamicFrack", false).toInt();; dyn_frack[Chan] = getAX25Param("DynamicFrack", false).toInt();;
recovery[Chan] = getAX25Param("BitRecovery", 0).toInt(); recovery[Chan] = getAX25Param("BitRecovery", 0).toInt();
@ -99,8 +112,11 @@ void GetPortSettings(int Chan)
IPOLL[Chan] = getAX25Param("IPOLL", 80).toInt(); IPOLL[Chan] = getAX25Param("IPOLL", 80).toInt();
strcpy(MyDigiCall[Chan], getAX25Param("MyDigiCall", "").toString().toUtf8()); strcpy(MyDigiCall[Chan], getAX25Param("MyDigiCall", "").toString().toUtf8());
strcpy(exclude_callsigns[Chan], getAX25Param("ExcludeCallsigns", "").toString().toUtf8());
fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).toInt(); fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).toInt();
il2p_mode[Chan] = getAX25Param("IL2P", IL2P_MODE_NONE).toInt(); il2p_mode[Chan] = getAX25Param("IL2P", IL2P_MODE_NONE).toInt();
il2p_crc[Chan] = getAX25Param("IL2PCRC", 0).toInt();
RSID_UI[Chan] = getAX25Param("RSID_UI", 0).toInt(); RSID_UI[Chan] = getAX25Param("RSID_UI", 0).toInt();
RSID_SABM[Chan] = getAX25Param("RSID_SABM", 0).toInt(); RSID_SABM[Chan] = getAX25Param("RSID_SABM", 0).toInt();
RSID_SetModem[Chan] = getAX25Param("RSID_SetModem", 0).toInt(); RSID_SetModem[Chan] = getAX25Param("RSID_SetModem", 0).toInt();
@ -113,6 +129,8 @@ void getSettings()
QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat); QSettings* settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
settings->sync(); settings->sync();
PSKRect = settings->value("PSKWindow").toRect();
SoundMode = settings->value("Init/SoundMode", 0).toInt(); SoundMode = settings->value("Init/SoundMode", 0).toInt();
UDPClientPort = settings->value("Init/UDPClientPort", 8888).toInt(); UDPClientPort = settings->value("Init/UDPClientPort", 8888).toInt();
UDPServerPort = settings->value("Init/UDPServerPort", 8884).toInt(); UDPServerPort = settings->value("Init/UDPServerPort", 8884).toInt();
@ -150,9 +168,12 @@ void getSettings()
DualPTT = settings->value("Init/DualPTT", 1).toInt(); DualPTT = settings->value("Init/DualPTT", 1).toInt();
TX_rotate = settings->value("Init/TXRotate", 0).toInt(); TX_rotate = settings->value("Init/TXRotate", 0).toInt();
multiCore = settings->value("Init/multiCore", 0).toInt(); multiCore = settings->value("Init/multiCore", 0).toInt();
MintoTray = settings->value("Init/MinimizetoTray", 1).toInt(); MintoTray = settings->value("Init/MinimizetoTray", 1).toInt();
Wisdom = strdup(settings->value("Init/Wisdom", "").toString().toUtf8());
WaterfallMin = settings->value("Init/WaterfallMin", 0).toInt();
WaterfallMax = settings->value("Init/WaterfallMax", 3300).toInt();
rx_freq[0] = settings->value("Modem/RXFreq1", 1700).toInt(); rx_freq[0] = settings->value("Modem/RXFreq1", 1700).toInt();
rx_freq[1] = settings->value("Modem/RXFreq2", 1700).toInt(); rx_freq[1] = settings->value("Modem/RXFreq2", 1700).toInt();
@ -209,12 +230,18 @@ void getSettings()
txdelay[2] = settings->value("Modem/TxDelay3", 250).toInt(); txdelay[2] = settings->value("Modem/TxDelay3", 250).toInt();
txdelay[3] = settings->value("Modem/TxDelay4", 250).toInt(); txdelay[3] = settings->value("Modem/TxDelay4", 250).toInt();
txtail[0] = settings->value("Modem/TxTail1", 50).toInt();
txtail[1] = settings->value("Modem/TxTail2", 50).toInt();
txtail[2] = settings->value("Modem/TxTail3", 50).toInt();
txtail[3] = settings->value("Modem/TxTail4", 50).toInt();
strcpy(CWIDCall, settings->value("Modem/CWIDCall", "").toString().toUtf8().toUpper()); strcpy(CWIDCall, settings->value("Modem/CWIDCall", "").toString().toUtf8().toUpper());
strcpy(CWIDMark, settings->value("Modem/CWIDMark", "").toString().toUtf8().toUpper());
CWIDInterval = settings->value("Modem/CWIDInterval", 0).toInt(); CWIDInterval = settings->value("Modem/CWIDInterval", 0).toInt();
CWIDLeft = settings->value("Modem/CWIDLeft", 0).toInt(); CWIDLeft = settings->value("Modem/CWIDLeft", 0).toInt();
CWIDRight = settings->value("Modem/CWIDRight", 0).toInt(); CWIDRight = settings->value("Modem/CWIDRight", 0).toInt();
CWIDType = settings->value("Modem/CWIDType", 1).toInt(); // on/off CWIDType = settings->value("Modem/CWIDType", 1).toInt(); // on/off
afterTraffic = settings->value("Modem/afterTraffic", false).toBool();
getAX25Params(0); getAX25Params(0);
getAX25Params(1); getAX25Params(1);
@ -278,6 +305,8 @@ void getSettings()
} }
darkTheme = settings->value("Init/darkTheme", false).toBool();
delete(settings); delete(settings);
} }
@ -322,6 +351,7 @@ void SavePortSettings(int Chan)
saveAX25Param("MyDigiCall", MyDigiCall[Chan]); saveAX25Param("MyDigiCall", MyDigiCall[Chan]);
saveAX25Param("FX25", fx25_mode[Chan]); saveAX25Param("FX25", fx25_mode[Chan]);
saveAX25Param("IL2P", il2p_mode[Chan]); saveAX25Param("IL2P", il2p_mode[Chan]);
saveAX25Param("IL2PCRC", il2p_crc[Chan]);
saveAX25Param("RSID_UI", RSID_UI[Chan]); saveAX25Param("RSID_UI", RSID_UI[Chan]);
saveAX25Param("RSID_SABM", RSID_SABM[Chan]); saveAX25Param("RSID_SABM", RSID_SABM[Chan]);
saveAX25Param("RSID_SetModem", RSID_SetModem[Chan]); saveAX25Param("RSID_SetModem", RSID_SetModem[Chan]);
@ -331,6 +361,11 @@ void saveSettings()
{ {
QSettings * settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat); QSettings * settings = new QSettings("QtSoundModem.ini", QSettings::IniFormat);
settings->setValue("FontFamily", Font.family());
settings->setValue("PointSize", Font.pointSize());
settings->setValue("Weight", Font.weight());
settings->setValue("PSKWindow", constellationDialog->geometry());
settings->setValue("Init/SoundMode", SoundMode); settings->setValue("Init/SoundMode", SoundMode);
settings->setValue("Init/UDPClientPort", UDPClientPort); settings->setValue("Init/UDPClientPort", UDPClientPort);
settings->setValue("Init/UDPServerPort", UDPServerPort); settings->setValue("Init/UDPServerPort", UDPServerPort);
@ -366,8 +401,11 @@ void saveSettings()
settings->setValue("Init/HamLibPort", HamLibPort); settings->setValue("Init/HamLibPort", HamLibPort);
settings->setValue("Init/HamLibHost", HamLibHost); settings->setValue("Init/HamLibHost", HamLibHost);
settings->setValue("Init/MinimizetoTray", MintoTray); settings->setValue("Init/MinimizetoTray", MintoTray);
settings->setValue("Init/multiCore", multiCore); settings->setValue("Init/multiCore", multiCore);
settings->setValue("Init/Wisdom", Wisdom);
settings->setValue("Init/WaterfallMin", WaterfallMin);
settings->setValue("Init/WaterfallMax", WaterfallMax);
// Don't save freq on close as it could be offset by multiple decoders // Don't save freq on close as it could be offset by multiple decoders
@ -423,10 +461,14 @@ void saveSettings()
settings->setValue("Modem/TxTail4", txtail[3]); settings->setValue("Modem/TxTail4", txtail[3]);
settings->setValue("Modem/CWIDCall", CWIDCall); settings->setValue("Modem/CWIDCall", CWIDCall);
settings->setValue("Modem/CWIDMark", CWIDMark);
settings->setValue("Modem/CWIDInterval", CWIDInterval); settings->setValue("Modem/CWIDInterval", CWIDInterval);
settings->setValue("Modem/CWIDLeft", CWIDLeft); settings->setValue("Modem/CWIDLeft", CWIDLeft);
settings->setValue("Modem/CWIDRight", CWIDRight); settings->setValue("Modem/CWIDRight", CWIDRight);
settings->setValue("Modem/CWIDType", CWIDType); settings->setValue("Modem/CWIDType", CWIDType);
settings->setValue("Modem/afterTraffic", afterTraffic);
settings->setValue("Init/darkTheme", darkTheme);
saveAX25Params(0); saveAX25Params(0);
saveAX25Params(1); saveAX25Params(1);

1
HEAD
View File

@ -1 +0,0 @@
ref: refs/heads/master

311
LinuxBits.c Normal file
View File

@ -0,0 +1,311 @@
/*
Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO
This file is part of QtSoundModem
QtSoundModem 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 3 of the License, or
(at your option) any later version.
QtSoundModem 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 QtSoundModem. If not, see http://www.gnu.org/licenses
*/
//#define TXSILENCE
// UZ7HO Soundmodem Port by John Wiseman G8BPQ
//
// Audio interface Routine
// Passes audio samples to/from the sound interface
// As this is platform specific it also has the main() routine, which does
// platform specific initialisation before calling ardopmain()
// This is ALSASound.c for Linux
// Windows Version is Waveout.c
void gpioSetMode(unsigned gpio, unsigned mode);
void gpioWrite(unsigned gpio, unsigned level);
int _memicmp(unsigned char *a, unsigned char *b, int n);
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2);
int gpioInitialise(void);
void Sleep(int mS)
{
usleep(mS * 1000);
return;
}
// GPIO access stuff for PTT on PI
#ifdef __ARM_ARCH
/*
tiny_gpio.c
2016-04-30
Public Domain
*/
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#define GPSET0 7
#define GPSET1 8
#define GPCLR0 10
#define GPCLR1 11
#define GPLEV0 13
#define GPLEV1 14
#define GPPUD 37
#define GPPUDCLK0 38
#define GPPUDCLK1 39
unsigned piModel;
unsigned piRev;
static volatile uint32_t *gpioReg = MAP_FAILED;
#define PI_BANK (gpio>>5)
#define PI_BIT (1<<(gpio&0x1F))
/* gpio modes. */
// PTT via GPIO code
#ifdef __ARM_ARCH
#define PI_INPUT 0
#define PI_OUTPUT 1
#define PI_ALT0 4
#define PI_ALT1 5
#define PI_ALT2 6
#define PI_ALT3 7
#define PI_ALT4 3
#define PI_ALT5 2
// Set GPIO pin as output and set low
void SetupGPIOPTT()
{
}
#endif
void gpioSetMode(unsigned gpio, unsigned mode)
{
int reg, shift;
reg = gpio/10;
shift = (gpio%10) * 3;
gpioReg[reg] = (gpioReg[reg] & ~(7<<shift)) | (mode<<shift);
}
int gpioGetMode(unsigned gpio)
{
int reg, shift;
reg = gpio/10;
shift = (gpio%10) * 3;
return (*(gpioReg + reg) >> shift) & 7;
}
/* Values for pull-ups/downs off, pull-down and pull-up. */
#define PI_PUD_OFF 0
#define PI_PUD_DOWN 1
#define PI_PUD_UP 2
void gpioSetPullUpDown(unsigned gpio, unsigned pud)
{
*(gpioReg + GPPUD) = pud;
usleep(20);
*(gpioReg + GPPUDCLK0 + PI_BANK) = PI_BIT;
usleep(20);
*(gpioReg + GPPUD) = 0;
*(gpioReg + GPPUDCLK0 + PI_BANK) = 0;
}
int gpioRead(unsigned gpio)
{
if ((*(gpioReg + GPLEV0 + PI_BANK) & PI_BIT) != 0) return 1;
else return 0;
}
void gpioWrite(unsigned gpio, unsigned level)
{
if (level == 0)
*(gpioReg + GPCLR0 + PI_BANK) = PI_BIT;
else
*(gpioReg + GPSET0 + PI_BANK) = PI_BIT;
}
void gpioTrigger(unsigned gpio, unsigned pulseLen, unsigned level)
{
if (level == 0) *(gpioReg + GPCLR0 + PI_BANK) = PI_BIT;
else *(gpioReg + GPSET0 + PI_BANK) = PI_BIT;
usleep(pulseLen);
if (level != 0) *(gpioReg + GPCLR0 + PI_BANK) = PI_BIT;
else *(gpioReg + GPSET0 + PI_BANK) = PI_BIT;
}
/* Bit (1<<x) will be set if gpio x is high. */
uint32_t gpioReadBank1(void) { return (*(gpioReg + GPLEV0)); }
uint32_t gpioReadBank2(void) { return (*(gpioReg + GPLEV1)); }
/* To clear gpio x bit or in (1<<x). */
void gpioClearBank1(uint32_t bits) { *(gpioReg + GPCLR0) = bits; }
void gpioClearBank2(uint32_t bits) { *(gpioReg + GPCLR1) = bits; }
/* To set gpio x bit or in (1<<x). */
void gpioSetBank1(uint32_t bits) { *(gpioReg + GPSET0) = bits; }
void gpioSetBank2(uint32_t bits) { *(gpioReg + GPSET1) = bits; }
unsigned gpioHardwareRevision(void)
{
static unsigned rev = 0;
FILE * filp;
char buf[512];
char term;
int chars=4; /* number of chars in revision string */
if (rev) return rev;
piModel = 0;
filp = fopen ("/proc/cpuinfo", "r");
if (filp != NULL)
{
while (fgets(buf, sizeof(buf), filp) != NULL)
{
if (piModel == 0)
{
if (!strncasecmp("model name", buf, 10))
{
if (strstr (buf, "ARMv6") != NULL)
{
piModel = 1;
chars = 4;
}
else if (strstr (buf, "ARMv7") != NULL)
{
piModel = 2;
chars = 6;
}
else if (strstr (buf, "ARMv8") != NULL)
{
piModel = 2;
chars = 6;
}
}
}
if (!strncasecmp("revision", buf, 8))
{
if (sscanf(buf+strlen(buf)-(chars+1),
"%x%c", &rev, &term) == 2)
{
if (term != '\n') rev = 0;
}
}
}
fclose(filp);
}
return rev;
}
int gpioInitialise(void)
{
int fd;
piRev = gpioHardwareRevision(); /* sets piModel and piRev */
fd = open("/dev/gpiomem", O_RDWR | O_SYNC) ;
if (fd < 0)
{
fprintf(stderr, "failed to open /dev/gpiomem\n");
return -1;
}
gpioReg = (uint32_t *)mmap(NULL, 0xB4, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
if (gpioReg == MAP_FAILED)
{
fprintf(stderr, "Bad, mmap failed\n");
return -1;
}
return 0;
}
#endif
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2)
{
unsigned char c1, c2;
int v;
if (pStr1 == NULL)
{
if (pStr2)
Debugprintf("stricmp called with NULL 1st param - 2nd %s ", pStr2);
else
Debugprintf("stricmp called with two NULL params");
return 1;
}
do {
c1 = *pStr1++;
c2 = *pStr2++;
/* The casts are necessary when pStr1 is shorter & char is signed */
v = tolower(c1) - tolower(c2);
} while ((v == 0) && (c1 != '\0') && (c2 != '\0') );
return v;
}

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,9 @@
#define ARDOPBufferSize 12000 * 100 #define ARDOPBufferSize 12000 * 100
extern short ARDOPTXBuffer[4][12000 * 100]; // Enough to hold whole frame of samples char CWIDMark[32] = "";
extern short ARDOPTXBuffer[4][ARDOPBufferSize]; // Enough to hold whole frame of samples
extern int ARDOPTXLen[4]; // Length of frame extern int ARDOPTXLen[4]; // Length of frame
extern int ARDOPTXPtr[4]; // Tx Pointer extern int ARDOPTXPtr[4]; // Tx Pointer
@ -966,7 +968,7 @@ void sendCWID(char * strID, BOOL CWOnOff, int Chan)
0x557, 0x155, 0x755, 0x1DD5, 0x7775, 0x1DDDD, 0x1D57, 0x1D57}; 0x557, 0x155, 0x755, 0x1DD5, 0x7775, 0x1DDDD, 0x1D57, 0x1D57};
float dblHiPhaseInc = 2 * M_PI * 1609.375f / 12000; // 1609.375 Hz High tone float dblHiPhaseInc = 2 * M_PI * 1509.375f / 12000; // 1609.375 Hz High tone
float dblLoPhaseInc = 2 * M_PI * 1390.625f / 12000; // 1390.625 low tone float dblLoPhaseInc = 2 * M_PI * 1390.625f / 12000; // 1390.625 low tone
float dblHiPhase = 0; float dblHiPhase = 0;
float dblLoPhase = 0; float dblLoPhase = 0;
@ -978,6 +980,23 @@ void sendCWID(char * strID, BOOL CWOnOff, int Chan)
char * index; char * index;
int intMask; int intMask;
int idoffset; int idoffset;
int Filter = 1500;
if (CWIDMark[0])
{
// Want nonstandard tones
float Mark = atof(CWIDMark);
float Space = Mark - 200;
dblHiPhaseInc = 2 * M_PI * Mark / 12000; // 1609.375 Hz High tone
dblLoPhaseInc = 2 * M_PI * Space / 12000; // 1390.625 low tone
if (CWOnOff)
Filter = Mark;
else
Filter = (Mark + Space) / 2;
}
strlop(strID, '-'); // Remove any SSID strlop(strID, '-'); // Remove any SSID
@ -1000,7 +1019,39 @@ void sendCWID(char * strID, BOOL CWOnOff, int Chan)
dblLoPhase -= 2 * M_PI; dblLoPhase -= 2 * M_PI;
} }
initFilter(500,1500, Chan); if (CWOnOff)
initFilter(500, Filter, Chan);
else
initFilter(200, Filter, Chan);
// if sending 1500 cal tone send mark tone for 10 secs
if (strcmp(strID, "1500TONE") == 0)
{
float m_amplitude = 30000.0f;
float m_frequency = 1500.0f;
float m_phase = 0.0;
float m_time = 0.0;
float m_deltaTime = 1.0f / 12000;
float x;
// generate sin wave in mono
for (int sample = 0; sample < 120000; ++sample)
{
x = m_amplitude * sin(2 * M_PI * m_frequency * m_time + m_phase);
ARDOPSampleSink(x);
m_time += m_deltaTime;
}
ARDOPTXPtr[Chan] = 0;
ARDOPTXLen[Chan] = Number;
Number = 0;
return;
}
//Generate leader for VOX 6 dots long //Generate leader for VOX 6 dots long

File diff suppressed because it is too large Load Diff

View File

@ -1,288 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4EDE958E-D0AC-37B4-81F7-78313A262DCD}</ProjectGuid>
<RootNamespace>QtSoundModem</RootNamespace>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>release\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>release\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>debug\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>debug\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>C:\Dev\Msdev2005\projects\QT\QtSoundModem\Win32\Debug\</OutDir>
<IntDir>C:\Dev\Msdev2005\projects\QT\QtSoundModem\Intermed\Win32\Debug\</IntDir>
<TargetName>QtSoundModem</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>C:\Dev\Msdev2005\projects\QT\QtSoundModem\Win32\Release\</OutDir>
<IntDir>C:\Dev\Msdev2005\projects\QT\QtSoundModem\Intermed\Win32\Release\</IntDir>
<TargetName>QtSoundModem</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtInstall>5.14.2_msvc2017</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtInstall>5.14.2_msvc2017</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>rsid;.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;release;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>libfftw3f-3.lib;shell32.lib;setupapi.lib;WS2_32.Lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>false</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(OutDir)\QtSoundModem.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;NDEBUG;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_SERIALPORT_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(IntDir)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtRcc>
<InitFuncName>QtSoundModem</InitFuncName>
<Compression>default</Compression>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<QtRccDir>$(IntDir)</QtRccDir>
<QtRccFileName>qrc_%(Filename).cpp</QtRccFileName>
</QtRcc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>$(IntDir)</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;debug;/include;rsid;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>libfftw3f-3.lib;shell32.lib;setupapi.lib;WS2_32.Lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>true</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutputFile>$(OutDir)\QtSoundModem.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_SERIALPORT_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(IntDir)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtRcc>
<InitFuncName>QtSoundModem</InitFuncName>
<Compression>default</Compression>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<QtRccDir>$(IntDir)</QtRccDir>
<QtRccFileName>qrc_%(Filename).cpp</QtRccFileName>
</QtRcc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>$(IntDir)</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ARDOPC.c" />
<ClCompile Include="BusyDetect.c" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="hid.c" />
<ClCompile Include="Modulate.c" />
<ClCompile Include="QtSoundModem.cpp" />
<ClCompile Include="rsid.c" />
<ClCompile Include="RSUnit.c" />
<ClCompile Include="SMMain.c" />
<ClCompile Include="ShowFilter.cpp" />
<ClCompile Include="SoundInput.c" />
<ClCompile Include="UZ7HOUtils.c" />
<ClCompile Include="ardopSampleArrays.c" />
<ClCompile Include="ax25.c" />
<ClCompile Include="ax25_agw.c" />
<ClCompile Include="ax25_demod.c" />
<ClCompile Include="ax25_fec.c" />
<ClCompile Include="ax25_l2.c" />
<ClCompile Include="ax25_mod.c" />
<ClCompile Include="berlekamp.c" />
<ClCompile Include="galois.c" />
<ClCompile Include="kiss_mode.c" />
<ClCompile Include="main.cpp" />
<ClCompile Include="ofdm.c" />
<ClCompile Include="pktARDOP.c" />
<ClCompile Include="rs.c" />
<ClCompile Include="sm_main.c" />
<ClCompile Include="tcpCode.cpp" />
<ClCompile Include="Waveout.c" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="QtSoundModem.h">
</QtMoc>
<ClInclude Include="UZ7HOStuff.h" />
<QtMoc Include="tcpCode.h">
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;debug\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\moc_predefs.h;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<FileType>Document</FileType>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;release\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\moc_predefs.h;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<QtUic Include="ModemDialog.ui">
</QtUic>
<QtUic Include="QtSoundModem.ui">
</QtUic>
<QtUic Include="calibrateDialog.ui">
</QtUic>
<QtUic Include="devicesDialog.ui">
</QtUic>
<QtUic Include="filterWindow.ui">
</QtUic>
</ItemGroup>
<ItemGroup>
<QtRcc Include="QtSoundModem.qrc">
</QtRcc>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include=".\QtSoundModem_resource.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="QtSoundModem.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets" />
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,15 +29,21 @@ public:
~QtSoundModem(); ~QtSoundModem();
void RefreshWaterfall(int snd_ch, unsigned char * Data); void RefreshWaterfall(int snd_ch, unsigned char * Data);
void initWaterfall(int chan, int state); void initWaterfall(int state);
void show_grid(); void show_grid();
void checkforCWID();
public slots:
private slots: private slots:
void CWIDTimer();
void doDevices(); void doDevices();
void mysetstyle();
void updateFont();
void MinimizetoTray(); void MinimizetoTray();
void TrayActivated(QSystemTrayIcon::ActivationReason reason); void TrayActivated(QSystemTrayIcon::ActivationReason reason);
void CWIDTimer(); void StatsTimer();
void MyTimerSlot(); void MyTimerSlot();
void returnPressed(); void returnPressed();
void clickedSlotI(int i); void clickedSlotI(int i);
@ -58,6 +64,7 @@ private slots:
void doRSIDD(); void doRSIDD();
void handleButton(int Port, int Act); void handleButton(int Port, int Act);
void doCalibrate(); void doCalibrate();
void RefreshSpectrum(unsigned char * Data);
void doAbout(); void doAbout();
void doRestartWF(); void doRestartWF();
void doupdateDCD(int, int); void doupdateDCD(int, int);
@ -68,7 +75,15 @@ private slots:
void preEmphAllDChanged(int state); void preEmphAllDChanged(int state);
void menuChecked(); void menuChecked();
void onTEselectionChanged(); void onTEselectionChanged();
void StartWatchdog();
void StopWatchdog();
void PTTWatchdogExpired();
void showRequest(QByteArray Data);
void clickedSlot(); void clickedSlot();
void startCWIDTimerSlot();
void setWaterfallImage();
void setLevelImage();
void setConstellationImage(int chan, int Qual);
protected: protected:
@ -85,6 +100,7 @@ private:
QAction *actDevices; QAction *actDevices;
QAction *actModems; QAction *actModems;
QAction *actFont;
QAction *actMintoTray; QAction *actMintoTray;
QAction *actCalib; QAction *actCalib;
QAction *actAbout; QAction *actAbout;
@ -92,8 +108,8 @@ private:
QAction *actWaterfall1; QAction *actWaterfall1;
QAction *actWaterfall2; QAction *actWaterfall2;
signals:
void RefreshSpectrum(unsigned char * Data);
}; };
class myResize : public QObject class myResize : public QObject
@ -104,3 +120,31 @@ protected:
bool eventFilter(QObject *obj, QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override;
}; };
#define WaterfallDisplayPixels 80
#define WaterfallHeaderPixels 38
#define WaterfallTotalPixels WaterfallDisplayPixels + WaterfallHeaderPixels
#define WaterfallImageHeight (WaterfallTotalPixels + WaterfallTotalPixels)
class serialThread : public QThread
{
Q_OBJECT
public:
void run() Q_DECL_OVERRIDE;
void startSlave(const QString &portName, int waitTimeout, const QString &response);
signals:
void request(const QByteArray &s);
void error(const QString &s);
void timeout(const QString &s);
private:
QString portName;
QString response;
int waitTimeout;
QMutex mutex;
bool quit;
};

View File

@ -43,8 +43,9 @@ SOURCES += ./audio.c \
./Modulate.c \ ./Modulate.c \
./ofdm.c \ ./ofdm.c \
./pktARDOP.c \ ./pktARDOP.c \
./BusyDetect.c ./BusyDetect.c \
./DW9600.c \
./6pack.cpp
FORMS += ./calibrateDialog.ui \ FORMS += ./calibrateDialog.ui \

263
QtSoundModem.pro.user Normal file
View File

@ -0,0 +1,263 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 11.0.3, 2024-08-15T14:29:24. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{6e41d268-43e9-43ac-b8fa-a3c083d547a3}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">0</value>
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop (x86-darwin-generic-mach_o-64bit)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop (x86-darwin-generic-mach_o-64bit)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{a36d9ffa-38ce-4dfc-9820-5a456a9dc53d}</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Volumes/Source/QT/QtSoundModem/QtSoundModem.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Volumes/Source/QT/QtSoundModem/QtSoundModem.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Volumes/Source/QT/build-QtSoundModem-Desktop_x86_darwin_generic_mach_o_64bit-Debug/QtSoundModem.app/Contents/MacOS</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

64
QtSoundModem.pro~ Normal file
View File

@ -0,0 +1,64 @@
QT += core gui
QT += network
QT += serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QtSoundModem
TEMPLATE = app
HEADERS += ./UZ7HOStuff.h \
./QtSoundModem.h \
./tcpCode.h
SOURCES += ./audio.c \
./pulse.c \
./ax25.c \
./ax25_demod.c \
./ax25_l2.c \
./ax25_mod.c \
./Config.cpp \
./kiss_mode.c \
./main.cpp \
./QtSoundModem.cpp \
./ShowFilter.cpp \
./SMMain.c \
./sm_main.c \
./UZ7HOUtils.c \
./ALSASound.c \
./ax25_agw.c \
./berlekamp.c \
./galois.c \
./rs.c \
./rsid.c \
./il2p.c \
./tcpCode.cpp \
./ax25_fec.c \
./RSUnit.c \
./ARDOPC.c \
./ardopSampleArrays.c \
./SoundInput.c \
./Modulate.c \
./ofdm.c \
./pktARDOP.c \
./BusyDetect.c \
./DW9600.c
FORMS += ./calibrateDialog.ui \
./devicesDialog.ui \
./filterWindow.ui \
./ModemDialog.ui \
./QtSoundModem.ui
RESOURCES += QtSoundModem.qrc
RC_ICONS = QtSoundModem.ico
QMAKE_CFLAGS += -g
#QMAKE_LFLAGS += -lasound -lpulse-simple -lpulse -lfftw3f
QMAKE_LIBS += -lasound -lfftw3f -ldl

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>962</width> <width>993</width>
<height>721</height> <height>900</height>
</rect> </rect>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -50,48 +50,6 @@
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="WaterfallB">
<property name="geometry">
<rect>
<x>0</x>
<y>586</y>
<width>959</width>
<height>80</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>Waterfall</string>
</property>
</widget>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -121,25 +79,25 @@
<number>1500</number> <number>1500</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="WaterfallA"> <widget class="QLabel" name="Waterfall">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>80</x>
<y>488</y> <y>488</y>
<width>953</width> <width>881</width>
<height>80</height> <height>100</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>600</width> <width>600</width>
<height>80</height> <height>100</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>5000</width> <width>5000</width>
<height>100</height> <height>250</height>
</size> </size>
</property> </property>
<property name="font"> <property name="font">
@ -171,9 +129,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>690</x> <x>690</x>
<y>0</y> <y>2</y>
<width>73</width> <width>73</width>
<height>16</height> <height>13</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@ -215,91 +173,6 @@
<number>10</number> <number>10</number>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="holdPointers">
<property name="geometry">
<rect>
<x>782</x>
<y>6</y>
<width>93</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Hold Pointers</string>
</property>
</widget>
<widget class="QLabel" name="HeaderA">
<property name="geometry">
<rect>
<x>25</x>
<y>460</y>
<width>1076</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>Waterfall</string>
</property>
</widget>
<widget class="QLabel" name="HeaderB">
<property name="geometry">
<rect>
<x>10</x>
<y>560</y>
<width>1076</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>Waterfall</string>
</property>
</widget>
<widget class="QTextEdit" name="monWindow"> <widget class="QTextEdit" name="monWindow">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -425,7 +298,7 @@
<x>600</x> <x>600</x>
<y>2</y> <y>2</y>
<width>87</width> <width>87</width>
<height>16</height> <height>13</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@ -496,13 +369,75 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="RXLevel">
<property name="geometry">
<rect>
<x>780</x>
<y>14</y>
<width>150</width>
<height>11</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>780</x>
<y>0</y>
<width>91</width>
<height>13</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Rcv Level:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="RXLevel2">
<property name="geometry">
<rect>
<x>780</x>
<y>23</y>
<width>150</width>
<height>11</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menuBar"> <widget class="QMenuBar" name="menuBar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>962</width> <width>993</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>

View File

@ -1,516 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtSoundModemClass</class>
<widget class="QMainWindow" name="QtSoundModemClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>962</width>
<height>721</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>1024</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>QtSoundModem</string>
</property>
<property name="windowIcon">
<iconset resource="QtSoundModem.qrc">
<normaloff>:/QtSoundModem/soundmodem.ico</normaloff>:/QtSoundModem/soundmodem.ico</iconset>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QSpinBox" name="centerA">
<property name="geometry">
<rect>
<x>174</x>
<y>6</y>
<width>56</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>3000</number>
</property>
<property name="value">
<number>1500</number>
</property>
</widget>
<widget class="QComboBox" name="modeB">
<property name="geometry">
<rect>
<x>316</x>
<y>6</y>
<width>145</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="WaterfallB">
<property name="geometry">
<rect>
<x>0</x>
<y>586</y>
<width>959</width>
<height>80</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>6</x>
<y>7</y>
<width>16</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>A:</string>
</property>
</widget>
<widget class="QSpinBox" name="centerB">
<property name="geometry">
<rect>
<x>468</x>
<y>6</y>
<width>56</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>3000</number>
</property>
<property name="value">
<number>1500</number>
</property>
</widget>
<widget class="QLabel" name="WaterfallA">
<property name="geometry">
<rect>
<x>0</x>
<y>488</y>
<width>953</width>
<height>80</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QComboBox" name="modeA">
<property name="geometry">
<rect>
<x>22</x>
<y>6</y>
<width>145</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>690</x>
<y>0</y>
<width>73</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>DCD Level</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="labelB">
<property name="geometry">
<rect>
<x>300</x>
<y>9</y>
<width>16</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>B:</string>
</property>
</widget>
<widget class="QSlider" name="DCDSlider">
<property name="geometry">
<rect>
<x>690</x>
<y>18</y>
<width>73</width>
<height>14</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
<widget class="QCheckBox" name="holdPointers">
<property name="geometry">
<rect>
<x>782</x>
<y>6</y>
<width>93</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Hold Pointers</string>
</property>
</widget>
<widget class="QLabel" name="HeaderA">
<property name="geometry">
<rect>
<x>25</x>
<y>460</y>
<width>1076</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>fall</string>
</property>
</widget>
<widget class="QLabel" name="HeaderB">
<property name="geometry">
<rect>
<x>10</x>
<y>560</y>
<width>1076</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>fall</string>
</property>
</widget>
<widget class="QTextEdit" name="monWindow">
<property name="geometry">
<rect>
<x>-6</x>
<y>60</y>
<width>971</width>
<height>201</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labelC">
<property name="geometry">
<rect>
<x>5</x>
<y>32</y>
<width>16</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>C:</string>
</property>
</widget>
<widget class="QComboBox" name="modeC">
<property name="geometry">
<rect>
<x>22</x>
<y>31</y>
<width>145</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QSpinBox" name="centerD">
<property name="geometry">
<rect>
<x>468</x>
<y>31</y>
<width>56</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>3000</number>
</property>
<property name="value">
<number>1500</number>
</property>
</widget>
<widget class="QComboBox" name="modeD">
<property name="geometry">
<rect>
<x>316</x>
<y>31</y>
<width>145</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="labelD">
<property name="geometry">
<rect>
<x>298</x>
<y>33</y>
<width>16</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>D:</string>
</property>
</widget>
<widget class="QSpinBox" name="centerC">
<property name="geometry">
<rect>
<x>174</x>
<y>31</y>
<width>56</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>3000</number>
</property>
<property name="value">
<number>1500</number>
</property>
</widget>
<widget class="QSlider" name="RXOffset">
<property name="geometry">
<rect>
<x>600</x>
<y>18</y>
<width>63</width>
<height>14</height>
</rect>
</property>
<property name="minimum">
<number>-200</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="RXOffsetLabel">
<property name="geometry">
<rect>
<x>600</x>
<y>2</y>
<width>87</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>RX Offset 0</string>
</property>
</widget>
<widget class="QLineEdit" name="RXOffsetA">
<property name="geometry">
<rect>
<x>238</x>
<y>6</y>
<width>37</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="RXOffsetB">
<property name="geometry">
<rect>
<x>532</x>
<y>6</y>
<width>37</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="RXOffsetC">
<property name="geometry">
<rect>
<x>238</x>
<y>31</y>
<width>37</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLineEdit" name="RXOffsetD">
<property name="geometry">
<rect>
<x>532</x>
<y>31</y>
<width>37</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>962</width>
<height>21</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="QtSoundModem.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
@ -9,12 +13,16 @@
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{4EDE958E-D0AC-37B4-81F7-78313A262DCD}</ProjectGuid> <ProjectGuid>{4EDE958E-D0AC-37B4-81F7-78313A262DCD}</ProjectGuid>
<RootNamespace>QtSoundModem</RootNamespace> <RootNamespace>QtSoundModem</RootNamespace>
<Keyword>QtVS_v304</Keyword> <Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion> <WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> <QtMsBuild Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup> </PropertyGroup>
@ -28,6 +36,15 @@
<IntermediateDirectory>release\</IntermediateDirectory> <IntermediateDirectory>release\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput> <PrimaryOutput>QtSoundModem</PrimaryOutput>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>release\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>release\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<OutputDirectory>debug\</OutputDirectory> <OutputDirectory>debug\</OutputDirectory>
@ -37,6 +54,15 @@
<IntermediateDirectory>debug\</IntermediateDirectory> <IntermediateDirectory>debug\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput> <PrimaryOutput>QtSoundModem</PrimaryOutput>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>debug\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>debug\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')"> <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
@ -45,9 +71,15 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" /> <Import Project="$(QtMsBuild)\qt_defaults.props" />
@ -59,6 +91,13 @@
<IgnoreImportLibrary>true</IgnoreImportLibrary> <IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\</IntDir>
<TargetName>QtSoundModem</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\\</IntDir> <IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\\</IntDir>
@ -66,14 +105,29 @@
<IgnoreImportLibrary>true</IgnoreImportLibrary> <IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\\</IntDir>
<TargetName>QtSoundModem</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtInstall>5.14.2</QtInstall> <QtInstall>5.14.2</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules> <QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
<QtInstall>msvc 2017 5.1464</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtInstall>5.14.2</QtInstall> <QtInstall>5.14.2</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules> <QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
<QtInstall>5.14.2</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" /> <Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup> </ImportGroup>
@ -140,6 +194,69 @@
<QtUicFileName>ui_%(Filename).h</QtUicFileName> <QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic> </QtUic>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>rsid;.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;release;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>libfftw3f-3.lib;shell32.lib;setupapi.lib;WS2_32.Lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>false</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(OutDir)QtSoundModem.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;NDEBUG;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_SERIALPORT_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(IntDir)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtRcc>
<InitFuncName>QtSoundModem</InitFuncName>
<Compression>default</Compression>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<QtRccDir>$(IntDir)</QtRccDir>
<QtRccFileName>qrc_%(Filename).cpp</QtRccFileName>
</QtRcc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>$(IntDir)</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;debug;/include;rsid;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;debug;/include;rsid;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -202,13 +319,79 @@
<QtUicFileName>ui_%(Filename).h</QtUicFileName> <QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic> </QtUic>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;debug;/include;rsid;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>libfftw3f-64-3.lib;shell32.lib;setupapi.lib;WS2_32.Lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>true</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutputFile>$(OutDir)\QtSoundModem.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_SERIALPORT_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(IntDir)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtRcc>
<InitFuncName>QtSoundModem</InitFuncName>
<Compression>default</Compression>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<QtRccDir>$(IntDir)</QtRccDir>
<QtRccFileName>qrc_%(Filename).cpp</QtRccFileName>
</QtRcc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>$(IntDir)</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="6pack.cpp" />
<ClCompile Include="ARDOPC.c" /> <ClCompile Include="ARDOPC.c" />
<ClCompile Include="berlekamp.c" />
<ClCompile Include="BusyDetect.c" /> <ClCompile Include="BusyDetect.c" />
<ClCompile Include="Config.cpp" /> <ClCompile Include="Config.cpp" />
<ClCompile Include="dw9600.c" />
<ClCompile Include="hid.c" /> <ClCompile Include="hid.c" />
<ClCompile Include="il2p.c"> <ClCompile Include="il2p.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs>
</ClCompile> </ClCompile>
<ClCompile Include="Modulate.c" /> <ClCompile Include="Modulate.c" />
<ClCompile Include="QtSoundModem.cpp" /> <ClCompile Include="QtSoundModem.cpp" />
@ -225,7 +408,6 @@
<ClCompile Include="ax25_fec.c" /> <ClCompile Include="ax25_fec.c" />
<ClCompile Include="ax25_l2.c" /> <ClCompile Include="ax25_l2.c" />
<ClCompile Include="ax25_mod.c" /> <ClCompile Include="ax25_mod.c" />
<ClCompile Include="berlekamp.c" />
<ClCompile Include="galois.c" /> <ClCompile Include="galois.c" />
<ClCompile Include="kiss_mode.c" /> <ClCompile Include="kiss_mode.c" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
@ -247,18 +429,15 @@
<CustomBuild Include="debug\moc_predefs.h.cbt"> <CustomBuild Include="debug\moc_predefs.h.cbt">
<FileType>Document</FileType> <FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;debug\moc_predefs.h</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;debug\moc_predefs.h</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;debug\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generate moc_predefs.h</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generate moc_predefs.h</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\moc_predefs.h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\moc_predefs.h;%(Outputs)</Outputs>
</CustomBuild> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">debug\moc_predefs.h;%(Outputs)</Outputs>
<CustomBuild Include="release\moc_predefs.h.cbt">
<FileType>Document</FileType>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;release\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\moc_predefs.h;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>C:\Devprogs\bpq32\SMSat2</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>c:\devprogs\bpq32\SMSAT2</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>&lt; d:\samples.wav</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SMSat</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SMSat</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2022-12-30T15:55:55.0433562Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2022-03-11T19:38:31.5906689Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2022-12-30T15:55:55.2283725Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2022-03-11T19:38:33.3845083Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

View File

@ -98,9 +98,6 @@
<ClCompile Include="ax25_mod.c"> <ClCompile Include="ax25_mod.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="berlekamp.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="galois.c"> <ClCompile Include="galois.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -137,14 +134,20 @@
<ClCompile Include="il2p.c"> <ClCompile Include="il2p.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dw9600.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="berlekamp.c">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="6pack.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="QtSoundModem.h"> <QtMoc Include="QtSoundModem.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<ClInclude Include="UZ7HOStuff.h">
<Filter>Header Files</Filter>
</ClInclude>
<QtMoc Include="tcpCode.h"> <QtMoc Include="tcpCode.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
@ -153,9 +156,6 @@
<CustomBuild Include="debug\moc_predefs.h.cbt"> <CustomBuild Include="debug\moc_predefs.h.cbt">
<Filter>Generated Files</Filter> <Filter>Generated Files</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="ModemDialog.ui"> <QtUic Include="ModemDialog.ui">
@ -187,4 +187,9 @@
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</Image> </Image>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="UZ7HOStuff.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SM2</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SMTest</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>-stylesheet StyleSheet.css</LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>c:\devprogs\bpq32\SMSAT2</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>c:\devprogs\bpq32\SMSAT2</LocalDebuggerWorkingDirectory>
@ -12,23 +11,24 @@
<LocalDebuggerCommandArguments>&lt; d:\samples.wav</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>&lt; d:\samples.wav</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>.\debug</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SMTest</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-stylesheet StyleSheet.css</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SMSat</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>C:\DevProgs\BPQ32\SMSat</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2023-06-27T07:43:13.0567353Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-10-02T12:37:32.3312444Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2022-03-11T19:38:31.5906689Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-10-02T12:37:32.7461423Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2023-06-27T07:43:13.1602990Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-10-02T12:37:33.4644113Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2022-03-11T19:38:33.3845083Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-10-02T12:37:33.9800504Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

BIN
QtSoundModem_resource.aps Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

510
SMMain.c
View File

@ -27,10 +27,49 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
#include "hidapi.h" #include "hidapi.h"
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <stdint.h>
void platformInit();
void RsCreate();
void detector_init();
void KISS_init();
void ax25_init();
void init_raduga();
void il2p_init(int il2p_debug);
void SoundFlush();
void BufferFull(short * Samples, int nSamples);
void PollReceivedSamples();
void chk_dcd1(int snd_ch, int buf_size);
void make_core_BPF(UCHAR snd_ch, short freq, short width);
void modulator(UCHAR snd_ch, int buf_size);
void sendAckModeAcks(int snd_ch);
void PktARDOPEncode(UCHAR * Data, int Len, int Chan);
void RUHEncode(unsigned char * Data, int Len, int chan);
void sendRSID(int Chan, int dropTX);
void SetupGPIOPTT();
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2);
int gpioInitialise(void);
int OpenCOMPort(char * pPort, int speed, BOOL SetDTR, BOOL SetRTS, BOOL Quiet, int Stopbits);
void HAMLIBSetPTT(int PTTState);
void FLRigSetPTT(int PTTState);
void StartWatchdog();
void StopWatchdog();
void gpioWrite(unsigned gpio, unsigned level);
BOOL WriteCOMBlock(int fd, char * Block, int BytesToWrite);
void COMSetDTR(int fd);
void COMSetRTS(int fd);
void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag);
size_t write(int fd, void * buf, size_t count);
int close(int fd);
void SendMgmtPTT(int snd_ch, int PTTState);
BOOL KISSServ; BOOL KISSServ;
int KISSPort; int KISSPort;
int NeedWaterfallHeaders = 0;
BOOL AGWServ; BOOL AGWServ;
int AGWPort; int AGWPort;
@ -40,6 +79,9 @@ int SoundIsPlaying = 0;
int UDPSoundIsPlaying = 0; int UDPSoundIsPlaying = 0;
int Capturing = 0; int Capturing = 0;
int txmin = 0;
int txmax = 0;
extern unsigned short buffer[2][1200]; extern unsigned short buffer[2][1200];
extern int SoundMode; extern int SoundMode;
extern int needRSID[4]; extern int needRSID[4];
@ -50,6 +92,7 @@ unsigned short * SendtoCard(unsigned short * buf, int n);
short * SoundInit(); short * SoundInit();
void DoTX(int Chan); void DoTX(int Chan);
void UDPPollReceivedSamples(); void UDPPollReceivedSamples();
extern void checkforCWID();
extern int SampleNo; extern int SampleNo;
@ -135,6 +178,8 @@ void soundMain()
init_raduga(); // Set up waterfall colour table init_raduga(); // Set up waterfall colour table
initfft(); initfft();
il2p_init(1);
if (nonGUIMode) if (nonGUIMode)
{ {
@ -161,7 +206,6 @@ void SampleSink(int LR, short Sample)
{ {
DMABuffer[2 * Number] = Sample; DMABuffer[2 * Number] = Sample;
DMABuffer[1 + 2 * Number] = Sample; DMABuffer[1 + 2 * Number] = Sample;
} }
else else
{ {
@ -176,6 +220,18 @@ void SampleSink(int LR, short Sample)
DMABuffer[1 + 2 * Number] = 0; DMABuffer[1 + 2 * Number] = 0;
} }
} }
if (using48000)
{
// Need to upsample to 48K. Try just duplicating sample
uint32_t * ptr = &DMABuffer[2 * Number];
*(&ptr[1]) = *(ptr);
*(&ptr[2]) = *(ptr);
*(&ptr[3]) = *(ptr);
Number += 3;
}
Number++; Number++;
#endif #endif
if (Number >= SendSize) if (Number >= SendSize)
@ -332,194 +388,171 @@ extern UCHAR * pixelPointer;
#endif #endif
extern int blnBusyStatus; extern int blnBusyStatus;
BusyDet = 0; BusyDet = 5;
#define PLOTWATERFALL #define PLOTWATERFALL
int WaterfallActive = 1; int WaterfallActive = 1;
int SpectrumActive; int SpectrumActive;
/* float BinSize;
void UpdateBusyDetector(short * bytNewSamples) extern int intLastStart;
extern int intLastStop;
void SMSortSignals2(float * dblMag, int intStartBin, int intStopBin, int intNumBins, float * dblAVGSignalPerBin, float * dblAVGBaselinePerBin);
BOOL SMBusyDetect3(int Chan, float * dblMag, int intStart, int intStop) // this only called while searching for leader ...once leader detected, no longer called.
{ {
float dblReF[1024]; // First sort signals and look at highes signals:baseline ratio..
float dblImF[1024];
float dblMag[206];
#ifdef PLOTSPECTRUM
float dblMagMax = 0.0000000001f;
float dblMagMin = 10000000000.0f;
#endif
UCHAR Waterfall[256]; // Colour index values to send to GUI
int clrTLC = Lime; // Default Bandwidth lines on waterfall
static BOOL blnLastBusyStatus; float dblAVGSignalPerBinNarrow, dblAVGSignalPerBinWide, dblAVGBaselineNarrow, dblAVGBaselineWide;
float dblSlowAlpha = 0.2f;
static float dblAvgStoNNarrow[4] = { 0 }, dblAvgStoNWide[4] = {0};
int intNarrow = 8; // 8 x 11.72 Hz about 94 z
int intWide = ((intStop - intStart) * 2) / 3; //* 0.66);
int blnBusy = FALSE;
int BusyDet4th = BusyDet * BusyDet * BusyDet * BusyDet;
// First sort signals and look at highest signals:baseline ratio..
// First narrow band (~94Hz)
SMSortSignals2(dblMag, intStart, intStop, intNarrow, &dblAVGSignalPerBinNarrow, &dblAVGBaselineNarrow);
// Shouldn't dblAvgStoNNarrow, dblAvgStoNWide be static ??????
if (intLastStart == intStart && intLastStop == intStop)
dblAvgStoNNarrow[Chan] = (1 - dblSlowAlpha) * dblAvgStoNNarrow[Chan] + dblSlowAlpha * dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
else
{
// This initializes the Narrow average after a bandwidth change
dblAvgStoNNarrow[Chan] = dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
}
// Wide band (66% of current bandwidth)
SMSortSignals2(dblMag, intStart, intStop, intWide, &dblAVGSignalPerBinWide, &dblAVGBaselineWide);
if (intLastStart == intStart && intLastStop == intStop)
dblAvgStoNWide[Chan] = (1 - dblSlowAlpha) * dblAvgStoNWide[Chan] + dblSlowAlpha * dblAVGSignalPerBinWide / dblAVGBaselineWide;
else
{
// This initializes the Wide average after a bandwidth change
dblAvgStoNWide[Chan] = dblAVGSignalPerBinWide / dblAVGBaselineWide;
intLastStart = intStart;
intLastStop = intStop;
}
// Preliminary calibration...future a function of bandwidth and BusyDet.
blnBusy = (dblAvgStoNNarrow[Chan] > (3 + 0.008 * BusyDet4th)) || (dblAvgStoNWide[Chan] > (5 + 0.02 * BusyDet4th));
// if (BusyDet == 0)
// blnBusy = FALSE; // 0 Disables check ?? Is this the best place to do this?
// WriteDebugLog(LOGDEBUG, "Busy %d Wide %f Narrow %f", blnBusy, dblAvgStoNWide, dblAvgStoNNarrow);
return blnBusy;
}
extern int compare(const void *p1, const void *p2);
void SMSortSignals2(float * dblMag, int intStartBin, int intStopBin, int intNumBins, float * dblAVGSignalPerBin, float * dblAVGBaselinePerBin)
{
// puts the top intNumber of bins between intStartBin and intStopBin into dblAVGSignalPerBin, the rest into dblAvgBaselinePerBin
// for decent accuracy intNumBins should be < 75% of intStopBin-intStartBin)
// This version uses a native sort function which is much faster and reduces CPU loading significantly on wide bandwidths.
float dblSort[8192];
float dblSum1 = 0, dblSum2 = 0;
int numtoSort = (intStopBin - intStartBin) + 1, i;
memcpy(dblSort, &dblMag[intStartBin], numtoSort * sizeof(float));
qsort((void *)dblSort, numtoSort, sizeof(float), compare);
for (i = numtoSort - 1; i >= 0; i--)
{
if (i >= (numtoSort - intNumBins))
dblSum1 += dblSort[i];
else
dblSum2 += dblSort[i];
}
*dblAVGSignalPerBin = dblSum1 / intNumBins;
*dblAVGBaselinePerBin = dblSum2 / (intStopBin - intStartBin - intNumBins - 1);
}
extern void updateDCD(int Chan, BOOL State);
void SMUpdateBusyDetector(int LR, float * Real, float *Imag)
{
// Energy based detector for each channel.
// Fed from FFT generated for waterfall display
// FFT size is 4096
float dblMag[4096];
static BOOL blnLastBusyStatus[4];
float dblMagAvg = 0; float dblMagAvg = 0;
int intTuneLineLow, intTuneLineHi, intDelta; int i, chan;
int i;
// if (State != SearchingForLeader)
// return; // only when looking for leader
if (Now - LastBusyCheck < 100) if (Now - LastBusyCheck < 100) // ??
return; return;
LastBusyCheck = Now; LastBusyCheck = Now;
FourierTransform(1024, bytNewSamples, &dblReF[0], &dblImF[0], FALSE); // We need to run busy test on the frequncies used by each modem.
for (i = 0; i < 206; i++) for (chan = 0; chan < 4; chan++)
{ {
// starting at ~300 Hz to ~2700 Hz Which puts the center of the signal in the center of the window (~1500Hz) int Low, High, Start, End;
dblMag[i] = powf(dblReF[i + 25], 2) + powf(dblImF[i + 25], 2); // first pass if (soundChannel[chan] != (LR + 1)) // on this side of soundcard
continue;
Low = tx_freq[chan] - txbpf[chan] / 2;
High = tx_freq[chan] + txbpf[chan] / 2;
// Low = tx_freq[chan] - 0.5*rx_shift[chan];
// High = tx_freq[chan] + 0.5*rx_shift[chan];
// BinSize is width of each fft bin in Hz
Start = (Low / BinSize); // First and last bins to process
End = (High / BinSize);
for (i = Start; i < End; i++)
{
dblMag[i] = powf(Real[i], 2) + powf(Imag[i], 2); // first pass
dblMagAvg += dblMag[i]; dblMagAvg += dblMag[i];
#ifdef PLOTSPECTRUM
dblMagSpectrum[i] = 0.2f * dblMag[i] + 0.8f * dblMagSpectrum[i];
dblMagMax = max(dblMagMax, dblMagSpectrum[i]);
dblMagMin = min(dblMagMin, dblMagSpectrum[i]);
#endif
} }
// LookforPacket(dblMag, dblMagAvg, 206, &dblReF[25], &dblImF[25]); blnBusyStatus = SMBusyDetect3(chan, dblMag, Start, End);
// packet_process_samples(bytNewSamples, 1200);
intDelta = roundf(500 / 2) + 50 / 11.719f; if (blnBusyStatus && !blnLastBusyStatus[chan])
intTuneLineLow = max((103 - intDelta), 3);
intTuneLineHi = min((103 + intDelta), 203);
// if (ProtocolState == DISC) // ' Only process busy when in DISC state
{ {
// blnBusyStatus = BusyDetect3(dblMag, intTuneLineLow, intTuneLineHi); // Debugprintf("Ch %d Busy True", chan);
updateDCD(chan, TRUE);
if (blnBusyStatus && !blnLastBusyStatus) }
else if (blnLastBusyStatus[chan] && !blnBusyStatus)
{ {
// QueueCommandToHost("BUSY TRUE"); // Debugprintf("Ch %d Busy False", chan);
// newStatus = TRUE; // report to PTC updateDCD(chan, FALSE);
if (!WaterfallActive && !SpectrumActive)
{
UCHAR Msg[2];
// Msg[0] = blnBusyStatus;
// SendtoGUI('B', Msg, 1);
} }
} blnLastBusyStatus[chan] = blnBusyStatus;
// stcStatus.Text = "TRUE"
// queTNCStatus.Enqueue(stcStatus)
// 'Debug.WriteLine("BUSY TRUE @ " & Format(DateTime.UtcNow, "HH:mm:ss"))
else if (blnLastBusyStatus && !blnBusyStatus)
{
// QueueCommandToHost("BUSY FALSE");
// newStatus = TRUE; // report to PTC
if (!WaterfallActive && !SpectrumActive)
{
UCHAR Msg[2];
Msg[0] = blnBusyStatus;
// SendtoGUI('B', Msg, 1);
}
}
// stcStatus.Text = "FALSE"
// queTNCStatus.Enqueue(stcStatus)
// 'Debug.WriteLine("BUSY FALSE @ " & Format(DateTime.UtcNow, "HH:mm:ss"))
blnLastBusyStatus = blnBusyStatus;
}
if (BusyDet == 0)
clrTLC = Goldenrod;
else if (blnBusyStatus)
clrTLC = Fuchsia;
// At the moment we only get here what seaching for leader,
// but if we want to plot spectrum we should call
// it always
if (WaterfallActive)
{
#ifdef PLOTWATERFALL
dblMagAvg = log10f(dblMagAvg / 5000.0f);
for (i = 0; i < 206; i++)
{
// The following provides some AGC over the waterfall to compensate for avg input level.
float y1 = (0.25f + 2.5f / dblMagAvg) * log10f(0.01 + dblMag[i]);
int objColor;
// Set the pixel color based on the intensity (log) of the spectral line
if (y1 > 6.5)
objColor = Orange; // Strongest spectral line
else if (y1 > 6)
objColor = Khaki;
else if (y1 > 5.5)
objColor = Cyan;
else if (y1 > 5)
objColor = DeepSkyBlue;
else if (y1 > 4.5)
objColor = RoyalBlue;
else if (y1 > 4)
objColor = Navy;
else
objColor = Black;
if (i == 102)
Waterfall[i] = Tomato; // 1500 Hz line (center)
else if (i == intTuneLineLow || i == intTuneLineLow - 1 || i == intTuneLineHi || i == intTuneLineHi + 1)
Waterfall[i] = clrTLC;
else
Waterfall[i] = objColor; // ' Else plot the pixel as received
}
// Send Signal level and Busy indicator to save extra packets
Waterfall[206] = CurrentLevel;
Waterfall[207] = blnBusyStatus;
doWaterfall(Waterfall);
#endif
}
else if (SpectrumActive)
{
#ifdef PLOTSPECTRUM
// This performs an auto scaling mechansim with fast attack and slow release
if (dblMagMin / dblMagMax < 0.0001) // more than 10000:1 difference Max:Min
dblMaxScale = max(dblMagMax, dblMaxScale * 0.9f);
else
dblMaxScale = max(10000 * dblMagMin, dblMagMax);
// clearDisplay();
for (i = 0; i < 206; i++)
{
// The following provides some AGC over the spectrum to compensate for avg input level.
float y1 = -0.25f * (SpectrumHeight - 1) * log10f((max(dblMagSpectrum[i], dblMaxScale / 10000)) / dblMaxScale); // ' range should be 0 to bmpSpectrumHeight -1
int objColor = Yellow;
Waterfall[i] = round(y1);
}
// Send Signal level and Busy indicator to save extra packets
Waterfall[206] = CurrentLevel;
Waterfall[207] = blnBusyStatus;
Waterfall[208] = intTuneLineLow;
Waterfall[209] = intTuneLineHi;
// SendtoGUI('X', Waterfall, 210);
#endif
} }
} }
*/
extern short rawSamples[2400]; // Get Frame Type need 2400 and we may add 1200 extern short rawSamples[2400]; // Get Frame Type need 2400 and we may add 1200
int rawSamplesLength = 0; int rawSamplesLength = 0;
@ -539,24 +572,33 @@ void doCalib(int Chan, int Act)
if (Chan == 1 && calib_mode[0]) if (Chan == 1 && calib_mode[0])
return; return;
calib_mode[Chan] = Act;
if (Act == 0) if (Act == 0)
{ {
calib_mode[Chan] = 0;
tx_status[Chan] = TX_SILENCE; // Stop TX tx_status[Chan] = TX_SILENCE; // Stop TX
Flush(); Flush();
RadioPTT(Chan, 0); RadioPTT(Chan, 0);
Debugprintf("Stop Calib"); Debugprintf("Stop Calib");
} }
else
{
if (calib_mode[Chan] == 0)
SampleNo = 0;
calib_mode[Chan] = Act;
}
} }
int Freq_Change(int Chan, int Freq) int Freq_Change(int Chan, int Freq)
{ {
int low, high; int low, high;
low = round(rx_shift[1] / 2 + RCVR[Chan] * rcvr_offset[Chan] + 1); low = round(rx_shift[Chan] / 2 + (RCVR[Chan] * rcvr_offset[Chan]));
high = round(RX_Samplerate / 2 - (rx_shift[Chan] / 2 + RCVR[Chan] * rcvr_offset[Chan])); high = round(RX_Samplerate / 2 - (rx_shift[Chan] / 2 + RCVR[Chan] * rcvr_offset[Chan]));
if (Freq < 300)
return rx_freq[Chan]; // Dont allow change
if (Freq < low) if (Freq < low)
return rx_freq[Chan]; // Dont allow change return rx_freq[Chan]; // Dont allow change
@ -567,7 +609,7 @@ int Freq_Change(int Chan, int Freq)
tx_freq[Chan] = Freq; tx_freq[Chan] = Freq;
pnt_change[Chan] = TRUE; pnt_change[Chan] = TRUE;
wf_pointer(soundChannel[Chan]); NeedWaterfallHeaders = TRUE;
return Freq; return Freq;
} }
@ -611,6 +653,7 @@ int ARDOPSendToCard(int Chan, int Len)
{ {
// Send Next Block of samples to the soundcard // Send Next Block of samples to the soundcard
short * in = &ARDOPTXBuffer[Chan][ARDOPTXPtr[Chan]]; // Enough to hold whole frame of samples short * in = &ARDOPTXBuffer[Chan][ARDOPTXPtr[Chan]]; // Enough to hold whole frame of samples
short * out = DMABuffer; short * out = DMABuffer;
@ -639,6 +682,7 @@ int ARDOPSendToCard(int Chan, int Len)
} }
} }
} }
DMABuffer = SendtoCard(DMABuffer, Len); DMABuffer = SendtoCard(DMABuffer, Len);
ARDOPTXPtr[Chan] += Len; ARDOPTXPtr[Chan] += Len;
@ -678,8 +722,10 @@ void DoTX(int Chan)
if (tx_status[Chan] == TX_NO_DATA) if (tx_status[Chan] == TX_NO_DATA)
{ {
Flush(); Flush();
Debugprintf("TX Complete"); Debugprintf("TX Complete %d", SampleNo);
RadioPTT(0, 0); RadioPTT(Chan, 0);
Continuation[Chan] = 0;
tx_status[Chan] = TX_SILENCE; tx_status[Chan] = TX_SILENCE;
// We should now send any ackmode acks as the channel is now free for dest to reply // We should now send any ackmode acks as the channel is now free for dest to reply
@ -691,7 +737,7 @@ void DoTX(int Chan)
{ {
// Continue the send // Continue the send
if (modem_mode[Chan] == MODE_ARDOP) if (modem_mode[Chan] == MODE_ARDOP || modem_mode[Chan] == MODE_RUH)
{ {
// if (SeeIfCardBusy()) // if (SeeIfCardBusy())
// return 0; // return 0;
@ -710,6 +756,8 @@ void DoTX(int Chan)
SoundIsPlaying = TRUE; SoundIsPlaying = TRUE;
Number = 0; Number = 0;
Continuation[Chan] = 1;
Debugprintf("TX Continuing"); Debugprintf("TX Continuing");
string * myTemp = Strings(&all_frame_buf[Chan], 0); // get message string * myTemp = Strings(&all_frame_buf[Chan], 0); // get message
@ -739,19 +787,26 @@ void DoTX(int Chan)
put_frame(Chan, tx_data, "", TRUE, FALSE); put_frame(Chan, tx_data, "", TRUE, FALSE);
if (modem_mode[Chan] == MODE_ARDOP)
PktARDOPEncode(tx_data->Data, tx_data->Length - 2, Chan); PktARDOPEncode(tx_data->Data, tx_data->Length - 2, Chan);
else
RUHEncode(tx_data->Data, tx_data->Length - 2, Chan);
freeString(tx_data); freeString(tx_data);
// Samples are now in DMABuffer = Send first block // Samples are now in DMABuffer = Send first block
DMABuffer = SoundInit();
ARDOPSendToCard(Chan, SendSize); ARDOPSendToCard(Chan, SendSize);
tx_status[Chan] = TX_FRAME; tx_status[Chan] = TX_FRAME;
return; return;
} }
Debugprintf("TX Complete"); Debugprintf("TX Complete %d", SampleNo);
RadioPTT(0, 0); RadioPTT(Chan, 0);
Continuation[Chan] = 0;
tx_status[Chan] = TX_SILENCE; tx_status[Chan] = TX_SILENCE;
// We should now send any ackmode acks as the channel is now free for dest to reply // We should now send any ackmode acks as the channel is now free for dest to reply
@ -796,6 +851,8 @@ void DoTX(int Chan)
// Start a new send. modulator should handle TXD etc // Start a new send. modulator should handle TXD etc
checkforCWID(); // See if need to start CWID timer in afteractivity mode
Debugprintf("TX Start"); Debugprintf("TX Start");
SampleNo = 0; SampleNo = 0;
@ -856,6 +913,50 @@ void DoTX(int Chan)
ARDOPSendToCard(Chan, SendSize); ARDOPSendToCard(Chan, SendSize);
tx_status[Chan] = TX_FRAME; tx_status[Chan] = TX_FRAME;
}
else if (modem_mode[Chan] == MODE_RUH)
{
// Same as for ARDOP. Generate a whole frame of samples
// then send them out a bit at a time to avoid stopping here
// We allow two RUH modems
string * myTemp = Strings(&all_frame_buf[Chan], 0); // get message
string * tx_data;
if ((myTemp->Data[0] & 0x0f) == 12) // ACKMODE
{
// Save copy then copy data up 3 bytes
Add(&KISS_acked[Chan], duplicateString(myTemp));
mydelete(myTemp, 0, 3);
myTemp->Length -= sizeof(void *);
}
else
{
// Just remove control
mydelete(myTemp, 0, 1);
}
tx_data = duplicateString(myTemp); // so can free original below
Delete(&all_frame_buf[Chan], 0); // This will invalidate temp
AGW_AX25_frame_analiz(Chan, FALSE, tx_data);
put_frame(Chan, tx_data, "", TRUE, FALSE);
RUHEncode(tx_data->Data, tx_data->Length - 2, Chan);
freeString(tx_data);
// Samples are now in DMABuffer = Send first block
ARDOPSendToCard(Chan, SendSize);
tx_status[Chan] = TX_FRAME;
} }
else else
modulator(Chan, tx_bufsize); modulator(Chan, tx_bufsize);
@ -863,16 +964,6 @@ void DoTX(int Chan)
return; return;
} }
void stoptx(int snd_ch)
{
Flush();
Debugprintf("TX Complete");
RadioPTT(snd_ch, 0);
tx_status[snd_ch] = TX_SILENCE;
snd_status[snd_ch] = SND_IDLE;
}
void RX2TX(int snd_ch) void RX2TX(int snd_ch)
{ {
if (snd_status[snd_ch] == SND_IDLE) if (snd_status[snd_ch] == SND_IDLE)
@ -904,7 +995,10 @@ BOOL useGPIO = FALSE;
BOOL gotGPIO = FALSE; BOOL gotGPIO = FALSE;
int HamLibPort = 4532; int HamLibPort = 4532;
char HamLibHost[32] = "192.168.1.14"; char HamLibHost[32] = "127.0.0.1";
int FLRigPort = 12345;
char FLRigHost[32] = "127.0.0.1";
char CM108Addr[80] = ""; char CM108Addr[80] = "";
@ -1078,6 +1172,12 @@ void OpenPTTPort()
HAMLIBSetPTT(0); // to open port HAMLIBSetPTT(0); // to open port
return; return;
} }
else if (stricmp(PTTPort, "FLRIG") == 0)
{
PTTMode |= PTTFLRIG;
FLRigSetPTT(0); // to open port
return;
}
else // Not GPIO else // Not GPIO
{ {
@ -1088,7 +1188,9 @@ void OpenPTTPort()
void ClosePTTPort() void ClosePTTPort()
{ {
if (hPTTDevice)
CloseCOMPort(hPTTDevice); CloseCOMPort(hPTTDevice);
hPTTDevice = 0; hPTTDevice = 0;
} }
void CM108_set_ptt(int PTTState) void CM108_set_ptt(int PTTState)
@ -1153,10 +1255,37 @@ void CM108_set_ptt(int PTTState)
} }
float amplitudes[4] = { 32000, 32000, 32000, 32000 };
extern float amplitude;
void startpttOnTimer();
extern void UpdatePTTStats(int Chan, int State);
void RadioPTT(int snd_ch, BOOL PTTState) void RadioPTT(int snd_ch, BOOL PTTState)
{ {
snd_status[snd_ch] = PTTState; // SND_IDLE = 0 SND_TX = 1
if (PTTState)
{
txmax = txmin = 0;
amplitude = amplitudes[snd_ch];
StartWatchdog();
}
else
{
Debugprintf("Output peaks = %d, %d, amp %f", txmin, txmax, amplitude);
amplitudes[snd_ch] = amplitude;
StopWatchdog();
}
if ((PTTMode & PTTHOST))
{
// Send PTT ON/OFF to any mgmt connections
SendMgmtPTT(snd_ch, PTTState);
}
UpdatePTTStats(snd_ch, PTTState);
#ifdef __ARM_ARCH #ifdef __ARM_ARCH
if (useGPIO) if (useGPIO)
{ {
@ -1164,7 +1293,7 @@ void RadioPTT(int snd_ch, BOOL PTTState)
gpioWrite(pttGPIOPinR, (pttGPIOInvert ? (1 - PTTState) : (PTTState))); gpioWrite(pttGPIOPinR, (pttGPIOInvert ? (1 - PTTState) : (PTTState)));
else else
gpioWrite(pttGPIOPin, (pttGPIOInvert ? (1 - PTTState) : (PTTState))); gpioWrite(pttGPIOPin, (pttGPIOInvert ? (1 - PTTState) : (PTTState)));
startpttOnTimer();
return; return;
} }
@ -1173,17 +1302,29 @@ void RadioPTT(int snd_ch, BOOL PTTState)
if ((PTTMode & PTTCM108)) if ((PTTMode & PTTCM108))
{ {
CM108_set_ptt(PTTState); CM108_set_ptt(PTTState);
startpttOnTimer();
return; return;
} }
if ((PTTMode & PTTHAMLIB)) if ((PTTMode & PTTHAMLIB))
{ {
HAMLIBSetPTT(PTTState); HAMLIBSetPTT(PTTState);
startpttOnTimer();
return; return;
} }
if (hPTTDevice == 0)
return;
if ((PTTMode & PTTFLRIG))
{
FLRigSetPTT(PTTState);
startpttOnTimer();
return;
}
if (hPTTDevice == 0)
{
startpttOnTimer();
return;
}
if ((PTTMode & PTTCAT)) if ((PTTMode & PTTCAT))
{ {
if (PTTState) if (PTTState)
@ -1212,6 +1353,9 @@ void RadioPTT(int snd_ch, BOOL PTTState)
} }
} }
startpttOnTimer();
} }
char ShortDT[] = "HH:MM:SS"; char ShortDT[] = "HH:MM:SS";

File diff suppressed because it is too large Load Diff

View File

@ -1,234 +0,0 @@
/*
Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO
This file is part of QtSoundModem
QtSoundModem 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 3 of the License, or
(at your option) any later version.
QtSoundModem 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 QtSoundModem. If not, see http://www.gnu.org/licenses
*/
// UZ7HO Soundmodem Port by John Wiseman G8BPQ
#include "UZ7HOStuff.h"
#include <QPainter>
// This displays a graph of the filter characteristics
#define c3 -1.5000000000000E+00f // cos(2*pi / 3) - 1;
#define c32 8.6602540378444E-01f // sin(2*pi / 3);
#define u5 1.2566370614359E+00f // 2*pi / 5;
#define c51 -1.2500000000000E+00f // (cos(u5) + cos(2*u5))/2 - 1;
#define c52 5.5901699437495E-01f // (cos(u5) - cos(2*u5))/2;
#define c53 -9.5105651629515E-0f //- sin(u5);
#define c54 -1.5388417685876E+00f //-(sin(u5) + sin(2*u5));
#define c55 3.6327126400268E-01f // (sin(u5) - sin(2*u5));
#define c8 = 7.0710678118655E-01f // 1 / sqrt(2);
float pnt_graph_buf[4096];
float graph_buf[4096];
float prev_graph_buf[4096];
float src_graph_buf[4096];
float graph_f;
float RealOut[4096];
short RealIn[4096];
float ImagOut[4096];
#define Image1Width 642
#define Image1Height 312
void filter_grid(QPainter * Painter)
{
int col = 20;
int row = 8;
int top_margin = 10;
int bottom_margin = 20;
int left_margin = 30;
int right_margin = 10;
int x, y;
float kx, ky;
QPen pen; // creates a default pen
pen.setStyle(Qt::DotLine);
Painter->setPen(pen);
ky = 35;
kx = (Image1Width - left_margin - right_margin - 2) / col;
for (y = 0; y < row; y++)
{
Painter->drawLine(
left_margin + 1,
top_margin + round(ky*y) + 1,
Image1Width - right_margin - 1,
top_margin + round(ky*y) + 1);
}
for (x = 0; x < col; x++)
{
Painter->drawLine(
left_margin + round(kx*x) + 1,
top_margin + 1,
left_margin + round(kx*x) + 1,
Image1Height - bottom_margin - 1);
}
pen.setStyle(Qt::SolidLine);
Painter->setPen(pen);
for (y = 0; y < row / 2; y++)
{
char Textxx[20];
sprintf(Textxx, "%d", y * -20);
Painter->drawLine(
left_margin + 1,
top_margin + round(ky*y * 2) + 1,
Image1Width - right_margin - 1,
top_margin + round(ky*y * 2) + 1);
Painter->drawText(
1,
top_margin + round(ky*y * 2) + 1,
100, 20, 0, Textxx);
}
for (x = 0; x <= col / 5; x++)
{
char Textxx[20];
sprintf(Textxx, "%d", x * 1000);
Painter->drawLine(
left_margin + round(kx*x * 5) + 1,
top_margin + 1,
left_margin + round(kx*x * 5) + 1,
Image1Height - bottom_margin - 1);
Painter->drawText(
top_margin + round(kx*x * 5) + 8,
Image1Height - 15,
100, 20, 0, Textxx);
}
}
extern "C" void FourierTransform(int NumSamples, short * RealIn, float * RealOut, float * ImagOut, int InverseTransform);
void make_graph(float * buf, int buflen, QPainter * Painter)
{
int top_margin = 10;
int bottom_margin = 20;
int left_margin = 30;
int i, y1, y2;
float pixel;
if (buflen == 0)
return;
for (i = 0; i <= buflen - 2; i++)
{
y1 = 1 - round(buf[i]);
if (y1 > Image1Height - top_margin - bottom_margin - 2)
y1 = Image1Height - top_margin - bottom_margin - 2;
y2 = 1 - round(buf[i + 1]);
if (y2 > Image1Height - top_margin - bottom_margin - 2)
y2 = Image1Height - top_margin - bottom_margin - 2;
// 150 pixels for 1000 Hz
// i is the bin number, but bin is not 10 Hz but 12000 /1024
// so freq = i * 12000 / 1024;
// and pixel is freq * 300 /1000
pixel = i * 12000.0f / 1024.0f;
pixel = pixel * 150.0f /1000.0f;
Painter->drawLine(
left_margin + pixel,
top_margin + y1,
left_margin + pixel + 1,
top_margin + y2);
}
}
void make_graph_buf(float * buf, short tap, QPainter * Painter)
{
int FFTSize;
float max;
int i, k;
FFTSize = 1024; // 12000 / 10; // 10hz on sample;
for (i = 0; i < tap; i++)
prev_graph_buf[i]= 0;
for (i = 0; i < FFTSize; i++)
src_graph_buf[i] = 0;
src_graph_buf[0]= 1;
FIR_filter(src_graph_buf, FFTSize, tap, buf, graph_buf, prev_graph_buf);
for (k = 0; k < FFTSize; k++)
RealIn[k] = graph_buf[k] * 32768;
FourierTransform(FFTSize, RealIn, RealOut, ImagOut, 0);
for (k = 0; k < (FFTSize / 2) - 1; k++)
pnt_graph_buf[k] = powf(RealOut[k], 2) + powf(ImagOut[k], 2);
max = 0;
for (i = 0; i < (FFTSize / 2) - 1; i++)
{
if (pnt_graph_buf[i] > max)
max = pnt_graph_buf[i];
}
if (max > 0)
{
for (i = 0; i < (FFTSize / 2) - 1; i++)
pnt_graph_buf[i] = pnt_graph_buf[i] / max;
}
for (i = 0; i < (FFTSize / 2) - 1; i++)
{
if (pnt_graph_buf[i] > 0)
pnt_graph_buf[i] = 70 * log10(pnt_graph_buf[i]);
else
pnt_graph_buf[i] = 0;
}
filter_grid(Painter);
Painter->setPen(Qt::blue);
make_graph(pnt_graph_buf, 400, Painter);
}

View File

@ -322,7 +322,7 @@ VOID Track1Car4FSK(short * intSamples, int * intPtr, int intSampPerSymbol, float
VOID Decode1CarPSK(int Carrier, BOOL OFDM); VOID Decode1CarPSK(int Carrier, BOOL OFDM);
int EnvelopeCorrelator(); int EnvelopeCorrelator();
int EnvelopeCorrelatorNew(); int EnvelopeCorrelatorNew();
BOOL DecodeFrame(int intFrameType, UCHAR * bytData); BOOL DecodeFrame(int chan, int intFrameType, UCHAR * bytData);
void Update4FSKConstellation(int * intToneMags, int * intQuality); void Update4FSKConstellation(int * intToneMags, int * intQuality);
void Update16FSKConstellation(int * intToneMags, int * intQuality); void Update16FSKConstellation(int * intToneMags, int * intQuality);
@ -864,7 +864,7 @@ float dblFreqBin[MAXCAR];
BOOL CheckFrameTypeParity(int intTonePtr, int * intToneMags); BOOL CheckFrameTypeParity(int intTonePtr, int * intToneMags);
void ARDOPProcessNewSamples(short * Samples, int nSamples) void ARDOPProcessNewSamples(int chan, short * Samples, int nSamples)
{ {
BOOL blnFrameDecodedOK = FALSE; BOOL blnFrameDecodedOK = FALSE;
@ -1264,7 +1264,7 @@ else if (intPhaseError > 2)
// This mechanism is to skip actual decoding and reply/change state...no need to decode // This mechanism is to skip actual decoding and reply/change state...no need to decode
blnFrameDecodedOK = DecodeFrame(intFrameType, bytData); blnFrameDecodedOK = DecodeFrame(chan, intFrameType, bytData);
ProcessFrame: ProcessFrame:
@ -3047,7 +3047,7 @@ void DemodulateFrame(int intFrameType)
int intSNdB = 0, intQuality = 0; int intSNdB = 0, intQuality = 0;
BOOL DecodeFrame(int xxx, UCHAR * bytData) BOOL DecodeFrame(int chan, int xxx, UCHAR * bytData)
{ {
BOOL blnDecodeOK = FALSE; BOOL blnDecodeOK = FALSE;
char strCallerCallsign[10] = ""; char strCallerCallsign[10] = "";
@ -3176,7 +3176,7 @@ BOOL DecodeFrame(int xxx, UCHAR * bytData)
// Data in bytData len in frameLen // Data in bytData len in frameLen
ProcessPktFrame(0, bytData, frameLen); ProcessPktFrame(chan, bytData, frameLen);
// else // else
// L2Routine(bytData, frameLen, intLastRcvdFrameQuality, totalRSErrors, intNumCar, pktRXMode); // L2Routine(bytData, frameLen, intLastRcvdFrameQuality, totalRSErrors, intNumCar, pktRXMode);

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,14 @@
#pragma once
// //
// My port of UZ7HO's Soundmodem // My port of UZ7HO's Soundmodem
// //
#define VersionString "0.0.0.66" #define VersionString "0.0.0.73"
#define VersionBytes {0, 0, 0, 66} #define VersionBytes {0, 0, 0, 73}
//#define LOGTX
//#define LOGRX
// Added FX25. 4x100 FEC and V27 not Working and disabled // Added FX25. 4x100 FEC and V27 not Working and disabled
@ -104,13 +109,13 @@
// 0.48 Send FRMR for unrecognised frame types // 0.48 Send FRMR for unrecognised frame types
// 0.49 Add Andy's FEC Tag correlation coode // 0.49 Add Andy's FEC Tag correlation code
// 0.50 Fix Waterfall display when only using right channel // 0.50 Fix Waterfall display when only using right channel
// Allow 1200 baud fsk at other center freqs // Allow 1200 baud fsk at other center freqs
// Add Port numbers to Window title and Try Icon tooltip // Add Port numbers to Window title and Try Icon tooltip
// Fix calculation of filters for multiple decoders // Fix calculation of filters for multiple decoders
// Add RX Offset setting (for satellite operation // Add RX Offset setting (for satellite operation)
// 0.51 Fix Multithreading with more that 2 modems // 0.51 Fix Multithreading with more that 2 modems
@ -146,7 +151,60 @@
// 0.66 Allow configuration of waterfall span June 23 // 0.66 Allow configuration of waterfall span June 23
// Add Exclude // Add Exclude
// .67 Add extra modes 8PSK 900 RUH 4800 RUH 9600 QPSK 600 QPSK 2400 August 23
// Fix loading txtail
// Fix digipeating
// Add MaxFrame to Modem Dialog
// Fix 64 bit compatibility in ackmode
// Add option to change CWID tones
// Fix minimum centre freq validation
// .68 Monitor XID and TEST
// Flag active interface in title bar
// Improve header validation in il2p
// Add CWID only after traffic option
// Add font selection
// Separate modem bandwidth indicators
// Fix problems with il2p and PSK modes in nogui mode
// Add signal level bar to GUI
// Fix Waterfall display when using right channel only
// Allow PTT device to be added
// .69 Add basic Dark Theme
// Fix some timing bugs in Waterfall and RX Level refresh
// Only display session table if AGW interface is enabled
// Fix operation with both left and right channels in use
// .70 Restructure Waterfall area to be a single image
// .71 Add IL2P CRC Mode
// Improve reliability of waterfall update
// Report and set fx.25 and il2p flags to/from BPQ
// .72 Fix IL2P for RUH modems // July 2024
// Fix crash when closing in non-gui mode
// Fix loop in chk_dcd1
// Change method of timing PTT
// Add FLRIG PTT Support
// Beta 13 revert to new ptt timing
// Beta 14 Add display of mix/snoop devices
// Change phase map of QPSK3600 mode to match Nino TNC
//.73 Fix QPSK3600 RX Filters
// Add Mgmt Interface (Beta 2)
// Use ARDOP Busy detector (Beta 3)
// Various fixes to AGW interface (Beta 4)
// As far as I can see txtail is only there to make sure all bits get through the tx filter,
// so it shouldn't really matter what is sent. Code worked in characters, so resolution of txtail
// is 24 mS at 300 baud. I don't see why I can't work in bits, or even samples. Any reason why I shouldn't send
// a single tone during tail? .
//
// I'm currently sending reversals with timing resolution of bits (~3 mS at 300 baud)
@ -264,6 +322,15 @@ typedef struct TKISSMode_t
} TKISSMode; } TKISSMode;
typedef struct MgmtMode_t
{
void * Socket; // Used as a key
char Msg[512]; // Received message
int Len;
int BPQPort[4]; // BPQ port for each modem
} TMgmtMode;
typedef struct TMChannel_t typedef struct TMChannel_t
{ {
@ -299,8 +366,6 @@ typedef struct TFX25_t
Byte size_cnt; Byte size_cnt;
} TFX25; } TFX25;
typedef struct TDetector_t typedef struct TDetector_t
{ {
struct TFX25_t fx25[4]; struct TFX25_t fx25[4];
@ -402,7 +467,6 @@ typedef struct TDetector_t
Byte rx_decoded; Byte rx_decoded;
Byte errors; Byte errors;
} TDetector; } TDetector;
@ -411,7 +475,7 @@ typedef struct AGWUser_t
{ {
void *socket; void *socket;
string * data_in; string * data_in;
TStringList AGW_frame_buf; // TStringList AGW_frame_buf;
boolean Monitor; boolean Monitor;
boolean Monitor_raw; boolean Monitor_raw;
boolean reportFreqAndModem; // Can report modem and frequency to host boolean reportFreqAndModem; // Can report modem and frequency to host
@ -483,6 +547,8 @@ typedef struct TAX25Port_t
#define PTTCAT 4 #define PTTCAT 4
#define PTTCM108 8 #define PTTCM108 8
#define PTTHAMLIB 16 #define PTTHAMLIB 16
#define PTTFLRIG 32
#define PTTHOST 128 // May be combined with others
// Status flags // Status flags
@ -516,6 +582,10 @@ typedef struct TAX25Port_t
#define U_UA 99 #define U_UA 99
#define U_FRMR 135 #define U_FRMR 135
#define U_UI 3 #define U_UI 3
#define U_XID 0xAF
#define U_TEST 0xE3
// PID flags // PID flags
#define PID_X25 0x01 // 00000001-CCIT X25 PLP #define PID_X25 0x01 // 00000001-CCIT X25 PLP
#define PID_SEGMENT 0x08 // 00001000-Segmentation fragment #define PID_SEGMENT 0x08 // 00001000-Segmentation fragment
@ -528,10 +598,11 @@ typedef struct TAX25Port_t
#define PID_NET_ROM 0xCF // 11001111-NET/ROM #define PID_NET_ROM 0xCF // 11001111-NET/ROM
// Sound interface buffer size // Sound interface buffer sizes
extern int ReceiveSize;
extern int SendSize;
#define SendSize 1024 // 100 mS for now
#define ReceiveSize 512 // try 100 mS for now
#define NumberofinBuffers 4 #define NumberofinBuffers 4
#define Now getTicks() #define Now getTicks()
@ -543,8 +614,7 @@ typedef struct TAX25Port_t
#define MODEM_CAPTION 'SoundModem by UZ7HO' #define MODEM_CAPTION 'SoundModem by UZ7HO'
#define MODEM_VERSION '1.06' #define MODEM_VERSION '1.06'
#define SND_IDLE 0 #define SND_IDLE 0
#define SND_RX 1 #define SND_TX 1
#define SND_TX 2
#define BUF_EMPTY 0 #define BUF_EMPTY 0
#define BUF_FULL 1 #define BUF_FULL 1
#define DISP_MONO FALSE #define DISP_MONO FALSE
@ -564,7 +634,7 @@ typedef struct TAX25Port_t
#define DEBUG_SOUND 8 #define DEBUG_SOUND 8
#define IS_LAST TRUE #define IS_LAST TRUE
#define IS_NOT_LAST FALSE #define IS_NOT_LAST FALSE
#define modes_count 16 #define modes_count 20
#define SPEED_300 0 #define SPEED_300 0
#define SPEED_1200 1 #define SPEED_1200 1
#define SPEED_600 2 #define SPEED_600 2
@ -579,8 +649,12 @@ typedef struct TAX25Port_t
#define SPEED_MP400 11 #define SPEED_MP400 11
#define SPEED_DW2400 12 #define SPEED_DW2400 12
#define SPEED_8P4800 13 #define SPEED_8P4800 13
#define SPEED_AE2400 14 #define SPEED_2400V26B 14
#define SPEED_ARDOP 15 #define SPEED_ARDOP 15
#define SPEED_Q300 16
#define SPEED_8PSK300 17
#define SPEED_RUH48 18
#define SPEED_RUH96 19
#define MODE_FSK 0 #define MODE_FSK 0
#define MODE_BPSK 1 #define MODE_BPSK 1
@ -589,11 +663,11 @@ typedef struct TAX25Port_t
#define MODE_8PSK 4 #define MODE_8PSK 4
#define MODE_PI4QPSK 5 #define MODE_PI4QPSK 5
#define MODE_ARDOP 6 #define MODE_ARDOP 6
#define MODE_RUH 7
#define QPSK_SM 0 #define QPSK_SM 0
#define QPSK_V26 1 #define QPSK_V26 1
#define MODEM_8P4800_BPF 3200 #define MODEM_8P4800_BPF 3200
#define MODEM_8P4800_TXBPF 3400 #define MODEM_8P4800_TXBPF 3400
#define MODEM_8P4800_LPF 1000 #define MODEM_8P4800_LPF 1000
@ -619,7 +693,7 @@ typedef struct TAX25Port_t
#define MODEM_Q2400_LPF_TAP 128 //128 #define MODEM_Q2400_LPF_TAP 128 //128
// //
#define MODEM_Q3600_BPF 3600 #define MODEM_Q3600_BPF 3600
#define MODEM_Q3600_TXBPF 3750 #define MODEM_Q3600_TXBPF 3000
#define MODEM_Q3600_LPF 1350 #define MODEM_Q3600_LPF 1350
#define MODEM_Q3600_BPF_TAP 256 #define MODEM_Q3600_BPF_TAP 256
#define MODEM_Q3600_LPF_TAP 128 #define MODEM_Q3600_LPF_TAP 128
@ -720,7 +794,7 @@ typedef struct TAX25Port_t
#define ARDOPBufferSize 12000 * 100 #define ARDOPBufferSize 12000 * 100
extern short ARDOPTXBuffer[4][12000 * 100]; // Enough to hold whole frame of samples extern short ARDOPTXBuffer[4][ARDOPBufferSize]; // Enough to hold whole frame of samples
extern int ARDOPTXLen[4]; // Length of frame extern int ARDOPTXLen[4]; // Length of frame
extern int ARDOPTXPtr[4]; // Tx Pointer extern int ARDOPTXPtr[4]; // Tx Pointer
@ -776,6 +850,7 @@ extern UCHAR tx_status[5];
extern float tx_freq[5]; extern float tx_freq[5];
extern float tx_shift[5]; extern float tx_shift[5];
extern unsigned short tx_baudrate[5]; extern unsigned short tx_baudrate[5];
extern unsigned short tx_bitrate[5];
extern unsigned short bpf[5]; extern unsigned short bpf[5];
extern unsigned short lpf[5]; extern unsigned short lpf[5];
@ -910,6 +985,8 @@ extern int PID;
extern char CM108Addr[80]; extern char CM108Addr[80];
extern int HamLibPort; extern int HamLibPort;
extern char HamLibHost[]; extern char HamLibHost[];
extern int FLRigPort;
extern char FLRigHost[];
extern int SCO; extern int SCO;
extern int DualPTT; extern int DualPTT;
@ -927,6 +1004,7 @@ extern BOOL Secondwaterfall;
extern int dcd_threshold; extern int dcd_threshold;
extern int rxOffset; extern int rxOffset;
extern int chanOffset[4]; extern int chanOffset[4];
extern int Continuation[4]; // Sending 2nd or more packet of burst
extern boolean busy; extern boolean busy;
extern boolean dcd[5]; extern boolean dcd[5];
@ -948,6 +1026,9 @@ extern int IPOLL[4];
extern int maxframe[4]; extern int maxframe[4];
extern int TXFrmMode[4]; extern int TXFrmMode[4];
extern int bytes[4];
extern int bytes2mins[4];
extern char MyDigiCall[4][512]; extern char MyDigiCall[4][512];
extern char exclude_callsigns[4][512]; extern char exclude_callsigns[4][512];
extern char exclude_APRS_frm[4][512]; extern char exclude_APRS_frm[4][512];
@ -969,6 +1050,7 @@ extern TAX25Port AX25Port[4][port_num];
extern int fx25_mode[4]; extern int fx25_mode[4];
extern int il2p_mode[4]; extern int il2p_mode[4];
extern int il2p_crc[4];
extern int tx_fx25_size[4]; extern int tx_fx25_size[4];
extern int tx_fx25_size_cnt[4]; extern int tx_fx25_size_cnt[4];
@ -976,6 +1058,10 @@ extern int tx_fx25_mode[4];
extern int SatelliteMode; extern int SatelliteMode;
extern int using48000; // Set if using 48K sample rate (ie RUH Modem active)
extern int txmin, txmax;
// Function prototypes // Function prototypes
void KISS_send_ack(UCHAR port, string * data); void KISS_send_ack(UCHAR port, string * data);
@ -1014,9 +1100,10 @@ double pila(double x);
void AGW_Raw_monitor(int snd_ch, string * data); void AGW_Raw_monitor(int snd_ch, string * data);
// Dephi emulation functions // Delphi emulation functions
string * Strings(TStringList * Q, int Index); string * Strings(TStringList * Q, int Index);
void replaceString(TStringList * Q, int Index, string * item);
void Clear(TStringList * Q); void Clear(TStringList * Q);
int Count(TStringList * List); int Count(TStringList * List);
@ -1053,6 +1140,54 @@ int my_indexof(TStringList * l, string * s);
boolean compareStrings(string * a, string * b); boolean compareStrings(string * a, string * b);
int Add(TStringList * Q, string * Entry); int Add(TStringList * Q, string * Entry);
#define IL2P_SYNC_WORD_SIZE 3
#define IL2P_HEADER_SIZE 13 // Does not include 2 parity.
#define IL2P_HEADER_PARITY 2
#define IL2P_MAX_PAYLOAD_SIZE 1023
#define IL2P_MAX_PAYLOAD_BLOCKS 5
#define IL2P_MAX_PARITY_SYMBOLS 16 // For payload only.
#define IL2P_MAX_ENCODED_PAYLOAD_SIZE (IL2P_MAX_PAYLOAD_SIZE + IL2P_MAX_PAYLOAD_BLOCKS * IL2P_MAX_PARITY_SYMBOLS)
struct il2p_context_s {
enum { IL2P_SEARCHING = 0, IL2P_HEADER, IL2P_PAYLOAD, IL2P_CRC, IL2P_DECODE } state;
unsigned int acc; // Accumulate most recent 24 bits for sync word matching.
// Lower 8 bits are also used for accumulating bytes for
// the header and payload.
int bc; // Bit counter so we know when a complete byte has been accumulated.
int polarity; // 1 if opposite of expected polarity.
unsigned char shdr[IL2P_HEADER_SIZE + IL2P_HEADER_PARITY];
// Scrambled header as received over the radio. Includes parity.
int hc; // Number if bytes placed in above.
unsigned char uhdr[IL2P_HEADER_SIZE]; // Header after FEC and unscrambling.
int eplen; // Encoded payload length. This is not the nuumber from
// from the header but rather the number of encoded bytes to gather.
unsigned char spayload[IL2P_MAX_ENCODED_PAYLOAD_SIZE];
// Scrambled and encoded payload as received over the radio.
int pc; // Number of bytes placed in above.
int corrected; // Number of symbols corrected by RS FEC.
int crccount; // fec chars collected
unsigned char crc[4]; // the 4 fec chars
};
extern int NeedWaterfallHeaders;
#define stringAdd(s1, s2, c) mystringAdd(s1, s2, c, __FILE__, __LINE__)
string * mystringAdd(string * Msg, UCHAR * Chars, int Count, char * FILE, int LINE);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -96,12 +96,24 @@ void freeString(string * Msg)
string * Strings(TStringList * Q, int Index) string * Strings(TStringList * Q, int Index)
{ {
// Gets string at index in stringlist
if (Index >= Q->Count) if (Index >= Q->Count)
return NULL; return NULL;
return Q->Items[Index]; return Q->Items[Index];
} }
void replaceString(TStringList * Q, int Index, string * item)
{
// Gets string at index in stringlist
if (Index >= Q->Count)
return;
Q->Items[Index] = item;
}
int Add(TStringList * Q, string * Entry) int Add(TStringList * Q, string * Entry)
{ {
Q->Items = realloc(Q->Items,(Q->Count + 1) * sizeof(void *)); Q->Items = realloc(Q->Items,(Q->Count + 1) * sizeof(void *));
@ -166,16 +178,27 @@ void setlength(string * Msg, int Count)
Msg->Length = Count; Msg->Length = Count;
} }
string * stringAdd(string * Msg, UCHAR * Chars, int Count) string * mystringAdd(string * Msg, UCHAR * Chars, int Count, char * FILE, int LINE)
{ {
// Add Chars to string // Add Chars to string
if (Count < 0 || Count > 65536)
{
printf("stringAdd Strange Count %d called from %s %d\r\n", Count, FILE, LINE);
}
if (Msg->Length + Count > Msg->AllocatedLength) if (Msg->Length + Count > Msg->AllocatedLength)
{ {
Msg->AllocatedLength += Count + 256; Msg->AllocatedLength += Count + 256;
Msg->Data = realloc(Msg->Data, Msg->AllocatedLength); Msg->Data = realloc(Msg->Data, Msg->AllocatedLength);
} }
if (Msg->Data == 0)
{
printf("realloc failed\r\n");
exit(1);
}
memcpy(&Msg->Data[Msg->Length], Chars, Count); memcpy(&Msg->Data[Msg->Length], Chars, Count);
Msg->Length += Count; Msg->Length += Count;

150
Waveout.c
View File

@ -44,6 +44,11 @@ void printtick(char * msg);
void PollReceivedSamples(); void PollReceivedSamples();
short * SoundInit(); short * SoundInit();
void StdinPollReceivedSamples(); void StdinPollReceivedSamples();
extern void WriteDebugLog(char * Mess);
extern void UDPPollReceivedSamples();
extern void QSleep(int ms);
extern void ProcessNewSamples(short * Samples, int nSamples);
extern void sendSamplestoStdout(short * Samples, int nSamples);
#include <math.h> #include <math.h>
@ -54,12 +59,19 @@ void GetSoundDevices();
// Currently use 1200 samples for TX but 480 for RX to reduce latency // Currently use 1200 samples for TX but 480 for RX to reduce latency
short buffer[2][SendSize * 2]; // Two Transfer/DMA buffers of 0.1 Sec (x2 for Stereo) #define MaxReceiveSize 2048 // Enough for 9600
short inbuffer[5][ReceiveSize * 2]; // Input Transfer/ buffers of 0.1 Sec (x2 for Stereo) #define MaxSendSize 4096
short buffer[4][MaxSendSize * 2]; // Two Transfer/DMA buffers of 0.1 Sec (x2 for Stereo)
short inbuffer[5][MaxReceiveSize * 2]; // Input Transfer/ buffers of 0.1 Sec (x2 for Stereo)
extern short * DMABuffer; extern short * DMABuffer;
extern int Number; extern int Number;
int ReceiveSize = 512;
int SendSize = 1024;
int using48000 = 0;
int SoundMode = 0; int SoundMode = 0;
int stdinMode = 0; int stdinMode = 0;
@ -88,15 +100,19 @@ int PlaybackCount = 0;
char CaptureNames[16][256]= {""}; char CaptureNames[16][256]= {""};
char PlaybackNames[16][256]= {""}; char PlaybackNames[16][256]= {""};
int txLatency;
WAVEFORMATEX wfx = { WAVE_FORMAT_PCM, 2, 12000, 48000, 4, 16, 0 }; WAVEFORMATEX wfx = { WAVE_FORMAT_PCM, 2, 12000, 48000, 4, 16, 0 };
HWAVEOUT hWaveOut = 0; HWAVEOUT hWaveOut = 0;
HWAVEIN hWaveIn = 0; HWAVEIN hWaveIn = 0;
WAVEHDR header[2] = WAVEHDR header[4] =
{ {
{(char *)buffer[0], 0, 0, 0, 0, 0, 0, 0}, {(char *)buffer[0], 0, 0, 0, 0, 0, 0, 0},
{(char *)buffer[1], 0, 0, 0, 0, 0, 0, 0} {(char *)buffer[1], 0, 0, 0, 0, 0, 0, 0},
{(char *)buffer[2], 0, 0, 0, 0, 0, 0, 0},
{(char *)buffer[3], 0, 0, 0, 0, 0, 0, 0}
}; };
WAVEHDR inheader[5] = WAVEHDR inheader[5] =
@ -146,12 +162,6 @@ VOID __cdecl Debugprintf(const char * format, ...)
void platformInit() void platformInit()
{ {
TIMECAPS tc;
unsigned int wTimerRes;
DWORD t, lastt = 0;
int i = 0;
_strupr(CaptureDevice); _strupr(CaptureDevice);
_strupr(PlaybackDevice); _strupr(PlaybackDevice);
@ -183,6 +193,9 @@ void txSleep(int mS)
{ {
// called while waiting for next TX buffer. Run background processes // called while waiting for next TX buffer. Run background processes
if (mS < 0)
return;
while (mS > 50) while (mS > 50)
{ {
if (SoundMode == 3) if (SoundMode == 3)
@ -212,20 +225,20 @@ FILE * wavfp1;
BOOL DMARunning = FALSE; // Used to start DMA on first write BOOL DMARunning = FALSE; // Used to start DMA on first write
BOOL SeeIfCardBusy()
{
if ((header[!Index].dwFlags & WHDR_DONE))
return 0;
return 1;
}
extern void sendSamplestoUDP(short * Samples, int nSamples, int Port); extern void sendSamplestoUDP(short * Samples, int nSamples, int Port);
extern int UDPClientPort; extern int UDPClientPort;
short * SendtoCard(unsigned short * buf, int n) short * SendtoCard(unsigned short * buf, int n)
{ {
int NextBuffer = Index;
char Msg[80];
NextBuffer++;
if (NextBuffer > 3)
NextBuffer = 0;
if (SoundMode == 3) // UDP if (SoundMode == 3) // UDP
{ {
sendSamplestoUDP(buf, n, UDPClientPort); sendSamplestoUDP(buf, n, UDPClientPort);
@ -244,15 +257,17 @@ short * SendtoCard(unsigned short * buf, int n)
waveOutPrepareHeader(hWaveOut, &header[Index], sizeof(WAVEHDR)); waveOutPrepareHeader(hWaveOut, &header[Index], sizeof(WAVEHDR));
waveOutWrite(hWaveOut, &header[Index], sizeof(WAVEHDR)); waveOutWrite(hWaveOut, &header[Index], sizeof(WAVEHDR));
// wait till previous buffer is complete // wait till next buffer is free
while (!(header[!Index].dwFlags & WHDR_DONE)) while (!(header[NextBuffer].dwFlags & WHDR_DONE))
{ {
txSleep(10); // Run buckground while waiting txSleep(5); // Run buckground while waiting
} }
waveOutUnprepareHeader(hWaveOut, &header[!Index], sizeof(WAVEHDR)); waveOutUnprepareHeader(hWaveOut, &header[NextBuffer], sizeof(WAVEHDR));
Index = !Index; Index = NextBuffer;
sprintf(Msg, "TX Buffer %d", NextBuffer);
return &buffer[Index][0]; return &buffer[Index][0];
} }
@ -349,10 +364,11 @@ void GetSoundDevices()
HANDLE hStdin; HANDLE hStdin;
int onlyMixSnoop = 0;
int InitSound(BOOL Report) int InitSound(BOOL Report)
{ {
int i, t, ret; int i, ret;
if (SoundMode == 4) if (SoundMode == 4)
{ {
@ -387,6 +403,8 @@ int InitSound(BOOL Report)
header[0].dwFlags = WHDR_DONE; header[0].dwFlags = WHDR_DONE;
header[1].dwFlags = WHDR_DONE; header[1].dwFlags = WHDR_DONE;
header[2].dwFlags = WHDR_DONE;
header[3].dwFlags = WHDR_DONE;
if (strlen(PlaybackDevice) <= 2) if (strlen(PlaybackDevice) <= 2)
PlayBackIndex = atoi(PlaybackDevice); PlayBackIndex = atoi(PlaybackDevice);
@ -404,6 +422,21 @@ int InitSound(BOOL Report)
} }
} }
if (using48000)
{
wfx.nSamplesPerSec = 48000;
wfx.nAvgBytesPerSec = 48000 * 4;
ReceiveSize = 2048;
SendSize = 4096; // 100 mS for now
}
else
{
wfx.nSamplesPerSec = 12000;
wfx.nAvgBytesPerSec = 12000 * 4;
ReceiveSize = 512;
SendSize = 1024;
}
ret = waveOutOpen(&hWaveOut, PlayBackIndex, &wfx, 0, 0, CALLBACK_NULL); //WAVE_MAPPER ret = waveOutOpen(&hWaveOut, PlayBackIndex, &wfx, 0, 0, CALLBACK_NULL); //WAVE_MAPPER
if (ret) if (ret)
@ -487,9 +520,10 @@ for (i = 0; i < 100; i++)
return TRUE; return TRUE;
} }
static int min = 0, max = 0, lastlevelGUI = 0, lastlevelreport = 0; static int minL = 0, maxL = 0, minR = 0; maxR = 0, lastlevelGUI = 0, lastlevelreport = 0;
static UCHAR CurrentLevel = 0; // Peak from current samples UCHAR CurrentLevel = 0; // Peak from current samples
UCHAR CurrentLevelR = 0; // Peak from current samples
void PollReceivedSamples() void PollReceivedSamples()
{ {
@ -499,7 +533,7 @@ void PollReceivedSamples()
// For level display we want a fairly rapid level average but only want to report // For level display we want a fairly rapid level average but only want to report
// to log every 10 secs or so // to log every 10 secs or so
// with Windows we get mono data // We get stereo data
if (stdinMode) if (stdinMode)
{ {
@ -507,21 +541,31 @@ void PollReceivedSamples()
return; return;
} }
if (inheader[inIndex].dwFlags & WHDR_DONE) while (inheader[inIndex].dwFlags & WHDR_DONE)
{ {
short * ptr = &inbuffer[inIndex][0]; short * ptr = &inbuffer[inIndex][0];
int i; int i;
// Find min and max left abd right samples
for (i = 0; i < ReceiveSize; i++) for (i = 0; i < ReceiveSize; i++)
{ {
if (*(ptr) < min) if (*(ptr) < minL)
min = *ptr; minL = *ptr;
else if (*(ptr) > max) else if (*(ptr) > maxL)
max = *ptr; maxL = *ptr;
ptr++;
if (*(ptr) < minR)
minR = *ptr;
else if (*(ptr) > maxR)
maxR = *ptr;
ptr++; ptr++;
} }
CurrentLevel = ((max - min) * 75) /32768; // Scale to 150 max CurrentLevel = ((maxL - minL) * 75) / 32768; // Scale to 150 max
CurrentLevelR = ((maxR - minR) * 75) / 32768; // Scale to 150 max
if ((Now - lastlevelGUI) > 2000) // 2 Secs if ((Now - lastlevelGUI) > 2000) // 2 Secs
{ {
@ -530,16 +574,18 @@ void PollReceivedSamples()
lastlevelGUI = Now; lastlevelGUI = Now;
if ((Now - lastlevelreport) > 10000) // 10 Secs if ((Now - lastlevelreport) > 60000) // 60 Secs
{ {
char HostCmd[64]; char HostCmd[64];
lastlevelreport = Now; lastlevelreport = Now;
sprintf(HostCmd, "INPUTPEAKS %d %d", min, max); sprintf(HostCmd, "INPUTPEAKS %d %d", minL, maxL);
Debugprintf("Input peaks = %d, %d", min, max); if (UsingBothChannels)
Debugprintf("Input peaks L= %d, %d, R= %d, %d", minL, maxL, minR, maxR);
else
Debugprintf("Input peaks = %d, %d", minL, maxL);
} }
min = max = 0; minL = maxL = minR = maxR = 0;
} }
// debugprintf(LOGDEBUG, "Process %d %d", inIndex, inheader[inIndex].dwBytesRecorded/2); // debugprintf(LOGDEBUG, "Process %d %d", inIndex, inheader[inIndex].dwBytesRecorded/2);
@ -656,6 +702,7 @@ VOID WriteSamples(short * buffer, int len)
short * SoundInit() short * SoundInit()
{ {
Index = 0; Index = 0;
inIndex = 0;
return &buffer[0][0]; return &buffer[0][0];
@ -667,6 +714,8 @@ extern int Number; // Number of samples waiting to be sent
// Subroutine to add trailer before filtering // Subroutine to add trailer before filtering
extern int SampleNo;
void SoundFlush() void SoundFlush()
{ {
// Append Trailer then wait for TX to complete // Append Trailer then wait for TX to complete
@ -684,6 +733,10 @@ void SoundFlush()
txSleep(10); txSleep(10);
while (!(header[1].dwFlags & WHDR_DONE)) while (!(header[1].dwFlags & WHDR_DONE))
txSleep(10); txSleep(10);
while (!(header[2].dwFlags & WHDR_DONE))
txSleep(10);
while (!(header[3].dwFlags & WHDR_DONE))
txSleep(10);
// I think we should turn round the link here. I dont see the point in // I think we should turn round the link here. I dont see the point in
// waiting for MainPoll // waiting for MainPoll
@ -878,6 +931,7 @@ BOOL WriteCOMBlock(HANDLE fd, char * Block, int BytesToWrite)
if ((!fWriteStat) || (BytesToWrite != BytesWritten)) if ((!fWriteStat) || (BytesToWrite != BytesWritten))
{ {
int Err = GetLastError(); int Err = GetLastError();
Debugprintf("Serial Write Error %d", Err);
ClearCommError(fd, &ErrorFlags, &ComStat); ClearCommError(fd, &ErrorFlags, &ComStat);
return FALSE; return FALSE;
} }
@ -954,20 +1008,18 @@ void StdinPollReceivedSamples()
for (i = 0; i < ReceiveSize; i++) for (i = 0; i < ReceiveSize; i++)
{ {
if (*(ptr) < min) if (*(ptr) < minL)
min = *ptr; minL = *ptr;
else if (*(ptr) > max) else if (*(ptr) > maxL)
max = *ptr; maxL = *ptr;
ptr++; ptr++;
} }
CurrentLevel = ((max - min) * 75) / 32768; // Scale to 150 max CurrentLevel = ((maxL - minL) * 75) / 32768; // Scale to 150 max
if ((Now - lastlevelGUI) > 2000) // 2 Secs if ((Now - lastlevelGUI) > 2000) // 2 Secs
{ {
// if (WaterfallActive == 0 && SpectrumActive == 0) // Don't need to send as included in Waterfall Line // RefreshLevel(CurrentLevel); // Signal Level
// SendtoGUI('L', &CurrentLevel, 1); // Signal Level
lastlevelGUI = Now; lastlevelGUI = Now;
if ((Now - lastlevelreport) > 10000) // 10 Secs if ((Now - lastlevelreport) > 10000) // 10 Secs
@ -975,11 +1027,11 @@ void StdinPollReceivedSamples()
char HostCmd[64]; char HostCmd[64];
lastlevelreport = Now; lastlevelreport = Now;
sprintf(HostCmd, "INPUTPEAKS %d %d", min, max); sprintf(HostCmd, "INPUTPEAKS %d %d", minL, maxL);
Debugprintf("Input peaks = %d, %d", min, max); Debugprintf("Input peaks = %d, %d", minL, maxL);
} }
min = max = 0; minL = maxL = 0;
} }
// debugprintf(LOGDEBUG, "Process %d %d", inIndex, inheader[inIndex].dwBytesRecorded/2); // debugprintf(LOGDEBUG, "Process %d %d", inIndex, inheader[inIndex].dwBytesRecorded/2);

View File

@ -40,6 +40,7 @@
#endif #endif
void Debugprintf(const char * format, ...); void Debugprintf(const char * format, ...);
void Sleep(int mS);
extern int Closing; extern int Closing;

54
ax25.c
View File

@ -29,10 +29,20 @@ __declspec(dllimport) unsigned short __stdcall ntohs(__in unsigned short hostsho
#else #else
#include <stdint.h>
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);
#define strtok_s strtok_r #define strtok_s strtok_r
#include <stddef.h> #include <stddef.h>
#endif #endif
void set_DM(int snd_ch, Byte * path);
void rst_values(TAX25Port * AX25Sess);
void decode_frame(Byte * frame, int len, Byte * path, string * data, void decode_frame(Byte * frame, int len, Byte * path, string * data,
Byte * pid, Byte * nr, Byte * ns, Byte * f_type, Byte * f_id, Byte * pid, Byte * nr, Byte * ns, Byte * f_type, Byte * f_id,
Byte * rpt, Byte * pf, Byte * cr); Byte * rpt, Byte * pf, Byte * cr);
@ -244,6 +254,9 @@ int maxframe[4] = { 0,0,0,0 };
int TXFrmMode[4] = { 0,0,0,0 }; int TXFrmMode[4] = { 0,0,0,0 };
int max_frame_collector[4] = { 0,0,0,0 }; int max_frame_collector[4] = { 0,0,0,0 };
int bytes[4] = { 0,0,0,0 };
int bytes2mins[4] = { 0,0,0,0 };
char MyDigiCall[4][512] = { "","","","" }; char MyDigiCall[4][512] = { "","","","" };
char exclude_callsigns[4][512] = { "","","","" }; char exclude_callsigns[4][512] = { "","","","" };
char exclude_APRS_frm[4][512] = { "","","","" }; char exclude_APRS_frm[4][512] = { "","","","" };
@ -869,6 +882,9 @@ int get_addr(char * Calls, UCHAR * AXCalls)
ptr = strtok_s(NULL, " ,", &Context); ptr = strtok_s(NULL, " ,", &Context);
if (ptr == NULL)
return FALSE;
if (ConvToAX25(ptr, axptr) == 0) if (ConvToAX25(ptr, axptr) == 0)
return FALSE; return FALSE;
@ -1526,6 +1542,40 @@ void get_exclude_list(char * line, TStringList * list)
} }
} }
void get_digi_list(char * line, TStringList * list)
{
// Convert comma separated list of calls to ax25 format in list
string axcall;
char copy[512];
char * ptr, *Context;
if (line[0] == 0)
return;
strcpy(copy, line); // copy as strtok messes with it
strcat(copy, ",");
axcall.Length = 7;
axcall.AllocatedLength = 8;
axcall.Data = malloc(8);
memset(axcall.Data, 0, 8);
ptr = strtok_s(copy, " ,", &Context);
while (ptr)
{
if (ConvToAX25(ptr, axcall.Data) == 0)
return;
Add(list, duplicateString(&axcall));
ptr = strtok_s(NULL, " ,", &Context);
}
}
void get_exclude_frm(char * line, TStringList * list) void get_exclude_frm(char * line, TStringList * list)
@ -1692,7 +1742,7 @@ int is_excluded_frm(int snd_ch, int f_id, string * data)
int number_digi(string path) int number_digi(char * path)
{ {
int n = 0; int n = 0;
@ -1959,7 +2009,7 @@ void ax25_init()
initTStringList(&list_digi_callsigns[i]); initTStringList(&list_digi_callsigns[i]);
initTStringList(&KISS_acked[i]); initTStringList(&KISS_acked[i]);
get_exclude_list(MyDigiCall[i], &list_digi_callsigns[i]); get_digi_list(MyDigiCall[i], &list_digi_callsigns[i]);
get_exclude_list(exclude_callsigns[i], &list_exclude_callsigns[i]); get_exclude_list(exclude_callsigns[i], &list_exclude_callsigns[i]);
get_exclude_frm(exclude_APRS_frm[i], &list_exclude_APRS_frm[i]); get_exclude_frm(exclude_APRS_frm[i], &list_exclude_APRS_frm[i]);

View File

@ -22,7 +22,7 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
#include "UZ7HOStuff.h" #include "UZ7HOStuff.h"
extern char modes_name[modes_count][20]; extern char modes_name[modes_count][21];
extern int RSID_SABM[4]; extern int RSID_SABM[4];
extern int RSID_UI[4]; extern int RSID_UI[4];
extern int RSID_SetModem[4]; extern int RSID_SetModem[4];
@ -177,7 +177,7 @@ void AGW_del_socket(void * socket)
if (AGW == NULL) if (AGW == NULL)
return; return;
Clear(&AGW->AGW_frame_buf); // Clear(&AGW->AGW_frame_buf);
freeString(AGW->data_in); freeString(AGW->data_in);
AGW->Monitor = 0; AGW->Monitor = 0;
AGW->Monitor_raw = 0; AGW->Monitor_raw = 0;
@ -189,10 +189,8 @@ void AGW_del_socket(void * socket)
void AGW_add_socket(void * socket) void AGW_add_socket(void * socket)
{ {
AGWUser * User = (struct AGWUser_t *)malloc(sizeof(struct AGWUser_t)); // One Client AGWUser * User = (struct AGWUser_t *)malloc(sizeof(struct AGWUser_t)); // One Client
memset(User, 0, sizeof(struct AGWUser_t));
AGWUsers = realloc(AGWUsers, (AGWConCount + 1) * sizeof(void *)); AGWUsers = realloc(AGWUsers, (AGWConCount + 1) * sizeof(void *));
AGWUsers[AGWConCount++] = User; AGWUsers[AGWConCount++] = User;
User->data_in = newString(); User->data_in = newString();
@ -259,7 +257,7 @@ string * AGW_R_Frame()
string * AGW_X_Frame(char * CallFrom, UCHAR reg_call) string * AGW_X_Frame(char * CallFrom, UCHAR reg_call)
{ {
string * Msg = AGW_frame_header(0, 'x', 0, CallFrom, "", 1); string * Msg = AGW_frame_header(0, 'X', 0, CallFrom, "", 1);
stringAdd(Msg, (UCHAR *)&reg_call, 1); stringAdd(Msg, (UCHAR *)&reg_call, 1);
@ -276,14 +274,17 @@ string * AGW_G_Frame()
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
Ports[0]++;
if (soundChannel[i]) if (soundChannel[i])
{
Ports[0]++;
sprintf(portMsg, "Port%c with SoundCard Ch %c;", Ports[0], 'A' + i); sprintf(portMsg, "Port%c with SoundCard Ch %c;", Ports[0], 'A' + i);
else
sprintf(portMsg, "Port%c Disabled;", Ports[0]);
strcat(Ports, portMsg); strcat(Ports, portMsg);
} }
// else
// sprintf(portMsg, "Port%c Disabled;", Ports[0]);
;
}
Msg = AGW_frame_header(0, 'G', 0, "", "", strlen(Ports) + 1); Msg = AGW_frame_header(0, 'G', 0, "", "", strlen(Ports) + 1);
@ -294,7 +295,6 @@ string * AGW_G_Frame()
}; };
string * AGW_Gs_Frame(int port, Byte * port_info, int Len) string * AGW_Gs_Frame(int port, Byte * port_info, int Len)
{ {
string * Msg; string * Msg;
@ -511,17 +511,57 @@ void on_AGW_R_frame(AGWUser * AGW)
int refreshModems = 0; int refreshModems = 0;
/*
+ 00 On air baud rate(0 = 1200 / 1 = 2400 / 2 = 4800 / 3 = 9600)
+ 01 Traffic level(if 0xFF the port is not in autoupdate mode)
+ 02 TX Delay
+ 03 TX Tail
+ 04 Persist
+ 05 SlotTime
+ 06 MaxFrame
+ 07 How Many connections are active on this port
+ 08 LSB Low Word
+ 09 MSB Low Word
+ 10 LSB High Word
+ 11 MSB High Word HowManyBytes(received in the last 2 minutes) as a 32 bits(4 bytes) integer.Updated every two minutes.
*/
void on_AGW_Gs_frame(AGWUser * AGW, struct AGWHeader * Frame, Byte * Data) void on_AGW_Gs_frame(AGWUser * AGW, struct AGWHeader * Frame, Byte * Data)
{ {
// QTSM with a data field is used by QtSM to set/read Modem Params // QTSM with a data field is used by QtSM to set/read Modem Params
Byte info[44] = { 0, 255, 24, 3, 100, 15, 6, 0, 1, 0, 0, 0 }; //QTSM Signature Byte info[48] = { 0, 255, 24, 3, 100, 15, 6, 0, 1, 0, 0, 0 }; //QTSM Signature
int Len = 12; int Len = 12;
int Port = Frame->Port;
// KD6YAM wants the info to be correct. BPQ used 24, 3, 100 as a signature but could use the Version.
// For now I'll fill in the rest
info[2] = txdelay[Port] / 10;
info[3] = txtail[Port] / 10;
info[4] = persist[Port];
info[5] = slottime[Port];
info[6] = maxframe[Port];
info[7] = 0;
int i = 0;
while (i < port_num)
{
if (AX25Port[Port][i].status != STAT_NO_LINK)
info[7]++;
i++;
}
memcpy(&info[8], &bytes2mins[Port], 4);
if (Frame->DataLength == 32) if (Frame->DataLength == 32)
{ {
// BPQ to QTSM private Format. // BPQ to QTSM private Format.
// First 4 Freq, 4 to 24 Modem, rest was spare. Use 27-31 for modem control flags (fx.25 il2p etc)
int Freq; int Freq;
Byte versionBytes[4] = VersionBytes; Byte versionBytes[4] = VersionBytes;
@ -569,6 +609,13 @@ void on_AGW_Gs_frame(AGWUser * AGW, struct AGWHeader * Frame, Byte * Data)
} }
} }
if (Data[27] == 2)
{
fx25_mode[Frame->Port] = Data[28];
il2p_mode[Frame->Port] = Data[29];
il2p_crc[Frame->Port] = Data[30];
}
// Return Freq and Modem // Return Freq and Modem
memcpy(&info[12], &rx_freq[Frame->Port], 2); memcpy(&info[12], &rx_freq[Frame->Port], 2);
@ -577,6 +624,22 @@ void on_AGW_Gs_frame(AGWUser * AGW, struct AGWHeader * Frame, Byte * Data)
memcpy(&info[38], versionBytes, 4); memcpy(&info[38], versionBytes, 4);
Len = 44; Len = 44;
if (Data[27])
{
// BPQ understands fx25 and il2p fields
AGW->reportFreqAndModem = 2; // Can report frequency Modem and flags
Len = 48;
info[44] = 1; // Show includes Modem Flags
info[45] = fx25_mode[Frame->Port];
info[46] = il2p_mode[Frame->Port];
info[47] = il2p_crc[Frame->Port];
}
AGW_send_to_app(AGW->socket, AGW_Gs_Frame(Frame->Port, info, Len)); AGW_send_to_app(AGW->socket, AGW_Gs_Frame(Frame->Port, info, Len));
return; return;
} }
@ -1335,7 +1398,9 @@ void AGW_Report_Modem_Change(int port)
int i; int i;
AGWUser * AGW; AGWUser * AGW;
string * pkt;
if (soundChannel[port] == 0) // Not in use
return;
// I think we send to all AGW sockets // I think we send to all AGW sockets
@ -1345,16 +1410,27 @@ void AGW_Report_Modem_Change(int port)
if (AGW->reportFreqAndModem) if (AGW->reportFreqAndModem)
{ {
// QTSM 's' Message with a data field is used by QtSM to set/read Modem Params // QTSM 'g' Message with a data field is used by QtSM to set/read Modem Params
Byte info[44] = { 0, 255, 24, 3, 100, 15, 6, 0, 1, 0, 0, 0 }; //QTSM Signature Byte info[48] = { 0, 255, 24, 3, 100, 15, 6, 0, 1, 0, 0, 0 }; //QTSM Signature
int Len = 44;
// Return Freq and Modem // Return Freq and Modem
memcpy(&info[12], &rx_freq[port], 2); memcpy(&info[12], &rx_freq[port], 2);
memcpy(&info[16], modes_name[speed[port]], 20); memcpy(&info[16], modes_name[speed[port]], 20);
info[37] = speed[port]; // Index info[37] = speed[port]; // Index
AGW_send_to_app(AGW->socket, AGW_Gs_Frame(port, info, 44));
if (AGW->reportFreqAndModem == 2)
{
Len = 48;
info[44] = 1; // Show includes Modem Flags
info[45] = fx25_mode[port];
info[46] = il2p_mode[port];
info[47] = il2p_crc[port];
}
AGW_send_to_app(AGW->socket, AGW_Gs_Frame(port, info, Len));
} }
} }
} }
@ -1498,3 +1574,16 @@ void AGW_frame_analiz(AGWUser * AGW)
Debugprintf("AGW %c", Frame->DataKind); Debugprintf("AGW %c", Frame->DataKind);
} }
} }
void doAGW2MinTimer()
{
for (int n = 0; n < 4; n++)
{
if (soundChannel[n] == 0) // Channel not used
continue;
bytes2mins[n] = bytes[n];
bytes[n] = 0;
}
}

View File

@ -27,8 +27,20 @@ extern word MEMRecovery[5];
void make_rx_frame_FX25(int snd_ch, int rcvr_nr, int emph, string * data); void make_rx_frame_FX25(int snd_ch, int rcvr_nr, int emph, string * data);
string * memory_ARQ(TStringList * buf, string * data); string * memory_ARQ(TStringList * buf, string * data);
void CreateStringList(TStringList * List);
void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag);
void KISS_on_data_out(int port, string * frame, int TX);
void updateDCD(int Chan, boolean State);
void Frame_Optimize(TAX25Port * AX25Sess, TStringList * buf);
void RX2TX(int snd_ch);
int fx25_decode_rs(Byte * data, int * eras_pos, int no_eras, int pad, int rs_size);
void il2p_rec_bit(int chan, int subchan, int slice, int dbit);
float GuessCentreFreq(int i); float GuessCentreFreq(int i);
void ProcessRXFrames(int snd_ch);
extern struct il2p_context_s *il2p_context[4][16][3];
/* /*
@ -116,6 +128,8 @@ int dcd_on_hdr[5] = { 0 };
extern int centreFreq[4]; extern int centreFreq[4];
float lastangle[4]; // pevious value for differential modes
unsigned short n_INTR[5] = { 1,1,1,1,1 }; unsigned short n_INTR[5] = { 1,1,1,1,1 };
unsigned short INTR_tap[5] = { 16, 16,16,16,16 }; unsigned short INTR_tap[5] = { 16, 16,16,16,16 };
@ -136,6 +150,7 @@ short active_rx_freq[5] = { 1700, 1700,1700,1700,1700 };
int fx25_mode[4] = { 0, 0, 0, 0 }; int fx25_mode[4] = { 0, 0, 0, 0 };
int il2p_mode[4] = { 0, 0, 0, 0 }; int il2p_mode[4] = { 0, 0, 0, 0 };
int il2p_crc[4] = { 0, 0, 0, 0 };
int pnt_change[5] = { 0 }; int pnt_change[5] = { 0 };
float src_buf[5][2048]; float src_buf[5][2048];
@ -154,6 +169,12 @@ int modemtoSoundLR[4] = { 0 };
struct TDetector_t DET[nr_emph + 1][16]; struct TDetector_t DET[nr_emph + 1][16];
// Chan, Decoder, Emph
float Phases[4][16][nr_emph + 1][4096];
float Mags[4][16][nr_emph + 1][4096];
int nPhases[4][16][nr_emph + 1];
TStringList detect_list_l[5]; TStringList detect_list_l[5];
TStringList detect_list[5]; TStringList detect_list[5];
TStringList detect_list_c[5]; TStringList detect_list_c[5];
@ -322,7 +343,7 @@ void chk_dcd1(int snd_ch, int buf_size)
// ? does this work as Andy passes aborted frames to decoder // ? does this work as Andy passes aborted frames to decoder
Byte port; Byte port;
word i; int i;
single tick; single tick;
word active; word active;
boolean ind_dcd; boolean ind_dcd;
@ -341,6 +362,10 @@ void chk_dcd1(int snd_ch, int buf_size)
{ {
dcd_bit_sync[snd_ch] = blnBusyStatus; dcd_bit_sync[snd_ch] = blnBusyStatus;
} }
else if (modem_mode[snd_ch] == MODE_RUH)
{
dcd_bit_sync[snd_ch] = blnBusyStatus;
}
else else
{ {
if (dcd_bit_cnt[snd_ch] > 0) if (dcd_bit_cnt[snd_ch] > 0)
@ -357,6 +382,7 @@ void chk_dcd1(int snd_ch, int buf_size)
if (lastDCDState[snd_ch] != dcd_bit_sync[snd_ch]) if (lastDCDState[snd_ch] != dcd_bit_sync[snd_ch])
{ {
updateDCD(snd_ch, dcd_bit_sync[snd_ch]);
updateDCD(snd_ch, dcd_bit_sync[snd_ch]); updateDCD(snd_ch, dcd_bit_sync[snd_ch]);
lastDCDState[snd_ch] = dcd_bit_sync[snd_ch]; lastDCDState[snd_ch] = dcd_bit_sync[snd_ch];
} }
@ -406,9 +432,9 @@ void chk_dcd1(int snd_ch, int buf_size)
if (TX_rotate) if (TX_rotate)
{ {
for (int i = 0; i < 4; i++) for (int n = 0; n < 4; n++)
{ {
if (snd_status[i] == SND_TX) if (snd_status[n] == SND_TX)
dcd[snd_ch] = TRUE; dcd[snd_ch] = TRUE;
} }
} }
@ -418,7 +444,7 @@ void chk_dcd1(int snd_ch, int buf_size)
if (!dcd[snd_ch] && resptime_tick[snd_ch] >= resptime[snd_ch]) if (!dcd[snd_ch] && resptime_tick[snd_ch] >= resptime[snd_ch])
{ {
i = 0; int n = 0;
port = new_tx_port[snd_ch]; port = new_tx_port[snd_ch];
do do
@ -446,9 +472,9 @@ void chk_dcd1(int snd_ch, int buf_size)
if (all_frame_buf[snd_ch].Count > 0) if (all_frame_buf[snd_ch].Count > 0)
new_tx_port[snd_ch] = port; new_tx_port[snd_ch] = port;
i++; n++;
} while (all_frame_buf[snd_ch].Count == 0 && i < port_num); } while (all_frame_buf[snd_ch].Count == 0 && n < port_num);
// Add KISS frames // Add KISS frames
@ -458,7 +484,7 @@ void chk_dcd1(int snd_ch, int buf_size)
if (all_frame_buf[snd_ch].Count > 0) if (all_frame_buf[snd_ch].Count > 0)
{ {
for (n = 0; n < all_frame_buf[snd_ch].Count; n++) for (int n = 0; n < all_frame_buf[snd_ch].Count; n++)
{ {
KISS_on_data_out(snd_ch, Strings(&all_frame_buf[snd_ch], n), 1); // Mon TX KISS_on_data_out(snd_ch, Strings(&all_frame_buf[snd_ch], n), 1); // Mon TX
} }
@ -468,14 +494,14 @@ void chk_dcd1(int snd_ch, int buf_size)
if (KISS.buffer[snd_ch].Count > 0) if (KISS.buffer[snd_ch].Count > 0)
{ {
for (n = 0; n < KISS.buffer[snd_ch].Count; n++) for (int k = 0; k < KISS.buffer[snd_ch].Count; k++)
{ {
if (AGWServ) if (AGWServ)
AGW_Raw_monitor(snd_ch, Strings(&KISS.buffer[snd_ch], n)); AGW_Raw_monitor(snd_ch, Strings(&KISS.buffer[snd_ch], n));
// Need to add copy as clear will free original // Need to add copy as clear will free original
Add(&all_frame_buf[snd_ch], duplicateString(Strings(&KISS.buffer[snd_ch], n))); Add(&all_frame_buf[snd_ch], duplicateString(Strings(&KISS.buffer[snd_ch], k)));
} }
Clear(&KISS.buffer[snd_ch]); Clear(&KISS.buffer[snd_ch]);
} }
@ -1341,7 +1367,7 @@ int stats[2] = { 0 };
void decode_stream_MPSK(int snd_ch, int rcvr_nr, float * src, int buf_size, int last) void decode_stream_MPSK(int snd_ch, int rcvr_nr, float * src, int buf_size, int last)
{ {
#ifndef WIN32 #ifndef XXXX
// Until ASM is converted // Until ASM is converted
@ -2787,6 +2813,9 @@ void decode_stream_BPSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
angle = atan2f(sumIQ2, sumIQ1); angle = atan2f(sumIQ2, sumIQ1);
PSK_IZ1 = PkAmpI; PSK_IZ1 = PkAmpI;
PSK_QZ1 = PkAmpQ; PSK_QZ1 = PkAmpQ;
float Mag = sqrtf(powf(PSK_IZ1, 2) + powf(PSK_QZ1, 2));
// Phase corrector // Phase corrector
if (fabsf(angle) < PI5) if (fabsf(angle) < PI5)
@ -2808,11 +2837,24 @@ void decode_stream_BPSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
bit = RX_BIT0; bit = RX_BIT0;
// //
// is this the best place to store phase for constellation?
// only for ilp2 for now
if (il2p_mode[snd_ch]) if (il2p_mode[snd_ch])
{
struct il2p_context_s * il2p = il2p_context[snd_ch][rcvr_nr][emph];
if (il2p && il2p->state > IL2P_SEARCHING)
{
Phases[snd_ch][rcvr_nr][emph][nPhases[snd_ch][rcvr_nr][emph]] = angle;
Mags[snd_ch][rcvr_nr][emph][nPhases[snd_ch][rcvr_nr][emph]++] = Mag;
if (nPhases[snd_ch][rcvr_nr][emph] > 4090)
nPhases[snd_ch][rcvr_nr][emph]--;
}
il2p_rec_bit(snd_ch, rcvr_nr, emph, bit); il2p_rec_bit(snd_ch, rcvr_nr, emph, bit);
if (il2p_mode[snd_ch] == IL2P_MODE_ONLY) // Dont try HDLC decode if (il2p_mode[snd_ch] == IL2P_MODE_ONLY) // Dont try HDLC decode
continue; continue;
}
if (bit) if (bit)
stats[1]++; stats[1]++;
else else
@ -2949,7 +2991,6 @@ void decode_stream_QPSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
struct TDetector_t * pDET = &DET[emph][rcvr_nr]; struct TDetector_t * pDET = &DET[emph][rcvr_nr];
bit_stuff_cnt = pDET->bit_stuff_cnt[snd_ch]; bit_stuff_cnt = pDET->bit_stuff_cnt[snd_ch];
last_rx_bit = pDET->last_rx_bit[snd_ch]; last_rx_bit = pDET->last_rx_bit[snd_ch];
sample_cnt = pDET->sample_cnt[snd_ch]; sample_cnt = pDET->sample_cnt[snd_ch];
@ -3073,6 +3114,8 @@ void decode_stream_QPSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
PSK_IZ1 = PkAmpI; PSK_IZ1 = PkAmpI;
PSK_QZ1 = PkAmpQ; PSK_QZ1 = PkAmpQ;
float Mag = sqrtf(powf(PSK_IZ1, 2) + powf(PSK_QZ1, 2));
if (angle > pi || angle < -pi) if (angle > pi || angle < -pi)
angle = angle; angle = angle;
@ -3120,6 +3163,8 @@ void decode_stream_QPSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
} }
else else
{ {
// "Normal" QPSK
// Phase corrector // Phase corrector
// I think this sends 0 90 180 270 // I think this sends 0 90 180 270
@ -3158,6 +3203,26 @@ void decode_stream_QPSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
{ {
dibit = dibit << 1; dibit = dibit << 1;
// is this the best place to store phase for constellation?
// only for ilp2 for now
if (il2p_mode[snd_ch])
{
struct il2p_context_s * il2p = il2p_context[snd_ch][rcvr_nr][emph];
if (il2p && il2p->state > IL2P_SEARCHING)
{
Phases[snd_ch][rcvr_nr][emph][nPhases[snd_ch][rcvr_nr][emph]] = angle;
Mags[snd_ch][rcvr_nr][emph][nPhases[snd_ch][rcvr_nr][emph]++] = Mag;
if (nPhases[snd_ch][rcvr_nr][emph] > 4090)
nPhases[snd_ch][rcvr_nr][emph]--;
}
il2p_rec_bit(snd_ch, rcvr_nr, emph, (dibit & RX_BIT1));
if (il2p_mode[snd_ch] == IL2P_MODE_ONLY) // Dont try HDLC decode
continue;
}
// NRZI // NRZI
if (last_rx_bit == (dibit & RX_BIT1)) if (last_rx_bit == (dibit & RX_BIT1))
@ -3328,7 +3393,13 @@ void decode_stream_8PSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
dcd_bit_cnt[snd_ch] = 0; dcd_bit_cnt[snd_ch] = 0;
} }
// Not sure how this works
if (tx_baudrate[snd_ch] == 300)
baudrate = 300;
else
baudrate = 1600 / 6; baudrate = 1600 / 6;
div_bit_afc = 1.0 / round(BIT_AFC*(RX_Samplerate / 11025)); div_bit_afc = 1.0 / round(BIT_AFC*(RX_Samplerate / 11025));
x = baudrate / RX_Samplerate; x = baudrate / RX_Samplerate;
max_cnt = round(RX_Samplerate / baudrate) + 1; max_cnt = round(RX_Samplerate / baudrate) + 1;
@ -3403,6 +3474,8 @@ void decode_stream_8PSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
PSK_IZ1 = PkAmpI; PSK_IZ1 = PkAmpI;
PSK_QZ1 = PkAmpQ; PSK_QZ1 = PkAmpQ;
float Mag = sqrtf(powf(PSK_IZ1, 2) + powf(PSK_QZ1, 2));
// Phase corrector // Phase corrector
if (fabsf(angle) < PI125) if (fabsf(angle) < PI125)
@ -3431,7 +3504,6 @@ void decode_stream_8PSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
AngleCorr = AngleCorr * 0.95 - KCorr * 0.05; AngleCorr = AngleCorr * 0.95 - KCorr * 0.05;
angle = angle + AngleCorr; angle = angle + AngleCorr;
//
if (fabsf(angle) < PI125) if (fabsf(angle) < PI125)
tribit = 1; tribit = 1;
@ -3455,6 +3527,29 @@ void decode_stream_8PSK(int last, int snd_ch, int rcvr_nr, int emph, float * src
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
tribit = tribit << 1; tribit = tribit << 1;
// look for il2p before nrzi
// is this the best place to store phase for constellation?
// only for ilp2 for now
if (il2p_mode[snd_ch])
{
struct il2p_context_s * il2p = il2p_context[snd_ch][rcvr_nr][emph];
if (il2p && il2p->state > IL2P_SEARCHING)
{
Phases[snd_ch][rcvr_nr][emph][nPhases[snd_ch][rcvr_nr][emph]] = angle;
Mags[snd_ch][rcvr_nr][emph][nPhases[snd_ch][rcvr_nr][emph]++] = Mag;
if (nPhases[snd_ch][rcvr_nr][emph] > 4090)
nPhases[snd_ch][rcvr_nr][emph]--;
}
il2p_rec_bit(snd_ch, rcvr_nr, emph, tribit & RX_BIT1);
if (il2p_mode[snd_ch] == IL2P_MODE_ONLY) // Dont try HDLC decode
continue;
}
//NRZI //NRZI
if (last_rx_bit == (tribit & RX_BIT1)) if (last_rx_bit == (tribit & RX_BIT1))
@ -3733,6 +3828,14 @@ void make_core_INTR(UCHAR snd_ch)
n_INTR[snd_ch] = 1; n_INTR[snd_ch] = 1;
break; break;
case SPEED_Q300:
case SPEED_8PSK300:
width = roundf(RX_Samplerate / 2);
n_INTR[snd_ch] = 1;
break;
case SPEED_600: case SPEED_600:
width = roundf(RX_Samplerate / 4); width = roundf(RX_Samplerate / 4);
@ -3755,6 +3858,11 @@ void make_core_INTR(UCHAR snd_ch)
n_INTR[snd_ch] = 4; n_INTR[snd_ch] = 4;
break; break;
// case SPEED_Q1200:
// width = roundf(RX_Samplerate / 8);
// n_INTR[snd_ch] = 4;
// break;
case SPEED_Q2400: case SPEED_Q2400:
width = 300; width = 300;
n_INTR[snd_ch] = 4; n_INTR[snd_ch] = 4;
@ -3766,7 +3874,7 @@ void make_core_INTR(UCHAR snd_ch)
n_INTR[snd_ch] = 4; n_INTR[snd_ch] = 4;
break; break;
case SPEED_AE2400: case SPEED_2400V26B:
width = 300; width = 300;
n_INTR[snd_ch] = 4; n_INTR[snd_ch] = 4;
@ -3784,6 +3892,7 @@ void make_core_INTR(UCHAR snd_ch)
break; break;
case SPEED_8P4800: case SPEED_8P4800:
width = 100; width = 100;
n_INTR[snd_ch] = 6; n_INTR[snd_ch] = 6;
break; break;
@ -4121,7 +4230,7 @@ void Demodulator(int snd_ch, int rcvr_nr, float * src_buf, int last, int xcenter
QPSK_Demodulator(snd_ch, rcvr_nr, emph_db[snd_ch], last); QPSK_Demodulator(snd_ch, rcvr_nr, emph_db[snd_ch], last);
} }
// QPSK demodulator // 8PSK demodulator
if (modem_mode[snd_ch]==MODE_8PSK) if (modem_mode[snd_ch]==MODE_8PSK)
{ {
@ -4147,14 +4256,20 @@ void Demodulator(int snd_ch, int rcvr_nr, float * src_buf, int last, int xcenter
// I think this handles multiple decoders and passes packet on to next level // I think this handles multiple decoders and passes packet on to next level
// Packet manager // Packet manager
if (last) if (last)
ProcessRXFrames(snd_ch);
}
void ProcessRXFrames(int snd_ch)
{ {
boolean fecflag = 0; boolean fecflag = 0;
char indicators[5] = "-$#F+"; // None, Single, MEM, FEC, Normal char indicators[5] = "-$#F+"; // None, Single, MEM, FEC, Normal
// Work out which decoder and which emph settings worked. // Work out which decoder and which emph settings worked.
if (snd_ch < 0 || snd_ch > 3)
return;
if (detect_list[snd_ch].Count > 0) // no point if nothing decoded if (detect_list[snd_ch].Count > 0) // no point if nothing decoded
{ {
char decoded[32] = ""; char decoded[32] = "";
@ -4167,7 +4282,7 @@ void Demodulator(int snd_ch, int rcvr_nr, float * src_buf, int last, int xcenter
// The is one DET for each Decoder for each Emph setting // The is one DET for each Decoder for each Emph setting
struct TDetector_t * pDET; struct TDetector_t * pDET;
int i = 0, j; int i = 0, j, found;
int maxemph = nr_emph; int maxemph = nr_emph;
for (i = 0; i <= nr_emph; i++) for (i = 0; i <= nr_emph; i++)
@ -4261,7 +4376,6 @@ void Demodulator(int snd_ch, int rcvr_nr, float * src_buf, int last, int xcenter
} }
chk_dcd1(snd_ch, rx_bufsize); chk_dcd1(snd_ch, rx_bufsize);
} }
}
string * memory_ARQ(TStringList * buf, string * data) string * memory_ARQ(TStringList * buf, string * data)
{ {

View File

@ -28,6 +28,16 @@ extern int RSID_SetModem[4];
extern int needRSID[4]; extern int needRSID[4];
extern int needRSID[4]; extern int needRSID[4];
BOOL useKISSControls = 0;
#define FEND 0xc0
#define FESC 0xDB
#define TFEND 0xDC
#define TFESC 0xDD
#define KISS_ACKMODE 0x0C
#define KISS_DATA 0
#define QTSMKISSCMD 7
/* /*
@ -60,6 +70,23 @@ string * make_frame(string * data, Byte * path, Byte pid, Byte nr, Byte ns, Byt
void rst_t3(TAX25Port * AX25Sess); void rst_t3(TAX25Port * AX25Sess);
TAX25Port * get_user_port(int snd_ch, Byte * path); TAX25Port * get_user_port(int snd_ch, Byte * path);
void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag);
boolean is_last_digi(Byte *path);
int is_excluded_call(int snd_ch, unsigned char * path);
boolean is_correct_path(Byte * path, Byte pid);
void KISS_on_data_out(int port, string * frame, int TX);
void ax25_info_init(TAX25Port * AX25Sess);
void clr_frm_win(TAX25Port * AX25Sess);
void decode_frame(Byte * frame, int len, Byte * path, string * data,
Byte * pid, Byte * nr, Byte * ns, Byte * f_type, Byte * f_id,
Byte * rpt, Byte * pf, Byte * cr);
void ax25_info_init(TAX25Port * AX25Sess);
void AGW_AX25_disc(TAX25Port * AX25Sess, Byte mode);
void AGW_AX25_conn(TAX25Port * AX25Sess, int snd_ch, Byte mode);
int number_digi(char * path);
void AGW_AX25_data_in(void * socket, int snd_ch, int PID, Byte * path, string * data);
void inc_frack(TAX25Port * AX25Sess) void inc_frack(TAX25Port * AX25Sess)
{ {
@ -1100,7 +1127,8 @@ void on_FRMR(void * socket, TAX25Port * AX25Sess, Byte * path)
{ {
AX25Sess->info.stat_end_ses = time(NULL); AX25Sess->info.stat_end_ses = time(NULL);
AGW_AX25_disc(socket, AX25Sess->snd_ch, MODE_OTHER, path); AGW_AX25_disc(AX25Sess, MODE_OTHER);
write_ax25_info(AX25Sess); write_ax25_info(AX25Sess);
} }
@ -1408,6 +1436,11 @@ void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag)
if (len < PKT_ERR) if (len < PKT_ERR)
return; return;
bytes[snd_ch] += frame->Length; // For AGW stats
if (AGWServ)
AGW_AX25_frame_analiz(snd_ch, TRUE, frame);
decode_frame(frame->Data, frame->Length, path, data, &pid, &nr, &ns, &f_type, &f_id, &rpt, &pf, &cr); decode_frame(frame->Data, frame->Length, path, data, &pid, &nr, &ns, &f_type, &f_id, &rpt, &pf, &cr);
if (is_excluded_call(snd_ch, path)) if (is_excluded_call(snd_ch, path))
@ -1415,7 +1448,6 @@ void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag)
// if is_excluded_frm(snd_ch,f_id,data) then excluded:=TRUE; // if is_excluded_frm(snd_ch,f_id,data) then excluded:=TRUE;
if (excluded) if (excluded)
return; return;
@ -1448,8 +1480,21 @@ void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag)
AGW_Raw_monitor(snd_ch, frame); AGW_Raw_monitor(snd_ch, frame);
if (KISSServ) if (KISSServ)
{
if (useKISSControls)
{
// Send a KISS Control frame with frame stats before data frame
int len = strlen(code);
UCHAR * Control = (UCHAR *)malloc(64);
len = sprintf(Control, "%c%cPKTINFO [%s]%c", FEND, (snd_ch) << 4 | QTSMKISSCMD, code, FEND);
KISSSendtoServer(NULL, Control, len);
}
KISS_on_data_out(snd_ch, frame, 0); KISS_on_data_out(snd_ch, frame, 0);
} }
}
// Digipeat frame // Digipeat frame
@ -1618,9 +1663,6 @@ void analiz_frame(int snd_ch, string * frame, char * code, boolean fecflag)
on_FRMR(socket, AX25Sess, path); on_FRMR(socket, AX25Sess, path);
break; break;
} }
if (AGWServ)
AGW_AX25_frame_analiz(snd_ch, TRUE, frame);
} }

View File

@ -25,6 +25,17 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
// I assume this modulates (and sends?} frames // I assume this modulates (and sends?} frames
void InitBuffers();
void EncodeRS(Byte * xData, Byte * xEncoded);
void scrambler(UCHAR * in_buf, int Len);
void fx25_encode_rs(Byte * data, Byte *parity, int pad, int rs_size);
int fx25_decode_rs(Byte * data, int * eras_pos, int no_eras, int pad, int rs_size);
int il2p_get_new_bit_tail(UCHAR snd_ch, UCHAR bit);
int il2p_get_new_bit(int snd_ch, Byte bit);
int ARDOPSendToCard(int Chan, int Len);
void Flush();
void SampleSink(int LR, short Sample);
int RSEncode(UCHAR * bytToRS, UCHAR * RSBytes, int DataLen, int RSLen); int RSEncode(UCHAR * bytToRS, UCHAR * RSBytes, int DataLen, int RSLen);
//unit ax25_mod; //unit ax25_mod;
@ -45,6 +56,7 @@ extern UCHAR modem_mode[];
#define sbc 175 #define sbc 175
extern single ch_offset[4]; extern single ch_offset[4];
int Continuation[4] = { 0, 0, 0, 0 }; // Sending 2nd or more packet of burst
#define COS45 0.70710676908493f #define COS45 0.70710676908493f
@ -90,6 +102,7 @@ float tx_bit_osc[5] = {0}; // : array[1..4] of single=(0,0,0,0};
unsigned short txbpf[5] = { 400, 400, 400, 400, 400}; // : array[1..4] of word=(400,400,400,400}; unsigned short txbpf[5] = { 400, 400, 400, 400, 400}; // : array[1..4] of word=(400,400,400,400};
unsigned short tx_BPF_tap[5] = { 256, 256, 256, 256, 256}; // : array[1..4] of word=(256,256,256,256}; unsigned short tx_BPF_tap[5] = { 256, 256, 256, 256, 256}; // : array[1..4] of word=(256,256,256,256};
unsigned short tx_baudrate[5] = { 300, 300, 300, 300, 300 }; // : array[1..4] of word=(300,300,300,300}; unsigned short tx_baudrate[5] = { 300, 300, 300, 300, 300 }; // : array[1..4] of word=(300,300,300,300};
unsigned short tx_bitrate[5] = { 300, 300, 300, 300, 300 }; // : array[1..4] of word=(300,300,300,300};
unsigned short tx_BPF_timer[5] = {0}; // : array[1..4] of word=(0,0,0,0}; unsigned short tx_BPF_timer[5] = {0}; // : array[1..4] of word=(0,0,0,0};
UCHAR tx_pol[5] = {0}; // : array[1..4] of byte=(0,0,0,0}; UCHAR tx_pol[5] = {0}; // : array[1..4] of byte=(0,0,0,0};
UCHAR tx_last_pol[5] = {0}; // : array[1..4] of byte=(0,0,0,0}; UCHAR tx_last_pol[5] = {0}; // : array[1..4] of byte=(0,0,0,0};
@ -864,7 +877,6 @@ int get_new_bit_tail(UCHAR snd_ch, UCHAR bit)
} }
else else
{ {
Debugprintf("End TXTAIL %d", SampleNo);
tx_status[snd_ch] = TX_WAIT_BPF; tx_status[snd_ch] = TX_WAIT_BPF;
} }
@ -879,7 +891,6 @@ int get_new_bit_tail(UCHAR snd_ch, UCHAR bit)
} }
else else
{ {
Debugprintf("End TXTAIL %d", SampleNo);
tx_status[snd_ch] = TX_WAIT_BPF; tx_status[snd_ch] = TX_WAIT_BPF;
} }
break; break;
@ -1191,11 +1202,13 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX) if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX)
{ {
// il2p generates TXDELAY as part of the frame, so go straight to TX_FRAME
if (tx_status[snd_ch] == TX_DELAY) if (tx_status[snd_ch] == TX_DELAY)
tx_status[snd_ch] = TX_FRAME; // il2p generates TXDELAY as part of the frame, so go straight to TX_FRAME tx_status[snd_ch] = TX_FRAME;
if (tx_status[snd_ch] == TX_TAIL) if (tx_status[snd_ch] == TX_TAIL)
bit = get_new_bit_tail(snd_ch, bit); bit = il2p_get_new_bit_tail(snd_ch, bit);
if (tx_status[snd_ch] == TX_FRAME) if (tx_status[snd_ch] == TX_FRAME)
bit = il2p_get_new_bit(snd_ch, bit); bit = il2p_get_new_bit(snd_ch, bit);
@ -1226,6 +1239,7 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
*bitptr = tx_nrzi(snd_ch, bit); *bitptr = tx_nrzi(snd_ch, bit);
} }
} }
// BPSK Mode // BPSK Mode
@ -1236,11 +1250,10 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
if (tx_status[snd_ch] == TX_SILENCE) if (tx_status[snd_ch] == TX_SILENCE)
{ {
tx_delay_cnt[snd_ch] = 0; tx_delay_cnt[snd_ch] = 0;
Debugprintf("Start TXD");
tx_status[snd_ch] = TX_DELAY; tx_status[snd_ch] = TX_DELAY;
} }
// il2p generates TXDELAY as part of the frame, so go straight too TX_FRAME // il2p generates TXDELAY as part of the frame, so go straight to TX_FRAME
if (tx_status[snd_ch] == TX_DELAY) if (tx_status[snd_ch] == TX_DELAY)
if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX) if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX)
@ -1249,7 +1262,12 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
bit = get_new_bit_delay(snd_ch, bit); bit = get_new_bit_delay(snd_ch, bit);
if (tx_status[snd_ch] == TX_TAIL) if (tx_status[snd_ch] == TX_TAIL)
{
if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX)
bit = il2p_get_new_bit_tail(snd_ch, bit);
else
bit = get_new_bit_tail(snd_ch, bit); bit = get_new_bit_tail(snd_ch, bit);
}
if (tx_status[snd_ch] == TX_FRAME) if (tx_status[snd_ch] == TX_FRAME)
{ {
@ -1260,6 +1278,7 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
else else
bit = get_new_bit(snd_ch, bit); bit = get_new_bit(snd_ch, bit);
} }
// ?? *bitptr = tx_nrzi(snd_ch, bit); // ?? *bitptr = tx_nrzi(snd_ch, bit);
if (bit == 0) if (bit == 0)
@ -1273,7 +1292,7 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
// QPSK Mode // QPSK Mode
if (modem_mode[snd_ch] == MODE_QPSK) else if (modem_mode[snd_ch] == MODE_QPSK)
{ {
dibit = 0; dibit = 0;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
@ -1284,6 +1303,26 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
tx_delay_cnt[snd_ch] = 0; tx_delay_cnt[snd_ch] = 0;
tx_status[snd_ch] = TX_DELAY; tx_status[snd_ch] = TX_DELAY;
} }
if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX)
{
if (tx_status[snd_ch] == TX_DELAY)
tx_status[snd_ch] = TX_FRAME; // il2p generates TXDELAY as part of the frame, so go straight to TX_FRAME
if (tx_status[snd_ch] == TX_TAIL)
bit = il2p_get_new_bit_tail(snd_ch, bit);
if (tx_status[snd_ch] == TX_FRAME)
bit = il2p_get_new_bit(snd_ch, bit);
// No nrzi for il2p
dibit = (dibit << 1) | bit;
}
else
{
// ax25/fx25
if (tx_status[snd_ch] == TX_DELAY) if (tx_status[snd_ch] == TX_DELAY)
bit = get_new_bit_delay(snd_ch, bit); bit = get_new_bit_delay(snd_ch, bit);
if (tx_status[snd_ch] == TX_TAIL) if (tx_status[snd_ch] == TX_TAIL)
@ -1291,6 +1330,8 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
if (tx_status[snd_ch] == TX_FRAME) if (tx_status[snd_ch] == TX_FRAME)
bit = get_new_bit(snd_ch, bit); bit = get_new_bit(snd_ch, bit);
dibit = (dibit << 1) | tx_nrzi(snd_ch, bit); dibit = (dibit << 1) | tx_nrzi(snd_ch, bit);
}
} }
@ -1344,10 +1385,28 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
if (tx_status[snd_ch] == TX_SILENCE) if (tx_status[snd_ch] == TX_SILENCE)
{ {
tx_delay_cnt[snd_ch] = 0; tx_delay_cnt[snd_ch] = 0;
Debugprintf("Start TXD");
tx_status[snd_ch] = TX_DELAY; tx_status[snd_ch] = TX_DELAY;
} }
if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX)
{
if (tx_status[snd_ch] == TX_DELAY)
tx_status[snd_ch] = TX_FRAME; // il2p generates TXDELAY as part of the frame, so go straight to TX_FRAME
if (tx_status[snd_ch] == TX_TAIL)
bit = il2p_get_new_bit_tail(snd_ch, bit);
if (tx_status[snd_ch] == TX_FRAME)
bit = il2p_get_new_bit(snd_ch, bit);
// No nrzi for il2p
dibit = (dibit << 1) | bit;
}
else
{
// ax25/fx25
if (tx_status[snd_ch] == TX_DELAY) if (tx_status[snd_ch] == TX_DELAY)
bit = get_new_bit_delay(snd_ch, bit); bit = get_new_bit_delay(snd_ch, bit);
@ -1360,7 +1419,7 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
*bitptr = tx_nrzi(snd_ch, bit); *bitptr = tx_nrzi(snd_ch, bit);
dibit = (dibit << 1) | *bitptr; dibit = (dibit << 1) | *bitptr;
}
} }
// This returns 3,1,5 or 7 so we use the odd enties in the 8PSK table // This returns 3,1,5 or 7 so we use the odd enties in the 8PSK table
@ -1436,6 +1495,26 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
tx_delay_cnt[snd_ch] = 0; tx_delay_cnt[snd_ch] = 0;
tx_status[snd_ch] = TX_DELAY; tx_status[snd_ch] = TX_DELAY;
} }
if (il2p_mode[snd_ch] >= IL2P_MODE_TXRX)
{
if (tx_status[snd_ch] == TX_DELAY)
tx_status[snd_ch] = TX_FRAME; // il2p generates TXDELAY as part of the frame, so go straight to TX_FRAME
if (tx_status[snd_ch] == TX_TAIL)
bit = il2p_get_new_bit_tail(snd_ch, bit);
if (tx_status[snd_ch] == TX_FRAME)
bit = il2p_get_new_bit(snd_ch, bit);
// No nrzi for il2p
tribit = (tribit << 1) | bit;
}
else
{
// ax25/fx25
if (tx_status[snd_ch] == TX_DELAY) if (tx_status[snd_ch] == TX_DELAY)
bit = get_new_bit_delay(snd_ch, bit); bit = get_new_bit_delay(snd_ch, bit);
if (tx_status[snd_ch] == TX_TAIL) if (tx_status[snd_ch] == TX_TAIL)
@ -1445,7 +1524,7 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
tribit = (tribit << 1) | tx_nrzi(snd_ch, bit); tribit = (tribit << 1) | tx_nrzi(snd_ch, bit);
} }
}
tribit = gray_8PSK[tribit & 7]; tribit = gray_8PSK[tribit & 7];
tx_8PSK[snd_ch] = (tx_8PSK[snd_ch] + tribit) & 7; tx_8PSK[snd_ch] = (tx_8PSK[snd_ch] + tribit) & 7;
@ -1523,7 +1602,6 @@ float make_samples(unsigned char snd_ch, unsigned char * bitptr)
if (tx_status[snd_ch] == TX_SILENCE) if (tx_status[snd_ch] == TX_SILENCE)
{ {
tx_delay_cnt[snd_ch] = 0; tx_delay_cnt[snd_ch] = 0;
Debugprintf("Start TXD");
tx_status[snd_ch] = TX_DELAY; tx_status[snd_ch] = TX_DELAY;
} }
@ -1632,7 +1710,7 @@ float make_samples_calib(UCHAR snd_ch, UCHAR tones)
return amp * sinf(tx_osc[snd_ch]); return amp * sinf(tx_osc[snd_ch]);
} }
int amplitude = 22000; float amplitude = 32000;
void modulator(UCHAR snd_ch, int buf_size) void modulator(UCHAR snd_ch, int buf_size)
{ {
@ -1641,7 +1719,7 @@ void modulator(UCHAR snd_ch, int buf_size)
// I think this is the top of the TX hierarchy // I think this is the top of the TX hierarchy
int i; int i;
short Sample; int Sample;
if (calib_mode[snd_ch] > 0) if (calib_mode[snd_ch] > 0)
{ {
@ -1694,6 +1772,12 @@ void modulator(UCHAR snd_ch, int buf_size)
for (i = 0; i < buf_size; i++) for (i = 0; i < buf_size; i++)
{ {
Sample = tx_BPF_buf[snd_ch][i] * amplitude; Sample = tx_BPF_buf[snd_ch][i] * amplitude;
if (Sample < txmin)
txmin = Sample;
else if (Sample > txmax)
txmax = Sample;
SampleSink(modemtoSoundLR[snd_ch], Sample); SampleSink(modemtoSoundLR[snd_ch], Sample);
} }
} }
@ -1734,7 +1818,22 @@ void modulator(UCHAR snd_ch, int buf_size)
for (i = 0; i < buf_size; i++) for (i = 0; i < buf_size; i++)
{ {
Sample = tx_BPF_buf[snd_ch][i] * 20000.0f; Sample = tx_BPF_buf[snd_ch][i] * amplitude;
if (Sample < txmin)
txmin = Sample;
else if (Sample > txmax)
{
txmax = Sample;
if (txmax > 32767)
{
amplitude = amplitude * 32767 / txmax;
txmax = 32767;
Sample = 32767;
}
}
SampleSink(modemtoSoundLR[snd_ch], Sample); SampleSink(modemtoSoundLR[snd_ch], Sample);
} }
} }

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>270</width> <width>270</width>
<height>411</height> <height>453</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -276,6 +276,19 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QPushButton" name="Cal1500">
<property name="geometry">
<rect>
<x>66</x>
<y>416</y>
<width>139</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>10 secs 1500Hz Tone</string>
</property>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

BIN
debian/QtSoundModem.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

50
debian/changelog vendored Normal file
View File

@ -0,0 +1,50 @@
qtsoundmodem (0.0.0.73~rc1-1) UNRELEASED; urgency=medium
* Upstream import
* Patches refreshed
-- hibby <hibby@velox.lan> Tue, 29 Oct 2024 22:45:40 +0000
qtsoundmodem (0.0.0.72.1-1~hibbian+1) bookworm-hibbian-unstable; urgency=medium
* New upstream release, I was a bit hasty with that 0.72 release earlier
this year
-- Dave Hibberd <hibby@debian.org> Fri, 06 Sep 2024 18:40:36 +0100
qtsoundmodem (0.0.0.72-1) unstable; urgency=medium
* New Upstream release
* Override QA settings for function-implicit-declaration
-- Dave Hibberd <hibby@debian.org> Sat, 13 Apr 2024 19:01:02 +0100
qtsoundmodem (0.0.0.71-1) unstable; urgency=medium
* New Upstream Release
-- Dave Hibberd <d@vehibberd.com> Sun, 17 Dec 2023 14:07:52 +0000
qtsoundmodem (0.0.0.68-1) unstable; urgency=medium
* New Upstream
-- Dave Hibberd <d@vehibberd.com> Tue, 10 Oct 2023 23:03:20 +0100
qtsoundmodem (0.0.0.67-2) unstable; urgency=medium
* Fixing libpulse
-- Dave Hibberd <d@vehibberd.com> Thu, 14 Sep 2023 21:53:22 +0100
qtsoundmodem (0.0.0.67-1) unstable; urgency=medium
* New Upstream
-- Dave Hibberd <d@vehibberd.com> Tue, 12 Sep 2023 21:49:25 +0100
qtsoundmodem (0.0.0.66-1) unstable; urgency=medium
* Initial release.
-- Dave Hibberd <d@vehibberd.com> Tue, 05 Sep 2023 21:13:47 +0100

17
debian/control vendored Normal file
View File

@ -0,0 +1,17 @@
Source: qtsoundmodem
Section: hamradio
Priority: optional
Maintainer: Dave Hibberd <d@vehibberd.com>,
Standards-Version: 4.6.2.0
Vcs-Browser:
Vcs-Git:
Homepage: https://www.cantab.net/users/john.wiseman/Documents/QtSoundModem.html
Build-Depends: debhelper-compat (= 13), qtbase5-dev, qt5-qmake, libqt5serialport5-dev, libfftw3-dev, libpulse-dev, libasound2-dev, extra-xdg-menus
Rules-Requires-Root: no
Package: qtsoundmodem
Architecture: linux-any
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: libpulse0
Description: Qt-based Sound Modem & Terminal for packet
QtSoundModem (QtSM) is a multi-platform port of UZ7HO's SoundModem

29
debian/copyright vendored Normal file
View File

@ -0,0 +1,29 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: QtSoundModem
Upstream-Contact: John Wiseman <bpq32@groups.io>
Source: https://www.cantab.net/users/john.wiseman/Documents/QtSoundModem.html
Files: *
Copyright: 2000-2023 John Wiseman <bpq32@groups.io>
License: GPL-3
Files: debian/*
Copyright: 2023 Dave Hibberd <d@vehibberd.com>
License: GPL-3
License: GPL-3
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 3 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, see <http://www.gnu.org/licenses/>.
.
The GPL License which applies to this package can be found on your Debian
system at /usr/share/common-licenses/GPL-3.

3
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
debian-branch = debian/latest
upstream-branch = upstream/latest

6
debian/gitlab-ci.yml vendored Normal file
View File

@ -0,0 +1,6 @@
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
reprotest:
extends: .test-reprotest-diffoscope

3
debian/install vendored Normal file
View File

@ -0,0 +1,3 @@
QtSoundModem /usr/bin
debian/qtsoundmodem.desktop /usr/share/applications
debian/QtSoundModem.png /usr/share/pixmaps

130
debian/patches/build-fix.patch vendored Normal file
View File

@ -0,0 +1,130 @@
--- a/tcpCode.cpp
+++ b/tcpCode.cpp
@@ -775,7 +775,7 @@
QByteArray datas = HAMLIBsock->readAll();
- qDebug(datas.data());
+ qDebug("SetPTT Error: %s", datas.data());
}
--- a/ax25.c
+++ b/ax25.c
@@ -1758,7 +1758,7 @@
-get_monitor_path(Byte * path, char * mycall, char * corrcall, char * digi)
+void get_monitor_path(Byte * path, char * mycall, char * corrcall, char * digi)
{
Byte * digiptr = digi;
--- a/ax25_l2.c
+++ b/ax25_l2.c
@@ -374,7 +374,7 @@
void delete_I_FRM_port(TAX25Port * AX25Sess)
{
string * frame;
- string path = { 0 };
+ Byte path[80];
string data= { 0 };
Byte pid, nr, ns, f_type, f_id, rpt, cr, pf;
@@ -386,7 +386,7 @@
optimize = TRUE;
frame = Strings(&AX25Sess->frame_buf, i);
- decode_frame(frame->Data, frame->Length, &path, &data, &pid, &nr, &ns, &f_type, &f_id, &rpt, &pf, &cr);
+ decode_frame(frame->Data, frame->Length, path, &data, &pid, &nr, &ns, &f_type, &f_id, &rpt, &pf, &cr);
if (f_id == I_I)
{
@@ -916,7 +916,7 @@
while (i != AX25Sess->hi_vs)
{
- i = (i++) & 7;
+ i = (i + 1) & 7;
need_frame[index++] = i + '0';
if (index > 10)
{
--- a/UZ7HOStuff.h
+++ b/UZ7HOStuff.h
@@ -1096,6 +1096,20 @@
BOOL ConvToAX25(char * callsign, unsigned char * ax25call);
void Debugprintf(const char * format, ...);
+// Hibby's collection for GCC14 and Hardening
+void closeTraceLog();
+void get_monitor_path(Byte * path, char * mycall, char * corrcall, char * digi);
+void decode_frame(Byte * frame, int len, Byte * path, string * data, Byte * pid, Byte * nr, Byte * ns, Byte * f_type, Byte * f_id, Byte * rpt, Byte * pf, Byte * cr);
+void Demodulator(int snd_ch, int rcvr_nr, float * src_buf, int last, int xcenter);
+void sendSamplestoUDP(short * Samples, int nSamples, int Port);
+void RSIDProcessSamples(short * Samples, int nSamples);
+void ARDOPProcessNewSamples(int chan, short * Samples, int nSamples);
+void ProcessRXFrames(int snd_ch);
+void doWaterfall(int snd_ch);
+void displayWaterfall();
+void timer_event();
+void CheckPSKWindows();
+
double pila(double x);
void AGW_Raw_monitor(int snd_ch, string * data);
@@ -1190,4 +1204,4 @@
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
--- a/SMMain.c
+++ b/SMMain.c
@@ -223,8 +223,9 @@
if (using48000)
{
// Need to upsample to 48K. Try just duplicating sample
-
- uint32_t * ptr = &DMABuffer[2 * Number];
+ // split init and initialisation for compiler cleanliness
+ uint32_t * ptr;
+ ptr = (uint32_t *)&DMABuffer[2 * Number];
*(&ptr[1]) = *(ptr);
*(&ptr[2]) = *(ptr);
@@ -388,7 +389,7 @@
#endif
extern int blnBusyStatus;
-BusyDet = 5;
+int BusyDet = 5;
#define PLOTWATERFALL
--- a/sm_main.c
+++ b/sm_main.c
@@ -796,7 +796,8 @@
void runModems()
{
- int snd_ch, res;
+ int snd_ch;
+ void *res;
pthread_t thread[4] = { 0,0,0,0 };
for (snd_ch = 0; snd_ch < 4; snd_ch++)
--- a/il2p.c
+++ b/il2p.c
@@ -394,6 +394,11 @@
typedef enum cmdres_e { cr_00 = 2, cr_cmd = 1, cr_res = 0, cr_11 = 3 } cmdres_t;
+// Hibby: Headers for GCC14
+
+int set_addrs(packet_t pp, char addrs, int num_addr, cmdres_t cr);
+static inline int ax25_get_control_offset(packet_t this_p);
+static inline int ax25_get_num_control(packet_t this_p);
extern packet_t ax25_new(void);

11
debian/patches/fix-bookworm-build.patch vendored Normal file
View File

@ -0,0 +1,11 @@
--- a/tcpCode.cpp
+++ b/tcpCode.cpp
@@ -732,7 +732,7 @@
QByteArray datas = FLRigsock->readAll();
- qDebug(datas.data());
+ qDebug() << "SetPTT Failed";
}

20
debian/patches/libpulse.patch vendored Normal file
View File

@ -0,0 +1,20 @@
--- a/pulse.c
+++ b/pulse.c
@@ -67,7 +67,7 @@
if (handle)
return handle; // already done
- handle = dlopen("libpulse.so", RTLD_LAZY);
+ handle = dlopen("libpulse.so.0", RTLD_LAZY);
if (!handle)
{
@@ -91,7 +91,7 @@
if ((ppa_operation_unref = getModule(handle, "pa_operation_unref")) == NULL) return NULL;
if ((ppa_operation_get_state = getModule(handle, "pa_operation_get_state")) == NULL) return NULL;
- shandle = dlopen("libpulse-simple.so", RTLD_LAZY);
+ shandle = dlopen("libpulse-simple.so.0", RTLD_LAZY);
if (!shandle)
{

3
debian/patches/series vendored Normal file
View File

@ -0,0 +1,3 @@
fix-bookworm-build.patch
libpulse.patch
build-fix.patch

9
debian/postinst vendored Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
SM="/opt/oarc/QtSoundModem"
if [ -d $SM ]; then
rm -rf /opt/oarc/QtSoundModem
fi

13
debian/qtsoundmodem.desktop vendored Normal file
View File

@ -0,0 +1,13 @@
[Desktop Entry]
Name=QtSoundModem
Comment=QtSoundModem
Version=1.0
Exec=/usr/bin/QtSoundModem
GenericName=QtSoundModem
Icon=QtSoundModem
NoDisplay=false
StartupNotify=true
Terminal=false
Type=Application
Categories=Education;HamRadio
X-AppImage-Version=1

7
debian/rules vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/make -f
export QT_SELECT=5
export DEB_BUILD_MAINT_OPTIONS=hardening=+all,qa=-bug-implicit-func
%:
dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

1
debian/source/include-binaries vendored Normal file
View File

@ -0,0 +1 @@
debian/QtSoundModem.png

0
debian/source/lintian-overrides vendored Normal file
View File

View File

@ -0,0 +1,12 @@
#define _MSC_EXTENSIONS
#define _INTEGRAL_MAX_BITS 64
#define _MSC_VER 1916
#define _MSC_FULL_VER 191627051
#define _MSC_BUILD 0
#define _WIN32
#define _M_IX86 600
#define _M_IX86_FP 2
#define _CPPRTTI
#define _DEBUG
#define _MT
#define _DLL

View File

@ -0,0 +1,12 @@
#define _MSC_EXTENSIONS
#define _INTEGRAL_MAX_BITS 64
#define _MSC_VER 1916
#define _MSC_FULL_VER 191627043
#define _MSC_BUILD 0
#define _WIN32
#define _M_IX86 600
#define _M_IX86_FP 2
#define _CPPRTTI
#define _DEBUG
#define _MT
#define _DLL

View File

@ -0,0 +1,12 @@
#define _MSC_EXTENSIONS
#define _INTEGRAL_MAX_BITS 64
#define _MSC_VER 1916
#define _MSC_FULL_VER 191627043
#define _MSC_BUILD 0
#define _WIN32
#define _M_IX86 600
#define _M_IX86_FP 2
#define _CPPRTTI
#define _DEBUG
#define _MT
#define _DLL

12
debug/moc_predefs.h Normal file
View File

@ -0,0 +1,12 @@
#define _MSC_EXTENSIONS
#define _INTEGRAL_MAX_BITS 64
#define _MSC_VER 1916
#define _MSC_FULL_VER 191627043
#define _MSC_BUILD 0
#define _WIN32
#define _M_IX86 600
#define _M_IX86_FP 2
#define _CPPRTTI
#define _DEBUG
#define _MT
#define _DLL

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>535</width> <width>528</width>
<height>698</height> <height>721</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -20,9 +20,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>5</x> <x>5</x>
<y>10</y> <y>0</y>
<width>512</width> <width>513</width>
<height>671</height> <height>711</height>
</rect> </rect>
</property> </property>
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
@ -40,7 +40,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>508</width> <width>508</width>
<height>668</height> <height>706</height>
</rect> </rect>
</property> </property>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
@ -49,7 +49,7 @@
<x>5</x> <x>5</x>
<y>10</y> <y>10</y>
<width>541</width> <width>541</width>
<height>331</height> <height>361</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -60,7 +60,7 @@
<rect> <rect>
<x>108</x> <x>108</x>
<y>25</y> <y>25</y>
<width>261</width> <width>371</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -73,7 +73,7 @@
<rect> <rect>
<x>108</x> <x>108</x>
<y>55</y> <y>55</y>
<width>261</width> <width>371</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -99,7 +99,7 @@
<rect> <rect>
<x>13</x> <x>13</x>
<y>55</y> <y>55</y>
<width>71</width> <width>91</width>
<height>19</height> <height>19</height>
</rect> </rect>
</property> </property>
@ -151,7 +151,7 @@
<rect> <rect>
<x>20</x> <x>20</x>
<y>304</y> <y>304</y>
<width>251</width> <width>231</width>
<height>17</height> <height>17</height>
</rect> </rect>
</property> </property>
@ -159,63 +159,37 @@
<string>Minimize window on startup</string> <string>Minimize window on startup</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="txSamplerate"> <widget class="QLineEdit" name="txLatency">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>108</x> <x>220</x>
<y>124</y> <y>140</y>
<width>63</width> <width>63</width>
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>12000</string> <string>0</string>
</property>
</widget>
<widget class="QLineEdit" name="rxSamplerate">
<property name="geometry">
<rect>
<x>304</x>
<y>124</y>
<width>63</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>12000</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>13</x> <x>13</x>
<y>125</y> <y>140</y>
<width>91</width> <width>201</width>
<height>18</height> <height>18</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>TX SampleRate</string> <string>Soundcard TX latency mS</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>190</x>
<y>125</y>
<width>91</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>RX SampleRate</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="Modem_1_Chan"> <widget class="QComboBox" name="Modem_1_Chan">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>72</x>
<y>164</y> <y>170</y>
<width>86</width> <width>86</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -245,7 +219,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>12</x> <x>12</x>
<y>166</y> <y>172</y>
<width>61</width> <width>61</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -258,7 +232,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
<y>164</y> <y>170</y>
<width>86</width> <width>86</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -283,7 +257,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>165</x> <x>165</x>
<y>166</y> <y>172</y>
<width>21</width> <width>21</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -352,7 +326,7 @@
<rect> <rect>
<x>168</x> <x>168</x>
<y>90</y> <y>90</y>
<width>91</width> <width>131</width>
<height>20</height> <height>20</height>
</rect> </rect>
</property> </property>
@ -406,7 +380,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>290</x> <x>290</x>
<y>164</y> <y>170</y>
<width>86</width> <width>86</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -431,7 +405,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>272</x> <x>272</x>
<y>166</y> <y>172</y>
<width>21</width> <width>21</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -444,7 +418,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>385</x> <x>385</x>
<y>166</y> <y>172</y>
<width>21</width> <width>21</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -457,7 +431,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>400</x> <x>400</x>
<y>164</y> <y>170</y>
<width>86</width> <width>86</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -582,14 +556,53 @@
<string>to</string> <string>to</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="darkTheme">
<property name="geometry">
<rect>
<x>260</x>
<y>304</y>
<width>161</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Dark Theme</string>
</property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QCheckBox" name="onlyMixSnoop">
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<width>421</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Only Mix/Snoop Devices (needs custom .asoundrc)</string>
</property>
</widget>
<widget class="QCheckBox" name="useKISSControls">
<property name="geometry">
<rect>
<x>20</x>
<y>328</y>
<width>271</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Enable KISS Control and Reporting</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="Goup">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>360</y> <y>380</y>
<width>481</width> <width>481</width>
<height>101</height> <height>133</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -600,7 +613,7 @@
<rect> <rect>
<x>22</x> <x>22</x>
<y>24</y> <y>24</y>
<width>121</width> <width>129</width>
<height>18</height> <height>18</height>
</rect> </rect>
</property> </property>
@ -633,7 +646,7 @@
<rect> <rect>
<x>22</x> <x>22</x>
<y>48</y> <y>48</y>
<width>111</width> <width>131</width>
<height>18</height> <height>18</height>
</rect> </rect>
</property> </property>
@ -718,7 +731,7 @@
<rect> <rect>
<x>20</x> <x>20</x>
<y>74</y> <y>74</y>
<width>111</width> <width>135</width>
<height>18</height> <height>18</height>
</rect> </rect>
</property> </property>
@ -726,12 +739,97 @@
<string>UDP Sound Server Host</string> <string>UDP Sound Server Host</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox" name="SixPackSerial">
<property name="geometry">
<rect>
<x>160</x>
<y>100</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_17">
<property name="geometry">
<rect>
<x>20</x>
<y>98</y>
<width>111</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>6Pack Serial Port</string>
</property>
</widget>
<widget class="QLineEdit" name="SixPackTCP">
<property name="geometry">
<rect>
<x>320</x>
<y>100</y>
<width>47</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>252</x>
<y>101</y>
<width>63</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>TCP Port</string>
</property>
</widget>
<widget class="QCheckBox" name="SixPackEnable">
<property name="geometry">
<rect>
<x>380</x>
<y>99</y>
<width>70</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
<widget class="QLineEdit" name="MgmtPort">
<property name="geometry">
<rect>
<x>410</x>
<y>25</y>
<width>47</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_18">
<property name="geometry">
<rect>
<x>340</x>
<y>25</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Mgmt Port</string>
</property>
</widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>470</y> <y>520</y>
<width>481</width> <width>481</width>
<height>151</height> <height>151</height>
</rect> </rect>
@ -748,6 +846,9 @@
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
<property name="editable">
<bool>true</bool>
</property>
</widget> </widget>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="geometry"> <property name="geometry">
@ -930,8 +1031,8 @@
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>140</x> <x>130</x>
<y>626</y> <y>670</y>
<width>215</width> <width>215</width>
<height>33</height> <height>33</height>
</rect> </rect>

4331
dw9600.c Normal file

File diff suppressed because it is too large Load Diff

2042
dw9600.h Normal file

File diff suppressed because it is too large Load Diff

660
il2p.c
View File

@ -42,12 +42,54 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
// IP2P receive code (il2p_rec_bit) is called from the bit receiving code in ax25_demod.c, so includes parallel decoders // IP2P receive code (il2p_rec_bit) is called from the bit receiving code in ax25_demod.c, so includes parallel decoders
#include "UZ7HOStuff.h" #include "UZ7HOStuff.h"
#include <stdint.h> // for uint64_t
void debugHexDump(unsigned char * Data, int Len, char Dirn);
extern void debugTimeStamp(char * Text, char Dirn);
extern int useTimedPTT;
// Oct 2023 Nino has added an optional crc
// Hamming(7,4) Encoding Table
// Enter this table with the 4-bit value to be encoded.
// Returns 7-bit encoded value, with high bit zero'd.
uint8_t Hamming74EncodeTable[16] = { 0x0, 0x71, 0x62, 0x13, 0x54, 0x25, 0x36, 0x47, 0x38, 0x49, 0x5a, 0x2b, 0x6c, 0x1d, 0xe, 0x7f };
// Hamming(7,4) Decoding Table
// Enter this table with 7-bit encoded value, high bit masked.
// Returns 4-bit decoded value.
uint16_t Hamming74DecodeTable[128] = { \
0x0, 0x0, 0x0, 0x3, 0x0, 0x5, 0xe, 0x7, \
0x0, 0x9, 0xe, 0xb, 0xe, 0xd, 0xe, 0xe, \
0x0, 0x3, 0x3, 0x3, 0x4, 0xd, 0x6, 0x3, \
0x8, 0xd, 0xa, 0x3, 0xd, 0xd, 0xe, 0xd, \
0x0, 0x5, 0x2, 0xb, 0x5, 0x5, 0x6, 0x5, \
0x8, 0xb, 0xb, 0xb, 0xc, 0x5, 0xe, 0xb, \
0x8, 0x1, 0x6, 0x3, 0x6, 0x5, 0x6, 0x6, \
0x8, 0x8, 0x8, 0xb, 0x8, 0xd, 0x6, 0xf, \
0x0, 0x9, 0x2, 0x7, 0x4, 0x7, 0x7, 0x7, \
0x9, 0x9, 0xa, 0x9, 0xc, 0x9, 0xe, 0x7, \
0x4, 0x1, 0xa, 0x3, 0x4, 0x4, 0x4, 0x7, \
0xa, 0x9, 0xa, 0xa, 0x4, 0xd, 0xa, 0xf, \
0x2, 0x1, 0x2, 0x2, 0xc, 0x5, 0x2, 0x7, \
0xc, 0x9, 0x2, 0xb, 0xc, 0xc, 0xc, 0xf, \
0x1, 0x1, 0x2, 0x1, 0x4, 0x1, 0x6, 0xf, \
0x8, 0x1, 0xa, 0xf, 0xc, 0xf, 0xf, 0xf };
void Debugprintf(const char * format, ...); void Debugprintf(const char * format, ...);
int SMUpdatePhaseConstellation(int chan, float * Phases, float * Mags, int intPSKPhase, int Count);
extern int openTraceLog();
extern uint64_t writeTraceLog(char * Data);
extern void closeTraceLog();
#define MAX_ADEVS 3 #define MAX_ADEVS 3
@ -69,6 +111,10 @@ void Debugprintf(const char * format, ...);
#define max(x, y) ((x) > (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y)) #define min(x, y) ((x) < (y) ? (x) : (y))
extern int nPhases[4][16][nr_emph + 1];
extern float Phases[4][16][nr_emph + 1][4096];
extern float Mags[4][16][nr_emph + 1][4096];
/* For option to try fixing frames with bad CRC. */ /* For option to try fixing frames with bad CRC. */
typedef enum retry_e { typedef enum retry_e {
@ -89,7 +135,7 @@ typedef struct alevel_s {
alevel_t demod_get_audio_level(int chan, int subchan); alevel_t demod_get_audio_level(int chan, int subchan);
void tone_gen_put_bit(int chan, int dat); void tone_gen_put_bit(int chan, int dat, int scramble);
int ax25memdebug = 1; int ax25memdebug = 1;
@ -104,8 +150,8 @@ int MaxMagIndex = 0;
#ifndef FX25_H #ifndef FX25_H
#define FX25_H #define FX25_H
#include <stdint.h> // for uint64_t
extern unsigned int pskStates[4];
/* Reed-Solomon codec control block */ /* Reed-Solomon codec control block */
struct rs { struct rs {
@ -337,6 +383,7 @@ struct packet_s {
unsigned char frame_data[AX25_MAX_PACKET_LEN + 1]; unsigned char frame_data[AX25_MAX_PACKET_LEN + 1];
/* Raw frame contents, without the CRC. */ /* Raw frame contents, without the CRC. */
unsigned char crc[4]; // received crc
int magic2; /* Will get stomped on if above overflows. */ int magic2; /* Will get stomped on if above overflows. */
}; };
@ -702,7 +749,7 @@ packet_t ax25_new(void)
//if (new_count > delete_count + 100) { //if (new_count > delete_count + 100) {
if (new_count > delete_count + 256) { if (new_count > delete_count + 256) {
Debugprintf("Report to WB2OSZ - Memory leak for packet objects. new=%d, delete=%d\n", new_count, delete_count); Debugprintf("Memory leak for packet objects. new=%d, delete=%d\n", new_count, delete_count);
#if AX25MEMDEBUG #if AX25MEMDEBUG
#endif #endif
} }
@ -992,9 +1039,6 @@ packet_t ax25_i_frame(char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int num_add
} /* end ax25_i_frame */ } /* end ax25_i_frame */
extern TStringList detect_list[5]; extern TStringList detect_list[5];
extern TStringList detect_list_c[5]; extern TStringList detect_list_c[5];
@ -1004,10 +1048,67 @@ void multi_modem_process_rec_packet(int snd_ch, int subchan, int slice, packet_t
struct TDetector_t * pDET = &DET[emph][subchan]; struct TDetector_t * pDET = &DET[emph][subchan];
string * data = newString(); string * data = newString();
char Mode[16] = "IL2P"; char Mode[32] = "IL2P";
int Quality = 0;
int CRCOK = 1;
char debugmsg[256];
sprintf(Mode, "IL2P %d", centreFreq); sprintf(Mode, "IL2P %d", centreFreq);
unsigned char * axcall = &pp->frame_data[7];
char call[10];
call[ConvFromAX25(axcall, call)] = 0;
// check crc if enabled
if (il2p_crc[snd_ch] & 1)
{
unsigned short CRCMSG;
unsigned short CRCCALC;
uint8_t crc[4];
// check crc if enabled
// The four encoded CRC bytes are arranged :
// | CRC3 | CRC2 | CRC1 | CRC0 | but we store as received, so F->crc[0] is CRC3
// CRC3 encoded from high nibble of 16 - bit CRC value (from crc2)
// CRC0 encoded from low nibble of 16 - bit CRC value (from crc1)
crc[0] = Hamming74DecodeTable[(pp->crc[0] & 0x7f)];
crc[1] = Hamming74DecodeTable[(pp->crc[1] & 0x7f)];
crc[2] = Hamming74DecodeTable[(pp->crc[2] & 0x7f)];
crc[3] = Hamming74DecodeTable[(pp->crc[3] & 0x7f)];
debugTimeStamp("CRC after Hamming decode is", 'R');
debugHexDump(crc, 4, 'R');
CRCMSG = crc[0] << 12 | crc[1] << 8 | crc[2] << 4 | crc[3];
CRCCALC = get_fcs(pp->frame_data, pp->frame_len);
if (CRCCALC != CRCMSG)
{
CRCOK = 0;
if ((il2p_crc[snd_ch] & 2) == 0) // Ignore CRC Error
{
Debugprintf("CRC Error from %s Decoder %d Calculated %x Received %x FEC corrections %d But ignore CRC Set", call, subchan, CRCCALC, CRCMSG, retries);
sprintf(debugmsg, "CRC Error from %s Decoder %d Calculated %x Received %x FEC corrections %d But ignore CRC Set", call, subchan, CRCCALC, CRCMSG, retries);
debugTimeStamp(debugmsg, 'R');
}
else
{
Debugprintf("CRC Error from %s Decoder %d Calculated %x Received %x FEC corrections %d", call, subchan, CRCCALC, CRCMSG, retries);
freeString(data);
ax25_delete(pp);
return;
}
}
}
stringAdd(data, pp->frame_data, pp->frame_len + 2); // QTSM assumes a CRC stringAdd(data, pp->frame_data, pp->frame_len + 2); // QTSM assumes a CRC
ax25_delete(pp); ax25_delete(pp);
@ -1025,19 +1126,68 @@ void multi_modem_process_rec_packet(int snd_ch, int subchan, int slice, packet_t
pDET->errors = 0; pDET->errors = 0;
} }
if (detect_list[snd_ch].Count > 0 && if (detect_list[snd_ch].Count > 0)
my_indexof(&detect_list[snd_ch], data) >= 0) {
int index = my_indexof(&detect_list[snd_ch], data);
if (index >= 0)
{ {
// Already have a copy of this frame // Already have a copy of this frame
freeString(data); // See if new one has fewer corrections
Debugprintf("Discarding copy rcvr %d emph %d", subchan, 0);
string * xx = Strings(&detect_list_c[snd_ch], index); // Should be corresponding frame info
string * olddata = Strings(&detect_list[snd_ch], index);
if (xx)
{
int oldRetries = xx->Data[255];
int oldCRCOK = xx->Data[254];
if ((oldCRCOK == 0 && CRCOK == 1) || (oldRetries > retries))
{
replaceString(&detect_list[snd_ch], index, data);
freeString(olddata);
// Just update the metadata
Debugprintf("Replacing il2p frame from %s rcvr %d emph %d FEC corrections %d CRCOK %d", call, subchan, slice, retries, CRCOK);
memset(xx->Data, 0, 16);
if (pskStates[snd_ch])
{
Quality = SMUpdatePhaseConstellation(snd_ch, &Phases[snd_ch][subchan][slice][0], &Mags[snd_ch][subchan][slice][0], pskStates[snd_ch], nPhases[snd_ch][subchan][slice]);
sprintf(Mode, "%s][Q%d", Mode, Quality);
}
xx->Length= sprintf(xx->Data, "%s", Mode);
xx->Data[254] = CRCOK;
xx->Data[255] = retries;
return; return;
} }
}
freeString(data);
Debugprintf("Discarding copy rcvr %d emph %d FEC corrections %d", subchan, slice, retries);
return;
}
}
Debugprintf("Good il2p frame from %s rcvr %d emph %d FEC corrections %d", call, subchan, slice, retries);
sprintf(debugmsg, "Good il2p frame from %s rcvr %d emph %d FEC corrections %d", call, subchan, slice, retries);
debugTimeStamp(debugmsg, 'R');
string * xx = newString(); string * xx = newString();
memset(xx->Data, 0, 16); memset(xx->Data, 0, 16);
if (pskStates[snd_ch])
{
Quality = SMUpdatePhaseConstellation(snd_ch, &Phases[snd_ch][subchan][slice][0], &Mags[snd_ch][subchan][slice][0], pskStates[snd_ch], nPhases[snd_ch][subchan][slice]);
sprintf(Mode, "%s][Q%d", Mode, Quality);
}
Add(&detect_list_c[snd_ch], xx); Add(&detect_list_c[snd_ch], xx);
Add(&detect_list[snd_ch], data); Add(&detect_list[snd_ch], data);
@ -1045,6 +1195,12 @@ void multi_modem_process_rec_packet(int snd_ch, int subchan, int slice, packet_t
// sprintf(Mode, "IP2P-%d", retries); // sprintf(Mode, "IP2P-%d", retries);
stringAdd(xx, Mode, strlen(Mode)); stringAdd(xx, Mode, strlen(Mode));
xx->Data[254] = CRCOK;
xx->Data[255] = retries;
closeTraceLog();
openTraceLog();
return; return;
} }
@ -2156,6 +2312,8 @@ void il2p_init(int il2p_debug)
} }
} }
openTraceLog();
} // end il2p_init } // end il2p_init
@ -2256,6 +2414,7 @@ int il2p_decode_rs(unsigned char *rec_block, int data_size, int num_parity, unsi
int derrlocs[FX25_MAX_CHECK]; // Half would probably be OK. int derrlocs[FX25_MAX_CHECK]; // Half would probably be OK.
int derrors = DECODE_RS(il2p_find_rs(num_parity), rs_block, derrlocs, 0); int derrors = DECODE_RS(il2p_find_rs(num_parity), rs_block, derrlocs, 0);
memcpy(out, rs_block + sizeof(rs_block) - n, data_size); memcpy(out, rs_block + sizeof(rs_block) - n, data_size);
if (il2p_get_debug() >= 3) { if (il2p_get_debug() >= 3) {
@ -2753,13 +2912,15 @@ void fx_hex_dump(unsigned char *p, int len)
int il2p_encode_frame(packet_t pp, int max_fec, unsigned char *iout) int il2p_encode_frame(packet_t pp, int max_fec, unsigned char *iout)
{ {
// Can a type 1 header be used? // Can a type 1 header be used?
unsigned char hdr[IL2P_HEADER_SIZE + IL2P_HEADER_PARITY]; unsigned char hdr[IL2P_HEADER_SIZE + IL2P_HEADER_PARITY];
int e; int e;
int out_len = 0; int out_len = 0;
debugTimeStamp("TX Raw Packet is", 'T');
debugHexDump(pp->frame_data, pp->frame_len, 'T');
e = il2p_type_1_header(pp, max_fec, hdr); e = il2p_type_1_header(pp, max_fec, hdr);
if (e >= 0) { if (e >= 0) {
il2p_scramble_block(hdr, iout, IL2P_HEADER_SIZE); il2p_scramble_block(hdr, iout, IL2P_HEADER_SIZE);
@ -2768,10 +2929,15 @@ int il2p_encode_frame(packet_t pp, int max_fec, unsigned char *iout)
if (e == 0) { if (e == 0) {
// Success. No info part. // Success. No info part.
debugTimeStamp("TX Type 1 IL2P Packet no info is", 'T');
debugHexDump(iout, out_len, 'R');
return (out_len); return (out_len);
} }
// Payload is AX.25 info part. // Payload is AX.25 info part.
unsigned char *pinfo; unsigned char *pinfo;
int info_len; int info_len;
info_len = ax25_get_info(pp, &pinfo); info_len = ax25_get_info(pp, &pinfo);
@ -2780,6 +2946,9 @@ int il2p_encode_frame(packet_t pp, int max_fec, unsigned char *iout)
if (k > 0) { if (k > 0) {
out_len += k; out_len += k;
// Success. Info part was <= 1023 bytes. // Success. Info part was <= 1023 bytes.
debugTimeStamp("TX Type 1 IL2P Packet is", 'T');
debugHexDump(iout, out_len, 'T');
return (out_len); return (out_len);
} }
@ -2806,6 +2975,10 @@ int il2p_encode_frame(packet_t pp, int max_fec, unsigned char *iout)
if (k > 0) { if (k > 0) {
out_len += k; out_len += k;
// Success. Entire AX.25 frame <= 1023 bytes. // Success. Entire AX.25 frame <= 1023 bytes.
debugTimeStamp("TX Type 2 IL2P Packet is", 'T');
debugHexDump(iout, out_len, 'T');
return (out_len); return (out_len);
} }
// Something went wrong with the payload encoding. // Something went wrong with the payload encoding.
@ -3135,6 +3308,13 @@ int il2p_type_1_header(packet_t pp, int max_fec, unsigned char *hdr)
ax25_get_addr_no_ssid(pp, AX25_SOURCE, src_addr); ax25_get_addr_no_ssid(pp, AX25_SOURCE, src_addr);
int src_ssid = ax25_get_ssid(pp, AX25_SOURCE); int src_ssid = ax25_get_ssid(pp, AX25_SOURCE);
if ((pp->frame_data[6] & 0x80) == (pp->frame_data[13] & 0x80))
{
// Both C bits are the same (ax.25 v1) so can't be sent as type 1 as will be changed
return -1;
}
unsigned char *a = (unsigned char *)dst_addr; unsigned char *a = (unsigned char *)dst_addr;
for (int i = 0; *a != '\0'; i++, a++) { for (int i = 0; *a != '\0'; i++, a++) {
if (*a < ' ' || *a > '_') { if (*a < ' ' || *a > '_') {
@ -3583,6 +3763,12 @@ int il2p_clarify_header(unsigned char *rec_hdr, unsigned char *corrected_descram
int e = il2p_decode_rs(rec_hdr, IL2P_HEADER_SIZE, IL2P_HEADER_PARITY, corrected); int e = il2p_decode_rs(rec_hdr, IL2P_HEADER_SIZE, IL2P_HEADER_PARITY, corrected);
if (e > 1) // only have 2 rs bytes so can only detect 1 error
{
Debugprintf("Header correction seems ok but errors > 1");
return -1;
}
il2p_descramble_block(corrected, corrected_descrambled_hdr, IL2P_HEADER_SIZE); il2p_descramble_block(corrected, corrected_descrambled_hdr, IL2P_HEADER_SIZE);
return (e); return (e);
@ -3857,45 +4043,14 @@ int il2p_decode_payload(unsigned char *received, int payload_size, int max_fec,
// end il2p_payload.c // end il2p_payload.c
struct il2p_context_s *il2p_context[4][16][3];
struct il2p_context_s {
enum { IL2P_SEARCHING = 0, IL2P_HEADER, IL2P_PAYLOAD, IL2P_DECODE } state;
unsigned int acc; // Accumulate most recent 24 bits for sync word matching.
// Lower 8 bits are also used for accumulating bytes for
// the header and payload.
int bc; // Bit counter so we know when a complete byte has been accumulated.
int polarity; // 1 if opposite of expected polarity.
unsigned char shdr[IL2P_HEADER_SIZE + IL2P_HEADER_PARITY];
// Scrambled header as received over the radio. Includes parity.
int hc; // Number if bytes placed in above.
unsigned char uhdr[IL2P_HEADER_SIZE]; // Header after FEC and unscrambling.
int eplen; // Encoded payload length. This is not the nuumber from
// from the header but rather the number of encoded bytes to gather.
unsigned char spayload[IL2P_MAX_ENCODED_PAYLOAD_SIZE];
// Scrambled and encoded payload as received over the radio.
int pc; // Number of bytes placed in above.
int corrected; // Number of symbols corrected by RS FEC.
};
static struct il2p_context_s *il2p_context[MAX_CHANS][MAX_SUBCHANS][MAX_SLICERS];
/*********************************************************************************** /***********************************************************************************
* *
* Name: il2p_rec_bit * Name: il2p_rec_bit
* *
* Purpose: Extract FX.25 packets from a stream of bits. * Purpose: Extract il2p packets from a stream of bits.
* *
* Inputs: chan - Channel number. * Inputs: chan - Channel number.
* *
@ -3920,8 +4075,11 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
if (dbit) if (dbit)
dbit = 1; dbit = 1;
else
dbit = 0;
struct il2p_context_s *F = il2p_context[chan][subchan][slice]; struct il2p_context_s *F = il2p_context[chan][subchan][slice];
if (F == NULL) { if (F == NULL) {
//assert(chan >= 0 && chan < MAX_CHANS); //assert(chan >= 0 && chan < MAX_CHANS);
//assert(subchan >= 0 && subchan < MAX_SUBCHANS); //assert(subchan >= 0 && subchan < MAX_SUBCHANS);
@ -3948,12 +4106,16 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
F->state = IL2P_HEADER; F->state = IL2P_HEADER;
F->bc = 0; F->bc = 0;
F->hc = 0; F->hc = 0;
nPhases[chan][subchan][slice] = 0;
// Determine Centre Freq // Determine Centre Freq
centreFreq[chan] = GuessCentreFreq(chan); centreFreq[chan] = GuessCentreFreq(chan);
debugTimeStamp("SYNC Detected", 'R');
} }
else if (__builtin_popcount((~F->acc & 0x00ffffff) ^ IL2P_SYNC_WORD) <= 1) { else if (__builtin_popcount((~(F->acc) & 0x00ffffff) ^ IL2P_SYNC_WORD) <= 1) {
// FIXME - this pops up occasionally with random noise. Find better way to convey information. // FIXME - this pops up occasionally with random noise. Find better way to convey information.
// This also happens for each slicer - to noisy. // This also happens for each slicer - to noisy.
//Debugprintf ("IL2P header has reverse polarity\n"); //Debugprintf ("IL2P header has reverse polarity\n");
@ -3962,6 +4124,7 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
F->bc = 0; F->bc = 0;
F->hc = 0; F->hc = 0;
centreFreq[chan] = GuessCentreFreq(chan); centreFreq[chan] = GuessCentreFreq(chan);
nPhases[chan][subchan][slice] = 0;
} }
break; break;
@ -3996,7 +4159,7 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
F->eplen = il2p_payload_compute(&plprop, len, max_fec); F->eplen = il2p_payload_compute(&plprop, len, max_fec);
if (il2p_get_debug() >= 1) if (il2p_get_debug() >= 2)
{ {
Debugprintf("Header type %d, max fec = %d", hdr_type, max_fec); Debugprintf("Header type %d, max fec = %d", hdr_type, max_fec);
Debugprintf("Need to collect %d encoded bytes for %d byte payload.", F->eplen, len); Debugprintf("Need to collect %d encoded bytes for %d byte payload.", F->eplen, len);
@ -4005,12 +4168,30 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
plprop.large_block_count, plprop.large_block_size, plprop.parity_symbols_per_block); plprop.large_block_count, plprop.large_block_size, plprop.parity_symbols_per_block);
} }
if (len > 340)
{
Debugprintf("Packet too big for QtSM");
F->state = IL2P_SEARCHING;
return;
}
if (F->eplen >= 1) { // Need to gather payload. if (F->eplen >= 1) { // Need to gather payload.
F->pc = 0; F->pc = 0;
F->state = IL2P_PAYLOAD; F->state = IL2P_PAYLOAD;
} }
else if (F->eplen == 0) { // No payload. else if (F->eplen == 0)
{
// No payload.
F->pc = 0; F->pc = 0;
if (il2p_crc[chan])
{
// enter collect crc state
F->crccount = 0;
F->state = IL2P_CRC;
}
else
F->state = IL2P_DECODE; F->state = IL2P_DECODE;
} }
else { // Error. else { // Error.
@ -4040,16 +4221,57 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
else { else {
F->spayload[F->pc++] = (~F->acc) & 0xff; F->spayload[F->pc++] = (~F->acc) & 0xff;
} }
if (F->pc == F->eplen) { if (F->pc == F->eplen)
{
// got frame. See if need crc
// TODO?: for symmetry it seems like we should clarify the payload before combining. if (il2p_crc[chan])
{
// enter collect crc state
F->crccount = 0;
F->state = IL2P_CRC;
}
else
F->state = IL2P_DECODE; F->state = IL2P_DECODE;
} }
} }
break; break;
case IL2P_CRC:
F->bc++;
if (F->bc == 8)
{
// full byte has been collected.
F->bc = 0;
if (!F->polarity)
F->crc[F->crccount++] = F->acc & 0xff;
else
F->crc[F->crccount++] = (~F->acc) & 0xff;
if (F->crccount == 4)
{
// have all crc bytes. enter DECODE
debugTimeStamp("CRC Complete Header is", 'R');
debugHexDump(F->shdr, 15, 'R');
if (F->pc)
{
debugTimeStamp("Payload is", 'R');
debugHexDump(F->spayload, F->pc, 'R');
}
debugTimeStamp("CRC is", 'R');
debugHexDump(F->crc, 4, 'R');
F->state = IL2P_DECODE;
}
}
break;
case IL2P_DECODE: case IL2P_DECODE:
// We get here after a good header and any payload has been collected. // We get here after a good header and any payload has been collected.
// Processing is delayed by one bit but I think it makes the logic cleaner. // Processing is delayed by one bit but I think it makes the logic cleaner.
// During unit testing be sure to send an extra bit to flush it out at the end. // During unit testing be sure to send an extra bit to flush it out at the end.
@ -4067,10 +4289,12 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
{ {
// Most likely too many FEC errors. // Most likely too many FEC errors.
Debugprintf("FAILED to construct frame in %s.\n", __func__); Debugprintf("FAILED to construct frame in %s.\n", __func__);
debugTimeStamp("Packet Decode failed", 'R');
} }
} }
if (pp != NULL) { if (pp != NULL)
{
alevel_t alevel = demod_get_audio_level(chan, subchan); alevel_t alevel = demod_get_audio_level(chan, subchan);
retry_t retries = F->corrected; retry_t retries = F->corrected;
int is_fx25 = 1; // FIXME: distinguish fx.25 and IL2P. int is_fx25 = 1; // FIXME: distinguish fx.25 and IL2P.
@ -4078,14 +4302,30 @@ void il2p_rec_bit(int chan, int subchan, int slice, int dbit)
// TODO: Could we put last 3 arguments in packet object rather than passing around separately? // TODO: Could we put last 3 arguments in packet object rather than passing around separately?
// if using crc pass received crc to packet object
debugTimeStamp("Decoded Packet is", 'R');
debugHexDump(pp->frame_data, pp->frame_len, 'R');
if (il2p_crc[chan])
{
//copy crc bytes to packet object
pp->crc[0] = F->crc[0];
pp->crc[1] = F->crc[1];
pp->crc[2] = F->crc[2];
pp->crc[3] = F->crc[3];
}
debugTimeStamp("CRC raw bytes", 'R');
debugHexDump(pp->crc, 4, 'R');
multi_modem_process_rec_packet(chan, subchan, slice, pp, alevel, retries, is_fx25, slice, centreFreq[chan]); multi_modem_process_rec_packet(chan, subchan, slice, pp, alevel, retries, is_fx25, slice, centreFreq[chan]);
} }
} // end block for local variables. } // end block for local variables.
if (il2p_get_debug() >= 1) { if (il2p_get_debug() >= 2)
Debugprintf("-----"); Debugprintf("-----");
}
F->state = IL2P_SEARCHING; F->state = IL2P_SEARCHING;
break; break;
@ -4270,19 +4510,25 @@ static void send_bit(int chan, int b, int polarity);
* *
*--------------------------------------------------------------*/ *--------------------------------------------------------------*/
string * il2p_send_frame(int chan, packet_t pp, int max_fec, int polarity) string * il2p_send_frame(int chan, packet_t pp, int max_fec, int polarity)
{ {
unsigned char encoded[IL2P_MAX_PACKET_SIZE]; unsigned char encoded[IL2P_MAX_PACKET_SIZE] = "";
string * packet = newString(); string * packet = newString();
int preamblecount; int preamblecount;
unsigned char preamble[1024]; unsigned char preamble[1024];
// The data includes the 2 byte crc but length doesn't
uint8_t crc1 = pp->frame_data[pp->frame_len]; // Low 8 bits
uint8_t crc2 = pp->frame_data[pp->frame_len + 1]; // High 8 bits
encoded[0] = (IL2P_SYNC_WORD >> 16) & 0xff; encoded[0] = (IL2P_SYNC_WORD >> 16) & 0xff;
encoded[1] = (IL2P_SYNC_WORD >> 8) & 0xff; encoded[1] = (IL2P_SYNC_WORD >> 8) & 0xff;
encoded[2] = (IL2P_SYNC_WORD) & 0xff; encoded[2] = (IL2P_SYNC_WORD) & 0xff;
int elen = il2p_encode_frame(pp, max_fec, encoded + IL2P_SYNC_WORD_SIZE); int elen = il2p_encode_frame(pp, max_fec, encoded + IL2P_SYNC_WORD_SIZE);
if (elen <= 0) { if (elen <= 0) {
Debugprintf("IL2P: Unable to encode frame into IL2P.\n"); Debugprintf("IL2P: Unable to encode frame into IL2P.\n");
return (packet); return (packet);
@ -4290,9 +4536,26 @@ string * il2p_send_frame(int chan, packet_t pp, int max_fec, int polarity)
elen += IL2P_SYNC_WORD_SIZE; elen += IL2P_SYNC_WORD_SIZE;
// if we are using crc add it now. elen should point to end of data
// crc should be at pp->frame_data[pp->frame_len]
if (il2p_crc[chan] & 1)
{
// The four encoded CRC bytes are arranged :
// | CRC3 | CRC2 | CRC1 | CRC0 |
// CRC3 encoded from high nibble of 16 - bit CRC value (from crc2)
// CRC0 encoded from low nibble of 16 - bit CRC value (from crc1)
encoded[elen++] = Hamming74EncodeTable[crc2 >> 4];
encoded[elen++] = Hamming74EncodeTable[crc2 & 0xf];
encoded[elen++] = Hamming74EncodeTable[crc1 >> 4];
encoded[elen++] = Hamming74EncodeTable[crc1 &0xf];
}
number_of_bits_sent[chan] = 0; number_of_bits_sent[chan] = 0;
if (il2p_get_debug() >= 1) { if (il2p_get_debug() >= 2) {
Debugprintf("IL2P frame, max_fec = %d, %d encoded bytes total", max_fec, elen); Debugprintf("IL2P frame, max_fec = %d, %d encoded bytes total", max_fec, elen);
// fx_hex_dump(encoded, elen); // fx_hex_dump(encoded, elen);
} }
@ -4301,23 +4564,38 @@ string * il2p_send_frame(int chan, packet_t pp, int max_fec, int polarity)
// Try using preaamble for txdelay // Try using preaamble for txdelay
preamblecount = (txdelay[chan] * tx_baudrate[chan]) / 8000; // 8 for bits, 1000 for mS // Nino now uses 00 as preamble for QPSK
// We don't need txdelay between frames in one transmission
if (Continuation[chan] == 0)
{
preamblecount = (txdelay[chan] * tx_bitrate[chan]) / 8000; // 8 for bits, 1000 for mS
if (preamblecount > 1024) if (preamblecount > 1024)
preamblecount = 1024; preamblecount = 1024;
if (pskStates[chan]) // PSK Modes
memset(preamble, 01, preamblecount);
else
memset(preamble, IL2P_PREAMBLE, preamblecount); memset(preamble, IL2P_PREAMBLE, preamblecount);
stringAdd(packet, preamble, preamblecount); stringAdd(packet, preamble, preamblecount);
Continuation[chan] = 1;
}
stringAdd(packet, encoded, elen); stringAdd(packet, encoded, elen);
// Add bytes for tail and TX padding, but don't send if another packet is available (?? how ??)
number_of_bits_sent[chan] = 0;
tx_fx25_size[chan] = packet->Length * 8; tx_fx25_size[chan] = packet->Length * 8;
return packet; return packet;
} }
// TX Code. Builds whole packet then sends a bit at a time // TX Code. Builds whole packet then sends a bit at a time
#define TX_SILENCE 0 #define TX_SILENCE 0
@ -4351,14 +4629,18 @@ string * fill_il2p_data(int snd_ch, string * data)
string * result; string * result;
packet_t pp = ax25_new(); packet_t pp = ax25_new();
// Call il2p_send_frame to build the bit stream // Call il2p_send_frame to build the bit stream
pp->frame_len = data->Length - 2; // Included CRC pp->frame_len = data->Length - 2; // Included CRC
memcpy(pp->frame_data, data->Data, data->Length); memcpy(pp->frame_data, data->Data, data->Length); // Copy the crc in case we are going to send it
result = il2p_send_frame(snd_ch, pp, 1, 0); result = il2p_send_frame(snd_ch, pp, 1, 0);
ax25_delete(pp);
debugTimeStamp("TX Complete packet including Preamble and CRC and Tail", 'T');
debugHexDump(result->Data, result->Length, 'T');
return result; return result;
} }
@ -4494,6 +4776,10 @@ int il2p_get_new_bit(int snd_ch, Byte bit)
break; break;
case FRAME_NO_FRAME: case FRAME_NO_FRAME:
// I dont really like this state machine. We have run out of frames to send so
// should go straight to tail. This way we add an extra bit. Or does this really matter ??
tx_tail_cnt[snd_ch] = 0; tx_tail_cnt[snd_ch] = 0;
tx_frame_status[snd_ch] = FRAME_EMPTY; tx_frame_status[snd_ch] = FRAME_EMPTY;
tx_status[snd_ch] = TX_TAIL; tx_status[snd_ch] = TX_TAIL;
@ -4503,5 +4789,251 @@ int il2p_get_new_bit(int snd_ch, Byte bit)
return bit; return bit;
} }
extern int txLatency;
extern int useTImedPTT;
int il2p_get_new_bit_tail(UCHAR snd_ch, UCHAR bit)
{
// This sends reversals. It is an experiment
int tailbits = (txtail[snd_ch] * tx_baudrate[snd_ch]) / 1000;
#ifndef WIN32
if (useTimedPTT)
tailbits += (txLatency * tx_baudrate[snd_ch]) / 1000; // add padding to tx buffer to make sure we don't send silence
#endif
if (tx_tail_cnt[snd_ch]++ > tailbits)
tx_status[snd_ch] = TX_WAIT_BPF;
return (tx_tail_cnt[snd_ch] & 1); // altenating 1/0
}
void debugHexDump(unsigned char * Data, int Len, char Dirn)
{
char Line[256];
#ifndef LOGTX
if (Dirn == 'T')
return;
#endif
#ifndef LOGRX
if (Dirn == 'R')
return;
#endif
while (Len > 0)
{
sprintf(Line, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
Data[0], Data[1], Data[2], Data[3], Data[4], Data[5], Data[6], Data[7],
Data[8], Data[9], Data[10], Data[11], Data[12], Data[13], Data[14], Data[15]);
if (Len < 16)
{
Line[Len * 3] = 10;
Line[Len * 3 + 1] = 0;
}
writeTraceLog(Line);
Data += 16;
Len -= 16;
}
}
// Hamming experiments
// from https://github.com/nasserkessas/hamming-codes/blob/master/hamming.c
#define block unsigned short // 16 bits
#define bit uint8_t // 8 bits (only last is used)
int multipleXor(int *indicies, int len)
{
int val = indicies[0];
for (int i = 1; i < len; i++)
{
val = val ^ indicies[i];
}
return val;
}
bit getBit(unsigned short b, int i)
{
return (b << i) & (int)pow(2, (sizeof(unsigned short) * 8 - 1));
}
unsigned short toggleBit(unsigned short b, int i)
{
return b ^ (1 << i);
}
bit getCharBit(char b, int i)
{
return (b << i) & (int)pow(2, (sizeof(char) * 8 - 1));
}
block modifyBit(block n, int p, bit b)
{
return ((n & ~(1 << (sizeof(block) * 8 - 1 - p))) | (b << (sizeof(block) * 8 - 1 - p)));
}
void encode(char *input, int len, FILE *ptr) {
// Amount of bits in a block //
int bits = sizeof(block) * 8;
// Amount of bits per block used to carry the message //
int messageBits = bits - log2(bits) - 1;
// Amount of blocks needed to encode message //
int blocks = ceil((float)len / messageBits);
// Array of encoded blocks //
block encoded[16];
// Loop through each block //
for (int i = 0; i < blocks + 1; i++) {
printf("On Block %d:\n", i);
// Final encoded block variable //
block thisBlock = 0;
// Amount of "skipped" bits (used for parity) //
int skipped = 0;
// Count of how many bits are "on" //
int onCount = 0;
// Array of "on" bits //
int onList[64];
// Loop through each message bit in this block to populate final block //
for (int j = 0; j < bits; j++) {
// Skip bit if reserved for parity bit //
if ((j & (j - 1)) == 0) { // Check if j is a power of two or 0
skipped++;
continue;
}
bit thisBit;
if (i != blocks) {
// Current overall bit number //
int currentBit = i * messageBits + (j - skipped);
// Current character //
int currentChar = currentBit / (sizeof(char) * 8); // int division
// Value of current bit //
thisBit = currentBit < len * sizeof(char) * 8 ? getCharBit(input[currentChar], currentBit - currentChar * 8) : 0;
}
else {
thisBit = getBit(len / 8, j - skipped + (sizeof(block) * 8 - messageBits));
}
// If bit is "on", add to onList and onCount //
if (thisBit) {
onList[onCount] = j;
onCount++;
}
// Populate final message block //
thisBlock = modifyBit(thisBlock, j, thisBit);
}
// Calculate values of parity bits //
block parityBits = multipleXor(onList, onCount);
// Loop through skipped bits (parity bits) //
for (int k = 1; k < skipped; k++) { // skip bit 0
// If bit is "on", add to onCount
if (getBit(parityBits, sizeof(block) * 8 - skipped + k)) {
onCount++;
}
// Add parity bit to final block //
thisBlock = modifyBit(thisBlock, (int)pow(2, skipped - k - 1), getBit(parityBits, sizeof(block) * 8 - skipped + k));
}
// Add overall parity bit (total parity of onCount) //
thisBlock = modifyBit(thisBlock, 0, onCount & 1);
// Output final block //
// printBlock(thisBlock);
// putchar('\n');
// Add block to encoded blocks //
encoded[i] = thisBlock;
}
// Write encoded message to file //
fwrite(encoded, sizeof(block), blocks + 1, ptr);
}
void decode(block input[], int len, FILE *ptr)
{
// Amount of bits in a block //
int bits = sizeof(block) * 8;
for (int b = 0; b < (len / sizeof(block)); b++) {
printf("On Block %d:\n", b);
// Print initial block //
// printBlock(input[b]);
// Count of how many bits are "on" //
int onCount = 0;
// Array of "on" bits //
int onList[64];
// Populate onCount and onList //
for (int i = 1; i < bits; i++) {
getBit(input[b], i);
if (getBit(input[b], i)) {
onList[onCount] = i;
onCount++;
}
}
// Check for single errors //
int errorLoc = multipleXor(onList, onCount);
if (errorLoc) {
// Check for multiple errors //
if (!(onCount & 1 ^ getBit(input[b], 0))) { // last bit of onCount (total parity) XOR first bit of block (parity bit)
printf("\nMore than one error detected. Aborting.\n");
exit(1);
}
// Flip error bit //
else {
printf("\nDetected error at position %d, flipping bit.\n", errorLoc);
input[b] = toggleBit(input[b], (bits - 1) - errorLoc);
// Re-print block for comparison //
// printBlock(input[b]);
}
}
putchar('\n');
}
}

4502
il2p.c.bak

File diff suppressed because it is too large Load Diff

View File

@ -22,19 +22,7 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
#include "UZ7HOStuff.h" #include "UZ7HOStuff.h"
/* int add_raw_frames(int snd_ch, string * frame, TStringList * buf);
uses sysutils,classes;
procedure KISS_init;
procedure KISS_free;
procedure KISS_add_stream(socket: integer);
procedure KISS_del_stream(socket: integer);
procedure KISS_on_data_in(socket: integer; data: string);
procedure KISS_on_data_out(port: byte; frame: string);
procedure KISS_send_ack(port: byte; data: string);
procedure KISS_send_ack1(port: byte);
*/
// I don't like this. maybe fine for Dephi but overcomlicated for C
// I think I need a struct for each connection, but a simple array of entries should be fine // I think I need a struct for each connection, but a simple array of entries should be fine
// My normal ** and count system // My normal ** and count system
@ -49,6 +37,7 @@ int KISSConCount = 0;
#define TFESC 0xDD #define TFESC 0xDD
#define KISS_ACKMODE 0x0C #define KISS_ACKMODE 0x0C
#define KISS_DATA 0 #define KISS_DATA 0
#define QTSMKISSCMD 7
struct TKISSMode_t KISS; struct TKISSMode_t KISS;
@ -95,7 +84,8 @@ void KISS_add_stream(void * Socket)
KissConnections = realloc(KissConnections, (KISSConCount + 1) * sizeof(void *)); KissConnections = realloc(KissConnections, (KISSConCount + 1) * sizeof(void *));
KISS = KissConnections[KISSConCount++] = malloc(sizeof(KISS)); KISS = KissConnections[KISSConCount++] = malloc(sizeof(*KISS));
memset(KISS, 0, sizeof(*KISS));
KISS->Socket = Socket; KISS->Socket = Socket;
KISS->data_in = newString(); KISS->data_in = newString();
@ -245,7 +235,6 @@ void ProcessKISSFrame(void * socket, UCHAR * Msg, int Len)
Add(&KISS.buffer[Chan], TXMSG); Add(&KISS.buffer[Chan], TXMSG);
} }
return; return;
case KISS_DATA: case KISS_DATA:
@ -473,7 +462,7 @@ void sendAckModeAcks(int snd_ch)
// Socket to reply to is on end // Socket to reply to is on end
Msg += (temp->Length - 4); Msg += (temp->Length - sizeof(void *));
memcpy(&socket, Msg, sizeof(void *)); memcpy(&socket, Msg, sizeof(void *));

BIN
libfftw3f-64-3.lib Normal file

Binary file not shown.

View File

@ -33,15 +33,18 @@ extern void saveSettings();
extern int Closing; extern int Closing;
workerThread *t; workerThread *t;
serialThread *serial;
mynet m1; mynet m1;
QCoreApplication * a; QCoreApplication * a;
QtSoundModem * w; QtSoundModem * w;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char Title[128]; char Title[128];
QString Response;
if (argc > 1 && strcmp(argv[1], "nogui") == 0) if (argc > 1 && strcmp(argv[1], "nogui") == 0)
nonGUIMode = 1; nonGUIMode = 1;
@ -53,6 +56,8 @@ int main(int argc, char *argv[])
qDebug() << Title; qDebug() << Title;
if (nonGUIMode) if (nonGUIMode)
a = new QCoreApplication(argc, argv); a = new QCoreApplication(argc, argv);
else else
@ -60,6 +65,7 @@ int main(int argc, char *argv[])
getSettings(); getSettings();
t = new workerThread; t = new workerThread;
if (nonGUIMode == 0) if (nonGUIMode == 0)
@ -67,13 +73,17 @@ int main(int argc, char *argv[])
w = new QtSoundModem(); w = new QtSoundModem();
char Title[128]; char Title[128];
sprintf(Title, "QtSoundModem Version %s Ports %d/%d", VersionString, AGWPort, KISSPort); sprintf(Title, "QtSoundModem Version %s Ports %d%s/%d%s", VersionString, AGWPort, AGWServ ? "*" : "", KISSPort, KISSServ ? "*" : "");
w->setWindowTitle(Title); w->setWindowTitle(Title);
w->show(); w->show();
} }
QObject::connect(&m1, SIGNAL(HLSetPTT(int)), &m1, SLOT(doHLSetPTT(int)), Qt::QueuedConnection); QObject::connect(&m1, SIGNAL(HLSetPTT(int)), &m1, SLOT(doHLSetPTT(int)), Qt::QueuedConnection);
QObject::connect(&m1, SIGNAL(FLRigSetPTT(int)), &m1, SLOT(doFLRigSetPTT(int)), Qt::QueuedConnection);
QObject::connect(&m1, SIGNAL(mgmtSetPTT(int, int)), &m1, SLOT(domgmtSetPTT(int, int)), Qt::QueuedConnection);
QObject::connect(&m1, SIGNAL(startTimer(int)), &m1, SLOT(dostartTimer(int)), Qt::QueuedConnection); QObject::connect(&m1, SIGNAL(startTimer(int)), &m1, SLOT(dostartTimer(int)), Qt::QueuedConnection);
QObject::connect(&m1, SIGNAL(stopTimer()), &m1, SLOT(dostopTimer()), Qt::QueuedConnection); QObject::connect(&m1, SIGNAL(stopTimer()), &m1, SLOT(dostopTimer()), Qt::QueuedConnection);
@ -85,4 +95,3 @@ int main(int argc, char *argv[])
} }

1
ofdm.c
View File

@ -200,6 +200,7 @@ extern int LastDataFrameType; // Last data frame processed (for Memory ARQ, et
extern int intNAKctr; extern int intNAKctr;
extern int intACKctr; extern int intACKctr;
extern int intTimeouts; extern int intTimeouts;
void ARDOPSampleSink(short Sample);
extern UCHAR goodReceivedBlocks[128]; extern UCHAR goodReceivedBlocks[128];
extern UCHAR goodReceivedBlockLen[128]; extern UCHAR goodReceivedBlockLen[128];

View File

@ -48,7 +48,7 @@ extern int PacketMonLength;
#define ARDOPBufferSize 12000 * 100 #define ARDOPBufferSize 12000 * 100
short ARDOPTXBuffer[4][12000 * 100]; // Enough to hold whole frame of samples short ARDOPTXBuffer[4][ARDOPBufferSize]; // Enough to hold whole frame of samples
int ARDOPTXLen[4] = { 0,0,0,0 }; // Length of frame int ARDOPTXLen[4] = { 0,0,0,0 }; // Length of frame
int ARDOPTXPtr[4] = { 0,0,0,0 }; // Tx Pointer int ARDOPTXPtr[4] = { 0,0,0,0 }; // Tx Pointer

11
release/moc_predefs.h Normal file
View File

@ -0,0 +1,11 @@
#define _MSC_EXTENSIONS
#define _INTEGRAL_MAX_BITS 64
#define _MSC_VER 1916
#define _MSC_FULL_VER 191627043
#define _MSC_BUILD 0
#define _WIN32
#define _M_IX86 600
#define _M_IX86_FP 2
#define _CPPRTTI
#define _MT
#define _DLL

File diff suppressed because it is too large Load Diff

1849
sm_main.c

File diff suppressed because it is too large Load Diff

1431
sm_main.c.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
*/ */
// UZ7HO Soundmodem Port by John Wiseman G8BPQ // UZ7HO Soundmodem Port by John Wiseman G8BPQ
#include <QMessageBox> #include <QMessageBox>
@ -27,15 +28,26 @@ along with QtSoundModem. If not, see http://www.gnu.org/licenses
#define CONNECT(sndr, sig, rcvr, slt) connect(sndr, SIGNAL(sig), rcvr, SLOT(slt)) #define CONNECT(sndr, sig, rcvr, slt) connect(sndr, SIGNAL(sig), rcvr, SLOT(slt))
QList<QTcpSocket*> _MgmtSockets;
QList<QTcpSocket*> _KISSSockets; QList<QTcpSocket*> _KISSSockets;
QList<QTcpSocket*> _AGWSockets; QList<QTcpSocket*> _AGWSockets;
QTcpServer * _KISSserver; QTcpServer * _KISSserver;
QTcpServer * _AGWserver; QTcpServer * _AGWserver;
QTcpServer * SixPackServer;
QTcpSocket *SixPackSocket;
QTcpServer * _MgmtServer;
TMgmtMode ** MgmtConnections = NULL;
int MgmtConCount = 0;
extern workerThread *t; extern workerThread *t;
extern mynet m1; extern mynet m1;
extern serialThread *serial;
QString Response;
extern int MgmtPort;
extern "C" int KISSPort; extern "C" int KISSPort;
extern "C" void * initPulse(); extern "C" void * initPulse();
extern "C" int SoundMode; extern "C" int SoundMode;
@ -44,6 +56,10 @@ extern "C" int UDPClientPort;
extern "C" int UDPServerPort; extern "C" int UDPServerPort;
extern "C" int TXPort; extern "C" int TXPort;
extern char SixPackDevice[256];
extern int SixPackPort;
extern int SixPackEnable;
char UDPHost[64] = ""; char UDPHost[64] = "";
int UDPServ = 0; // UDP Server Active (ie broadcast sound frams as UDP packets) int UDPServ = 0; // UDP Server Active (ie broadcast sound frams as UDP packets)
@ -68,9 +84,10 @@ extern "C"
void MainLoop(); void MainLoop();
void set_speed(int snd_ch, int Modem); void set_speed(int snd_ch, int Modem);
void init_speed(int snd_ch); void init_speed(int snd_ch);
} }
void Process6PackData(unsigned char * Bytes, int Len);
extern "C" int nonGUIMode; extern "C" int nonGUIMode;
QTimer *timer; QTimer *timer;
@ -121,12 +138,56 @@ void mynet::start()
} }
} }
if (MgmtPort)
{
_MgmtServer = new(QTcpServer);
if (_MgmtServer->listen(QHostAddress::Any, MgmtPort))
connect(_MgmtServer, SIGNAL(newConnection()), this, SLOT(onMgmtConnection()));
else
{
if (nonGUIMode)
Debugprintf("Listen failed for Mgmt Port");
else
{
QMessageBox msgBox;
msgBox.setText("Listen failed for Mgmt Port.");
msgBox.exec();
}
}
}
QObject::connect(t, SIGNAL(sendtoKISS(void *, unsigned char *, int)), this, SLOT(sendtoKISS(void *, unsigned char *, int)), Qt::QueuedConnection); QObject::connect(t, SIGNAL(sendtoKISS(void *, unsigned char *, int)), this, SLOT(sendtoKISS(void *, unsigned char *, int)), Qt::QueuedConnection);
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(MyTimerSlot())); connect(timer, SIGNAL(timeout()), this, SLOT(MyTimerSlot()));
timer->start(100); timer->start(100);
if (SixPackEnable)
{
if (SixPackDevice[0] && strcmp(SixPackDevice, "None") != 0) // Using serial
{
serial->startSlave(SixPackDevice, 30000, Response);
serial->start();
// connect(serial, &serialThread::request, this, &QtSoundModem::showRequest);
// connect(serial, &serialThread::error, this, &QtSoundModem::processError);
// connect(serial, &serialThread::timeout, this, &QtSoundModem::processTimeout);
}
else if (SixPackPort) // using TCP
{
SixPackServer = new(QTcpServer);
if (SixPackServer->listen(QHostAddress::Any, SixPackPort))
connect(SixPackServer, SIGNAL(newConnection()), this, SLOT(on6PackConnection()));
}
}
} }
void mynet::MyTimerSlot() void mynet::MyTimerSlot()
@ -172,6 +233,32 @@ void mynet::onAGWReadyRead()
AGW_explode_frame(sender, datas.data(), datas.length()); AGW_explode_frame(sender, datas.data(), datas.length());
} }
void mynet::on6PackReadyRead()
{
QTcpSocket* sender = static_cast<QTcpSocket*>(QObject::sender());
QByteArray datas = sender->readAll();
Process6PackData((unsigned char *)datas.data(), datas.length());
}
void mynet::on6PackSocketStateChanged(QAbstractSocket::SocketState socketState)
{
if (socketState == QAbstractSocket::UnconnectedState)
{
QTcpSocket* sender = static_cast<QTcpSocket*>(QObject::sender());
}
}
void mynet::on6PackConnection()
{
QTcpSocket *clientSocket = SixPackServer->nextPendingConnection();
connect(clientSocket, SIGNAL(readyRead()), this, SLOT(on6PackReadyRead()));
connect(clientSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(on6PackSocketStateChanged(QAbstractSocket::SocketState)));
Debugprintf("6Pack Connect Sock %x", clientSocket);
}
void mynet::onKISSConnection() void mynet::onKISSConnection()
{ {
@ -186,6 +273,183 @@ void mynet::onKISSConnection()
Debugprintf("KISS Connect Sock %x", clientSocket); Debugprintf("KISS Connect Sock %x", clientSocket);
} }
void Mgmt_del_socket(void * socket)
{
int i;
TMgmtMode * MGMT = NULL;
if (MgmtConCount == 0)
return;
for (i = 0; i < MgmtConCount; i++)
{
if (MgmtConnections[i]->Socket == socket)
{
MGMT = MgmtConnections[i];
break;
}
}
if (MGMT == NULL)
return;
// Need to remove entry and move others down
MgmtConCount--;
while (i < MgmtConCount)
{
MgmtConnections[i] = MgmtConnections[i + 1];
i++;
}
}
void mynet::onMgmtConnection()
{
QTcpSocket *clientSocket = (QTcpSocket *)_MgmtServer->nextPendingConnection();
connect(clientSocket, SIGNAL(readyRead()), this, SLOT(onMgmtReadyRead()));
connect(clientSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(onMgmtSocketStateChanged(QAbstractSocket::SocketState)));
_MgmtSockets.append(clientSocket);
// Create a data structure to hold session info
TMgmtMode * MGMT;
MgmtConnections = (TMgmtMode **)realloc(MgmtConnections, (MgmtConCount + 1) * sizeof(void *));
MGMT = MgmtConnections[MgmtConCount++] = (TMgmtMode *)malloc(sizeof(*MGMT));
memset(MGMT, 0, sizeof(*MGMT));
MGMT->Socket = clientSocket;
Debugprintf("Mgmt Connect Sock %x", clientSocket);
clientSocket->write("Connected to QtSM\r");
}
void mynet::onMgmtSocketStateChanged(QAbstractSocket::SocketState socketState)
{
if (socketState == QAbstractSocket::UnconnectedState)
{
QTcpSocket* sender = static_cast<QTcpSocket*>(QObject::sender());
Mgmt_del_socket(sender);
// free(sender->Msg);
_MgmtSockets.removeOne(sender);
Debugprintf("Mgmt Disconnect Sock %x", sender);
}
}
void mynet::onMgmtReadyRead()
{
QTcpSocket* sender = static_cast<QTcpSocket*>(QObject::sender());
MgmtProcessLine(sender);
}
extern "C" void SendMgmtPTT(int snd_ch, int PTTState)
{
// Won't work in non=gui mode
emit m1.mgmtSetPTT(snd_ch, PTTState);
}
extern "C" char * strlop(char * buf, char delim);
extern "C" char modes_name[modes_count][21];
extern "C" int speed[5];
#ifndef WIN32
extern "C" int memicmp(char *a, char *b, int n);
#endif
void mynet::MgmtProcessLine(QTcpSocket* socket)
{
// Find Session
TMgmtMode * MGMT = NULL;
for (int i = 0; i < MgmtConCount; i++)
{
if (MgmtConnections[i]->Socket == socket)
{
MGMT = MgmtConnections[i];
break;
}
}
if (MGMT == NULL)
{
socket->readAll();
return;
}
while (socket->bytesAvailable())
{
QByteArray datas = socket->peek(512);
char * Line = datas.data();
if (strchr(Line, '\r') == 0)
return;
char * rest = strlop(Line, '\r');
int used = rest - Line;
// Read the upto the cr Null
datas = socket->read(used);
Line = datas.data();
rest = strlop(Line, '\r');
if (memicmp(Line, "QtSMPort ", 8) == 0)
{
if (strlen(Line) > 10)
{
int port = atoi(&Line[8]);
int bpqport = atoi(&Line[10]);
if ((port > 0 && port < 5) && (bpqport > 0 && bpqport < 64))
{
MGMT->BPQPort[port - 1] = bpqport;
socket->write("Ok\r");
}
}
}
else if (memicmp(Line, "Modem ", 6) == 0)
{
int port = atoi(&Line[6]);
if (port > 0 && port < 5)
{
// if any more params - if a name follows, set it else return it
char reply[80];
sprintf(reply, "Port %d Chan %d Freq %d Modem %s \r", MGMT->BPQPort[port - 1], port, rx_freq[port - 1], modes_name[speed[port - 1]]);
socket->write(reply);
}
else
socket->write("Invalid Port\r");
}
else
{
socket->write("Invalid command\r");
}
}
}
void mynet::onKISSSocketStateChanged(QAbstractSocket::SocketState socketState) void mynet::onKISSSocketStateChanged(QAbstractSocket::SocketState socketState)
{ {
if (socketState == QAbstractSocket::UnconnectedState) if (socketState == QAbstractSocket::UnconnectedState)
@ -195,6 +459,7 @@ void mynet::onKISSSocketStateChanged(QAbstractSocket::SocketState socketState)
KISS_del_socket(sender); KISS_del_socket(sender);
_KISSSockets.removeOne(sender); _KISSSockets.removeOne(sender);
Debugprintf("KISS Disconnect Sock %x", sender);
} }
} }
@ -235,7 +500,7 @@ void mynet::sendtoKISS(void * sock, unsigned char * Msg, int Len)
QTcpSocket* socket = (QTcpSocket*)sock; QTcpSocket* socket = (QTcpSocket*)sock;
socket->write((char *)Msg, Len); socket->write((char *)Msg, Len);
} }
// free(Msg); free(Msg);
} }
@ -244,6 +509,10 @@ QTcpSocket * HAMLIBsock;
int HAMLIBConnected = 0; int HAMLIBConnected = 0;
int HAMLIBConnecting = 0; int HAMLIBConnecting = 0;
QTcpSocket * FLRIGsock;
int FLRIGConnected = 0;
int FLRIGConnecting = 0;
void mynet::HAMLIBdisplayError(QAbstractSocket::SocketError socketError) void mynet::HAMLIBdisplayError(QAbstractSocket::SocketError socketError)
{ {
switch (socketError) switch (socketError)
@ -332,6 +601,142 @@ extern "C" void HAMLIBSetPTT(int PTTState)
emit m1.HLSetPTT(PTTState); emit m1.HLSetPTT(PTTState);
} }
extern "C" void FLRigSetPTT(int PTTState)
{
// Won't work in non=gui mode
emit m1.FLRigSetPTT(PTTState);
}
QTcpSocket * FLRigsock;
int FLRigConnected = 0;
int FLRigConnecting = 0;
void mynet::FLRigdisplayError(QAbstractSocket::SocketError socketError)
{
switch (socketError)
{
case QAbstractSocket::RemoteHostClosedError:
break;
case QAbstractSocket::HostNotFoundError:
QMessageBox::information(nullptr, tr("QtSM"),
"FLRig host was not found. Please check the "
"host name and portsettings->");
break;
case QAbstractSocket::ConnectionRefusedError:
qDebug() << "FLRig Connection Refused";
break;
default:
qDebug() << "FLRig Connection Failed";
break;
}
FLRigConnecting = 0;
FLRigConnected = 0;
}
void mynet::FLRigreadyRead()
{
unsigned char Buffer[4096];
QTcpSocket* Socket = static_cast<QTcpSocket*>(QObject::sender());
// read the data from the socket. Don't do anyhing with it at the moment
Socket->read((char *)Buffer, 4095);
}
void mynet::onFLRigSocketStateChanged(QAbstractSocket::SocketState socketState)
{
if (socketState == QAbstractSocket::UnconnectedState)
{
// Close any connections
FLRigConnected = 0;
FLRigConnecting = 0;
// delete (FLRigsock);
// FLRigsock = 0;
qDebug() << "FLRig Connection Closed";
}
else if (socketState == QAbstractSocket::ConnectedState)
{
FLRigConnected = 1;
FLRigConnecting = 0;
qDebug() << "FLRig Connected";
}
}
void mynet::ConnecttoFLRig()
{
delete(FLRigsock);
FLRigConnected = 0;
FLRigConnecting = 1;
FLRigsock = new QTcpSocket();
connect(FLRigsock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(FLRigdisplayError(QAbstractSocket::SocketError)));
connect(FLRigsock, SIGNAL(readyRead()), this, SLOT(FLRigreadyRead()));
connect(FLRigsock, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(onFLRigSocketStateChanged(QAbstractSocket::SocketState)));
FLRigsock->connectToHost(FLRigHost, FLRigPort);
return;
}
static char MsgHddr[] = "POST /RPC2 HTTP/1.1\r\n"
"User-Agent: XMLRPC++ 0.8\r\n"
"Host: 127.0.0.1:7362\r\n"
"Content-Type: text/xml\r\n"
"Content-length: %d\r\n"
"\r\n%s";
static char Req[] = "<?xml version=\"1.0\"?>\r\n"
"<methodCall><methodName>%s</methodName>\r\n"
"%s"
"</methodCall>\r\n";
void mynet::doFLRigSetPTT(int c)
{
int Len;
char ReqBuf[512];
char SendBuff[512];
char ValueString[256] = "";
sprintf(ValueString, "<params><param><value><i4>%d</i4></value></param></params\r\n>", c);
Len = sprintf(ReqBuf, Req, "rig.set_ptt", ValueString);
Len = sprintf(SendBuff, MsgHddr, Len, ReqBuf);
if (FLRigsock == nullptr || FLRigsock->state() != QAbstractSocket::ConnectedState)
ConnecttoFLRig();
if (FLRigsock == nullptr || FLRigsock->state() != QAbstractSocket::ConnectedState)
return;
FLRigsock->write(SendBuff);
FLRigsock->waitForBytesWritten(3000);
QByteArray datas = FLRigsock->readAll();
qDebug(datas.data());
}
extern "C" void startTimer(int Time) extern "C" void startTimer(int Time)
{ {
// Won't work in non=gui mode // Won't work in non=gui mode
@ -374,6 +779,36 @@ void mynet::doHLSetPTT(int c)
} }
void mynet::domgmtSetPTT(int snd_ch, int PTTState)
{
char Msg[64];
uint64_t ret;
for (QTcpSocket* socket : _MgmtSockets)
{
// Find Session
TMgmtMode * MGMT = NULL;
for (int i = 0; i < MgmtConCount; i++)
{
if (MgmtConnections[i]->Socket == socket)
{
MGMT = MgmtConnections[i];
break;
}
}
if (MGMT == NULL)
continue;
if (MGMT->BPQPort[snd_ch])
{
sprintf(Msg, "PTT %d %s\r", MGMT->BPQPort[snd_ch], PTTState ? "ON" : "OFF");
ret = socket->write(Msg);
}
}
}

View File

@ -4,6 +4,16 @@
#define CONNECT(sndr, sig, rcvr, slt) connect(sndr, SIGNAL(sig), rcvr, SLOT(slt)) #define CONNECT(sndr, sig, rcvr, slt) connect(sndr, SIGNAL(sig), rcvr, SLOT(slt))
//class myTcpSocket : public QTcpSocket
//{
//public:
// char Msg[512]; // Received message
// int Len;
// int BPQPort[4]; // BPQ port for each modem
//};
class mynet : public QObject class mynet : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -11,6 +21,8 @@ class mynet : public QObject
signals: signals:
void HLSetPTT(int c); void HLSetPTT(int c);
void FLRigSetPTT(int c);
void mgmtSetPTT(int port, int state);
void startTimer(int Time); void startTimer(int Time);
void stopTimer(); void stopTimer();
@ -22,17 +34,27 @@ public:
public slots: public slots:
void onAGWReadyRead(); void onAGWReadyRead();
void onKISSSocketStateChanged(QAbstractSocket::SocketState socketState); void onKISSSocketStateChanged(QAbstractSocket::SocketState socketState);
void onMgmtSocketStateChanged(QAbstractSocket::SocketState socketState);
void onMgmtReadyRead();
void onKISSReadyRead(); void onKISSReadyRead();
void onAGWSocketStateChanged(QAbstractSocket::SocketState socketState); void onAGWSocketStateChanged(QAbstractSocket::SocketState socketState);
void onKISSConnection(); void onKISSConnection();
void onMgmtConnection();
void MyTimerSlot(); void MyTimerSlot();
void onAGWConnection(); void onAGWConnection();
void on6PackConnection();
void on6PackReadyRead();
void on6PackSocketStateChanged(QAbstractSocket::SocketState socketState);
void dropPTT(); void dropPTT();
void displayError(QAbstractSocket::SocketError socketError); void displayError(QAbstractSocket::SocketError socketError);
void sendtoKISS(void * sock, unsigned char * Msg, int Len); void sendtoKISS(void * sock, unsigned char * Msg, int Len);
void FLRigdisplayError(QAbstractSocket::SocketError socketError);
void FLRigreadyRead();
void onFLRigSocketStateChanged(QAbstractSocket::SocketState socketState);
void ConnecttoFLRig();
void HAMLIBdisplayError(QAbstractSocket::SocketError socketError); void HAMLIBdisplayError(QAbstractSocket::SocketError socketError);
void HAMLIBreadyRead(); void HAMLIBreadyRead();
void onHAMLIBSocketStateChanged(QAbstractSocket::SocketState socketState); void onHAMLIBSocketStateChanged(QAbstractSocket::SocketState socketState);
@ -40,6 +62,8 @@ public slots:
void dostartTimer(int Time); void dostartTimer(int Time);
void dostopTimer(); void dostopTimer();
void doHLSetPTT(int c); void doHLSetPTT(int c);
void domgmtSetPTT(int chan, int state);
void doFLRigSetPTT(int c);
void readPendingDatagrams(); void readPendingDatagrams();
void socketError(); void socketError();
@ -53,6 +77,7 @@ private:
int bytesReceived; int bytesReceived;
int TotalBytes; int TotalBytes;
int PayloadSize; int PayloadSize;
void MgmtProcessLine(QTcpSocket* socket);
}; };
@ -64,6 +89,13 @@ signals:
void sendtoTrace(char *, int); void sendtoTrace(char *, int);
void sendtoKISS(void *, unsigned char *, int); void sendtoKISS(void *, unsigned char *, int);
void openSockets(); void openSockets();
void startCWIDTimer();
void setWaterfallImage();
void setLevelImage();
void setConstellationImage(int, int);
void startWatchdog();
void stopWatchdog();
private: private:
void run(); void run();
@ -73,4 +105,3 @@ public: