Compare commits

...

No commits in common. "debian/latest" and "pristine-tar" have entirely different histories.

122 changed files with 7 additions and 87021 deletions

1
.gitignore vendored
View File

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

377
6pack.cpp
View File

@ -1,377 +0,0 @@
/*
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;
}
}

File diff suppressed because it is too large Load Diff

1880
ARDOPC.c

File diff suppressed because it is too large Load Diff

771
ARDOPC.h
View File

@ -1,771 +0,0 @@
#ifndef ARDOPCHEADERDEFINED
#define ARDOPCHEADERDEFINED
#ifdef CONST
#undef CONST
#endif
#define CONST const // for building sample arrays
extern const char ProductName[];
extern const char ProductVersion[];
//#define USE_SOUNDMODEM
#define UseGUI // Enable GUI Front End Support
#ifndef TEENSY
#ifdef UseGUI
// Constellation and Waterfall for GUI interface
//#define PLOTCONSTELLATION
//#define PLOTWATERFALL
//#define PLOTSPECTRUM
#define ConstellationHeight 90
#define ConstellationWidth 90
#define WaterfallWidth 205
#define WaterfallHeight 64
#define SpectrumWidth 205
#define SpectrumHeight 64
#define PLOTRADIUS 42
#define WHITE 0
#define Tomato 1
#define Gold 2
#define Lime 3
#define Yellow 4
#define Orange 5
#define Khaki 6
#define Cyan 7
#define DeepSkyBlue 8
#define RoyalBlue 9
#define Navy 10
#define Black 11
#define Goldenrod 12
#define Fuchsia 13
#endif
#endif
// Sound interface buffer size
#define SendSize 1200 // 100 mS for now
#define ReceiveSize 240 // try 100 mS for now
#define NumberofinBuffers 4
#define MAXCAR 43 // Max OFDM Carriers
#define DATABUFFERSIZE 11000
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#ifndef WIN32
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif
#ifdef WIN32
typedef void *HANDLE;
#else
#define HANDLE int
#endif
void txSleep(int mS);
unsigned int getTicks();
//#ifdef WIN32
//#define round(x) floorf(x + 0.5f);
//#endif
#define Now getTicks()
// DebugLog Severity Levels
#define LOGEMERGENCY 0
#define LOGALERT 1
#define LOGCRIT 2
#define LOGERROR 3
#define LOGWARNING 4
#define LOGNOTICE 5
#define LOGINFO 6
#define LOGDEBUG 7
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
//#include <math.h>
#ifdef M_PI
#undef M_PI
#endif
#define M_PI 3.1415926f
#ifndef TEENSY
#ifndef WIN32
#define LINUX
#endif
#endif
#ifdef __ARM_ARCH
#ifndef TEENSY
#define ARMLINUX
#endif
#endif
#include "ecc.h" // RS Constants
typedef int BOOL;
typedef unsigned char UCHAR;
#define VOID void
#define FALSE 0
#define TRUE 1
#define False 0
#define True 1
// TEENSY Interface board equates
#ifdef TEENSY
#ifdef PIBOARD
#define ISSLED LED0
#else
#define ISSLED LED1
#endif
#define IRSLED LED1
#define TRAFFICLED LED2
#else
#define ISSLED 1
#define IRSLED 2
#define TRAFFICLED 3
#define PKTLED 4
#endif
BOOL KeyPTT(BOOL State);
UCHAR FrameCode(char * strFrameName);
BOOL FrameInfo(UCHAR bytFrameType, int * blnOdd, int * intNumCar, char * strMod,
int * intBaud, int * intDataLen, int * intRSLen, UCHAR * bytQualThres, char * strType);
void ClearDataToSend();
int EncodeFSKData(UCHAR bytFrameType, UCHAR * bytDataToSend, int Length, unsigned char * bytEncodedBytes);
int EncodePSKData(UCHAR bytFrameType, UCHAR * bytDataToSend, int Length, unsigned char * bytEncodedBytes);
int EncodeOFDMData(UCHAR bytFrameType, UCHAR * bytDataToSend, int Length, unsigned char * bytEncodedBytes);
int Encode4FSKIDFrame(char * Callsign, char * Square, unsigned char * bytreturn, UCHAR SessionID);
int EncodeDATAACK(int intQuality, UCHAR bytSessionID, UCHAR * bytreturn);
int EncodeDATANAK(int intQuality , UCHAR bytSessionID, UCHAR * bytreturn);
void Mod4FSKDataAndPlay(unsigned char * bytEncodedBytes, int Len, int intLeaderLen, int Chan);
void ModPSKDataAndPlay(unsigned char * bytEncodedBytes, int Len, int intLeaderLen, int Chan);
BOOL IsDataFrame(UCHAR intFrameType);
BOOL CheckValidCallsignSyntax(char * strTargetCallsign);
void StartCodec(char * strFault);
void StopCodec(char * strFault);
BOOL SendARQConnectRequest(char * strMycall, char * strTargetCall);
void AddDataToDataToSend(UCHAR * bytNewData, int Len);
BOOL StartFEC(UCHAR * bytData, int Len, char * strDataMode, int intRepeats, BOOL blnSendID);
void SendID(BOOL blnEnableCWID);
BOOL CheckGSSyntax(char * GS);
//void SetARDOPProtocolState(int value);
unsigned int GenCRC16(unsigned char * Data, unsigned short length);
void SendCommandToHost(char * Cmd);
void TCPSendCommandToHost(char * Cmd);
void SCSSendCommandToHost(char * Cmd);
void SendCommandToHostQuiet(char * Cmd);
void TCPSendCommandToHostQuiet(char * Cmd);
void SCSSendCommandToHostQuiet(char * Cmd);
void UpdateBusyDetector(short * bytNewSamples);
int UpdatePhaseConstellation(short * intPhases, short * intMags, int intPSKPhase, BOOL blnQAM, BOOL OFDM);
void SetARDOPProtocolState(int value);
BOOL BusyDetect3(float * dblMag, int intStart, int intStop);
void SendLogToHost(char * Msg, int len);
VOID Gearshift_2(int intAckNakValue, BOOL blnInit);
void displayState(const char * State);
void displayCall(int dirn, char * call);
void SampleSink(int LR, short Sample);
void SoundFlush();
void StopCapture();
void StartCapture();
void DiscardOldSamples();
void ClearAllMixedSamples();
void SetFilter(void * Filter());
void AddTrailer();
void CWID(char * strID, short * intSamples, BOOL blnPlay);
void sendCWID(char * Call, BOOL Play, int Chan);
UCHAR ComputeTypeParity(UCHAR bytFrameType);
void GenCRC16FrameType(char * Data, int Length, UCHAR bytFrameType);
BOOL CheckCRC16FrameType(unsigned char * Data, int Length, UCHAR bytFrameType);
char * strlop(char * buf, char delim);
void QueueCommandToHost(char * Cmd);
void SCSQueueCommandToHost(char * Cmd);
void TCPQueueCommandToHost(char * Cmd);
void SendReplyToHost(char * strText);
void TCPSendReplyToHost(char * strText);
void SCSSendReplyToHost(char * strText);
void LogStats();
int GetNextFrameData(int * intUpDn, UCHAR * bytFrameTypeToSend, UCHAR * strMod, BOOL blnInitialize);
void SendData();
int ComputeInterFrameInterval(int intRequestedIntervalMS);
VOID EncodeAndSend4FSKControl(UCHAR bytFrameType, UCHAR bytSessionID, int LeaderLength);
VOID WriteExceptionLog(const char * format, ...);
void SaveQueueOnBreak();
VOID Statsprintf(const char * format, ...);
VOID CloseDebugLog();
VOID CloseStatsLog();
void Abort();
void SetLED(int LED, int State);
VOID ClearBusy();
VOID CloseCOMPort(HANDLE fd);
VOID COMClearRTS(HANDLE fd);
VOID COMClearDTR(HANDLE fd);
//#ifdef WIN32
void ProcessNewSamples(short * Samples, int nSamples);
VOID Debugprintf(const char * format, ...);
VOID WriteDebugLog(const char * format, ...);
void ardopmain();
BOOL GetNextFECFrame();
void GenerateFSKTemplates();
void printtick(char * msg);
void InitValidFrameTypes();
//#endif
extern void Generate50BaudTwoToneLeaderTemplate();
extern BOOL blnDISCRepeating;
BOOL DemodDecode4FSKID(UCHAR bytFrameType, char * strCallID, char * strGridSquare);
void DeCompressCallsign(char * bytCallsign, char * returned);
void DeCompressGridSquare(char * bytGS, char * returned);
int RSEncode(UCHAR * bytToRS, UCHAR * RSBytes, int DataLen, int RSLen);
BOOL RSDecode(UCHAR * bytRcv, int Length, int CheckLen, BOOL * blnRSOK);
void ProcessRcvdFECDataFrame(int intFrameType, UCHAR * bytData, BOOL blnFrameDecodedOK);
void ProcessUnconnectedConReqFrame(int intFrameType, UCHAR * bytData);
void ProcessRcvdARQFrame(UCHAR intFrameType, UCHAR * bytData, int DataLen, BOOL blnFrameDecodedOK);
void InitializeConnection();
void AddTagToDataAndSendToHost(UCHAR * Msg, char * Type, int Len);
void TCPAddTagToDataAndSendToHost(UCHAR * Msg, char * Type, int Len);
void SCSAddTagToDataAndSendToHost(UCHAR * Msg, char * Type, int Len);
void RemoveDataFromQueue(int Len);
void RemodulateLastFrame();
void GetSemaphore();
void FreeSemaphore();
const char * Name(UCHAR bytID);
const char * shortName(UCHAR bytID);
void InitSound();
void initFilter(int Width, int centerFreq, int Chan);
void FourierTransform(int NumSamples, short * RealIn, float * RealOut, float * ImagOut, int InverseTransform);
VOID ClosePacketSessions();
VOID LostHost();
VOID ProcessPacketHostBytes(UCHAR * RXBuffer, int Len);
int ReadCOMBlock(HANDLE fd, char * Block, int MaxLength);
VOID ProcessDEDModeFrame(UCHAR * rxbuffer, unsigned int Length);
BOOL CheckForPktMon();
BOOL CheckForPktData();
void ModOFDMDataAndPlay(unsigned char * bytEncodedBytes, int Len, int intLeaderLen, int Chan);
void GetOFDMFrameInfo(int OFDMMode, int * intDataLen, int * intRSLen, int * Mode, int * Symbols);
void ClearOFDMVariables();
VOID EncodeAndSendOFDMACK(UCHAR bytSessionID, int LeaderLength, int Chan);
int ProcessOFDMAck(int AckType);
void ProcessOFDMNak(int AckType);
int SendtoGUI(char Type, unsigned char * Msg, int Len);
void DrawRXFrame(int State, const char * Frame);
void DrawTXFrame(const char * Frame);
void mySetPixel(unsigned char x, unsigned char y, unsigned int Colour);
void clearDisplay();
void DrawDecode(char * Decode);
extern int WaterfallActive;
extern int SpectrumActive;
extern unsigned int PKTLEDTimer;
extern char stcLastPingstrSender[10];
extern char stcLastPingstrTarget[10];
extern int stcLastPingintRcvdSN;
extern int stcLastPingintQuality;
extern time_t stcLastPingdttTimeReceived;
enum _ReceiveState // used for initial receive testing...later put in correct protocol states
{
SearchingForLeader,
AcquireSymbolSync,
AcquireFrameSync,
AcquireFrameType,
DecodeFrameType,
AcquireFrame,
DecodeFramestate
};
extern enum _ReceiveState State;
enum _ARQBandwidth
{
XB200,
XB500,
XB2500,
UNDEFINED
};
extern enum _ARQBandwidth ARQBandwidth;
extern const char ARQBandwidths[9][12];
enum _ARDOPState
{
OFFLINE,
DISC,
ISS,
IRS,
IDLE, // ISS in quiet state ...no transmissions)
IRStoISS, // IRS during transition to ISS waiting for ISS's ACK from IRS's BREAK
FECSend,
FECRcv
};
extern enum _ARDOPState ProtocolState;
extern const char ARDOPStates[8][9];
// Enum of ARQ Substates
enum _ARQSubStates
{
None,
ISSConReq,
ISSConAck,
ISSData,
ISSId,
IRSConAck,
IRSData,
IRSBreak,
IRSfromISS,
DISCArqEnd
};
extern enum _ARQSubStates ARQState;
enum _ProtocolMode
{
Undef,
FEC,
ARQ
};
extern enum _ProtocolMode ProtocolMode;
extern const char ARDOPModes[3][6];
extern enum _ARQSubStates ARQState;
struct SEM
{
unsigned int Flag;
int Clashes;
int Gets;
int Rels;
};
extern struct SEM Semaphore;
#define DataNAK 0x00
#define DataNAKLoQ 0x01
#define ConRejBusy 0x02
#define ConRejBW 0x03
#define ConAck 0x04
#define DISCFRAME 0x05
#define BREAK 0x06
#define END 0x07
#define IDLEFRAME 0x08
#define ConReq200 0x09
#define ConReq500 0x0A
#define ConReq2500 0x0B
#define IDFRAME 0x0C
#define PINGACK 0x0D
#define PING 0x0E
#define CQ_de 0x0F
// 200 Hz Bandwidth
// 1 Car modes
#define D4PSK_200_50_E 0x10
#define D4PSK_200_50_O 0x11
#define D4PSK_200_100_E 0x12
#define D4PSK_200_100_O 0x13
#define D16QAM_200_100_E 0x14
#define D16QAM_200_100_O 0x15
// 500 Hz bandwidth Data
// 1 Car 4FSK Data mode 500 Hz, 50 baud tones spaced @ 100 Hz
#define D4FSK_500_50_E 0x1A
#define D4FSK_500_50_O 0x1B
#define D4PSK_500_50_E 0x1C
#define D4PSK_500_50_O 0x1D
#define D4PSK_500_100_E 0x1E
#define D4PSK_500_100_O 0x1F
// 2 Car 16QAM Data Modes 100 baud
#define D16QAMR_500_100_E 0x20
#define D16QAMR_500_100_O 0x21
#define D16QAM_500_100_E 0x22
#define D16QAM_500_100_O 0x23
// OFDM modes
#define DOFDM_500_55_E 0x24
#define DOFDM_500_55_O 0x25
#define DOFDM_200_55_E 0x26
#define DOFDM_200_55_O 0x27
#define OConReq500 0x18
#define OConReq2500 0x19
// 1 Khz Bandwidth Data Modes
// 2 Car 4FSK Data mode 1000 Hz, 50 baud tones spaced @ 100 Hz
#define D4FSK_1000_50_E 0x28
#define D4FSK_1000_50_O 0x29
// 2500 bandwidth modes
// 10 Car PSK Data Modes 50 baud
#define D4PSKR_2500_50_E 0x2A
#define D4PSKR_2500_50_O 0x2B
#define D4PSK_2500_50_E 0x2C
#define D4PSK_2500_50_O 0x2D
// 10 Car PSK Data Modes 100 baud
#define D4PSK_2500_100_E 0x2E
#define D4PSK_2500_100_O 0x2F
// 10 Car 10 Car 16QAMRobust (duplicated carriers)
#define D16QAMR_2500_100_E 0x30
#define D16QAMR_2500_100_O 0x31
// 10 Car 16QAM Data modes 100 baud
#define D16QAM_2500_100_E 0x32
#define D16QAM_2500_100_O 0x33
// OFDM modes
#define DOFDM_2500_55_E 0x34
#define DOFDM_2500_55_O 0x35
#define PktFrameHeader 0x3A // Variable length frame Header
#define PktFrameData 0x3B // Variable length frame Data (Virtual Frsme Type)
#define OFDMACK 0x3D
#define DataACK 0x3E
#define DataACKHiQ 0x3F
extern CONST short int50BaudTwoToneLeaderTemplate[240]; // holds just 1 symbol (20 ms) of the leader
//The actual templates over 11 carriers for 16QAM in a 8-8 circular constellation. First 4 symbols only
// (only positive Phase values are in the table, sign reversal is used to get the negative phase values) This reduces the template size to 5280 integers
extern CONST short intQAM50bdCarTemplate[11][4][120];
extern CONST short intFSK50bdCarTemplate[12][240]; // Template for 4FSK carriers spaced at 50 Hz, 50 baud
extern CONST short intFSK100bdCarTemplate[4][120];
extern CONST short intOFDMTemplate[MAXCAR][8][216];
// Config Params
extern char GridSquare[9];
extern char Callsign[10];
extern BOOL wantCWID;
extern BOOL CWOnOff;
extern int LeaderLength;
extern int TrailerLength;
extern unsigned int ARQTimeout;
extern int TuningRange;
extern int TXLevel;
extern int RXLevel;
extern int autoRXLevel;
extern BOOL DebugLog;
extern int ARQConReqRepeats;
extern BOOL CommandTrace;
extern char strFECMode[];
extern char CaptureDevice[];
extern char PlaybackDevice[];
extern int port;
extern char HostPort[80];
extern int pktport;
extern BOOL RadioControl;
extern BOOL SlowCPU;
extern BOOL AccumulateStats;
extern BOOL Use600Modes;
extern BOOL UseOFDM;
extern BOOL EnableOFDM;
extern BOOL FSKOnly;
extern BOOL fastStart;
extern BOOL ConsoleLogLevel;
extern BOOL FileLogLevel;
extern BOOL EnablePingAck;
extern BOOL NegotiateBW;
extern int dttLastPINGSent;
extern BOOL blnPINGrepeating;
extern BOOL blnFramePending;
extern int intPINGRepeats;
extern BOOL gotGPIO;
extern BOOL useGPIO;
extern int pttGPIOPin;
extern HANDLE hCATDevice; // port for Rig Control
extern char CATPort[80];
extern int CATBAUD;
extern int EnableHostCATRX;
extern HANDLE hPTTDevice; // port for PTT
extern char PTTPort[80]; // Port for Hardware PTT - may be same as control port.
extern int PTTBAUD;
#define PTTRTS 1
#define PTTDTR 2
#define PTTCI_V 4
extern UCHAR PTTOnCmd[];
extern UCHAR PTTOnCmdLen;
extern UCHAR PTTOffCmd[];
extern UCHAR PTTOffCmdLen;
extern int PTTMode; // PTT Control Flags.
extern char * CaptureDevices;
extern char * PlaybackDevices;
extern int dttCodecStarted;
extern int dttStartRTMeasure;
extern int intCalcLeader; // the computed leader to use based on the reported Leader Length
extern const char strFrameType[64][18];
extern const char shortFrameType[64][12];
extern BOOL Capturing;
extern int SoundIsPlaying;
extern int blnLastPTT;
extern BOOL blnAbort;
extern BOOL blnClosing;
extern BOOL blnCodecStarted;
extern BOOL blnInitializing;
extern BOOL blnARQDisconnect;
extern int DriveLevel;
extern int FECRepeats;
extern BOOL FECId;
extern int Squelch;
extern int BusyDet;
extern BOOL blnEnbARQRpt;
extern unsigned int dttNextPlay;
extern UCHAR bytDataToSend[];
extern int bytDataToSendLength;
extern BOOL blnListen;
extern BOOL Monitor;
extern BOOL AutoBreak;
extern BOOL BusyBlock;
extern int DecodeCompleteTime;
extern BOOL AccumulateStats;
extern unsigned char bytEncodedBytes[4500];
extern int EncLen;
extern char AuxCalls[10][10];
extern int AuxCallsLength;
extern int bytValidFrameTypesLength;
extern int bytValidFrameTypesLengthALL;
extern int bytValidFrameTypesLengthISS;
extern BOOL blnTimeoutTriggered;
extern int intFrameRepeatInterval;
extern int extraDelay;
extern BOOL PlayComplete;
extern const UCHAR bytValidFrameTypesALL[];
extern const UCHAR bytValidFrameTypesISS[];
extern const UCHAR * bytValidFrameTypes;
extern const char strAllDataModes[][16];
extern int strAllDataModesLen;
extern const short Rate[64]; // Data Rate (in bits/sec) by Frame Type
extern BOOL newStatus;
// RS Variables
extern int MaxCorrections;
// Stats counters
extern int SessBytesSent;
extern int SessBytesReceived;
extern int intLeaderDetects;
extern int intLeaderSyncs;
extern int intAccumLeaderTracking;
extern float dblFSKTuningSNAvg;
extern int intGoodFSKFrameTypes;
extern int intFailedFSKFrameTypes;
extern int intAccumFSKTracking;
extern int intFSKSymbolCnt;
extern int intGoodFSKFrameDataDecodes;
extern int intFailedFSKFrameDataDecodes;
extern int intAvgFSKQuality;
extern int intFrameSyncs;
extern int intGoodPSKSummationDecodes;
extern int intGoodFSKSummationDecodes;
extern int intGoodOFDMSummationDecodes;
extern float dblLeaderSNAvg;
extern int intAccumPSKLeaderTracking;
extern float dblAvgPSKRefErr;
extern int intPSKTrackAttempts;
extern int intAccumPSKTracking;
extern int intQAMTrackAttempts;
extern int intAccumQAMTracking;
extern int intOFDMTrackAttempts;
extern int intAccumOFDMTracking;
extern int intPSKSymbolCnt;
extern int intQAMSymbolCnt;
extern int intOFDMSymbolCnt;
extern int intGoodPSKFrameDataDecodes;
extern int intFailedPSKFrameDataDecodes;
extern int intAvgPSKQuality;
extern int intGoodOFDMFrameDataDecodes;
extern int intFailedOFDMFrameDataDecodes;
extern int intAvgOFDMQuality;
extern float dblAvgDecodeDistance;
extern int intDecodeDistanceCount;
extern int intShiftUPs;
extern int intShiftDNs;
extern unsigned int dttStartSession;
extern int intLinkTurnovers;
extern int intEnvelopeCors;
extern float dblAvgCorMaxToMaxProduct;
extern int intConReqSN;
extern int intConReqQuality;
extern int int4FSKQuality;
extern int int4FSKQualityCnts;
extern int int8FSKQuality;
extern int int8FSKQualityCnts;
extern int int16FSKQuality;
extern int int16FSKQualityCnts;
extern int intFSKSymbolsDecoded;
extern int intPSKQuality[2];
extern int intPSKQualityCnts[2];
extern int intPSKSymbolsDecoded;
extern int intOFDMQuality[8];
extern int intOFDMQualityCnts[8];
extern int intOFDMSymbolsDecoded;
extern int intQAMQuality;
extern int intQAMQualityCnts;
extern int intQAMSymbolsDecoded;
extern int intQAMSymbolCnt;
extern int intOFDMSymbolCnt;
extern int intGoodQAMFrameDataDecodes;
extern int intFailedQAMFrameDataDecodes;
extern int intGoodQAMSummationDecodes;
extern int dttLastBusyOn;
extern int dttLastBusyOff;
extern int dttLastLeaderDetect;
extern int LastBusyOn;
extern int LastBusyOff;
extern int dttLastLeaderDetect;
extern int pktDataLen;
extern int pktRSLen;
extern const char pktMod[16][12];
extern int pktMode;
extern int pktModeLen;
extern const int pktBW[16];
extern const int pktCarriers[16];
extern const int defaultPacLen[16];
extern const BOOL pktFSK[16];
extern int pktMaxFrame;
extern int pktMaxBandwidth;
extern int pktPacLen;
extern int initMode; // 0 - 4PSK 1 - 8PSK 2 = 16QAM
extern UCHAR UnackedOFDMBlocks[128];
extern int NextOFDMBlock;
extern BOOL SerialMode; // Set if using SCS Mode, Unset ofr TCP Mode
// Has to follow enum defs
BOOL EncodeARQConRequest(char * strMyCallsign, char * strTargetCallsign, enum _ARQBandwidth ARQBandwidth, UCHAR * bytReturn);
// OFDM Modes
#define PSK2 0
#define PSK4 1
#define PSK8 2
#define QAM16 3
#define PSK16 4 // Experimental - is it better than 16QAM?
#define QAM32 5
#define PSK4S 6 // Special shorter frame for short messages
extern int OFDMMode; // OFDM can use various modulation modes and redundancy levels
extern int LastSentOFDMMode; // For retries
extern int LastSentOFDMType; // For retries
extern int SavedOFDMMode; // used if we switch to a more robust mode cos we don't have much to send
extern int SavedFrameType;
extern const char OFDMModes[8][6];
#endif

View File

@ -1,239 +0,0 @@
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#endif
#include "ARDOPC.h"
VOID SortSignals2(float * dblMag, int intStartBin, int intStopBin, int intNumBins, float * dblAVGSignalPerBin, float * dblAVGBaselinePerBin);
int LastBusyOn;
int LastBusyOff;
BOOL blnLastBusy = FALSE;
float dblAvgStoNSlowNarrow;
float dblAvgStoNFastNarrow;
float dblAvgStoNSlowWide;
float dblAvgStoNFastWide;
int intLastStart = 0;
int intLastStop = 0;
int intBusyOnCnt = 0; // used to filter Busy ON detections
int intBusyOffCnt = 0; // used to filter Busy OFF detections
int dttLastBusyTrip = 0;
int dttPriorLastBusyTrip = 0;
int dttLastBusyClear = 0;
int dttLastTrip;
extern float dblAvgPk2BaselineRatio, dblAvgBaselineSlow, dblAvgBaselineFast;
int intHoldMs = 5000;
VOID ClearBusy()
{
dttLastBusyTrip = Now;
dttPriorLastBusyTrip = dttLastBusyTrip;
dttLastBusyClear = dttLastBusyTrip + 610; // This insures test in ARDOPprotocol ~ line 887 will work
dttLastTrip = dttLastBusyTrip -intHoldMs; // This clears the busy detect immediatly (required for scanning when re enabled by Listen=True
blnLastBusy = False;
intBusyOnCnt = 0;
intBusyOffCnt = 0;
intLastStart = 0;
intLastStop = 0; // This will force the busy detector to ignore old averages and initialze the rolling average filters
}
extern int FFTSize;
BOOL BusyDetect3(float * dblMag, int StartFreq, int EndFreq)
{
// 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..
// Start and Stop are in Hz. Convert to bin numbers
float BinSize = 12000.0 / FFTSize;
int StartBin = StartFreq / BinSize;
int EndBin = EndFreq / BinSize;
float dblAVGSignalPerBinNarrow, dblAVGSignalPerBinWide, dblAVGBaselineNarrow, dblAVGBaselineWide;
float dblSlowAlpha = 0.2f;
float dblAvgStoNNarrow = 0, dblAvgStoNWide = 0;
int intNarrow = 100 / BinSize; // 8 x 11.72 Hz about 94 z
int intWide = ((EndBin - StartBin) * 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)
SortSignals2(dblMag, StartBin, EndBin, intNarrow, &dblAVGSignalPerBinNarrow, &dblAVGBaselineNarrow);
if (intLastStart == StartBin && intLastStop == EndBin)
dblAvgStoNNarrow = (1 - dblSlowAlpha) * dblAvgStoNNarrow + dblSlowAlpha * dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
else
{
// This initializes the Narrow average after a bandwidth change
dblAvgStoNNarrow = dblAVGSignalPerBinNarrow / dblAVGBaselineNarrow;
intLastStart = StartBin;
intLastStop = EndBin;
}
// Wide band (66% of current bandwidth)
SortSignals2(dblMag, StartBin, EndBin, intWide, &dblAVGSignalPerBinWide, &dblAVGBaselineWide);
if (intLastStart == StartBin && intLastStop == EndBin)
dblAvgStoNWide = (1 - dblSlowAlpha) * dblAvgStoNWide + dblSlowAlpha * dblAVGSignalPerBinWide / dblAVGBaselineWide;
else
{
// This initializes the Wide average after a bandwidth change
dblAvgStoNWide = dblAVGSignalPerBinWide / dblAVGBaselineWide;
intLastStart = StartBin;
intLastStop = EndBin;
}
// Preliminary calibration...future a function of bandwidth and BusyDet.
switch (ARQBandwidth)
{
case XB200:
blnBusy = (dblAvgStoNNarrow > (3 + 0.008 * BusyDet4th)) || (dblAvgStoNWide > (5 + 0.02 * BusyDet4th));
break;
case XB500:
blnBusy = (dblAvgStoNNarrow > (3 + 0.008 * BusyDet4th) )|| (dblAvgStoNWide > (5 + 0.02 * BusyDet4th));
break;
case XB2500:
blnBusy = (dblAvgStoNNarrow > (3 + 0.008 * BusyDet4th)) || (dblAvgStoNWide > (5 + 0.016 * 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);
if (blnBusy)
{
// This requires multiple adjacent busy conditions to skip over one nuisance Busy trips.
// Busy must be present at least 3 consecutive times ( ~250 ms) to be reported
intBusyOnCnt += 1;
intBusyOffCnt = 0;
if (intBusyOnCnt > 3)
dttLastTrip = Now;
}
else
{
intBusyOffCnt += 1;
intBusyOnCnt = 0;
}
if (blnLastBusy == False && intBusyOnCnt >= 3)
{
dttPriorLastBusyTrip = dttLastBusyTrip; // save old dttLastBusyTrip for use in BUSYBLOCKING function
dttLastBusyTrip = Now;
blnLastBusy = True;
}
else
{
if (blnLastBusy && (Now - dttLastTrip) > intHoldMs && intBusyOffCnt >= 3)
{
dttLastBusyClear = Now;
blnLastBusy = False;
}
}
return blnLastBusy;
}
VOID SortSignals(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)
float dblAVGSignal[200] = {0};//intNumBins
float dblAVGBaseline[200] = {0};//intStopBin - intStartBin - intNumBins
float dblSigSum = 0;
float dblTotalSum = 0;
int intSigPtr = 0;
int intBasePtr = 0;
int i, j, k;
for (i = 0; i < intNumBins; i++)
{
for (j = intStartBin; j <= intStopBin; j++)
{
if (i == 0)
{
dblTotalSum += dblMag[j];
if (dblMag[j] > dblAVGSignal[i])
dblAVGSignal[i] = dblMag[j];
}
else
{
if (dblMag[j] > dblAVGSignal[i] && dblMag[j] < dblAVGSignal[i - 1])
dblAVGSignal[i] = dblMag[j];
}
}
}
for(k = 0; k < intNumBins; k++)
{
dblSigSum += dblAVGSignal[k];
}
*dblAVGSignalPerBin = dblSigSum / intNumBins;
*dblAVGBaselinePerBin = (dblTotalSum - dblSigSum) / (intStopBin - intStartBin - intNumBins + 1);
}
BOOL compare(const void *p1, const void *p2)
{
float x = *(const float *)p1;
float y = *(const float *)p2;
if (x < y)
return -1; // Return -1 if you want ascending, 1 if you want descending order.
else if (x > y)
return 1; // Return 1 if you want ascending, -1 if you want descending order.
return 0;
}
VOID SortSignals2(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[202];
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);
}

View File

@ -1,159 +0,0 @@
#include "UZ7HOStuff.h"
// if in Satellite Mode look for a Tuning signal
// As a first try, use ardop leader pattern then single tone
static short rawSamples[2400]; // Get Frame Type need 2400 and we may add 1200
static int rawSamplesLength = 0;
static int maxrawSamplesLength;
static float dblOffsetHz = 0;;
static int blnLeaderFound = 0;
enum _ReceiveState // used for initial receive testing...later put in correct protocol states
{
SearchingForLeader,
AcquireSymbolSync,
AcquireFrameSync,
AcquireFrameType,
DecodeFrameType,
AcquireFrame,
DecodeFramestate
};
static enum _ReceiveState State;
void LookForCalPattern(short * Samples, int nSamples);
void doTuning(short * Samples, int nSamples)
{
short ardopbuff[2][1200];
int i, i1 = 0;
if (UsingBothChannels)
{
for (i = 0; i < rx_bufsize; i++)
{
ardopbuff[0][i] = Samples[i1];
i1++;
ardopbuff[1][i] = Samples[i1];
i1++;
}
}
else if (UsingRight)
{
// Extract just right
i1 = 1;
for (i = 0; i < rx_bufsize; i++)
{
ardopbuff[1][i] = Samples[i1];
i1 += 2;
}
}
else
{
// Extract just left
for (i = 0; i < rx_bufsize; i++)
{
ardopbuff[0][i] = Samples[i1];
i1 += 2;
}
}
if (UsingLeft)
{
LookForCalPattern(&ardopbuff[0][0], 0);
}
if (UsingRight)
{
LookForCalPattern(&ardopbuff[0][0], 1);
}
}
void LookForCalPattern(short * Samples, int nSamples)
{
BOOL blnFrameDecodedOK = FALSE;
// LookforUZ7HOLeader(Samples, nSamples);
// printtick("Start afsk");
// DemodAFSK(Samples, nSamples);
// printtick("End afsk");
// return;
// Append new data to anything in rawSamples
memcpy(&rawSamples[rawSamplesLength], Samples, nSamples * 2);
rawSamplesLength += nSamples;
if (rawSamplesLength > maxrawSamplesLength)
maxrawSamplesLength = rawSamplesLength;
if (rawSamplesLength >= 2400)
Debugprintf("Corrupt rawSamplesLength %d", rawSamplesLength);
nSamples = rawSamplesLength;
Samples = rawSamples;
rawSamplesLength = 0;
// printtick("Start Busy");
if (nSamples >= 1024)
UpdateBusyDetector(Samples);
// printtick("Done Busy");
// it seems that searchforleader runs on unmixed and unfilered samples
// Searching for leader
if (State == SearchingForLeader)
{
// Search for leader as long as 960 samples (8 symbols) available
// printtick("Start Leader Search");
while (State == SearchingForLeader && nSamples >= 1200)
{
int intSN;
blnLeaderFound = SearchFor2ToneLeader4(Samples, nSamples, &dblOffsetHz, &intSN);
// blnLeaderFound = SearchFor2ToneLeader2(Samples, nSamples, &dblOffsetHz, &intSN);
if (blnLeaderFound)
{
// Debugprintf("Got Leader");
nSamples -= 480;
Samples += 480; // !!!! needs attention !!!
}
else
{
nSamples -= 240;
Samples += 240; // !!!! needs attention !!!
}
}
if (State == SearchingForLeader)
{
// Save unused samples
memmove(rawSamples, Samples, nSamples * 2);
rawSamplesLength = nSamples;
// printtick("End Leader Search");
return;
}
}
}

View File

@ -1,521 +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 <QDialog>
#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" bool onlyMixSnoop;
//extern "C" int RX_SR;
//extern "C" int TX_SR;
extern "C" int txLatency;
extern "C" int multiCore;
extern "C" char * Wisdom;
extern int WaterfallMin;
extern int WaterfallMax;
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 QDialog * constellationDialog;
extern QRect PSKRect;
extern char CWIDCall[128];
extern "C" char CWIDMark[32];
extern int CWIDInterval;
extern int CWIDLeft;
extern int CWIDRight;
extern int CWIDType;
extern bool afterTraffic;
extern bool darkTheme;
extern "C" bool useKISSControls;
extern "C" int RSID_SABM[4];
extern "C" int RSID_UI[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);
// 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];
QVariant Q;
QByteArray x;
sprintf(fullKey, "%s/%s", Prefix, key);
Q = settings->value(fullKey, Default);
x = Q.toString().toUtf8();
return Q;
}
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();
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());
strcpy(exclude_callsigns[Chan], getAX25Param("ExcludeCallsigns", "").toString().toUtf8());
fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).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_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();
PSKRect = settings->value("PSKWindow").toRect();
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();
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(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());
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();
TX_rotate = settings->value("Init/TXRotate", 0).toInt();
multiCore = settings->value("Init/multiCore", 0).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[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();
useKISSControls = settings->value("Init/useKISSControls", 0).toBool();
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();
MgmtPort = settings->value("MGMT/Port", 0).toInt();
SixPackEnable = settings->value("SixPack/Enable", FALSE).toBool();
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[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();
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(CWIDMark, settings->value("Modem/CWIDMark", "").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
afterTraffic = settings->value("Modem/afterTraffic", false).toBool();
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;
}
darkTheme = settings->value("Init/darkTheme", false).toBool();
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("IL2PCRC", il2p_crc[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("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/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/txLatency", txLatency);
settings->setValue("Init/onlyMixSnoop", onlyMixSnoop);
settings->setValue("Init/SndRXDeviceName", CaptureDevice);
settings->setValue("Init/SndTXDeviceName", PlaybackDevice);
settings->setValue("Init/useKISSControls", useKISSControls);
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/FLRigPort", FLRigPort);
settings->setValue("Init/FLRigHost", FLRigHost);
settings->setValue("Init/MinimizetoTray", MintoTray);
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
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("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/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/CWIDMark", CWIDMark);
settings->setValue("Modem/CWIDInterval", CWIDInterval);
settings->setValue("Modem/CWIDLeft", CWIDLeft);
settings->setValue("Modem/CWIDRight", CWIDRight);
settings->setValue("Modem/CWIDType", CWIDType);
settings->setValue("Modem/afterTraffic", afterTraffic);
settings->setValue("Init/darkTheme", darkTheme);
saveAX25Params(0);
saveAX25Params(1);
saveAX25Params(2);
saveAX25Params(3);
settings->sync();
delete(settings);
}

View File

@ -1,481 +0,0 @@
/*extern "C"
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 <QDialog>
#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 int WaterfallMin;
extern int WaterfallMax;
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 QDialog * constellationDialog;
extern QRect PSKRect;
extern char CWIDCall[128];
extern "C" char CWIDMark[32];
extern int CWIDInterval;
extern int CWIDLeft;
extern int CWIDRight;
extern int CWIDType;
extern bool afterTraffic;
extern bool darkTheme;
extern "C" int RSID_SABM[4];
extern "C" int RSID_UI[4];
extern "C" int RSID_SetModem[4];
extern QFont Font;
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];
QVariant Q;
QByteArray x;
sprintf(fullKey, "%s/%s", Prefix, key);
Q = settings->value(fullKey, Default);
x = Q.toString().toUtf8();
return Q;
}
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();
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());
strcpy(exclude_callsigns[Chan], getAX25Param("ExcludeCallsigns", "").toString().toUtf8());
fx25_mode[Chan] = getAX25Param("FX25", FX25_MODE_RX).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_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();
PSKRect = settings->value("PSKWindow").toRect();
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();
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[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();
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(CWIDMark, settings->value("Modem/CWIDMark", "").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
afterTraffic = settings->value("Modem/afterTraffic", false).toBool();
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;
}
darkTheme = settings->value("Init/darkTheme", false).toBool();
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("IL2PCRC", il2p_crc[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("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/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);
settings->setValue("Init/WaterfallMin", WaterfallMin);
settings->setValue("Init/WaterfallMax", WaterfallMax);
// 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/CWIDMark", CWIDMark);
settings->setValue("Modem/CWIDInterval", CWIDInterval);
settings->setValue("Modem/CWIDLeft", CWIDLeft);
settings->setValue("Modem/CWIDRight", CWIDRight);
settings->setValue("Modem/CWIDType", CWIDType);
settings->setValue("Modem/afterTraffic", afterTraffic);
settings->setValue("Init/darkTheme", darkTheme);
saveAX25Params(0);
saveAX25Params(1);
saveAX25Params(2);
saveAX25Params(3);
settings->sync();
delete(settings);
}

View File

@ -1,100 +0,0 @@
<ui version="4.0">
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>250</y>
<width>351</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint">
<size>
<width>131</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,311 +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
*/
//#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

1117
Modulate.c

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,150 +0,0 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_QtSoundModem.h"
#include "ui_calibrateDialog.h"
#include "ui_devicesDialog.h"
#include "ui_filterWindow.h"
#include "ui_ModemDialog.h"
#include "QThread"
#include <QLabel>
#include <QTableWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QUdpSocket>
#include <QSystemTrayIcon>
#include "tcpCode.h"
class QtSoundModem : public QMainWindow
{
Q_OBJECT
public:
QtSoundModem(QWidget *parent = Q_NULLPTR);
void changeEvent(QEvent * e);
void closeEvent(QCloseEvent * event);
~QtSoundModem();
void RefreshWaterfall(int snd_ch, unsigned char * Data);
void initWaterfall(int state);
void show_grid();
void checkforCWID();
public slots:
private slots:
void CWIDTimer();
void doDevices();
void mysetstyle();
void updateFont();
void MinimizetoTray();
void TrayActivated(QSystemTrayIcon::ActivationReason reason);
void StatsTimer();
void MyTimerSlot();
void returnPressed();
void clickedSlotI(int i);
void doModems();
void doFilter(int Chan, int Filter);
void SoundModeChanged(bool State);
void DualPTTChanged(bool State);
void CATChanged(bool State);
void PTTPortChanged(int);
void deviceaccept();
void devicereject();
void modemaccept();
void modemSave();
void modemreject();
void doRSIDA();
void doRSIDB();
void doRSIDC();
void doRSIDD();
void handleButton(int Port, int Act);
void doCalibrate();
void RefreshSpectrum(unsigned char * Data);
void doAbout();
void doRestartWF();
void doupdateDCD(int, int);
void sendtoTrace(char * Msg, int tx);
void preEmphAllAChanged(int);
void preEmphAllBChanged(int);
void preEmphAllCChanged(int state);
void preEmphAllDChanged(int state);
void menuChecked();
void onTEselectionChanged();
void StartWatchdog();
void StopWatchdog();
void PTTWatchdogExpired();
void showRequest(QByteArray Data);
void clickedSlot();
void startCWIDTimerSlot();
void setWaterfallImage();
void setLevelImage();
void setConstellationImage(int chan, int Qual);
protected:
bool eventFilter(QObject * obj, QEvent * evt);
void resizeEvent(QResizeEvent *event) override;
private:
Ui::QtSoundModemClass ui;
QTableWidget* sessionTable;
QStringList m_TableHeader;
QMenu *setupMenu;
QMenu *viewMenu;
QAction *actDevices;
QAction *actModems;
QAction *actFont;
QAction *actMintoTray;
QAction *actCalib;
QAction *actAbout;
QAction *actRestartWF;
QAction *actWaterfall1;
QAction *actWaterfall2;
signals:
};
class myResize : public QObject
{
Q_OBJECT
protected:
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;
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View File

@ -1,195 +0,0 @@
[General]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\xb5\0\0\0\xa1\0\0\x4\xb2\0\0\x3v\0\0\0\xb6\0\0\0\xc0\0\0\x4\xb1\0\0\x3u\0\0\0\0\0\0\0\0\x5\0\0\0\0\xb6\0\0\0\xc0\0\0\x4\xb1\0\0\x3u)
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x3\xfc\0\0\x2\xa1\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)
[Init]
TXSampleRate=12000
RXSampleRate=12000
SndRXDeviceName="CABLE-A OUTPUT (VB-AUDIO CABLE "
SndTXDeviceName=CABLE INPUT (VB-AUDIO VIRTUAL C
DualChan=2
SCO=0
DualPTT=1
PTT=HAMLIB
TXRotate=1
DispMode=1
SoundMode=0
UDPClientPort=8888
UDPServerPort=8884
UDPServer=0
PTTBAUD=19200
PTTMode=17
PTTOffString=
PTTOnString=127.0.0.1
pttGPIOPin=17
pttGPIOPinR=17
CM108Addr=0xD8C:0x08
HamLibPort=4532
HamLibHost=127.0.0.1
MinimizetoTray=0
multiCore=0
UDPHost=127.0.0.1
TXPort=8888
[Modem]
RXFreq1=1100
RXFreq2=2000
ModemType1=0
ModemType2=0
DCDThreshold=36
NRRcvrPairs1=2
NRRcvrPairs2=2
RcvrShift1=30
RcvrShift2=30
soundChannel1=1
soundChannel2=1
RawPktMinLen=17
SwapPTTPins=0
PreEmphasisDB1=0
PreEmphasisDB2=0
PreEmphasisAll1=1
PreEmphasisAll2=0
Default1=1
Default2=1
HoldPnt=0
AFC=32
TxDelay1=250
TxDelay2=250
TxTail1=50
TxTail2=50
Diddles=0
InvPTTPins=0
RXFreq3=2000
NRRcvrPairs3=2
NRRcvrPairs4=0
RcvrShift3=30
RcvrShift4=30
ModemType3=0
ModemType4=0
soundChannel3=0
soundChannel4=0
PreEmphasisAll3=1
PreEmphasisAll4=0
PreEmphasisDB3=0
PreEmphasisDB4=0
TxDelay3=250
TxDelay4=250
TxTail3=50
TxTail4=50
RXFreq4=2700
CWIDCall=
CWIDInterval=0
CWIDLeft=0
CWIDRight=0
CWIDType=1
[AGWHost]
Server=1
Port=8009
[KISS]
Server=0
Port=8100
[AX25_A]
Maxframe=2
Retries=8
FrackTime=5
IdleTime=180
SlotTime=100
Persist=128
RespTime=2000
TXFrmMode=1
FrameCollector=6
ExcludeCallsigns=
ExcludeAPRSFrmType=
KISSOptimization=1
DynamicFrack=0
BitRecovery=0
NonAX25Frm=1
MEMRecovery=200
IPOLL=80
MyDigiCall=
HiToneRaise=0
soundChannel=1
FX25=2
[AX25_B]
Maxframe=2
Retries=5
FrackTime=5
IdleTime=180
SlotTime=100
Persist=128
RespTime=2000
TXFrmMode=1
FrameCollector=6
ExcludeCallsigns=
ExcludeAPRSFrmType=
KISSOptimization=1
DynamicFrack=0
BitRecovery=0
NonAX25Frm=1
MEMRecovery=200
IPOLL=80
MyDigiCall=
HiToneRaise=0
soundChannel=0
FX25=2
[Window]
Top=281
Left=73
Height=735
Width=810
Waterfall1=1
Waterfall2=1
StatTable=1
Monitor=1
MinimizedOnStartup=0
[Font]
Size=8
Name=MS Sans Serif
[AX25_C]
Retries=15
HiToneRaise=0
Maxframe=3
FrackTime=5
IdleTime=180
SlotTime=100
Persist=128
RespTime=1500
TXFrmMode=1
FrameCollector=6
ExcludeCallsigns=
ExcludeAPRSFrmType=
KISSOptimization=0
DynamicFrack=0
BitRecovery=0
NonAX25Frm=0
IPOLL=80
MyDigiCall=
FX25=1
[AX25_D]
Retries=15
HiToneRaise=0
Maxframe=3
FrackTime=5
IdleTime=180
SlotTime=100
Persist=128
RespTime=1500
TXFrmMode=1
FrameCollector=6
ExcludeCallsigns=
ExcludeAPRSFrmType=
KISSOptimization=0
DynamicFrack=0
BitRecovery=0
NonAX25Frm=0
IPOLL=80
MyDigiCall=
FX25=1

View File

@ -1,36 +0,0 @@
# ----------------------------------------------------
# This file is generated by the Qt Visual Studio Tools.
# ------------------------------------------------------
# This is a reminder that you are using a generated .pro file.
# Remove it when you are finished editing this file.
message("You are running qmake on a generated .pro file. This may not work!")
HEADERS += ./UZ7HOStuff.h \
./QtSoundModem.h \
./tcpCode.h
SOURCES += ./ax25.c \
./ax25_agw.c \
./ax25_demod.c \
./ax25_l2.c \
./ax25_mod.c \
./berlekamp.c \
./Config.cpp \
./galois.c \
./kiss_mode.c \
./main.cpp \
./QtSoundModem.cpp \
./rs.c \
./ShowFilter.cpp \
./SMMain.c \
./sm_main.c \
./UZ7HOUtils.c \
./Waveout.c \
./tcpCode.cpp
FORMS += ./calibrateDialog.ui \
./devicesDialog.ui \
./filterWindow.ui \
./ModemDialog.ui \
./QtSoundModem.ui
RESOURCES += QtSoundModem.qrc

View File

@ -1,64 +0,0 @@
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 \
./6pack.cpp
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

@ -1,263 +0,0 @@
<?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>

View File

@ -1,64 +0,0 @@
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

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/QtSoundModem">
<file>soundmodem.ico</file>
</qresource>
</RCC>

Binary file not shown.

View File

@ -1,451 +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>993</width>
<height>900</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="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="Waterfall">
<property name="geometry">
<rect>
<x>80</x>
<y>488</y>
<width>881</width>
<height>100</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>5000</width>
<height>250</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="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>2</y>
<width>73</width>
<height>13</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="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>13</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 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 class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>993</width>
<height>21</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="QtSoundModem.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,470 +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="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4EDE958E-D0AC-37B4-81F7-78313A262DCD}</ProjectGuid>
<RootNamespace>QtSoundModem</RootNamespace>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.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)'=='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">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>debug\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>debug\</IntermediateDirectory>
<PrimaryOutput>QtSoundModem</PrimaryOutput>
</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" />
<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)'=='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">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</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" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<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)'=='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'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\\</IntDir>
<TargetName>QtSoundModem</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</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'">
<QtInstall>5.14.2</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</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'">
<QtInstall>5.14.2</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</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')">
<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)'=='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'">
<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>
<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>
<ClCompile Include="6pack.cpp" />
<ClCompile Include="ARDOPC.c" />
<ClCompile Include="berlekamp.c" />
<ClCompile Include="BusyDetect.c" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="dw9600.c" />
<ClCompile Include="hid.c" />
<ClCompile Include="il2p.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs>
</ClCompile>
<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="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>
<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|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|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|x64'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\moc_predefs.h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">debug\moc_predefs.h;%(Outputs)</Outputs>
</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>

View File

@ -1,195 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ARDOPC.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BusyDetect.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Modulate.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="QtSoundModem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RSUnit.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SMMain.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ShowFilter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SoundInput.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UZ7HOUtils.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ardopSampleArrays.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25_agw.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25_demod.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25_fec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25_l2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25_mod.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="galois.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="kiss_mode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ofdm.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pktARDOP.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="rs.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sm_main.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tcpCode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Waveout.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="hid.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="rsid.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="il2p.c">
<Filter>Source Files</Filter>
</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>
<QtMoc Include="QtSoundModem.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="tcpCode.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<QtUic Include="ModemDialog.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="QtSoundModem.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="calibrateDialog.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="devicesDialog.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="filterWindow.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<QtRcc Include="QtSoundModem.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include=".\QtSoundModem_resource.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="QtSoundModem.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UZ7HOStuff.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

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\SMTest</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-stylesheet StyleSheet.css</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\SMTest</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-stylesheet StyleSheet.css</LocalDebuggerCommandArguments>
</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>2024-10-02T12:37:32.3312444Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2024-10-02T12:37:32.7461423Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2024-10-02T12:37:33.4644113Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2024-10-02T12:37:33.9800504Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

View File

@ -1,175 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
<Keyword>QtVS_v301</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">
<QtMsBuild>$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Copy\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\Copy\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Copy\</OutDir>
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\Copy\</IntDir>
</PropertyGroup>
<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 Label="Shared" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtInstall>msvc2017</QtInstall>
<QtModules>core;gui;network;widgets</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtInstall>msvc2017</QtInstall>
<QtModules>core;gui;network;widgets</QtModules>
</PropertyGroup>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalDependencies>libfftw3f-3.lib;setupapi.lib;WS2_32.Lib;$(QtDir)\lib\Qt5SerialPort.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalDependencies>libfftw3f-3.lib;setupapi.lib;WS2_32.Lib;$(QtDir)\lib\Qt5SerialPort.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ARDOPC.c" />
<ClCompile Include="ardopSampleArrays.c" />
<ClCompile Include="ax25.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
</ClCompile>
<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="BusyDetect.c" />
<ClCompile Include="Config.cpp">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</CompileAs>
</ClCompile>
<ClCompile Include="galois.c" />
<ClCompile Include="hid.c" />
<ClCompile Include="kiss_mode.c" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Modulate.c" />
<ClCompile Include="ofdm.c" />
<ClCompile Include="pktARDOP.c" />
<ClCompile Include="QtSoundModem.cpp">
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">input</DynamicSource>
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).moc</QtMocFileName>
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">input</DynamicSource>
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).moc</QtMocFileName>
</ClCompile>
<ClCompile Include="rs.c" />
<ClCompile Include="RSUnit.c" />
<ClCompile Include="ShowFilter.cpp" />
<ClCompile Include="SMMain.c" />
<ClCompile Include="sm_main.c" />
<ClCompile Include="SoundInput.c" />
<ClCompile Include="tcpCode.cpp" />
<ClCompile Include="UZ7HOUtils.c" />
<ClCompile Include="Waveout.c" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="QtSoundModem.h" />
</ItemGroup>
<ItemGroup>
<QtUic Include="calibrateDialog.ui" />
<QtUic Include="devicesDialog.ui">
<SubType>Designer</SubType>
</QtUic>
<QtUic Include="filterWindow.ui" />
<QtUic Include="ModemDialog.ui">
<SubType>Designer</SubType>
</QtUic>
<QtUic Include="QtSoundModem.ui">
<SubType>Designer</SubType>
</QtUic>
</ItemGroup>
<ItemGroup>
<QtRcc Include="QtSoundModem.qrc" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="tcpCode.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="resource1.h" />
<ClInclude Include="UZ7HOStuff.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="QtSoundModem.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="icon1.ico" />
<Image Include="soundmodem.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Binary file not shown.

View File

@ -0,0 +1 @@
8922b347a8fa3c9e686c91f3bc76e7d350b4abb4

Binary file not shown.

View File

@ -1,37 +0,0 @@
#include <windows.h>
IDI_ICON1 ICON DISCARDABLE "SoundModem.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,0
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "\0"
VALUE "FileVersion", "0.0.0.0\0"
VALUE "LegalCopyright", "\0"
VALUE "OriginalFilename", "QtSoundModem.exe\0"
VALUE "ProductName", "QtSoundModem\0"
VALUE "ProductVersion", "0.0.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1200
END
END
/* End of Version info */

768
RSUnit.c
View File

@ -1,768 +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"
/*{***********************************************************************
* *
* RSUnit.pas *
* *
* (C) Copyright 1990-1999 Bruce K. Christensen *
* *
* Modifications *
* ============= *
* *
***********************************************************************}
{ This program is an encoder/decoder for Reed-Solomon codes. Encoding
is in systematic form, decoding via the Berlekamp iterative algorithm.
In the present form , the constants mm, nn, tt, and kk=nn-2tt must be
specified (the double letters are used simply to avoid clashes with
other n,k,t used in other programs into which this was incorporated!)
Also, the irreducible polynomial used to generate GF(2**mm) must also
be entered -- these can be found in Lin and Costello, and also Clark
and Cain.
The representation of the elements of GF(2**m) is either in index
form, where the number is the power of the primitive element alpha,
which is convenient for multiplication (add the powers
modulo 2**m-1) or in polynomial form, where the bits represent the
coefficients of the polynomial representation of the number, which
is the most convenient form for addition. The two forms are swapped
between via lookup tables. This leads to fairly messy looking
expressions, but unfortunately, there is no easy alternative when
working with Galois arithmetic.
The code is not written in the most elegant way, but to the best of
my knowledge, (no absolute guarantees!), it works. However, when
including it into a simulation program, you may want to do some
conversion of global variables (used here because I am lazy!) to
local variables where appropriate, and passing parameters (eg array
addresses) to the functions may be a sensible move to reduce the
number of global variables and thus decrease the chance of a bug
being introduced.
This program does not handle erasures at present, but should not be
hard to adapt to do this, as it is just an adjustment to the
Berlekamp-Massey algorithm. It also does not attempt to decode past
the BCH bound.
-- see Blahut "Theory and practiceof error control codes"
for how to do this.
Simon Rockliff, University of Adelaide 21/9/89 }
*/
#define mm 8 // { RS code over GF(2**mm) - change to suit }
#define nn (1 << mm) - 1 // { nn=2**mm -1 length of codeword }
#define MaxErrors 4 // { number of errors that can be corrected }
#define np 2 * MaxErrors // { number of parity symbols }
#define kk nn - np //{ data symbols, kk = nn-2*MaxErrors }
/*
short = short ;
TReedSolomon = Class(TComponent)
Procedure generate_gf ;
Procedure gen_poly ;
Procedure SetPrimitive(Var PP ;
nIdx : Integer ) ;
Public
Procedure InitBuffers ;
Procedure EncodeRS(Var xData ;
Var xEncoded ) ;
Function DecodeRS(Var xData ;
Var xDecoded ) : Integer ;
Constructor Create(AOwner : TComponent) ; Reintroduce ;
Destructor Destroy ; Reintroduce ;
End ;
*/
// specify irreducible polynomial coeffts }
Byte PP[17];
Byte CodeWord[256];
short Original_Recd[256];
short bb[np];
short data[256]; //
short recd[nn];
short alpha_to[nn + 1];
short index_of[nn + 1];
short gg[np + 1];
string cDuring;
string cName;
//aPPType = Array[2..16] of Pointer;
void * pPP[17];
Byte PP2[] = { 1 , 1 , 1 };
// { 1 + x + x^3 }
Byte PP3[] = { 1 , 1 , 0 , 1 };
// { 1 + x + x^4 }
Byte PP4[] = { 1 , 1 , 0 , 0 , 1 };
// { 1 + x^2 + x^5 }
Byte PP5[] = { 1 , 0 , 1 , 0 , 0 , 1 };
// { 1 + x + x^6 }
Byte PP6[] = { 1 , 1 , 0 , 0 , 0 , 0 , 1 };
// { 1 + x^3 + x^7 }
Byte PP7[] = { 1, 0, 0, 1, 0, 0, 0, 1 };
// { 1+x^2+x^3+x^4+x^8 }
Byte PP8[] = { 1 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 1 };
// { 1+x^4+x^9 }
Byte PP9[] = { 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
// { 1+x^3+x^10 }
Byte PP10[] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 };
// { 1+x^2+x^11 }
Byte PP11[] = { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
// { 1+x+x^4+x^6+x^12 }
Byte PP12[] = { 1, 1, 0, 0, 1, 0, 1, 0, 0,
0, 0, 0, 1 };
// { 1+x+x^3+x^4+x^13 }
Byte PP13[] = { 1, 1, 0, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 1 };
// { 1+x+x^6+x^10+x^14 }
Byte PP14[] = { 1, 1, 0, 0, 0, 0, 1, 0, 0,
0, 1, 0, 0, 0, 1 };
// { 1+x+x^15 }
Byte PP15[] = { 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1 };
// { 1+x+x^3+x^12+x^16 }
Byte PP16[] = { 1, 1, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 1 };
void InitBuffers();
/***********************************************************************
* *
* TReedSolomon.SetPrimitive *
* *
* Primitive polynomials - see Lin & Costello, Appendix A, *
* and Lee & Messerschmitt, p. 453. *
* *
* Modifications *
* ============= *
* *
***********************************************************************/
void SetPrimitive(void* PP, int nIdx)
{
move(pPP[nIdx], PP, (nIdx + 1));
}
/************************************************************************
* *
* Generate_GF *
* *
* Modifications *
* ============= *
* *
***********************************************************************/
void Generate_gf()
{
/* generate GF(2**mm) from the irreducible polynomial p(X)
in pp[0]..pp[mm]
lookup tables:
index->polynomial form alpha_to[] contains j=alpha**i ;
polynomial form -> index form index_of[j=alpha**i] = i
alpha = 2 is the primitive element of GF(2**mm)
*/
int i;
short mask;
SetPrimitive(PP, mm);
mask = 1;
alpha_to[mm] = 0;
for (i = 0; i < mm; i++)
{
alpha_to[i] = mask;
index_of[alpha_to[i]] = i;
if (PP[i] != 0)
alpha_to[mm] = alpha_to[mm] ^ mask;
mask = mask << 1;
}
index_of[alpha_to[mm]] = mm;
mask = mask >> 1;
for (i = mm + 1; i < nn; i++)
{
if (alpha_to[i - 1] >= mask)
alpha_to[i] = alpha_to[mm] ^ ((alpha_to[i - 1] ^ mask) << 1);
else
alpha_to[i] = alpha_to[i - 1] << 1;
index_of[alpha_to[i]] = i;
}
index_of[0] = -1;
}
/***********************************************************************
* *
* Gen_Poly *
* *
* Modifications *
* ============= *
* *
***********************************************************************/
void gen_poly()
{
/* Obtain the generator polynomial of the tt-error correcting, length
nn=(2**mm -1) Reed Solomon code from the product of
(X+alpha**i), i=1..2*tt
*/
short i, j;
gg[0] = 2; //{ primitive element alpha = 2 for GF(2**mm) }
gg[1] = 1; //{ g(x) = (X+alpha) initially }
i = nn;
j = kk;
j = i - j;
for (i = 2; i <= 8; i++)
{
gg[i] = 1;
for (j = (i - 1); j > 0; j--)
{
if (gg[j] != 0)
gg[j] = gg[j - 1] ^ alpha_to[(index_of[gg[j]] + i) % nn];
else
gg[j] = gg[j - 1];
}
// { gg[0] can never be zero }
gg[0] = alpha_to[(index_of[gg[0]] + i) % nn];
}
// { Convert gg[] to index form for quicker encoding. }
for (i = 0; i <= np; i++)
gg[i] = index_of[gg[i]];
}
/***********************************************************************
* *
* TxBase.Create *
* *
* Modifications *
* ============= *
* *
***********************************************************************/
void RsCreate()
{
InitBuffers();
//{ generate the Galois Field GF(2**mm) }
Generate_gf();
gen_poly();
}
/***********************************************************************
* *
* TReedSolomon.Destroy *
* *
* Modifications *
* ============= *
* *
************************************************************************/
/***********************************************************************
* *
* TReedSolomon.EncodeRS *
* *
* Modifications *
* ============= *
* *
***********************************************************************/
void EncodeRS(Byte * xData, Byte * xEncoded)
{
/* take the string of symbols in data[i], i=0..(k-1) and encode
systematically to produce 2*tt parity symbols in bb[0]..bb[2*tt-1]
data[] is input and bb[] is output in polynomial form. Encoding is
done by using a feedback shift register with appropriate connections
specified by the elements of gg[], which was generated above.
Codeword is c(X) = data(X)*X**(np)+ b(X) }
*/
// Type
// bArrType = Array[0..16383] of Byte;
int nI, i, j;
short feedback;
// absolute means variables share the same data
//axData : bArrType absolute xData ;
memset(bb, 0, sizeof(bb));
for (nI = 0; nI < nn; nI++)
data[nI] = xData[nI];
for (i = (kk - 1); i >= 0; i--)
{
feedback = index_of[data[i] ^ bb[np - 1]];
if (feedback != -1)
{
for (j = (np - 1); j > 0; j--)
{
if (gg[j] != -1)
bb[j] = bb[j - 1] ^ alpha_to[(gg[j] + feedback) % nn];
else
bb[j] = bb[j - 1];
}
bb[0] = alpha_to[(gg[0] + feedback) % nn];
}
else
{
for (j = (np - 1); j > 0; j--)
bb[j] = bb[j - 1];
bb[0] = 0;
}
}
//{ put the transmitted codeword, made up of data }
//{ plus parity, in CodeWord }
for (nI = 0; nI < np; nI++)
recd[nI] = bb[nI];
for (nI = 0; nI < kk; nI++)
recd[nI + np] = data[nI];
for (nI = 0; nI < nn; nI++)
CodeWord[nI] = recd[nI];
move(CodeWord, xEncoded, nn);
}
/***********************************************************************
* *
* DecodeRS *
* *
* Modifications *
* ============= *
* *
***********************************************************************}
Function TReedSolomon.DecodeRS(Var xData ;
Var xDecoded ) : Integer ;
{ assume we have received bits grouped into mm-bit symbols in recd[i],
i=0..(nn-1), and recd[i] is index form (ie as powers of alpha).
We first compute the 2*tt syndromes by substituting alpha**i into
rec(X) and evaluating, storing the syndromes in s[i], i=1..2tt
(leave s[0] zero). Then we use the Berlekamp iteration to find the
error location polynomial elp[i]. If the degree of the elp is >tt,
we cannot correct all the errors and hence just put out the information
symbols uncorrected. If the degree of elp is <=tt, we substitute
alpha**i , i=1..n into the elp to get the roots, hence the inverse
roots, the error location numbers. If the number of errors located
does not equal the degree of the elp, we have more than tt errors and
cannot correct them. Otherwise, we then solve for the error value at
the error location and correct the error. The procedure is that found
in Lin and Costello. for the cases where the number of errors is known
to be too large to correct, the information symbols as received are
output (the advantage of systematic encoding is that hopefully some
of the information symbols will be okay and that if we are in luck, the
errors are in the parity part of the transmitted codeword). Of course,
these insoluble cases can be returned as error flags to the calling
routine if desired. */
int DecodeRS(Byte * xData, Byte * xDecoded)
{
UNUSED(xDecoded);
// string cStr;
int nI; // , nJ, nK;
int i, j;
// short u, q;
// short elp[np + 2][np];
// short d[np + 2];
// short l[np + 2];
// short u_lu[np + 2];
short s[np + 1];
// short count;
short syn_error;
// short root[MaxErrors];
// short loc[MaxErrors];
// short z[MaxErrors];
// short err[nn];
// short reg[MaxErrors + 1];
for (nI = 0; nI < nn; nI++)
recd[nI] = xData[nI];
for (i = 0; i < nn; i++)
recd[i] = index_of[recd[i]]; // { put recd[i] into index form }
// count = 0;
syn_error = 0;
// { first form the syndromes }
for (i = 0; i < np; i++)
{
s[i] = 0;
for (j = 0; j < nn; j++)
{
if (recd[j] != -1)
// { recd[j] in index form }
{
s[i] = s[i] ^ alpha_to[(recd[j] + i * j) % nn];
}
}
//{ convert syndrome from polynomial form to index form }
if (s[i] != 0)
{
syn_error = 1; // { set flag if non-zero syndrome => error }
}
s[i] = index_of[s[i]];
}
if (syn_error != 0) // { if errors, try and correct }
{
/*
{ Compute the error location polynomial via the Berlekamp }
{ iterative algorithm, following the terminology of Lin and }
{ Costello: d[u] is the 'mu'th discrepancy, where u = 'mu' + 1 }
{ and 'mu' (the Greek letter!) is the step number ranging from }
{ -1 to 2 * tt(see L&C), l[u] is the degree of the elp at that }
{ step, and u_l[u] is the difference between the step number }
{and the degree of the elp. }
{ Initialize table entries }
d[0] : = 0; { index form }
d[1] : = s[1]; { index form }
elp[0][0] : = 0; { index form }
elp[1][0] : = 1; { polynomial form }
for i : = 1 to(np - 1) do
Begin
elp[0][i] : = -1; { index form }
elp[1][i] : = 0; { polynomial form }
End;
l[0] : = 0;
l[1] : = 0;
u_lu[0] : = -1;
u_lu[1] : = 0;
u: = 0;
While((u < np) and (l[u + 1] <= MaxErrors)) do
Begin
Inc(u);
If(d[u] = -1) then
Begin
l[u + 1] : = l[u];
for i : = 0 to l[u] do
Begin
elp[u + 1][i] : = elp[u][i];
elp[u][i] : = index_of[elp[u][i]];
End;
End
Else
{ search for words with greatest u_lu[q] for which d[q] != 0 }
Begin
q : = u - 1;
While((d[q] = -1) and (q > 0)) do
Dec(q);
{ have found first non - zero d[q] }
If(q > 0) then
Begin
j : = q;
While j > 0 do
Begin
Dec(j);
If((d[j] != -1) and (u_lu[q] < u_lu[j])) then
q : = j;
End;
End;
{ have now found q such that d[u] != 0 and u_lu[q] is maximum }
{ store degree of new elp polynomial }
If(l[u] > l[q] + u - q) then
l[u + 1] : = l[u]
Else
l[u + 1] : = l[q] + u - q;
{ form new elp(x) }
for i : = 0 to(np - 1) do
elp[u + 1][i] : = 0;
for i : = 0 to l[q] do
If(elp[q][i] != -1) then
elp[u + 1][i + u - q] : = alpha_to[(d[u] + nn - d[q] + elp[q][i]) mod nn];
for i : = 0 to l[u] do
Begin
elp[u + 1][i] : = elp[u + 1][i] ^ elp[u][i];
{ convert old elp value to index }
elp[u][i] : = index_of[elp[u][i]];
End;
End;
u_lu[u + 1] : = u - l[u + 1];
{ form(u + 1)th discrepancy }
If u < np then{ no discrepancy computed on last iteration }
Begin
If(s[u + 1] != -1) then
d[u + 1] : = alpha_to[s[u + 1]]
Else
d[u + 1] : = 0;
for i : = 1 to l[u + 1] do
If((s[u + 1 - i] != -1) and (elp[u + 1][i] != 0)) then
d[u + 1] : = d[u + 1] ^ alpha_to[(s[u + 1 - i] + index_of[elp[u + 1][i]]) mod nn];
{ put d[u + 1] into index form }
d[u + 1] : = index_of[d[u + 1]];
End;
End; { end While }
Inc(u);
If l[u] <= MaxErrors then{ can correct error }
Begin
{ put elp into index form }
for i : = 0 to l[u]do
elp[u][i] : = index_of[elp[u][i]];
{ find roots of the error location polynomial }
for i : = 1 to l[u] do
Begin
reg[i] : = elp[u][i];
End;
for i : = 1 to nn do
Begin
q : = 1;
for j : = 1 to l[u] do
If reg[j] != -1 then
Begin
reg[j] : = (reg[j] + j) mod nn;
q: = q ^ alpha_to[reg[j]];
End;
If q = 0 then{ store root and error location number indices }
Begin
root[count] : = i;
loc[count] : = nn - i;
Inc(count);
End;
End;
If count = l[u] then{ no.roots = degree of elp hence <= tt errors }
Begin
Result : = count;
{ form polynomial z(x) }
for i : = 1 to l[u] do { Z[0] = 1 always - do not need }
Begin
If((s[i] != -1) and (elp[u][i] != -1)) then
z[i] : = alpha_to[s[i]] ^ alpha_to[elp[u][i]]
Else
If((s[i] != -1) and (elp[u][i] = -1)) then
z[i] : = alpha_to[s[i]]
Else
If((s[i] = -1) and (elp[u][i] != -1)) then
z[i] : = alpha_to[elp[u][i]]
Else
z[i] : = 0;
for j : = 1 to(i - 1) do
if ((s[j] != -1) and (elp[u][i - j] != -1)) then
z[i] : = z[i] ^ alpha_to[(elp[u][i - j] + s[j]) mod nn];
{ put into index form }
z[i] : = index_of[z[i]];
End;
{ evaluate errors at locations given by }
{ error location numbers loc[i] }
for i : = 0 to(nn - 1) do
Begin
err[i] : = 0;
If recd[i] != -1 then{ convert recd[] to polynomial form }
recd[i] : = alpha_to[recd[i]]
Else
recd[i] : = 0;
End;
for i : = 0 to(l[u] - 1) do { compute numerator of error term first }
Begin
err[loc[i]] : = 1; { accounts for z[0] }
for j : = 1 to l[u] do
If z[j] != -1 then
err[loc[i]] : = err[loc[i]] ^ alpha_to[(z[j] + j * root[i]) mod nn];
If err[loc[i]] != 0 then
Begin
err[loc[i]] : = index_of[err[loc[i]]];
q: = 0; { form denominator of error term }
for j : = 0 to(l[u] - 1) do
If j != i then
q : = q + index_of[1 ^ alpha_to[(loc[j] + root[i]) mod nn]];
q: = q mod nn;
err[loc[i]] : = alpha_to[(err[loc[i]] - q + nn) mod nn];
{ recd[i] must be in polynomial form }
recd[loc[i]] : = recd[loc[i]] ^ err[loc[i]];
End;
End;
End
Else{ no.roots != degree of elp = > > tt errors and cannot solve }
Begin
Result : = -1; { Signal an error. }
for i : = 0 to(nn - 1) do { could return error flag if desired }
If recd[i] != -1 then{ convert recd[] to polynomial form }
recd[i] : = alpha_to[recd[i]]
Else
recd[i] : = 0; { just output received codeword as is }
End;
End{ if l[u] <= tt then }
Else{ elp has degree has degree > tt hence cannot solve }
for i : = 0 to(nn - 1) do { could return error flag if desired }
If recd[i] != -1 then{ convert recd[] to polynomial form }
recd[i] : = alpha_to[recd[i]]
Else
recd[i] : = 0; { just output received codeword as is }
End{ If syn_error != 0 then }
{ no non - zero syndromes = > no errors : output received codeword }
Else
Begin
for i : = 0 to(nn - 1) do
If recd[i] != -1 then{ convert recd[] to polynomial form }
recd[i] : = alpha_to[recd[i]]
Else
recd[i] : = 0;
Result: = 0; { No errors ocurred. }
End;
for nI : = 0 to(NN - 1) do
axDecoded[nI] : = Recd[nI];
End; { TReedSolomon.DecodeRS }
*/
return syn_error;
}
return 0;
}
/***********************************************************************
* *
* TReedSolomon.InitBuffers *
* *
* Modifications *
* ============= *
* *
***********************************************************************/
void InitBuffers()
{
memset(data, 0, sizeof(data));
memset(recd, 0, sizeof(recd));
memset(CodeWord, 0, sizeof(CodeWord));
//{ Initialize the Primitive Polynomial vector. }
pPP[2] = PP2;
pPP[3] = PP3;
pPP[4] = PP4;
pPP[5] = PP5;
pPP[6] = PP6;
pPP[7] = PP7;
pPP[8] = PP8;
pPP[9] = PP9;
pPP[10] = PP10;
pPP[11] = PP11;
pPP[12] = PP12;
pPP[13] = PP13;
pPP[14] = PP14;
pPP[15] = PP15;
pPP[16] = PP16;
}

Binary file not shown.

1538
SMMain.c

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 fft_size;
float max;
int i, k;
fft_size = 1024; // 12000 / 10; // 10hz on sample;
for (i = 0; i < tap; i++)
prev_graph_buf[i]= 0;
for (i = 0; i < fft_size; i++)
src_graph_buf[i] = 0;
src_graph_buf[0]= 1;
FIR_filter(src_graph_buf, fft_size, tap, buf, graph_buf, prev_graph_buf);
for (k = 0; k < fft_size; k++)
RealIn[k] = graph_buf[k] * 32768;
FourierTransform(fft_size, RealIn, RealOut, ImagOut, 0);
for (k = 0; k < (fft_size / 2) - 1; k++)
pnt_graph_buf[k] = powf(RealOut[k], 2) + powf(ImagOut[k], 2);
max = 0;
for (i = 0; i < (fft_size / 2) - 1; i++)
{
if (pnt_graph_buf[i] > max)
max = pnt_graph_buf[i];
}
if (max > 0)
{
for (i = 0; i < (fft_size / 2) - 1; i++)
pnt_graph_buf[i] = pnt_graph_buf[i] / max;
}
for (i = 0; i < (fft_size / 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);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,344 +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"
// TStringlist And String emulation Functions
// Dephi seems to mix starting counts at 0 or 1. I'll try making everything
// base zero.
// Initialise a list
void CreateStringList(TStringList * List)
{
List->Count = 0;
List->Items = 0;
}
int Count(TStringList * List)
{
return List->Count;
}
string * newString()
{
// Creates and Initialises a string
UCHAR * ptr = malloc(sizeof(string)); // Malloc Data separately so it can be ralloc'ed
string * New = (string *)ptr;
New->Length = 0;
New->AllocatedLength = 256;
New->Data = malloc(256);
return New;
}
void initString(string * S)
{
S->Length = 0;
S->AllocatedLength = 256;
S->Data = malloc(256);
}
void initTStringList(TStringList* T)
{
//string * New = newString();
T->Count = 0;
T->Items = NULL;
//Add(T, New);
}
TStringList * newTStringList()
{
TStringList * T = (TStringList *) malloc(sizeof(TStringList));
string * New = newString();
T->Count = 0;
T->Items = NULL;
Add(T, New);
return T;
}
void freeString(string * Msg)
{
if (Msg->Data)
free(Msg->Data);
free(Msg);
}
string * Strings(TStringList * Q, int Index)
{
// Gets string at index in stringlist
if (Index >= Q->Count)
return NULL;
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)
{
Q->Items = realloc(Q->Items,(Q->Count + 1) * sizeof(void *));
Q->Items[Q->Count++] = Entry;
return (Q->Count);
}
void mydelete(string * Source, int StartChar, int Count)
{
//Description
//The Delete procedure deletes up to Count characters from the passed parameter Source string starting
//from position StartChar.
if (StartChar > Source->Length)
return;
int left = Source->Length - StartChar;
if (Count > left)
Count = left;
memmove(&Source->Data[StartChar], &Source->Data[StartChar + Count], left - Count);
Source->Length -= Count;
}
void Delete(TStringList * Q, int Index)
{
// Remove item at Index and move rest up list
// Index starts at zero
if (Index >= Q->Count)
return;
// We should free it, so user must duplicate msg if needed after delete
freeString(Q->Items[Index]);
// free(Q->Items[Index]);
Q->Count--;
while (Index < Q->Count)
{
Q->Items[Index] = Q->Items[Index + 1];
Index++;
}
}
void setlength(string * Msg, int Count)
{
// Set length, allocating more space if needed
if (Count > Msg->AllocatedLength)
{
Msg->AllocatedLength = Count + 256;
Msg->Data = realloc(Msg->Data, Msg->AllocatedLength);
}
Msg->Length = Count;
}
string * mystringAdd(string * Msg, UCHAR * Chars, int Count, char * FILE, int LINE)
{
// 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)
{
Msg->AllocatedLength += Count + 256;
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);
Msg->Length += Count;
return Msg;
}
void Clear(TStringList * Q)
{
int i = 0;
if (Q->Items == NULL)
return;
while (Q->Count)
{
freeString(Q->Items[i++]);
Q->Count--;
}
free(Q->Items);
Q->Items = NULL;
}
// procedure move ( const SourcePointer; var DestinationPointer; CopyCount : Integer ) ;
// Description
// The move procedure is a badly named method of copying a section of memory from one place to another.
// CopyCount bytes are copied from storage referenced by SourcePointer and written to DestinationPointer
void move(UCHAR * SourcePointer, UCHAR * DestinationPointer, int CopyCount)
{
memmove(DestinationPointer, SourcePointer, CopyCount);
}
void fmove(float * SourcePointer, float * DestinationPointer, int CopyCount)
{
memmove(DestinationPointer, SourcePointer, CopyCount);
}
//Description
//The copy function has 2 forms. In the first, it creates a new string from part of an existing string. In the second, it creates a new array from part of an existing array.
//1.String copy
//The first character of a string has index = 1.
//Up to Count characters are copied from the StartChar of the Source string to the returned string.
//Less than Count characters if the end of the Source string is encountered before Count characters have been copied.
string * copy(string * Source, int StartChar, int Count)
{
string * NewString = newString();
int end = StartChar + Count;
if (end > Source->Length)
Count = Source->Length - StartChar;
memcpy(NewString->Data, &Source->Data[StartChar], Count);
NewString->Length = Count;
return NewString;
}
// Duplicate from > to
void Assign(TStringList * to, TStringList * from)
{
int i;
Clear(to);
if (from->Count == 0)
return;
// Duplicate each item
for (i = 0; i < from->Count; i++)
{
string * new = newString();
stringAdd(new, from->Items[i]->Data, from->Items[i]->Length);
Add(to, new);
}
}
string * duplicateString(string * in)
{
string * new = newString();
stringAdd(new, in->Data, in->Length);
return new;
}
double pila(double x)
{
//x : = frac(x); The frac function returns the fractional part of a floating point number.
double whole;
double rem;
rem = modf(x, &whole); // returns fraction, writes whole to whole
if (rem != rem)
rem = 0;
if (rem > 0.5)
rem = 1 - rem;
return 2 * rem;
}
boolean compareStrings(string * a, string * b)
{
if (a->Length == b->Length && memcmp(a->Data, b->Data, a->Length) == 0)
return TRUE;
return FALSE;
}
// This looks for a string in a stringlist. Returns index if found, otherwise -1
int my_indexof(TStringList * l, string * s)
{
int i;
for (i = 0; i < l->Count; i++)
{
// Need to compare count and data - C doesn't allow struct compare
if (l->Items[i]->Length == s->Length && memcmp(l->Items[i]->Data, s->Data, s->Length) == 0)
return i;
}
return -1;
}

1044
Waveout.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

328
audio.c
View File

@ -1,328 +0,0 @@
//
// This file is part of Dire Wolf, an amateur radio packet TNC.
//
// Copyright (C) 2011, 2012, 2013, 2014, 2015 John Langner, WB2OSZ
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// I've extracted the OSS bits from Direwolf's audio.c for use in QtSoundModem
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#ifdef __OpenBSD__
#include <soundcard.h>
#else
#include <sys/soundcard.h>
#endif
void Debugprintf(const char * format, ...);
void Sleep(int mS);
extern int Closing;
int oss_fd = -1; /* Single device, both directions. */
int insize = 0;
short rxbuffer[2400]; // 1200 stereo samples
int num_channels = 2; /* Should be 1 for mono or 2 for stereo. */
int samples_per_sec = 12000; /* Audio sampling rate. Typically 11025, 22050, or 44100. */
int bits_per_sample = 16; /* 8 (unsigned char) or 16 (signed short). */
// Originally 40. Version 1.2, try 10 for lower latency.
#define ONE_BUF_TIME 10
static int set_oss_params(int fd);
#define roundup1k(n) (((n) + 0x3ff) & ~0x3ff)
static int calcbufsize(int rate, int chans, int bits)
{
int size1 = (rate * chans * bits / 8 * ONE_BUF_TIME) / 1000;
int size2 = roundup1k(size1);
#if DEBUG
text_color_set(DW_COLOR_DEBUG);
printf("audio_open: calcbufsize (rate=%d, chans=%d, bits=%d) calc size=%d, round up to %d\n",
rate, chans, bits, size1, size2);
#endif
return (size2);
}
int oss_audio_open(char * adevice_in, char * adevice_out)
{
char audio_in_name[30];
char audio_out_name[30];
strcpy(audio_in_name, adevice_in);
strcpy(audio_out_name, adevice_out);
if (strcmp(audio_in_name, audio_out_name) == 0)
{
printf("Audio device for both receive and transmit: %s \n", audio_in_name);
}
else
{
printf("Audio input device for receive: %s\n", audio_in_name);
printf("Audio out device for transmit: %s\n", audio_out_name);
}
oss_fd = open(audio_in_name, O_RDWR);
if (oss_fd < 0)
{
printf("Could not open audio device %s\n", audio_in_name);
return 0;
}
else
printf("OSS fd = %d\n", oss_fd);
return set_oss_params(oss_fd);
}
static int set_oss_params(int fd)
{
int err;
int devcaps;
int asked_for;
int ossbuf_size_in_bytes;
int frag = (5 << 16) | (11);
err = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag);
if (err == -1)
{
perror("Not able to set fragment size");
// ossbuf_size_in_bytes = 2048; /* pick something reasonable */
}
err = ioctl(fd, SNDCTL_DSP_CHANNELS, &num_channels);
if (err == -1)
{
perror("Not able to set audio device number of channels");
return (0);
}
asked_for = samples_per_sec;
err = ioctl(fd, SNDCTL_DSP_SPEED, &samples_per_sec);
if (err == -1)
{
perror("Not able to set audio device sample rate");
return (0);
}
printf("Asked for %d samples/sec but actually using %d.\n", asked_for, samples_per_sec);
/* This is actually a bit mask but it happens that */
/* 0x8 is unsigned 8 bit samples and */
/* 0x10 is signed 16 bit little endian. */
err = ioctl(fd, SNDCTL_DSP_SETFMT, &bits_per_sample);
if (err == -1)
{
perror("Not able to set audio device sample size");
return (0);
}
/*
* Determine capabilities.
*/
err = ioctl(fd, SNDCTL_DSP_GETCAPS, &devcaps);
if (err == -1)
{
perror("Not able to get audio device capabilities");
// Is this fatal? // return (-1);
}
printf("audio_open(): devcaps = %08x\n", devcaps);
if (devcaps & DSP_CAP_DUPLEX) printf("Full duplex record/playback.\n");
if (devcaps & DSP_CAP_BATCH) printf("Device has some kind of internal buffers which may cause delays.\n");
if (devcaps & ~(DSP_CAP_DUPLEX | DSP_CAP_BATCH)) printf("Others...\n");
if (!(devcaps & DSP_CAP_DUPLEX))
{
printf("Audio device does not support full duplex\n");
// Do we care? // return (-1);
}
err = ioctl(fd, SNDCTL_DSP_SETDUPLEX, NULL);
if (err == -1)
{
perror("Not able to set audio full duplex mode");
// Unfortunate but not a disaster.
}
/*
* Get preferred block size.
* Presumably this will provide the most efficient transfer.
*
* In my particular situation, this turned out to be
* 2816 for 11025 Hz 16 bit mono
* 5568 for 11025 Hz 16 bit stereo
* 11072 for 44100 Hz 16 bit mono
*
* This was long ago under different conditions.
* Should study this again some day.
*
* Your milage may vary.
*/
err = ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &ossbuf_size_in_bytes);
if (err == -1)
{
perror("Not able to get audio block size");
ossbuf_size_in_bytes = 2048; /* pick something reasonable */
}
printf("audio_open(): suggestd block size is %d\n", ossbuf_size_in_bytes);
/*
* That's 1/8 of a second which seems rather long if we want to
* respond quickly.
*/
ossbuf_size_in_bytes = calcbufsize(samples_per_sec, num_channels, bits_per_sample);
printf("audio_open(): using block size of %d\n", ossbuf_size_in_bytes);
/* Version 1.3 - after a report of this situation for Mac OSX version. */
if (ossbuf_size_in_bytes < 256 || ossbuf_size_in_bytes > 32768)
{
printf("Audio buffer has unexpected extreme size of %d bytes.\n", ossbuf_size_in_bytes);
printf("Detected at %s, line %d.\n", __FILE__, __LINE__);
printf("This might be caused by unusual audio device configuration values.\n");
ossbuf_size_in_bytes = 2048;
printf("Using %d to attempt recovery.\n", ossbuf_size_in_bytes);
}
return (ossbuf_size_in_bytes);
}
int oss_read(short * samples, int nSamples)
{
int n;
int nBytes = nSamples * 4;
if (oss_fd < 0)
return 0;
// printf("audio_get(): read %d\n", nBytes - insize);
n = read(oss_fd, &rxbuffer[insize], nBytes - insize);
if (n < 0)
{
perror("Can't read from audio device");
insize = 0;
return (0);
}
insize += n;
if (n == nSamples * 4)
{
memcpy(samples, rxbuffer, insize);
insize = 0;
return nSamples;
}
return 0;
}
int oss_write(short * ptr, int len)
{
int k;
// int delay;
// ioctl(oss_fd, SNDCTL_DSP_GETODELAY, &delay);
// Debugprintf("Delay %d", delay);
k = write(oss_fd, ptr, len * 4);
//
if (k < 0)
{
perror("Can't write to audio device");
return (-1);
}
if (k < len * 4)
{
printf("oss_write(): write %d returns %d\n", len * 4, k);
/* presumably full but didn't block. */
usleep(10000);
}
ptr += k;
len -= k;
return 0;
}
void oss_flush()
{
int delay;
if (oss_fd < 0)
{
Debugprintf("OSS Flush Called when OSS closed");
return;
}
ioctl(oss_fd, SNDCTL_DSP_GETODELAY, &delay);
Debugprintf("OSS Flush Delay %d", delay);
while (delay)
{
Sleep(10);
ioctl(oss_fd, SNDCTL_DSP_GETODELAY, &delay);
// Debugprintf("Flush Delay %d", delay);
}
}
void oss_audio_close(void)
{
if (oss_fd > 0)
{
close(oss_fd);
oss_fd = -1;
}
return;
}

3344
ax25.c

File diff suppressed because it is too large Load Diff

1589
ax25_agw.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,417 +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"
//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);
#define FX25_FCR 1
#define FX25_PRIM 1
#define FX25_IPRIM 1
#define FX25_MM 8
#define FX25_NN 255
#define FX25_A0 FX25_NN
Byte FX25_ALPHA_TO[256] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,
0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,
0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,
0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,
0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,
0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,
0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,
0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,
0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,
0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,
0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,
0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00
};
Byte FX25_INDEX_OF[256] = {
255, 0, 1, 25, 2, 50, 26,198, 3,223, 51,238, 27,104,199, 75,
4,100,224, 14, 52,141,239,129, 28,193,105,248,200, 8, 76,113,
5,138,101, 47,225, 36, 15, 33, 53,147,142,218,240, 18,130, 69,
29,181,194,125,106, 39,249,185,201,154, 9,120, 77,228,114,166,
6,191,139, 98,102,221, 48,253,226,152, 37,179, 16,145, 34,136,
54,208,148,206,143,150,219,189,241,210, 19, 92,131, 56, 70, 64,
30, 66,182,163,195, 72,126,110,107, 58, 40, 84,250,133,186, 61,
202, 94,155,159, 10, 21,121, 43, 78,212,229,172,115,243,167, 87,
7,112,192,247,140,128, 99, 13,103, 74,222,237, 49,197,254, 24,
227,165,153,119, 38,184,180,124, 17, 68,146,217, 35, 32,137, 46,
55, 63,209, 91,149,188,207,205,144,135,151,178,220,252,190, 97,
242, 86,211,171, 20, 42, 93,158,132, 60, 57, 83, 71,109, 65,162,
31, 45, 67,216,183,123,164,118,196, 23, 73,236,127, 12,111,246,
108,161, 59, 82, 41,157, 85,170,251, 96,134,177,187,204, 62, 90,
203, 89, 95,176,156,169,160, 81, 11,245, 22,235,122,117, 44,215,
79,174,213,233,230,231,173,232,116,214,244,234,168, 80, 88,175
};
Byte FX25_CCSDS_poly_8[9] =
{ 29, 188, 142, 221, 118, 206, 52, 168, 0 };
Byte FX25_CCSDS_poly_16[17] =
{136,240,208,195,181,158,201,100, 11, 83,167,107,113,110,106,121, 0 };
Byte FX25_CCSDS_poly_32[33] = {
18,251,215, 28, 80,107,248, 53, 84,194, 91, 59,176, 99,203,137,
43,104,137, 0, 44,149,148,218, 75, 11,173,254,194,109, 8, 11,
0 };
Byte FX25_CCSDS_poly_64[65] = {
40, 21,218, 23, 48,237, 69, 6, 87, 42, 29,193,160,150,113, 32,
35,172,241,240,184, 90,188,225, 87,130,254, 41,245,253,184,241,
188,176, 54, 58,240,226,119,185, 77,150, 48,140,169,160, 96,217,
15,202,218,190,135,103,129, 77, 57,166,164, 12, 13,178, 53, 46,
0 };
integer FX25_NROOTS ;
Byte FX25_GENPOLY[256];
Byte MODNN(int x)
{
return x % 255;
}
void encode_rs(Byte * data, Byte * parity, int pad)
{
int i, j;
Byte feedback;
memset(parity, 0, FX25_NROOTS);
i = 0;
while (i < FX25_NN - FX25_NROOTS - pad)
{
feedback = FX25_INDEX_OF[data[i] ^ parity[0]];
if (feedback != FX25_A0)
{
j = 1;
while (j < FX25_NROOTS)
{
parity[j] = parity[j] ^ FX25_ALPHA_TO[MODNN(feedback + FX25_GENPOLY[FX25_NROOTS - j])];
j++;
}
}
move(&parity[1], &parity[0], FX25_NROOTS - 1);
if (feedback != FX25_A0)
parity[FX25_NROOTS - 1] = FX25_ALPHA_TO[MODNN(feedback + FX25_GENPOLY[0])];
else
parity[FX25_NROOTS - 1] = 0;
i++;
}
}
int FX25_MIN(int a, int b)
{
if (a > b)
return b;
else
return a;
}
int decode_rs(Byte * data, int * eras_pos, int no_eras, int pad)
{
int deg_lambda, el, deg_omega;
int i, j, r, k;
Byte q, tmp, num1, num2, den, discr_r;
Byte s[256];
Byte lambda[256];
Byte b[256];
Byte t[256];
Byte omega[256];
Byte root[256];
Byte reg[256];
Byte loc[256];
int syn_error, count = 0;
if (pad < 0 || pad>238)
return -1;
i = 0;
while (i < FX25_NROOTS)
{
s[i] = data[0];
i++;
}
j = 1;
while (j < FX25_NN - pad)
{
i = 0;
while (i < FX25_NROOTS)
{
if (s[i] == 0)
s[i] = data[j];
else
s[i] = data[j] ^ FX25_ALPHA_TO[MODNN(FX25_INDEX_OF[s[i]] + (FX25_FCR + i)*FX25_PRIM)];
i++;
}
j++;
}
syn_error = 0;
i = 0;
while (i < FX25_NROOTS)
{
syn_error = syn_error | s[i];
s[i] = FX25_INDEX_OF[s[i]];
i++;
}
if (syn_error == 0)
return count;
memset(&lambda[1], 0, FX25_NROOTS);
lambda[0] = 1;
i = 0;
while (i < FX25_NROOTS + 1)
{
b[i] = FX25_INDEX_OF[lambda[i]];
i++;
}
r = no_eras;
el = no_eras;
r++;
while (r <= FX25_NROOTS)
{
discr_r = 0;
i = 0;
while (i < r)
{
if (lambda[i] != 0 && s[r - i - 1] != FX25_A0)
discr_r = discr_r ^ FX25_ALPHA_TO[MODNN(FX25_INDEX_OF[lambda[i]] + s[r - i - 1])];
i++;
}
discr_r = FX25_INDEX_OF[discr_r];
if (discr_r == FX25_A0)
{
move(&b[0], &b[1], FX25_NROOTS);
b[0] = FX25_A0;
}
else
{
t[0] = lambda[0];
i = 0;
while (i < FX25_NROOTS)
{
if (b[i] != FX25_A0)
t[i + 1] = lambda[i + 1] ^ FX25_ALPHA_TO[MODNN(discr_r + b[i])];
else
t[i + 1] = lambda[i + 1];
i++;
}
if (2 * el <= r + no_eras - 1)
{
el = r + no_eras - el;
i = 0;
while (i <= FX25_NROOTS)
{
if (lambda[i] == 0)
b[i] = FX25_A0;
else
b[i] = MODNN(FX25_INDEX_OF[lambda[i]] - discr_r + FX25_NN);
i++;
}
}
else
{
move(&b[0], &b[1], FX25_NROOTS);
b[0] = FX25_A0;
}
move(t, lambda, FX25_NROOTS + 1);
}
r++;
}
deg_lambda = 0;
i = 0;
while (i < FX25_NROOTS + 1)
{
lambda[i] = FX25_INDEX_OF[lambda[i]];
if (lambda[i] != FX25_A0)
deg_lambda = i;
i++;
}
move(&lambda[1], &reg[1], FX25_NROOTS);
count = 0;
i = 1;
k = FX25_IPRIM - 1;
while (i <= FX25_NN)
{
q = 1;
j = deg_lambda;
while (j > 0)
{
if (reg[j] != FX25_A0)
{
reg[j] = MODNN(reg[j] + j);
q = q ^ FX25_ALPHA_TO[reg[j]];
}
j--;
}
if (q == 0)
{
root[count] = i;
loc[count] = k;
count++;
if (count == deg_lambda)
break;
}
i++;
k = MODNN(k + FX25_IPRIM);
}
if (deg_lambda != count)
return -1;
deg_omega = deg_lambda - 1;
i = 0;
while (i <= deg_omega)
{
tmp = 0;
j = i;
while (j >= 0)
{
if (s[i - j] != FX25_A0 && lambda[j] != FX25_A0)
tmp = tmp ^ FX25_ALPHA_TO[MODNN(s[i - j] + lambda[j])];
j--;
}
omega[i] = FX25_INDEX_OF[tmp];
i++;
}
j = count - 1;
while (j >= 0)
{
num1 = 0;
i = deg_omega;
while (i >= 0)
{
if (omega[i] != FX25_A0)
num1 = num1 ^ FX25_ALPHA_TO[MODNN(omega[i] + i * root[j])];
i--;
}
num2 = FX25_ALPHA_TO[MODNN(root[j] * (FX25_FCR - 1) + FX25_NN)];
den = 0;
i = FX25_MIN(deg_lambda, FX25_NROOTS - 1) & 0xFE;
while (i >= 0)
{
if (lambda[i + 1] != FX25_A0)
den = den ^ FX25_ALPHA_TO[MODNN(lambda[i + 1] + i * root[j])];
i = i - 2;
}
if (num1 != 0 && loc[j] >= pad)
data[loc[j] - pad] = data[loc[j] - pad] ^ FX25_ALPHA_TO[MODNN(FX25_INDEX_OF[num1] + FX25_INDEX_OF[num2] + FX25_NN - FX25_INDEX_OF[den])];
j--;
}
return count;
}
void fx25_encode_rs(Byte * data, Byte *parity, int pad, int rs_size)
{
switch (rs_size)
{
case 8:
move(&FX25_CCSDS_poly_8[0], &FX25_GENPOLY[0], 9);
FX25_NROOTS = rs_size;
encode_rs(data, parity, 0);
return;
case 16:
move(&FX25_CCSDS_poly_16[0], &FX25_GENPOLY[0], 17);
FX25_NROOTS = rs_size;
encode_rs(data, parity, 0);
return;
case 32:
move(&FX25_CCSDS_poly_32[0], &FX25_GENPOLY[0], 33);
FX25_NROOTS = rs_size;
encode_rs(data, parity, 0);
return;
case 64:
move(&FX25_CCSDS_poly_64[0], &FX25_GENPOLY[0], 65);
FX25_NROOTS = rs_size;
encode_rs(data, parity, 0);
return;
}
}
int fx25_decode_rs(Byte * data, int * eras_pos, int no_eras, int pad, int rs_size)
{
switch (rs_size)
{
case 8:
move(&FX25_CCSDS_poly_8[0], &FX25_GENPOLY[0], 9);
FX25_NROOTS = rs_size;
return decode_rs(data, eras_pos, no_eras, pad);
case 16:
move(&FX25_CCSDS_poly_16[0], &FX25_GENPOLY[0], 17);
FX25_NROOTS = rs_size;
return decode_rs(data, eras_pos, no_eras, pad);
case 32:
move(&FX25_CCSDS_poly_32[0], &FX25_GENPOLY[0], 33);
FX25_NROOTS = rs_size;
return decode_rs(data, eras_pos, no_eras, pad);
case 64:
move(&FX25_CCSDS_poly_64[0], &FX25_GENPOLY[0], 65);
FX25_NROOTS = rs_size;
return decode_rs(data, eras_pos, no_eras, pad);
default:
return -1;
}
}

1668
ax25_l2.c

File diff suppressed because it is too large Load Diff

1842
ax25_mod.c

File diff suppressed because it is too large Load Diff

View File

@ -1,329 +0,0 @@
/***********************************************************************
* Copyright Henry Minsky (hqm@alum.mit.edu) 1991-2009
*
* This software library is licensed under terms of the GNU GENERAL
* PUBLIC LICENSE
*
*
* RSCODE 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.
*
* RSCODE 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 Rscode. If not, see <http://www.gnu.org/licenses/>.
*
* Commercial licensing is available under a separate license, please
* contact author for details.
*
* Source code is available at http://rscode.sourceforge.net
* Berlekamp-Peterson and Berlekamp-Massey Algorithms for error-location
*
* From Cain, Clark, "Error-Correction Coding For Digital Communications", pp. 205.
*
* This finds the coefficients of the error locator polynomial.
*
* The roots are then found by looking for the values of a^n
* where evaluating the polynomial yields zero.
*
* Error correction is done using the error-evaluator equation on pp 207.
*
*/
#include <stdio.h>
#include "ecc.h"
/* The Error Locator Polynomial, also known as Lambda or Sigma. Lambda[0] == 1 */
static int Lambda[MAXDEG];
/* The Error Evaluator Polynomial */
static int Omega[MAXDEG];
/* local ANSI declarations */
static int compute_discrepancy(int lambda[], int S[], int L, int n);
static void init_gamma(int gamma[]);
static void compute_modified_omega (void);
static void mul_z_poly (int src[]);
/* error locations found using Chien's search*/
static int ErrorLocs[256];
int NErrors;
extern int xMaxErrors;
/* erasure flags */
static int ErasureLocs[256];
static int NErasures;
/* From Cain, Clark, "Error-Correction Coding For Digital Communications", pp. 216. */
void
Modified_Berlekamp_Massey (void)
{
int n, L, L2, k, d, i;
int psi[MAXDEG], psi2[MAXDEG], D[MAXDEG];
int gamma[MAXDEG];
/* initialize Gamma, the erasure locator polynomial */
init_gamma(gamma);
/* initialize to z */
copy_poly(D, gamma);
mul_z_poly(D);
copy_poly(psi, gamma);
k = -1; L = NErasures;
for (n = NErasures; n < NPAR; n++) {
d = compute_discrepancy(psi, synBytes, L, n);
if (d != 0) {
/* psi2 = psi - d*D */
for (i = 0; i < NPAR*2; i++) psi2[i] = psi[i] ^ gmult(d, D[i]);
if (L < (n-k)) {
L2 = n-k;
k = n-L;
/* D = scale_poly(ginv(d), psi); */
for (i = 0; i < NPAR*2; i++) D[i] = gmult(psi[i], ginv(d));
L = L2;
}
/* psi = psi2 */
for (i = 0; i < NPAR*2; i++) psi[i] = psi2[i];
}
mul_z_poly(D);
}
for(i = 0; i < NPAR*2; i++) Lambda[i] = psi[i];
compute_modified_omega();
}
/* given Psi (called Lambda in Modified_Berlekamp_Massey) and synBytes,
compute the combined erasure/error evaluator polynomial as
Psi*S mod z^4
*/
void
compute_modified_omega ()
{
int i;
int product[MAXDEG*2];
mult_polys(product, Lambda, synBytes);
zero_poly(Omega);
for(i = 0; i < NPAR; i++) Omega[i] = product[i];
}
/* polynomial multiplication */
void
mult_polys (int dst[], int p1[], int p2[])
{
int i, j;
int tmp1[MAXDEG*2];
for (i=0; i < (NPAR*2*2); i++) dst[i] = 0;
for (i = 0; i < NPAR*2; i++) {
for(j=NPAR*2; j<(NPAR*2*2); j++) tmp1[j]=0;
/* scale tmp1 by p1[i] */
for(j=0; j<NPAR*2; j++) tmp1[j]=gmult(p2[j], p1[i]);
/* and mult (shift) tmp1 right by i */
for (j = (NPAR*2*2)-1; j >= i; j--) tmp1[j] = tmp1[j-i];
for (j = 0; j < i; j++) tmp1[j] = 0;
/* add into partial product */
for(j=0; j < (NPAR*2*2); j++) dst[j] ^= tmp1[j];
}
}
/* gamma = product (1-z*a^Ij) for erasure locs Ij */
void
init_gamma (int gamma[])
{
int e, tmp[MAXDEG];
zero_poly(gamma);
zero_poly(tmp);
gamma[0] = 1;
for (e = 0; e < NErasures; e++) {
copy_poly(tmp, gamma);
scale_poly(gexp[ErasureLocs[e]], tmp);
mul_z_poly(tmp);
add_polys(gamma, tmp);
}
}
void
compute_next_omega (int d, int A[], int dst[], int src[])
{
int i;
for ( i = 0; i < NPAR*2; i++) {
dst[i] = src[i] ^ gmult(d, A[i]);
}
}
int
compute_discrepancy (int lambda[], int S[], int L, int n)
{
int i, sum=0;
for (i = 0; i <= L; i++)
sum ^= gmult(lambda[i], S[n-i]);
return (sum);
}
/********** polynomial arithmetic *******************/
void add_polys (int dst[], int src[])
{
int i;
for (i = 0; i < NPAR*2; i++) dst[i] ^= src[i];
}
void copy_poly (int dst[], int src[])
{
int i;
for (i = 0; i < NPAR*2; i++) dst[i] = src[i];
}
void scale_poly (int k, int poly[])
{
int i;
for (i = 0; i < NPAR*2; i++) poly[i] = gmult(k, poly[i]);
}
void zero_poly (int poly[])
{
int i;
for (i = 0; i < NPAR*2; i++) poly[i] = 0;
}
/* multiply by z, i.e., shift right by 1 */
static void mul_z_poly (int src[])
{
int i;
for (i = NPAR*2-1; i > 0; i--) src[i] = src[i-1];
src[0] = 0;
}
/* Finds all the roots of an error-locator polynomial with coefficients
* Lambda[j] by evaluating Lambda at successive values of alpha.
*
* This can be tested with the decoder's equations case.
*/
void
Find_Roots (void)
{
int sum, r, k;
NErrors = 0;
for (r = 1; r < 256; r++) {
sum = 0;
/* evaluate lambda at r */
for (k = 0; k < NPAR+1; k++) {
sum ^= gmult(gexp[(k*r)%255], Lambda[k]);
}
if (sum == 0)
{
ErrorLocs[NErrors] = (255-r); NErrors++;
if (DEBUG) fprintf(stderr, "Root found at r = %d, (255-r) = %d\n", r, (255-r));
}
}
}
/* Combined Erasure And Error Magnitude Computation
*
* Pass in the codeword, its size in bytes, as well as
* an array of any known erasure locations, along the number
* of these erasures.
*
* Evaluate Omega(actually Psi)/Lambda' at the roots
* alpha^(-i) for error locs i.
*
* returns 1 if everything ok, or 0 if an out-of-bounds error is found
*
*/
int
correct_errors_erasures (unsigned char codeword[],
int csize,
int nerasures,
int erasures[])
{
int r, i, j, err;
/* If you want to take advantage of erasure correction, be sure to
set NErasures and ErasureLocs[] with the locations of erasures.
*/
NErasures = nerasures;
for (i = 0; i < NErasures; i++) ErasureLocs[i] = erasures[i];
Modified_Berlekamp_Massey();
Find_Roots();
if (DEBUG) fprintf(stderr, "RS found %d errors\n", NErrors);
if ((NErrors <= xMaxErrors) && NErrors > 0) {
/* first check for illegal error locs */
for (r = 0; r < NErrors; r++) {
if (ErrorLocs[r] >= csize) {
if (DEBUG) fprintf(stderr, "Error loc i=%d outside of codeword length %d\n", i, csize);
return(0);
}
}
for (r = 0; r < NErrors; r++) {
int num, denom;
i = ErrorLocs[r];
/* evaluate Omega at alpha^(-i) */
num = 0;
for (j = 0; j < NPAR*2; j++)
num ^= gmult(Omega[j], gexp[((255-i)*j)%255]);
/* evaluate Lambda' (derivative) at alpha^(-i) ; all odd powers disappear */
denom = 0;
for (j = 1; j < NPAR*2; j += 2) {
denom ^= gmult(Lambda[j], gexp[((255-i)*(j-1)) % 255]);
}
err = gmult(num, ginv(denom));
if (DEBUG) fprintf(stderr, "Error magnitude %#x at loc %d\n", err, csize-i);
codeword[csize-i-1] ^= err;
}
return(1);
}
else {
if (DEBUG && NErrors) fprintf(stderr, "Uncorrectable codeword\n");
return(0);
}
}

View File

@ -1,298 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>calDialog</class>
<widget class="QDialog" name="calDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>270</width>
<height>453</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QGroupBox" name="groupBoxA">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>120</width>
<height>195</height>
</rect>
</property>
<property name="title">
<string>Channel A</string>
</property>
<widget class="QPushButton" name="Low_A">
<property name="geometry">
<rect>
<x>26</x>
<y>26</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Low Tone</string>
</property>
</widget>
<widget class="QPushButton" name="High_A">
<property name="geometry">
<rect>
<x>26</x>
<y>66</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>High Tone</string>
</property>
</widget>
<widget class="QPushButton" name="Both_A">
<property name="geometry">
<rect>
<x>26</x>
<y>106</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Both Tones</string>
</property>
</widget>
<widget class="QPushButton" name="Stop_A">
<property name="geometry">
<rect>
<x>26</x>
<y>146</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Stop TX</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxB">
<property name="geometry">
<rect>
<x>140</x>
<y>10</y>
<width>120</width>
<height>195</height>
</rect>
</property>
<property name="title">
<string>Channel B</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<widget class="QPushButton" name="Low_B">
<property name="geometry">
<rect>
<x>26</x>
<y>26</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Low Tone</string>
</property>
</widget>
<widget class="QPushButton" name="High_B">
<property name="geometry">
<rect>
<x>26</x>
<y>66</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>High Tone</string>
</property>
</widget>
<widget class="QPushButton" name="Both_B">
<property name="geometry">
<rect>
<x>26</x>
<y>106</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Both Tones</string>
</property>
</widget>
<widget class="QPushButton" name="Stop_B">
<property name="geometry">
<rect>
<x>28</x>
<y>146</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Stop TX</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>120</width>
<height>195</height>
</rect>
</property>
<property name="title">
<string>Channel C</string>
</property>
<widget class="QPushButton" name="High_C">
<property name="geometry">
<rect>
<x>26</x>
<y>70</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>High Tone</string>
</property>
</widget>
<widget class="QPushButton" name="Both_C">
<property name="geometry">
<rect>
<x>26</x>
<y>110</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Both Tones</string>
</property>
</widget>
<widget class="QPushButton" name="Low_C">
<property name="geometry">
<rect>
<x>26</x>
<y>30</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Low Tone</string>
</property>
</widget>
<widget class="QPushButton" name="Stop_C">
<property name="geometry">
<rect>
<x>26</x>
<y>150</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Stop TX</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>140</x>
<y>210</y>
<width>120</width>
<height>195</height>
</rect>
</property>
<property name="title">
<string>Channel D</string>
</property>
<widget class="QPushButton" name="High_D">
<property name="geometry">
<rect>
<x>26</x>
<y>70</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>High Tone</string>
</property>
</widget>
<widget class="QPushButton" name="Both_D">
<property name="geometry">
<rect>
<x>25</x>
<y>110</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Both Tones</string>
</property>
</widget>
<widget class="QPushButton" name="Low_D">
<property name="geometry">
<rect>
<x>26</x>
<y>30</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Low Tone</string>
</property>
</widget>
<widget class="QPushButton" name="Stop_D">
<property name="geometry">
<rect>
<x>26</x>
<y>150</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Stop TX</string>
</property>
</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>
<resources/>
<connections/>
<slots>
<slot>buttonClick()</slot>
</slots>
</ui>

9
config
View File

@ -1,9 +0,0 @@
[core]
repositoryformatversion = 0
filemode = false
bare = true
symlinks = false
ignorecase = true
[remote "origin"]
url = ssh://git@vps1.g8bpq.net:7322/home/git/QtSM
fetch = +refs/heads/*:refs/remotes/origin/*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

50
debian/changelog vendored
View File

@ -1,50 +0,0 @@
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
View File

@ -1,17 +0,0 @@
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
View File

@ -1,29 +0,0 @@
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
View File

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

View File

@ -1,6 +0,0 @@
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
View File

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

View File

@ -1,130 +0,0 @@
--- 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);

View File

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

View File

@ -1,20 +0,0 @@
--- 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)
{

View File

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

9
debian/postinst vendored
View File

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

View File

@ -1,13 +0,0 @@
[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
View File

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

View File

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

View File

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

View File

View File

@ -1,12 +0,0 @@
#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

@ -1,12 +0,0 @@
#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

@ -1,12 +0,0 @@
#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

@ -1,12 +0,0 @@
#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

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

File diff suppressed because it is too large Load Diff

4331
dw9600.c

File diff suppressed because it is too large Load Diff

2042
dw9600.h

File diff suppressed because it is too large Load Diff

102
ecc.h
View File

@ -1,102 +0,0 @@
/* Reed Solomon Coding for glyphs
* Copyright Henry Minsky (hqm@alum.mit.edu) 1991-2009
*
* This software library is licensed under terms of the GNU GENERAL
* PUBLIC LICENSE
*
* RSCODE 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.
*
* RSCODE 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 Rscode. If not, see <http://www.gnu.org/licenses/>.
*
* Source code is available at http://rscode.sourceforge.net
*
* Commercial licensing is available under a separate license, please
* contact author for details.
*
*/
/****************************************************************
Below is NPAR, the only compile-time parameter you should have to
modify.
It is the number of parity bytes which will be appended to
your data to create a codeword.
Note that the maximum codeword size is 255, so the
sum of your message length plus parity should be less than
or equal to this maximum limit.
In practice, you will get slooow error correction and decoding
if you use more than a reasonably small number of parity bytes.
(say, 10 or 20)
****************************************************************/
#define MAXNPAR 64 // Sets size of static tables
extern int NPAR; // Currently used number
/****************************************************************/
#define TRUE 1
#define FALSE 0
typedef unsigned long BIT32;
typedef unsigned short BIT16;
/* **************************************************************** */
/* Maximum degree of various polynomials. */
#define MAXDEG (MAXNPAR*2)
/*************************************/
/* Encoder parity bytes */
extern int pBytes[MAXDEG];
/* Decoder syndrome bytes */
extern int synBytes[MAXDEG];
/* print debugging info */
extern int DEBUG;
/* Reed Solomon encode/decode routines */
void initialize_ecc (void);
int check_syndrome (void);
void decode_data (unsigned char data[], int nbytes);
void encode_data (unsigned char msg[], int nbytes, unsigned char dst[]);
/* CRC-CCITT checksum generator */
BIT16 crc_ccitt(unsigned char *msg, int len);
/* galois arithmetic tables */
extern int gexp[];
extern int glog[];
void init_galois_tables (void);
int ginv(int elt);
int gmult(int a, int b);
/* Error location routines */
int correct_errors_erasures (unsigned char codeword[], int csize,int nerasures, int erasures[]);
/* polynomial arithmetic */
void add_polys(int dst[], int src[]) ;
void scale_poly(int k, int poly[]);
void mult_polys(int dst[], int p1[], int p2[]);
void copy_poly(int dst[], int src[]);
void zero_poly(int poly[]);

72
fftw3.f
View File

@ -1,72 +0,0 @@
INTEGER FFTW_R2HC
PARAMETER (FFTW_R2HC=0)
INTEGER FFTW_HC2R
PARAMETER (FFTW_HC2R=1)
INTEGER FFTW_DHT
PARAMETER (FFTW_DHT=2)
INTEGER FFTW_REDFT00
PARAMETER (FFTW_REDFT00=3)
INTEGER FFTW_REDFT01
PARAMETER (FFTW_REDFT01=4)
INTEGER FFTW_REDFT10
PARAMETER (FFTW_REDFT10=5)
INTEGER FFTW_REDFT11
PARAMETER (FFTW_REDFT11=6)
INTEGER FFTW_RODFT00
PARAMETER (FFTW_RODFT00=7)
INTEGER FFTW_RODFT01
PARAMETER (FFTW_RODFT01=8)
INTEGER FFTW_RODFT10
PARAMETER (FFTW_RODFT10=9)
INTEGER FFTW_RODFT11
PARAMETER (FFTW_RODFT11=10)
INTEGER FFTW_FORWARD
PARAMETER (FFTW_FORWARD=-1)
INTEGER FFTW_BACKWARD
PARAMETER (FFTW_BACKWARD=+1)
INTEGER FFTW_MEASURE
PARAMETER (FFTW_MEASURE=0)
INTEGER FFTW_DESTROY_INPUT
PARAMETER (FFTW_DESTROY_INPUT=1)
INTEGER FFTW_UNALIGNED
PARAMETER (FFTW_UNALIGNED=2)
INTEGER FFTW_CONSERVE_MEMORY
PARAMETER (FFTW_CONSERVE_MEMORY=4)
INTEGER FFTW_EXHAUSTIVE
PARAMETER (FFTW_EXHAUSTIVE=8)
INTEGER FFTW_PRESERVE_INPUT
PARAMETER (FFTW_PRESERVE_INPUT=16)
INTEGER FFTW_PATIENT
PARAMETER (FFTW_PATIENT=32)
INTEGER FFTW_ESTIMATE
PARAMETER (FFTW_ESTIMATE=64)
INTEGER FFTW_WISDOM_ONLY
PARAMETER (FFTW_WISDOM_ONLY=2097152)
INTEGER FFTW_ESTIMATE_PATIENT
PARAMETER (FFTW_ESTIMATE_PATIENT=128)
INTEGER FFTW_BELIEVE_PCOST
PARAMETER (FFTW_BELIEVE_PCOST=256)
INTEGER FFTW_NO_DFT_R2HC
PARAMETER (FFTW_NO_DFT_R2HC=512)
INTEGER FFTW_NO_NONTHREADED
PARAMETER (FFTW_NO_NONTHREADED=1024)
INTEGER FFTW_NO_BUFFERING
PARAMETER (FFTW_NO_BUFFERING=2048)
INTEGER FFTW_NO_INDIRECT_OP
PARAMETER (FFTW_NO_INDIRECT_OP=4096)
INTEGER FFTW_ALLOW_LARGE_GENERIC
PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192)
INTEGER FFTW_NO_RANK_SPLITS
PARAMETER (FFTW_NO_RANK_SPLITS=16384)
INTEGER FFTW_NO_VRANK_SPLITS
PARAMETER (FFTW_NO_VRANK_SPLITS=32768)
INTEGER FFTW_NO_VRECURSE
PARAMETER (FFTW_NO_VRECURSE=65536)
INTEGER FFTW_NO_SIMD
PARAMETER (FFTW_NO_SIMD=131072)
INTEGER FFTW_NO_SLOW
PARAMETER (FFTW_NO_SLOW=262144)
INTEGER FFTW_NO_FIXED_RADIX_LARGE_N
PARAMETER (FFTW_NO_FIXED_RADIX_LARGE_N=524288)
INTEGER FFTW_ALLOW_PRUNING
PARAMETER (FFTW_ALLOW_PRUNING=1048576)

415
fftw3.h
View File

@ -1,415 +0,0 @@
/*
* Copyright (c) 2003, 2007-14 Matteo Frigo
* Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
*
* The following statement of license applies *only* to this header file,
* and *not* to the other files distributed with FFTW or derived therefrom:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/***************************** NOTE TO USERS *********************************
*
* THIS IS A HEADER FILE, NOT A MANUAL
*
* If you want to know how to use FFTW, please read the manual,
* online at http://www.fftw.org/doc/ and also included with FFTW.
* For a quick start, see the manual's tutorial section.
*
* (Reading header files to learn how to use a library is a habit
* stemming from code lacking a proper manual. Arguably, it's a
* *bad* habit in most cases, because header files can contain
* interfaces that are not part of the public, stable API.)
*
****************************************************************************/
#ifndef FFTW3_H
#define FFTW3_H
#include <stdio.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* If <complex.h> is included, use the C99 complex type. Otherwise
define a type bit-compatible with C99 complex */
#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
#else
# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
#endif
#define FFTW_CONCAT(prefix, name) prefix ## name
#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name)
/* IMPORTANT: for Windows compilers, you should add a line
*/
//#define FFTW_DLL
/*
here and in kernel/ifftw.h if you are compiling/using FFTW as a
DLL, in order to do the proper importing/exporting, or
alternatively compile with -DFFTW_DLL or the equivalent
command-line flag. This is not necessary under MinGW/Cygwin, where
libtool does the imports/exports automatically. */
#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
/* annoying Windows syntax for shared-library declarations */
# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
# define FFTW_EXTERN extern __declspec(dllexport)
# else /* user is calling FFTW; import symbol */
# define FFTW_EXTERN extern __declspec(dllimport)
# endif
#else
# define FFTW_EXTERN extern
#endif
enum fftw_r2r_kind_do_not_use_me {
FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
};
struct fftw_iodim_do_not_use_me {
int n; /* dimension size */
int is; /* input stride */
int os; /* output stride */
};
#include <stddef.h> /* for ptrdiff_t */
struct fftw_iodim64_do_not_use_me {
ptrdiff_t n; /* dimension size */
ptrdiff_t is; /* input stride */
ptrdiff_t os; /* output stride */
};
typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *);
typedef int (*fftw_read_char_func_do_not_use_me)(void *);
/*
huge second-order macro that defines prototypes for all API
functions. We expand this macro for each supported precision
X: name-mangling macro
R: real data type
C: complex data type
*/
#define FFTW_DEFINE_API(X, R, C) \
\
FFTW_DEFINE_COMPLEX(R, C); \
\
typedef struct X(plan_s) *X(plan); \
\
typedef struct fftw_iodim_do_not_use_me X(iodim); \
typedef struct fftw_iodim64_do_not_use_me X(iodim64); \
\
typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
\
typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
\
FFTW_EXTERN void X(execute)(const X(plan) p); \
\
FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \
C *in, C *out, int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \
C *in, C *out, int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
int sign, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, C *out, \
int sign, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *ro, R *io, \
unsigned flags); \
\
FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \
FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \
R *ro, R *io); \
\
FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
C *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \
R *in, C *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \
R *in, C *out, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \
int n2, \
R *in, C *out, unsigned flags); \
\
\
FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \
int howmany, \
C *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \
C *in, R *out, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \
int n2, \
C *in, R *out, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \
int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \
int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, C *out, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \
const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
C *in, R *out, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \
int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *ro, R *io, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \
int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *ri, R *ii, R *out, \
unsigned flags); \
\
FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
\
FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \
R *in, R *ro, R *io); \
FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \
R *ri, R *ii, R *out); \
\
FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \
int howmany, \
R *in, const int *inembed, \
int istride, int idist, \
R *out, const int *onembed, \
int ostride, int odist, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \
X(r2r_kind) kind, unsigned flags); \
FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \
X(r2r_kind) kind0, X(r2r_kind) kind1, \
unsigned flags); \
FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \
R *in, R *out, X(r2r_kind) kind0, \
X(r2r_kind) kind1, X(r2r_kind) kind2, \
unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
int howmany_rank, \
const X(iodim) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \
int howmany_rank, \
const X(iodim64) *howmany_dims, \
R *in, R *out, \
const X(r2r_kind) *kind, unsigned flags); \
\
FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \
\
FFTW_EXTERN void X(destroy_plan)(X(plan) p); \
FFTW_EXTERN void X(forget_wisdom)(void); \
FFTW_EXTERN void X(cleanup)(void); \
\
FFTW_EXTERN void X(set_timelimit)(double t); \
\
FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \
FFTW_EXTERN int X(init_threads)(void); \
FFTW_EXTERN void X(cleanup_threads)(void); \
FFTW_EXTERN void X(make_planner_thread_safe)(void); \
\
FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \
FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \
FFTW_EXTERN char *X(export_wisdom_to_string)(void); \
FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \
void *data); \
FFTW_EXTERN int X(import_system_wisdom)(void); \
FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \
FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \
FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \
FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \
\
FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \
FFTW_EXTERN void X(print_plan)(const X(plan) p); \
FFTW_EXTERN char *X(sprint_plan)(const X(plan) p); \
\
FFTW_EXTERN void *X(malloc)(size_t n); \
FFTW_EXTERN R *X(alloc_real)(size_t n); \
FFTW_EXTERN C *X(alloc_complex)(size_t n); \
FFTW_EXTERN void X(free)(void *p); \
\
FFTW_EXTERN void X(flops)(const X(plan) p, \
double *add, double *mul, double *fmas); \
FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \
FFTW_EXTERN double X(cost)(const X(plan) p); \
\
FFTW_EXTERN int X(alignment_of)(R *p); \
FFTW_EXTERN const char X(version)[]; \
FFTW_EXTERN const char X(cc)[]; \
FFTW_EXTERN const char X(codelet_optim)[];
/* end of FFTW_DEFINE_API macro */
FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
&& !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \
&& (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
/* note: __float128 is a typedef, which is not supported with the _Complex
keyword in gcc, so instead we use this ugly __attribute__ version.
However, we can't simply pass the __attribute__ version to
FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
# undef FFTW_DEFINE_COMPLEX
# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
# endif
FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
#endif
#define FFTW_FORWARD (-1)
#define FFTW_BACKWARD (+1)
#define FFTW_NO_TIMELIMIT (-1.0)
/* documented flags */
#define FFTW_MEASURE (0U)
#define FFTW_DESTROY_INPUT (1U << 0)
#define FFTW_UNALIGNED (1U << 1)
#define FFTW_CONSERVE_MEMORY (1U << 2)
#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
#define FFTW_ESTIMATE (1U << 6)
#define FFTW_WISDOM_ONLY (1U << 21)
/* undocumented beyond-guru flags */
#define FFTW_ESTIMATE_PATIENT (1U << 7)
#define FFTW_BELIEVE_PCOST (1U << 8)
#define FFTW_NO_DFT_R2HC (1U << 9)
#define FFTW_NO_NONTHREADED (1U << 10)
#define FFTW_NO_BUFFERING (1U << 11)
#define FFTW_NO_INDIRECT_OP (1U << 12)
#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
#define FFTW_NO_RANK_SPLITS (1U << 14)
#define FFTW_NO_VRANK_SPLITS (1U << 15)
#define FFTW_NO_VRECURSE (1U << 16)
#define FFTW_NO_SIMD (1U << 17)
#define FFTW_NO_SLOW (1U << 18)
#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
#define FFTW_ALLOW_PRUNING (1U << 20)
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* FFTW3_H */

View File

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>673</width>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>160</x>
<y>345</y>
<width>351</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>15</x>
<y>15</y>
<width>642</width>
<height>312</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>

113
galois.c
View File

@ -1,113 +0,0 @@
/*****************************
* Copyright Henry Minsky (hqm@alum.mit.edu) 1991-2009
*
* This software library is licensed under terms of the GNU GENERAL
* PUBLIC LICENSE
*
* RSCODE 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.
* RSCODE 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 Rscode. If not, see <http://www.gnu.org/licenses/>.
* Commercial licensing is available under a separate license, please
* contact author for details.
*
* Source code is available at http://rscode.sourceforge.net
*
*
* Multiplication and Arithmetic on Galois Field GF(256)
*
* From Mee, Daniel, "Magnetic Recording, Volume III", Ch. 5 by Patel.
*
*
******************************/
#include <stdio.h>
#include <stdlib.h>
#include "ecc.h"
/* This is one of 14 irreducible polynomials
* of degree 8 and cycle length 255. (Ch 5, pp. 275, Magnetic Recording)
* The high order 1 bit is implicit */
/* x^8 + x^4 + x^3 + x^2 + 1 */
#define PPOLY 0x1D
int gexp[512];
int glog[256];
static void init_exp_table (void);
void
init_galois_tables (void)
{
/* initialize the table of powers of alpha */
init_exp_table();
}
static void
init_exp_table (void)
{
int i, z;
int pinit,p1,p2,p3,p4,p5,p6,p7,p8;
pinit = p2 = p3 = p4 = p5 = p6 = p7 = p8 = 0;
p1 = 1;
gexp[0] = 1;
gexp[255] = gexp[0];
glog[0] = 0; /* shouldn't log[0] be an error? */
// Private pp8() As Integer = {1, 0, 1, 1, 1, 0, 0, 0, 1} 'specify irreducible polynomial coeffts */
for (i = 1; i < 256; i++) {
pinit = p8;
p8 = p7;
p7 = p6;
p6 = p5;
p5 = p4 ^ pinit;
p4 = p3 ^ pinit;
p3 = p2 ^ pinit;
p2 = p1;
p1 = pinit;
gexp[i] = p1 + p2*2 + p3*4 + p4*8 + p5*16 + p6*32 + p7*64 + p8*128;
gexp[i+255] = gexp[i];
}
for (i = 1; i < 256; i++) {
for (z = 0; z < 256; z++) {
if (gexp[z] == i) {
glog[i] = z;
break;
}
}
}
}
/* multiplication using logarithms */
int gmult(int a, int b)
{
int i,j;
if (a==0 || b == 0) return (0);
i = glog[a];
j = glog[b];
return (gexp[i+j]);
}
int ginv (int elt)
{
return (gexp[255-glog[elt]]);
}

337
globals.h
View File

@ -1,337 +0,0 @@
// ----------------------------------------------------------------------------
// globals.h -- constants, variables, arrays & functions that need to be
// outside of any thread
//
// Copyright (C) 2006-2007
// Dave Freese, W1HKJ
// Copyright (C) 2007-2010
// Stelios Bounanos, M0GLD
//
// This file is part of fldigi. Adapted in part from code contained in gmfsk
// source code distribution.
//
// Fldigi 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.
//
// Fldigi 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 fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include <stdint.h>
//#include <string>
enum state_t {
STATE_PAUSE = 0,
STATE_RX,
STATE_TX,
STATE_RESTART,
STATE_TUNE,
STATE_ABORT,
STATE_FLUSH,
STATE_NOOP,
STATE_EXIT,
STATE_ENDED,
STATE_IDLE,
STATE_NEW_MODEM
};
enum {
MODE_PREV = -2,
MODE_NEXT,
MODE_NULL,
MODE_CW,
MODE_CONTESTIA,
MODE_CONTESTIA_4_125, MODE_CONTESTIA_4_250,
MODE_CONTESTIA_4_500, MODE_CONTESTIA_4_1000, MODE_CONTESTIA_4_2000,
MODE_CONTESTIA_8_125, MODE_CONTESTIA_8_250,
MODE_CONTESTIA_8_500, MODE_CONTESTIA_8_1000, MODE_CONTESTIA_8_2000,
MODE_CONTESTIA_16_250, MODE_CONTESTIA_16_500,
MODE_CONTESTIA_16_1000, MODE_CONTESTIA_16_2000,
MODE_CONTESTIA_32_1000, MODE_CONTESTIA_32_2000,
MODE_CONTESTIA_64_500, MODE_CONTESTIA_64_1000, MODE_CONTESTIA_64_2000,
MODE_CONTESTIA_FIRST = MODE_CONTESTIA_4_125,
MODE_CONTESTIA_LAST = MODE_CONTESTIA_64_2000,
MODE_DOMINOEXMICRO,
MODE_DOMINOEX4,
MODE_DOMINOEX5,
MODE_DOMINOEX8,
MODE_DOMINOEX11,
MODE_DOMINOEX16,
MODE_DOMINOEX22,
MODE_DOMINOEX44,
MODE_DOMINOEX88,
MODE_DOMINOEX_FIRST = MODE_DOMINOEXMICRO,
MODE_DOMINOEX_LAST = MODE_DOMINOEX88,
MODE_FELDHELL,
MODE_SLOWHELL,
MODE_HELLX5,
MODE_HELLX9,
MODE_FSKH245,
MODE_FSKH105,
MODE_HELL80,
MODE_HELL_FIRST = MODE_FELDHELL,
MODE_HELL_LAST = MODE_HELL80,
MODE_MFSK8,
MODE_MFSK16,
MODE_MFSK32,
MODE_MFSK4,
MODE_MFSK11,
MODE_MFSK22,
MODE_MFSK31,
MODE_MFSK64,
MODE_MFSK128,
MODE_MFSK64L,
MODE_MFSK128L,
MODE_MFSK_FIRST = MODE_MFSK8,
MODE_MFSK_LAST = MODE_MFSK128L,
MODE_WEFAX_576,
MODE_WEFAX_288,
MODE_WEFAX_FIRST = MODE_WEFAX_576,
MODE_WEFAX_LAST = MODE_WEFAX_288,
MODE_NAVTEX,
MODE_SITORB,
MODE_NAVTEX_FIRST = MODE_NAVTEX,
MODE_NAVTEX_LAST = MODE_SITORB,
MODE_MT63_500S,
MODE_MT63_500L,
MODE_MT63_1000S,
MODE_MT63_1000L,
MODE_MT63_2000S,
MODE_MT63_2000L,
MODE_MT63_FIRST = MODE_MT63_500S,
MODE_MT63_LAST = MODE_MT63_2000L,
MODE_PSK31,
MODE_PSK63,
MODE_PSK63F,
MODE_PSK125,
MODE_PSK250,
MODE_PSK500,
MODE_PSK1000,
MODE_12X_PSK125,
MODE_6X_PSK250,
MODE_2X_PSK500,
MODE_4X_PSK500,
MODE_2X_PSK800,
MODE_2X_PSK1000,
MODE_PSK_FIRST = MODE_PSK31,
MODE_PSK_LAST = MODE_2X_PSK1000,
MODE_QPSK31,
MODE_QPSK63,
MODE_QPSK125,
MODE_QPSK250,
MODE_QPSK500,
MODE_QPSK_FIRST = MODE_QPSK31,
MODE_QPSK_LAST = MODE_QPSK500,
MODE_8PSK125,
MODE_8PSK125FL,
MODE_8PSK125F,
MODE_8PSK250,
MODE_8PSK250FL,
MODE_8PSK250F,
MODE_8PSK500,
MODE_8PSK500F,
MODE_8PSK1000,
MODE_8PSK1000F,
MODE_8PSK1200F,
MODE_8PSK_FIRST = MODE_8PSK125,
MODE_8PSK_LAST = MODE_8PSK1200F,
MODE_OFDM_500F,
MODE_OFDM_750F,
MODE_OFDM_2000F,
MODE_OFDM_2000,
MODE_OFDM_3500,
MODE_OLIVIA,
MODE_OLIVIA_4_125,
MODE_OLIVIA_4_250,
MODE_OLIVIA_4_500,
MODE_OLIVIA_4_1000,
MODE_OLIVIA_4_2000,
MODE_OLIVIA_8_125,
MODE_OLIVIA_8_250,
MODE_OLIVIA_8_500,
MODE_OLIVIA_8_1000,
MODE_OLIVIA_8_2000,
MODE_OLIVIA_16_500,
MODE_OLIVIA_16_1000,
MODE_OLIVIA_16_2000,
MODE_OLIVIA_32_1000,
MODE_OLIVIA_32_2000,
MODE_OLIVIA_64_500,
MODE_OLIVIA_64_1000,
MODE_OLIVIA_64_2000,
MODE_OLIVIA_FIRST = MODE_OLIVIA,
MODE_OLIVIA_LAST = MODE_OLIVIA_64_2000,
MODE_RTTY,
MODE_THORMICRO,
MODE_THOR4,
MODE_THOR5,
MODE_THOR8,
MODE_THOR11,
MODE_THOR16,
MODE_THOR22,
MODE_THOR25x4,
MODE_THOR50x1,
MODE_THOR50x2,
MODE_THOR100,
MODE_THOR_FIRST = MODE_THORMICRO,
MODE_THOR_LAST = MODE_THOR100,
MODE_THROB1,
MODE_THROB2,
MODE_THROB4,
MODE_THROBX1,
MODE_THROBX2,
MODE_THROBX4,
MODE_THROB_FIRST = MODE_THROB1,
MODE_THROB_LAST = MODE_THROBX4,
// MODE_PACKET,
// high speed && multiple carrier modes
MODE_PSK125R,
MODE_PSK250R,
MODE_PSK500R,
MODE_PSK1000R,
MODE_4X_PSK63R,
MODE_5X_PSK63R,
MODE_10X_PSK63R,
MODE_20X_PSK63R,
MODE_32X_PSK63R,
MODE_4X_PSK125R,
MODE_5X_PSK125R,
MODE_10X_PSK125R,
MODE_12X_PSK125R,
MODE_16X_PSK125R,
MODE_2X_PSK250R,
MODE_3X_PSK250R,
MODE_5X_PSK250R,
MODE_6X_PSK250R,
MODE_7X_PSK250R,
MODE_2X_PSK500R,
MODE_3X_PSK500R,
MODE_4X_PSK500R,
MODE_2X_PSK800R,
MODE_2X_PSK1000R,
MODE_PSKR_FIRST = MODE_PSK125R,
MODE_PSKR_LAST = MODE_2X_PSK1000R,
MODE_FSQ,
MODE_IFKP,
MODE_SSB,
MODE_WWV,
MODE_ANALYSIS,
MODE_FMT,
MODE_EOT, // a dummy mode used to invoke transmission of RsID-EOT code
NUM_MODES,
NUM_RXTX_MODES = MODE_SSB
};
typedef intptr_t trx_mode;
struct mode_info_t {
trx_mode mode;
const char *sname;
const char *name;
const char *pskmail_name;
const char *adif_name;
const char *export_mode;
const char *export_submode;
const char *vid_name;
const unsigned int iface_io; // Some modes are not usable for a given interface.
};
extern const struct mode_info_t mode_info[NUM_MODES];
/*
class qrg_mode_t
{
public:
long long rfcarrier;
std::string rmode;
int carrier;
trx_mode mode;
std::string usage;
qrg_mode_t() :
rfcarrier(0),
rmode("NONE"),
carrier(0),
mode(NUM_MODES),
usage("") { }
qrg_mode_t(long long rfc_, std::string rm_, int c_, trx_mode m_, std::string use_ = "")
: rfcarrier(rfc_), rmode(rm_), carrier(c_), mode(m_), usage(use_) { }
bool operator<(const qrg_mode_t& rhs) const
{
return rfcarrier < rhs.rfcarrier;
}
bool operator==(const qrg_mode_t& rhs) const
{
return rfcarrier == rhs.rfcarrier && rmode == rhs.rmode &&
carrier == rhs.carrier && mode == rhs.mode;
}
std::string str(void);
};
std::ostream& operator<<(std::ostream& s, const qrg_mode_t& m);
std::istream& operator>>(std::istream& s, qrg_mode_t& m);
#include <bitset>
class mode_set_t : public std::bitset<NUM_MODES> {};
*/
enum band_t {
BAND_160M, BAND_80M, BAND_75M, BAND_60M, BAND_40M, BAND_30M, BAND_20M,
BAND_17M, BAND_15M, BAND_12M, BAND_10M, BAND_6M, BAND_4M, BAND_2M, BAND_125CM,
BAND_70CM, BAND_33CM, BAND_23CM, BAND_13CM, BAND_9CM, BAND_6CM, BAND_3CM, BAND_125MM,
BAND_6MM, BAND_4MM, BAND_2P5MM, BAND_2MM, BAND_1MM, BAND_OTHER, NUM_BANDS
};
/*
band_t band(long long freq_hz);
band_t band(const char* freq_mhz);
const char* band_name(band_t b);
const char* band_name(const char* freq_mhz);
const char* band_freq(band_t b);
const char* band_freq(const char* band_name);
*/
// psk_browser enums
enum { VIEWER_LABEL_OFF, VIEWER_LABEL_AF, VIEWER_LABEL_RF, VIEWER_LABEL_CH, VIEWER_LABEL_NTYPES };
#endif

910
hid.c
View File

@ -1,910 +0,0 @@
/*******************************************************
HIDAPI - Multi-Platform library for
communication with HID devices.
Alan Ott
Signal 11 Software
8/22/2009
Copyright 2009, All Rights Reserved.
At the discretion of the user of this library,
this software may be licensed under the terms of the
GNU Public License v3, a BSD-Style license, or the
original HIDAPI license as outlined in the LICENSE.txt,
LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
files located at the root of the source distribution.
These files may also be found in the public source
code repository located at:
http://github.com/signal11/hidapi .
********************************************************/
// Hacked about a bit for BPQ32. John Wiseman G8BPQ April 2018
#include <windows.h>
#ifndef _NTDEF_
typedef LONG NTSTATUS;
#endif
#ifdef __MINGW32__
#include <ntdef.h>
#include <winbase.h>
#endif
#ifdef __CYGWIN__
#include <ntdef.h>
#define _wcsdup wcsdup
#endif
//#define HIDAPI_USE_DDK
#ifdef __cplusplus
extern "C" {
#endif
#include <setupapi.h>
#include <winioctl.h>
#ifdef HIDAPI_USE_DDK
#include <hidsdi.h>
#endif
// Copied from inc/ddk/hidclass.h, part of the Windows DDK.
#define HID_OUT_CTL_CODE(id) \
CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
#ifdef __cplusplus
} // extern "C"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "hidapi.h"
#ifdef _MSC_VER
// Thanks Microsoft, but I know how to use strncpy().
#pragma warning(disable:4996)
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HIDAPI_USE_DDK
// Since we're not building with the DDK, and the HID header
// files aren't part of the SDK, we have to define all this
// stuff here. In lookup_functions(), the function pointers
// defined below are set.
typedef struct _HIDD_ATTRIBUTES{
ULONG Size;
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
typedef USHORT USAGE;
typedef struct _HIDP_CAPS {
USAGE Usage;
USAGE UsagePage;
USHORT InputReportByteLength;
USHORT OutputReportByteLength;
USHORT FeatureReportByteLength;
USHORT Reserved[17];
USHORT fields_not_used_by_hidapi[10];
} HIDP_CAPS, *PHIDP_CAPS;
typedef char* HIDP_PREPARSED_DATA;
#define HIDP_STATUS_SUCCESS 0x0
typedef BOOLEAN (__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib);
typedef BOOLEAN (__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN (__stdcall *HidD_GetManufacturerString_)(HANDLE handle, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN (__stdcall *HidD_GetProductString_)(HANDLE handle, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN (__stdcall *HidD_SetFeature_)(HANDLE handle, PVOID data, ULONG length);
typedef BOOLEAN (__stdcall *HidD_GetFeature_)(HANDLE handle, PVOID data, ULONG length);
typedef BOOLEAN (__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, HIDP_PREPARSED_DATA **preparsed_data);
typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(HIDP_PREPARSED_DATA *preparsed_data);
typedef BOOLEAN (__stdcall *HidP_GetCaps_)(HIDP_PREPARSED_DATA *preparsed_data, HIDP_CAPS *caps);
static HidD_GetAttributes_ HidD_GetAttributes;
static HidD_GetSerialNumberString_ HidD_GetSerialNumberString;
static HidD_GetManufacturerString_ HidD_GetManufacturerString;
static HidD_GetProductString_ HidD_GetProductString;
static HidD_SetFeature_ HidD_SetFeature;
static HidD_GetFeature_ HidD_GetFeature;
static HidD_GetIndexedString_ HidD_GetIndexedString;
static HidD_GetPreparsedData_ HidD_GetPreparsedData;
static HidD_FreePreparsedData_ HidD_FreePreparsedData;
static HidP_GetCaps_ HidP_GetCaps;
static HMODULE lib_handle = NULL;
static BOOLEAN initialized = FALSE;
#endif // HIDAPI_USE_DDK
struct hid_device_ {
HANDLE device_handle;
BOOL blocking;
int input_report_length;
void *last_error_str;
DWORD last_error_num;
BOOL read_pending;
char *read_buf;
OVERLAPPED ol;
};
static hid_device *new_hid_device()
{
hid_device *dev = (hid_device*) calloc(1, sizeof(hid_device));
dev->device_handle = INVALID_HANDLE_VALUE;
dev->blocking = TRUE;
dev->input_report_length = 0;
dev->last_error_str = NULL;
dev->last_error_num = 0;
dev->read_pending = FALSE;
dev->read_buf = NULL;
memset(&dev->ol, 0, sizeof(dev->ol));
dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*inital state f=nonsignaled*/, NULL);
return dev;
}
static void register_error(hid_device *device, const char *op)
{
WCHAR *ptr, *msg;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&msg, 0/*sz*/,
NULL);
// Get rid of the CR and LF that FormatMessage() sticks at the
// end of the message. Thanks Microsoft!
ptr = msg;
while (*ptr) {
if (*ptr == '\r') {
*ptr = 0x0000;
break;
}
ptr++;
}
// Store the message off in the Device entry so that
// the hid_error() function can pick it up.
LocalFree(device->last_error_str);
device->last_error_str = msg;
}
#ifndef HIDAPI_USE_DDK
static int lookup_functions()
{
lib_handle = LoadLibraryA("hid.dll");
if (lib_handle) {
#define RESOLVE(x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) return -1;
RESOLVE(HidD_GetAttributes);
RESOLVE(HidD_GetSerialNumberString);
RESOLVE(HidD_GetManufacturerString);
RESOLVE(HidD_GetProductString);
RESOLVE(HidD_SetFeature);
RESOLVE(HidD_GetFeature);
RESOLVE(HidD_GetIndexedString);
RESOLVE(HidD_GetPreparsedData);
RESOLVE(HidD_FreePreparsedData);
RESOLVE(HidP_GetCaps);
#undef RESOLVE
}
else
return -1;
return 0;
}
#endif
static HANDLE open_device(const char *path)
{
HANDLE handle;
/* First, try to open with sharing mode turned off. This will make it so
that a HID device can only be opened once. This is to be consistent
with the behavior on the other platforms. */
handle = CreateFileA(path,
GENERIC_WRITE |GENERIC_READ,
0, /*share mode*/
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
0);
if (handle == INVALID_HANDLE_VALUE) {
/* Couldn't open the device. Some devices must be opened
with sharing enabled (even though they are only opened once),
so try it here. */
handle = CreateFileA(path,
GENERIC_WRITE |GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, /*share mode*/
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
0);
}
return handle;
}
int HID_API_EXPORT hid_init(void)
{
#ifndef HIDAPI_USE_DDK
if (!initialized) {
if (lookup_functions() < 0) {
hid_exit();
return -1;
}
initialized = TRUE;
}
#endif
return 0;
}
int HID_API_EXPORT hid_exit(void)
{
#ifndef HIDAPI_USE_DDK
if (lib_handle)
FreeLibrary(lib_handle);
lib_handle = NULL;
initialized = FALSE;
#endif
return 0;
}
struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
{
BOOL res;
struct hid_device_info *root = NULL; // return object
struct hid_device_info *cur_dev = NULL;
// Windows objects for interacting with the driver.
GUID InterfaceClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, {0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} };
SP_DEVINFO_DATA devinfo_data;
SP_DEVICE_INTERFACE_DATA device_interface_data;
SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL;
HDEVINFO device_info_set = INVALID_HANDLE_VALUE;
int device_index = 0;
if (hid_init() < 0)
return NULL;
// Initialize the Windows objects.
devinfo_data.cbSize = sizeof(SP_DEVINFO_DATA);
device_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
// Get information for all the devices belonging to the HID class.
device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
// Iterate over each device in the HID class, looking for the right one.
for (;;) {
HANDLE write_handle = INVALID_HANDLE_VALUE;
DWORD required_size = 0;
HIDD_ATTRIBUTES attrib;
res = SetupDiEnumDeviceInterfaces(device_info_set,
NULL,
&InterfaceClassGuid,
device_index,
&device_interface_data);
if (!res) {
// A return of FALSE from this function means that
// there are no more devices.
break;
}
// Call with 0-sized detail size, and let the function
// tell us how long the detail struct needs to be. The
// size is put in &required_size.
res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
&device_interface_data,
NULL,
0,
&required_size,
NULL);
// Allocate a long enough structure for device_interface_detail_data.
device_interface_detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc(required_size);
device_interface_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
// Get the detailed data for this device. The detail data gives us
// the device path for this device, which is then passed into
// CreateFile() to get a handle to the device.
res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
&device_interface_data,
device_interface_detail_data,
required_size,
NULL,
NULL);
if (!res) {
//register_error(dev, "Unable to call SetupDiGetDeviceInterfaceDetail");
// Continue to the next device.
goto cont;
}
//wprintf(L"HandleName: %s\n", device_interface_detail_data->DevicePath);
// Open a handle to the device
write_handle = open_device(device_interface_detail_data->DevicePath);
// Check validity of write_handle.
if (write_handle == INVALID_HANDLE_VALUE) {
// Unable to open the device.
//register_error(dev, "CreateFile");
goto cont_close;
}
// Get the Vendor ID and Product ID for this device.
attrib.Size = sizeof(HIDD_ATTRIBUTES);
HidD_GetAttributes(write_handle, &attrib);
//wprintf(L"Product/Vendor: %x %x\n", attrib.ProductID, attrib.VendorID);
// Check the VID/PID to see if we should add this
// device to the enumeration list.
if ((vendor_id == 0x0 && product_id == 0x0) ||
(attrib.VendorID == vendor_id && attrib.ProductID == product_id))
{
#define WSTR_LEN 512
const char *str;
struct hid_device_info *tmp;
HIDP_PREPARSED_DATA *pp_data = NULL;
HIDP_CAPS caps;
BOOLEAN res;
NTSTATUS nt_res;
wchar_t wstr[WSTR_LEN]; // TODO: Determine Size
int len;
/* VID/PID match. Create the record. */
tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info));
if (cur_dev) {
cur_dev->next = tmp;
}
else {
root = tmp;
}
cur_dev = tmp;
// Get the Usage Page and Usage for this device.
res = HidD_GetPreparsedData(write_handle, &pp_data);
if (res) {
nt_res = HidP_GetCaps(pp_data, &caps);
if (nt_res == HIDP_STATUS_SUCCESS) {
cur_dev->usage_page = caps.UsagePage;
cur_dev->usage = caps.Usage;
}
HidD_FreePreparsedData(pp_data);
}
/* Fill out the record */
cur_dev->next = NULL;
str = device_interface_detail_data->DevicePath;
if (str) {
len = (int)strlen(str);
cur_dev->path = (char*) calloc(len+1, sizeof(char));
strncpy(cur_dev->path, str, len+1);
cur_dev->path[len] = '\0';
}
else
cur_dev->path = NULL;
/* Serial Number */
res = HidD_GetSerialNumberString(write_handle, wstr, sizeof(wstr));
wstr[WSTR_LEN-1] = 0x0000;
if (res) {
cur_dev->serial_number = _wcsdup(wstr);
}
/* Manufacturer String */
res = HidD_GetManufacturerString(write_handle, wstr, sizeof(wstr));
wstr[WSTR_LEN-1] = 0x0000;
if (res) {
cur_dev->manufacturer_string = _wcsdup(wstr);
}
/* Product String */
res = HidD_GetProductString(write_handle, wstr, sizeof(wstr));
wstr[WSTR_LEN-1] = 0x0000;
if (res) {
cur_dev->product_string = _wcsdup(wstr);
}
/* VID/PID */
cur_dev->vendor_id = attrib.VendorID;
cur_dev->product_id = attrib.ProductID;
/* Release Number */
cur_dev->release_number = attrib.VersionNumber;
/* Interface Number. It can sometimes be parsed out of the path
on Windows if a device has multiple interfaces. See
http://msdn.microsoft.com/en-us/windows/hardware/gg487473 or
search for "Hardware IDs for HID Devices" at MSDN. If it's not
in the path, it's set to -1. */
cur_dev->interface_number = -1;
if (cur_dev->path) {
char *interface_component = strstr(cur_dev->path, "&mi_");
if (interface_component) {
char *hex_str = interface_component + 4;
char *endptr = NULL;
cur_dev->interface_number = strtol(hex_str, &endptr, 16);
if (endptr == hex_str) {
/* The parsing failed. Set interface_number to -1. */
cur_dev->interface_number = -1;
}
}
}
}
cont_close:
CloseHandle(write_handle);
cont:
// We no longer need the detail data. It can be freed
free(device_interface_detail_data);
device_index++;
}
// Close the device information handle.
SetupDiDestroyDeviceInfoList(device_info_set);
return root;
}
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
{
// TODO: Merge this with the Linux version. This function is platform-independent.
struct hid_device_info *d = devs;
while (d) {
struct hid_device_info *next = d->next;
free(d->path);
free(d->serial_number);
free(d->manufacturer_string);
free(d->product_string);
free(d);
d = next;
}
}
HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number)
{
// TODO: Merge this functions with the Linux version. This function should be platform independent.
struct hid_device_info *devs, *cur_dev;
const char *path_to_open = NULL;
hid_device *handle = NULL;
devs = hid_enumerate(vendor_id, product_id);
cur_dev = devs;
while (cur_dev) {
if (cur_dev->vendor_id == vendor_id &&
cur_dev->product_id == product_id) {
if (serial_number) {
if (wcscmp(serial_number, cur_dev->serial_number) == 0) {
path_to_open = cur_dev->path;
break;
}
}
else {
path_to_open = cur_dev->path;
break;
}
}
cur_dev = cur_dev->next;
}
if (path_to_open) {
/* Open the device */
handle = hid_open_path(path_to_open);
}
hid_free_enumeration(devs);
return handle;
}
HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
{
hid_device *dev;
HIDP_CAPS caps;
HIDP_PREPARSED_DATA *pp_data = NULL;
BOOLEAN res;
NTSTATUS nt_res;
if (hid_init() < 0) {
return NULL;
}
dev = new_hid_device();
// Open a handle to the device
dev->device_handle = open_device(path);
// Check validity of write_handle.
if (dev->device_handle == INVALID_HANDLE_VALUE) {
// Unable to open the device.
register_error(dev, "CreateFile");
goto err;
}
// Get the Input Report length for the device.
res = HidD_GetPreparsedData(dev->device_handle, &pp_data);
if (!res) {
register_error(dev, "HidD_GetPreparsedData");
goto err;
}
nt_res = HidP_GetCaps(pp_data, &caps);
if (nt_res != HIDP_STATUS_SUCCESS) {
register_error(dev, "HidP_GetCaps");
goto err_pp_data;
}
dev->input_report_length = caps.InputReportByteLength;
HidD_FreePreparsedData(pp_data);
dev->read_buf = (char*) malloc(dev->input_report_length);
return dev;
err_pp_data:
HidD_FreePreparsedData(pp_data);
err:
CloseHandle(dev->device_handle);
free(dev);
return NULL;
}
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length)
{
DWORD bytes_written;
BOOL res;
OVERLAPPED ol;
memset(&ol, 0, sizeof(ol));
res = WriteFile(dev->device_handle, data, length, NULL, &ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// WriteFile() failed. Return error.
register_error(dev, "WriteFile");
return -1;
}
}
// Wait here until the write is done. This makes
// hid_write() synchronous.
res = GetOverlappedResult(dev->device_handle, &ol, &bytes_written, TRUE/*wait*/);
if (!res) {
// The Write operation failed.
register_error(dev, "WriteFile");
return -1;
}
return bytes_written;
}
int HID_API_EXPORT HID_API_CALL hid_set_ptt(int state)
{
int res;
hid_device *handle;
unsigned char buf[16];
handle = hid_open(0xd8c, 0x8, NULL);
if (!handle) {
printf("unable to open device\n");
return 1;
}
// Toggle PTT
buf[0] = 0;
buf[1] = 0;
buf[2]= 1 << (3 - 1);
buf[3] = state << (3 - 1);
buf[4] = 0;
res = hid_write(handle, buf, 5);
if (res < 0)
{
printf("Unable to write()\n");
printf("Error: %ls\n", hid_error(handle));
}
hid_close(handle);
return res;
}
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
{
DWORD bytes_read = 0;
BOOL res;
// Copy the handle for convenience.
HANDLE ev = dev->ol.hEvent;
if (!dev->read_pending) {
// Start an Overlapped I/O read.
dev->read_pending = TRUE;
ResetEvent(ev);
res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// ReadFile() has failed.
// Clean up and return error.
CancelIo(dev->device_handle);
dev->read_pending = FALSE;
goto end_of_function;
}
}
}
if (milliseconds >= 0) {
// See if there is any data yet.
res = WaitForSingleObject(ev, milliseconds);
if (res != WAIT_OBJECT_0) {
// There was no data this time. Return zero bytes available,
// but leave the Overlapped I/O running.
return 0;
}
}
// Either WaitForSingleObject() told us that ReadFile has completed, or
// we are in non-blocking mode. Get the number of bytes read. The actual
// data has been copied to the data[] array which was passed to ReadFile().
res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/);
// Set pending back to false, even if GetOverlappedResult() returned error.
dev->read_pending = FALSE;
if (res && bytes_read > 0) {
if (dev->read_buf[0] == 0x0) {
/* If report numbers aren't being used, but Windows sticks a report
number (0x0) on the beginning of the report anyway. To make this
work like the other platforms, and to make it work more like the
HID spec, we'll skip over this byte. */
bytes_read--;
memcpy(data, dev->read_buf+1, length);
}
else {
/* Copy the whole buffer, report number and all. */
memcpy(data, dev->read_buf, length);
}
}
end_of_function:
if (!res) {
register_error(dev, "GetOverlappedResult");
return -1;
}
return bytes_read;
}
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length)
{
return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0);
}
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock)
{
dev->blocking = !nonblock;
return 0; /* Success */
}
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
{
BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, length);
if (!res) {
register_error(dev, "HidD_SetFeature");
return -1;
}
return length;
}
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
{
BOOL res;
#if 0
res = HidD_GetFeature(dev->device_handle, data, length);
if (!res) {
register_error(dev, "HidD_GetFeature");
return -1;
}
return 0; /* HidD_GetFeature() doesn't give us an actual length, unfortunately */
#else
DWORD bytes_returned;
OVERLAPPED ol;
memset(&ol, 0, sizeof(ol));
res = DeviceIoControl(dev->device_handle,
IOCTL_HID_GET_FEATURE,
data, length,
data, length,
&bytes_returned, &ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// DeviceIoControl() failed. Return error.
register_error(dev, "Send Feature Report DeviceIoControl");
return -1;
}
}
// Wait here until the write is done. This makes
// hid_get_feature_report() synchronous.
res = GetOverlappedResult(dev->device_handle, &ol, &bytes_returned, TRUE/*wait*/);
if (!res) {
// The operation failed.
register_error(dev, "Send Feature Report GetOverLappedResult");
return -1;
}
return bytes_returned;
#endif
}
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev)
{
if (!dev)
return;
CancelIo(dev->device_handle);
CloseHandle(dev->ol.hEvent);
CloseHandle(dev->device_handle);
LocalFree(dev->last_error_str);
free(dev->read_buf);
free(dev);
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)
{
BOOL res;
res = HidD_GetManufacturerString(dev->device_handle, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetManufacturerString");
return -1;
}
return 0;
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen)
{
BOOL res;
res = HidD_GetProductString(dev->device_handle, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetProductString");
return -1;
}
return 0;
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen)
{
BOOL res;
res = HidD_GetSerialNumberString(dev->device_handle, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetSerialNumberString");
return -1;
}
return 0;
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
{
BOOL res;
res = HidD_GetIndexedString(dev->device_handle, string_index, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetIndexedString");
return -1;
}
return 0;
}
HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
{
return (wchar_t*)dev->last_error_str;
}
//#define PICPGM
//#define S11
#define P32
#ifdef S11
unsigned short VendorID = 0xa0a0;
unsigned short ProductID = 0x0001;
#endif
#ifdef P32
unsigned short VendorID = 0x04d8;
unsigned short ProductID = 0x3f;
#endif
#ifdef PICPGM
unsigned short VendorID = 0x04d8;
unsigned short ProductID = 0x0033;
#endif
#if 0
int __cdecl main(int argc, char* argv[])
{
int res;
unsigned char buf[65];
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
// Set up the command buffer.
memset(buf,0x00,sizeof(buf));
buf[0] = 0;
buf[1] = 0x81;
// Open the device.
int handle = open(VendorID, ProductID, L"12345");
if (handle < 0)
printf("unable to open device\n");
// Toggle LED (cmd 0x80)
buf[1] = 0x80;
res = write(handle, buf, 65);
if (res < 0)
printf("Unable to write()\n");
// Request state (cmd 0x81)
buf[1] = 0x81;
write(handle, buf, 65);
if (res < 0)
printf("Unable to write() (2)\n");
// Read requested state
read(handle, buf, 65);
if (res < 0)
printf("Unable to read()\n");
// Print out the returned buffer.
for (int i = 0; i < 4; i++)
printf("buf[%d]: %d\n", i, buf[i]);
return 0;
}
#endif
#ifdef __cplusplus
} // extern "C"
#endif

386
hidapi.h
View File

@ -1,386 +0,0 @@
/*******************************************************
HIDAPI - Multi-Platform library for
communication with HID devices.
Alan Ott
Signal 11 Software
8/22/2009
Copyright 2009, All Rights Reserved.
At the discretion of the user of this library,
this software may be licensed under the terms of the
GNU Public License v3, a BSD-Style license, or the
original HIDAPI license as outlined in the LICENSE.txt,
LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
files located at the root of the source distribution.
These files may also be found in the public source
code repository located at:
http://github.com/signal11/hidapi .
********************************************************/
/** @file
* @defgroup API hidapi API
*/
#ifndef HIDAPI_H__
#define HIDAPI_H__
#include <wchar.h>
#ifdef _WIN32
// #define HID_API_EXPORT __declspec(dllexport) // BPQ
#define HID_API_EXPORT
#define HID_API_CALL
#else
#define HID_API_EXPORT /**< API export macro */
#define HID_API_CALL /**< API call macro */
#endif
#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/
#ifdef __cplusplus
extern "C" {
#endif
struct hid_device_;
typedef struct hid_device_ hid_device; /**< opaque hidapi structure */
/** hidapi info structure */
struct hid_device_info {
/** Platform-specific device path */
char *path;
/** Device Vendor ID */
unsigned short vendor_id;
/** Device Product ID */
unsigned short product_id;
/** Serial Number */
wchar_t *serial_number;
/** Device Release Number in binary-coded decimal,
also known as Device Version Number */
unsigned short release_number;
/** Manufacturer String */
wchar_t *manufacturer_string;
/** Product string */
wchar_t *product_string;
/** Usage Page for this Device/Interface
(Windows/Mac only). */
unsigned short usage_page;
/** Usage for this Device/Interface
(Windows/Mac only).*/
unsigned short usage;
/** The USB interface which this logical device
represents. Valid on both Linux implementations
in all cases, and valid on the Windows implementation
only if the device contains more than one interface. */
int interface_number;
/** Pointer to the next device */
struct hid_device_info *next;
};
/** @brief Initialize the HIDAPI library.
This function initializes the HIDAPI library. Calling it is not
strictly necessary, as it will be called automatically by
hid_enumerate() and any of the hid_open_*() functions if it is
needed. This function should be called at the beginning of
execution however, if there is a chance of HIDAPI handles
being opened by different threads simultaneously.
@ingroup API
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_init(void);
/** @brief Finalize the HIDAPI library.
This function frees all of the static data associated with
HIDAPI. It should be called at the end of execution to avoid
memory leaks.
@ingroup API
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_exit(void);
/** @brief Enumerate the HID Devices.
This function returns a linked list of all the HID devices
attached to the system which match vendor_id and product_id.
If @p vendor_id and @p product_id are both set to 0, then
all HID devices will be returned.
@ingroup API
@param vendor_id The Vendor ID (VID) of the types of device
to open.
@param product_id The Product ID (PID) of the types of
device to open.
@returns
This function returns a pointer to a linked list of type
struct #hid_device, containing information about the HID devices
attached to the system, or NULL in the case of failure. Free
this linked list by calling hid_free_enumeration().
*/
struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
/** @brief Free an enumeration Linked List
This function frees a linked list created by hid_enumerate().
@ingroup API
@param devs Pointer to a list of struct_device returned from
hid_enumerate().
*/
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs);
/** @brief Open a HID device using a Vendor ID (VID), Product ID
(PID) and optionally a serial number.
If @p serial_number is NULL, the first device with the
specified VID and PID is opened.
@ingroup API
@param vendor_id The Vendor ID (VID) of the device to open.
@param product_id The Product ID (PID) of the device to open.
@param serial_number The Serial Number of the device to open
(Optionally NULL).
@returns
This function returns a pointer to a #hid_device object on
success or NULL on failure.
*/
HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number);
/** @brief Open a HID device by its path name.
The path name be determined by calling hid_enumerate(), or a
platform-specific path name can be used (eg: /dev/hidraw0 on
Linux).
@ingroup API
@param path The path name of the device to open
@returns
This function returns a pointer to a #hid_device object on
success or NULL on failure.
*/
HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path);
/** @brief Write an Output report to a HID device.
The first byte of @p data[] must contain the Report ID. For
devices which only support a single report, this must be set
to 0x0. The remaining bytes contain the report data. Since
the Report ID is mandatory, calls to hid_write() will always
contain one more byte than the report contains. For example,
if a hid report is 16 bytes long, 17 bytes must be passed to
hid_write(), the Report ID (or 0x0, for devices with a
single report), followed by the report data (16 bytes). In
this example, the length passed in would be 17.
hid_write() will send the data on the first OUT endpoint, if
one exists. If it does not, it will send the data through
the Control Endpoint (Endpoint 0).
@ingroup API
@param device A device handle returned from hid_open().
@param data The data to send, including the report number as
the first byte.
@param length The length in bytes of the data to send.
@returns
This function returns the actual number of bytes written and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length);
/** @brief Read an Input report from a HID device with timeout.
Input reports are returned
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
@ingroup API
@param device A device handle returned from hid_open().
@param data A buffer to put the read data into.
@param length The number of bytes to read. For devices with
multiple reports, make sure to read an extra byte for
the report number.
@param milliseconds timeout in milliseconds or -1 for blocking wait.
@returns
This function returns the actual number of bytes read and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
/** @brief Read an Input report from a HID device.
Input reports are returned
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
@ingroup API
@param device A device handle returned from hid_open().
@param data A buffer to put the read data into.
@param length The number of bytes to read. For devices with
multiple reports, make sure to read an extra byte for
the report number.
@returns
This function returns the actual number of bytes read and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
/** @brief Set the device handle to be non-blocking.
In non-blocking mode calls to hid_read() will return
immediately with a value of 0 if there is no data to be
read. In blocking mode, hid_read() will wait (block) until
there is data to read before returning.
Nonblocking can be turned on and off at any time.
@ingroup API
@param device A device handle returned from hid_open().
@param nonblock enable or not the nonblocking reads
- 1 to enable nonblocking
- 0 to disable nonblocking.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock);
/** @brief Send a Feature report to the device.
Feature reports are sent over the Control endpoint as a
Set_Report transfer. The first byte of @p data[] must
contain the Report ID. For devices which only support a
single report, this must be set to 0x0. The remaining bytes
contain the report data. Since the Report ID is mandatory,
calls to hid_send_feature_report() will always contain one
more byte than the report contains. For example, if a hid
report is 16 bytes long, 17 bytes must be passed to
hid_send_feature_report(): the Report ID (or 0x0, for
devices which do not use numbered reports), followed by the
report data (16 bytes). In this example, the length passed
in would be 17.
@ingroup API
@param device A device handle returned from hid_open().
@param data The data to send, including the report number as
the first byte.
@param length The length in bytes of the data to send, including
the report number.
@returns
This function returns the actual number of bytes written and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length);
/** @brief Get a feature report from a HID device.
Make sure to set the first byte of @p data[] to the Report
ID of the report to be read. Make sure to allow space for
this extra byte in @p data[].
@ingroup API
@param device A device handle returned from hid_open().
@param data A buffer to put the read data into, including
the Report ID. Set the first byte of @p data[] to the
Report ID of the report to be read.
@param length The number of bytes to read, including an
extra byte for the report ID. The buffer can be longer
than the actual report.
@returns
This function returns the number of bytes read and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length);
/** @brief Close a HID device.
@ingroup API
@param device A device handle returned from hid_open().
*/
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device);
/** @brief Get The Manufacturer String from a HID device.
@ingroup API
@param device A device handle returned from hid_open().
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen);
/** @brief Get The Product String from a HID device.
@ingroup API
@param device A device handle returned from hid_open().
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen);
/** @brief Get The Serial Number String from a HID device.
@ingroup API
@param device A device handle returned from hid_open().
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen);
/** @brief Get a string from a HID device, based on its string index.
@ingroup API
@param device A device handle returned from hid_open().
@param string_index The index of the string to get.
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen);
/** @brief Get a string describing the last error which occurred.
@ingroup API
@param device A device handle returned from hid_open().
@returns
This function returns a string containing the last error
which occurred or NULL if none has occurred.
*/
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device);
int HID_API_EXPORT HID_API_CALL hid_set_ptt(int state);
#ifdef __cplusplus
}
#endif
#endif

5039
il2p.c

File diff suppressed because it is too large Load Diff

View File

@ -1,479 +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"
int add_raw_frames(int snd_ch, string * frame, TStringList * buf);
// I think I need a struct for each connection, but a simple array of entries should be fine
// My normal ** and count system
// Each needs an input buffer of max size kiss frame and length (or maybe string is a good idea)
TKISSMode ** KissConnections = NULL;
int KISSConCount = 0;
#define FEND 0xc0
#define FESC 0xDB
#define TFEND 0xDC
#define TFESC 0xDD
#define KISS_ACKMODE 0x0C
#define KISS_DATA 0
#define QTSMKISSCMD 7
struct TKISSMode_t KISS;
int KISS_encode(UCHAR * KISSBuffer, int port, string * frame, int TXMON);
void KISS_init()
{
int i;
KISS.data_in = newString();
// initTStringList(KISS.socket);
for (i = 0; i < 4; i++)
{
initTStringList(&KISS.buffer[i]);
}
}
/*
procedure KISS_free;
var
i: byte;
begin
KISS.data_in.Free;
KISS.socket.Free;
for i:=1 to 4 do
begin
KISS.buffer[i].Free;
KISS.request[i].Free;
KISS.acked[i].Free;
KISS.irequest[i].Free;
KISS.iacked[i].Free;
end;
end;
*/
void KISS_add_stream(void * Socket)
{
// Add a new connection. Called when QT accepts an incoming call}
TKISSMode * KISS;
KissConnections = realloc(KissConnections, (KISSConCount + 1) * sizeof(void *));
KISS = KissConnections[KISSConCount++] = malloc(sizeof(*KISS));
memset(KISS, 0, sizeof(*KISS));
KISS->Socket = Socket;
KISS->data_in = newString();
}
void KISS_del_socket(void * socket)
{
int i;
TKISSMode * KISS = NULL;
if (KISSConCount == 0)
return;
for (i = 0; i < KISSConCount; i++)
{
if (KissConnections[i]->Socket == socket)
{
KISS = KissConnections[i];
break;
}
}
if (KISS == NULL)
return;
// Need to remove entry and move others down
KISSConCount--;
while (i < KISSConCount)
{
KissConnections[i] = KissConnections[i + 1];
i++;
}
}
void KISS_on_data_out(int port, string * frame, int TX)
{
int Len;
UCHAR * KISSFrame = (UCHAR *)malloc(512); // cant pass local data via signal/slot
Len = KISS_encode(KISSFrame, port, frame, TX);
KISSSendtoServer(NULL, KISSFrame, Len); // Send to all open sockets
}
void ProcessKISSFrame(void * socket, UCHAR * Msg, int Len)
{
int n = Len;
UCHAR c;
int ESCFLAG = 0;
UCHAR * ptr1, *ptr2;
int Chan;
int Opcode;
string * TXMSG;
unsigned short CRC;
UCHAR CRCString[2];
ptr1 = ptr2 = Msg;
while (n--)
{
c = *(ptr1++);
if (ESCFLAG)
{
//
// FESC received - next should be TFESC or TFEND
ESCFLAG = 0;
if (c == TFESC)
c = FESC;
if (c == TFEND)
c = FEND;
}
else
{
switch (c)
{
case FEND:
//
// Either start of message or message complete
//
// npKISSINFO->MSGREADY = TRUE;
return;
case FESC:
ESCFLAG = 1;
continue;
}
}
//
// Ok, a normal char
//
*(ptr2++) = c;
}
Len = ptr2 - Msg;
Chan = (Msg[0] >> 4);
Opcode = Msg[0] & 0x0f;
if (Chan > 3)
return;
switch (Opcode)
{
case KISS_ACKMODE:
// How best to do ACKMODE?? I think pass whole frame including CMD and ack bytes to all_frame_buf
// But ack should only be sent to client that sent the message - needs more thought!
TXMSG = newString();
stringAdd(TXMSG, &Msg[0], Len); // include Control
CRC = get_fcs(&Msg[3], Len - 3); // exclude control and ack bytes
CRCString[0] = CRC & 0xff;
CRCString[1] = CRC >> 8;
stringAdd(TXMSG, CRCString, 2);
// Ackmode needs to know where to send ack back to, so save socket on end of data
stringAdd(TXMSG, (unsigned char * )&socket, sizeof(socket));
// if KISS Optimise see if frame is really needed
if (!KISS_opt[Chan])
Add(&KISS.buffer[Chan], TXMSG);
else
{
if (add_raw_frames(Chan, TXMSG, &KISS.buffer[Chan]))
Add(&KISS.buffer[Chan], TXMSG);
}
return;
case KISS_DATA:
TXMSG = newString();
stringAdd(TXMSG, &Msg[0], Len); // include Control
CRC = get_fcs(&Msg[1], Len - 1);
CRCString[0] = CRC & 0xff;
CRCString[1] = CRC >> 8;
stringAdd(TXMSG, CRCString, 2);
// if KISS Optimise see if frame is really needed
if (!KISS_opt[Chan])
Add(&KISS.buffer[Chan], TXMSG);
else
{
if (add_raw_frames(Chan, TXMSG, &KISS.buffer[Chan]))
Add(&KISS.buffer[Chan], TXMSG);
}
return;
}
// Still need to process kiss control frames
}
void KISSDataReceived(void * socket, UCHAR * data, int length)
{
int i;
UCHAR * ptr1, * ptr2;
int Length;
TKISSMode * KISS = NULL;
if (KISSConCount == 0)
return;
for (i = 0; i < KISSConCount; i++)
{
if (KissConnections[i]->Socket == socket)
{
KISS = KissConnections[i];
break;
}
}
if (KISS == NULL)
return;
stringAdd(KISS->data_in, data, length);
if (KISS->data_in->Length > 10000) // Probably AGW Data on KISS Port
{
KISS->data_in->Length = 0;
return;
}
ptr1 = KISS->data_in->Data;
Length = KISS->data_in->Length;
while ((ptr2 = memchr(ptr1, FEND, Length)))
{
int Len = (ptr2 - ptr1);
if (Len == 0)
{
// Start of frame
mydelete(KISS->data_in, 0, 1);
ptr1 = KISS->data_in->Data;
Length = KISS->data_in->Length;
continue;
}
// Process Frame
if (Len < 350) // Drop obviously corrupt frames
ProcessKISSFrame(socket, ptr1, Len);
mydelete(KISS->data_in, 0, Len + 1);
ptr1 = KISS->data_in->Data;
Length = KISS->data_in->Length;
}
/* if (length(KISS.data_in.Strings[idx]) > 65535)
if Form1.ServerSocket2.Socket.ActiveConnections > 0)
for i:=0 to Form1.ServerSocket2.Socket.ActiveConnections-1 do
if Form1.ServerSocket2.Socket.Connections[i].SocketHandle=socket then
try Form1.ServerSocket2.Socket.Connections[i].Close; except end;
*/
}
int KISS_encode(UCHAR * KISSBuffer, int port, string * frame, int TXMON)
{
// Encode frame
UCHAR * ptr1 = frame->Data;
UCHAR TXCCC = 0;
int Len = frame->Length - 2; // frame includes CRC
UCHAR * ptr2 = &KISSBuffer[2];
UCHAR c;
if (TXMON)
{
// TX Frame has control byte on front
ptr1++;
Len--;
}
KISSBuffer[0] = FEND;
KISSBuffer[1] = port << 4;
TXCCC ^= KISSBuffer[1];
while (Len--)
{
c = *(ptr1++);
TXCCC ^= c;
switch (c)
{
case FEND:
(*ptr2++) = FESC;
(*ptr2++) = TFEND;
break;
case FESC:
(*ptr2++) = FESC;
(*ptr2++) = TFESC;
break;
// Drop through
default:
(*ptr2++) = c;
}
}
// If using checksum, send it
/*
if (KISSFLAGS & CHECKSUM)
{
c = (UCHAR)KISS->TXCCC;
// On TNC-X based boards, it is difficult to cope with an encoded CRC, so if
// CRC is FEND, send it as 0xc1. This means we have to accept 00 or 01 as valid.
// which is a slight loss in robustness
if (c == FEND && (PORT->KISSFLAGS & TNCX))
{
(*ptr2++) = FEND + 1;
}
else
{
switch (c)
{
case FEND:
(*ptr2++) = FESC;
(*ptr2++) = TFEND;
break;
case FESC:
(*ptr2++) = FESC;
(*ptr2++) = TFESC;
break;
default:
(*ptr2++) = c;
}
}
}
*/
(*ptr2++) = FEND;
return (int)(ptr2 - KISSBuffer);
}
void sendAckModeAcks(int snd_ch)
{
// format and send any outstanding acks
string * temp;
UCHAR * Msg;
void * socket;
while (KISS_acked[snd_ch].Count)
{
UCHAR * ACK = (UCHAR *)malloc(15);
UCHAR * ackptr = ACK;
temp = Strings(&KISS_acked[snd_ch], 0); // get first
Msg = temp->Data;
*ackptr++ = FEND;
*ackptr++ = Msg[0]; // opcode and channel
*ackptr++ = Msg[1];
*ackptr++ = Msg[2]; // ACK Bytes
*ackptr++ = FEND;
// Socket to reply to is on end
Msg += (temp->Length - sizeof(void *));
memcpy(&socket, Msg, sizeof(void *));
KISSSendtoServer(socket, ACK, 5);
Delete(&KISS_acked[snd_ch], 0); // This will invalidate temp
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,97 +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 "QtSoundModem.h"
#include <QtWidgets/QApplication>
#include "UZ7HOStuff.h"
extern "C" int nonGUIMode;
extern void getSettings();
extern void saveSettings();
extern int Closing;
workerThread *t;
serialThread *serial;
mynet m1;
QCoreApplication * a;
QtSoundModem * w;
int main(int argc, char *argv[])
{
char Title[128];
QString Response;
if (argc > 1 && strcmp(argv[1], "nogui") == 0)
nonGUIMode = 1;
if (nonGUIMode)
sprintf(Title, "QtSoundModem Version %s Running in non-GUI Mode", VersionString);
else
sprintf(Title, "QtSoundModem Version %s Running in GUI Mode", VersionString);
qDebug() << Title;
if (nonGUIMode)
a = new QCoreApplication(argc, argv);
else
a = new QApplication(argc, argv); // GUI version
getSettings();
t = new workerThread;
if (nonGUIMode == 0)
{
w = new QtSoundModem();
char Title[128];
sprintf(Title, "QtSoundModem Version %s Ports %d%s/%d%s", VersionString, AGWPort, AGWServ ? "*" : "", KISSPort, KISSServ ? "*" : "");
w->setWindowTitle(Title);
w->show();
}
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(stopTimer()), &m1, SLOT(dostopTimer()), Qt::QueuedConnection);
t->start(); // This runs init
m1.start(); // Start TCP
return a->exec();
}

11
makeit
View File

@ -1,11 +0,0 @@
cp --preserve /mnt/Source/QT/QtSoundModem/*.cpp ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.c ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.h ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.ui ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.cxx ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.pro ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.qrc ./
cp --preserve /mnt/Source/QT/QtSoundModem/*.ico ./
qmake
make -j4
cp QtSoundModem /mnt/Source

1556
ofdm.c

File diff suppressed because it is too large Load Diff

View File

@ -1,198 +0,0 @@
//
// Code for Packet using ARDOP like frames.
//
// This Module handles frame level stuff, and can be used
// with a KISS interface. Module pktSession inplements an
// ax.25 like Level 2, with dynamic parameter updating
//
// This uses Special Variable Length frames
// Packet has header of 6 bytes sent in 4FSK.500.100.
// Header is 6 bits Type 10 Bits Len 2 bytes CRC 2 bytes RS
// Once we have that we receive the rest of the packet in the
// mode defined in the header.
// Uses Frame Type 0xC0, symbolic name PktFrameHeader
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <winioctl.h>
#else
#define HANDLE int
#endif
#include "ARDOPC.h"
extern UCHAR KISSBUFFER[500]; // Long enough for stuffed KISS frame
extern int KISSLength;
VOID EncodePacket(UCHAR * Data, int Len);
VOID AddTxByteDirect(UCHAR Byte);
VOID AddTxByteStuffed(UCHAR Byte);
unsigned short int compute_crc(unsigned char *buf,int len);
void PacketStartTX();
BOOL GetNextKISSFrame();
VOID SendAckModeAck();
extern unsigned char bytEncodedBytes[4500]; // I think the biggest is 600 bd 768 + overhead
extern int EncLen;
extern UCHAR PacketMon[360];
extern int PacketMonMore;
extern int PacketMonLength;
#define ARDOPBufferSize 12000 * 100
short ARDOPTXBuffer[4][ARDOPBufferSize]; // Enough to hold whole frame of samples
int ARDOPTXLen[4] = { 0,0,0,0 }; // Length of frame
int ARDOPTXPtr[4] = { 0,0,0,0 }; // Tx Pointer
int pktBandwidth = 4;
int pktMaxBandwidth = 8;
int pktMaxFrame = 4;
int pktPacLen = 80;
int pktMode = 0;
int pktRXMode; // Currently receiving mode
int pktDataLen;
int pktRSLen;
// Now use Mode number to encode type and bandwidth
const char pktMod[16][12] = {
"4PSK/200",
"4FSK/500", "4PSK/500", "8PSK/500", "16QAM/500",
"4FSK/1000", "4PSK/1000", "8PSK/1000", "16QAM/1000",
"4FSK/2000", "4PSK/2000", "8PSK/2000", "16QAM/2000",
};
// Note FSK modes, though identified as 200 500 or 1000 actually
// occupy 500, 1000 or 2000 BW
const int pktBW[16] = {200,
500, 500, 500, 500,
1000, 1000, 1000, 1000,
2000, 2500, 2500, 2500};
const int pktCarriers[16] = {
1,
1, 2, 2, 2,
2, 4, 4, 4,
4, 10, 10, 10};
const BOOL pktFSK[16] = {0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0};
int pktModeLen = 13;
VOID PktARDOPEncode(UCHAR * Data, int Len, int Chan)
{
unsigned char DataToSend[4];
int pktNumCar = pktCarriers[pktMode];
// Header now sent as 4FSK.500.100
// 6 Bits Mode, 10 Bits Length
// 2 Bytes Header 2 Bytes CRC 2 Bytes RS
if (Len > 1023)
return;
DataToSend[0] = (pktMode << 2)|(Len >> 8);
DataToSend[1] = Len & 0xff;
// Calc Data and RS Length
pktDataLen = (Len + (pktNumCar - 1))/pktNumCar; // Round up
pktRSLen = pktDataLen >> 2; // Try 25% for now
if (pktRSLen & 1)
pktRSLen++; // Odd RS bytes no use
if (pktRSLen < 4)
pktRSLen = 4; // At least 4
// Encode Header
EncLen = EncodeFSKData(PktFrameHeader, DataToSend, 2, bytEncodedBytes);
// Encode Data
if (pktFSK[pktMode])
EncodeFSKData(PktFrameData, Data, Len, &bytEncodedBytes[EncLen]);
else
EncodePSKData(PktFrameData, Data, Len, &bytEncodedBytes[EncLen]);
// Header is FSK
Mod4FSKDataAndPlay(bytEncodedBytes, EncLen, intCalcLeader, Chan); // Modulate Data frame
}
// Called when link idle to see if any packet frames to send
void PktARDOPStartTX()
{
/*
if (GetNextKISSFrame() == FALSE)
return; // nothing to send
while (TRUE) // loop till we run out of packets
{
switch(KISSBUFFER[0])
{
case 0: // Normal Data
WriteDebugLog(LOGALERT, "Sending Packet Frame Len %d", KISSLength - 1);
PktARDOPEncode(KISSBUFFER + 1, KISSLength - 1);
// Trace it
if (PacketMonLength == 0) // Ingore if one queued
{
PacketMon[0] = 0x80; // TX Flag
memcpy(&PacketMon[1], &KISSBUFFER[1], KISSLength);
PacketMonLength = KISSLength;
}
break;
case 6: // HW Paramters. Set Mode and Bandwidth
pktMode = KISSBUFFER[1];
break;
case 12:
// Ackmode frame. Return ACK Bytes (first 2) to host when TX complete
WriteDebugLog(LOGALERT, "Sending Packet Frame Len %d", KISSLength - 3);
PktARDOPEncode(KISSBUFFER + 3, KISSLength - 3);
// Returns when Complete so can send ACK
SendAckModeAck();
break;
}
// See if any more
if (GetNextKISSFrame() == FALSE)
break; // no more to send
}
*/
}
VOID SendAckModeAck()
{
}

518
pulse.c
View File

@ -1,518 +0,0 @@
// Pulse Audio bits for QtSoundmodem
#include <stdio.h>
#include <string.h>
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#define UNUSED(x) (void)(x)
extern char CaptureNames[16][256];
extern char PlaybackNames[16][256];
extern int PlaybackCount;
extern int CaptureCount;
#include <dlfcn.h>
void *handle = NULL;
void *shandle = NULL;
pa_mainloop * (*ppa_mainloop_new)(void);
pa_mainloop_api * (*ppa_mainloop_get_api)(pa_mainloop * m);
pa_context * (*ppa_context_new)(pa_mainloop_api *mainloop, const char *name);
int (*ppa_context_connect)(pa_context * c, const char * server, pa_context_flags_t flags, const pa_spawn_api * api);
void (*ppa_context_set_state_callback)(pa_context * c, pa_context_notify_cb_t cb, void * userdata);
int (*ppa_mainloop_iterate)(pa_mainloop * m, int block, int * retval);
void (*ppa_mainloop_free)(pa_mainloop * m);
void (*ppa_context_disconnect)(pa_context * c);
void (*ppa_context_unref)(pa_context * c);
const char * (*ppa_strerror)(int error);
pa_context_state_t(*ppa_context_get_state)(const pa_context *c);
pa_operation * (*ppa_context_get_sink_info_list)(pa_context * c, pa_sink_info_cb_t cb, void * userdata);
pa_operation * (*ppa_context_get_source_info_list)(pa_context * c, pa_source_info_cb_t cb, void * userdata);
void (*ppa_operation_unref)(pa_operation * o);
pa_operation_state_t(*ppa_operation_get_state)(const pa_operation * o);
pa_simple * (*ppa_simple_new)(const char * server,
const char * name,
pa_stream_direction_t dir,
const char * dev,
const char * stream_name,
const pa_sample_spec * ss,
const pa_channel_map * map,
const pa_buffer_attr * attr,
int * error) = NULL;
pa_usec_t(*ppa_simple_get_latency)(pa_simple * s, int * error);
int(*ppa_simple_read)(pa_simple * s, void * data, size_t bytes, int * error);
int(*ppa_simple_write)(pa_simple * s, void * data, size_t bytes, int * error);
int(*ppa_simple_flush)(pa_simple * s, int * error);
void(*ppa_simple_free)(pa_simple * s);
int(*ppa_simple_drain)(pa_simple * s, int * error);
void * getModule(void *handle, char * sym)
{
return dlsym(handle, sym);
}
void * initPulse()
{
// Load the pulse libraries
if (handle)
return handle; // already done
handle = dlopen("libpulse.so", RTLD_LAZY);
if (!handle)
{
fputs(dlerror(), stderr);
return NULL;
}
if ((ppa_mainloop_new = getModule(handle, "pa_mainloop_new")) == NULL) return NULL;
if ((ppa_mainloop_get_api = getModule(handle, "pa_mainloop_get_api")) == NULL) return NULL;
if ((ppa_context_new = getModule(handle, "pa_context_new")) == NULL) return NULL;
if ((ppa_context_connect = getModule(handle, "pa_context_connect")) == NULL) return NULL;
if ((ppa_context_set_state_callback = getModule(handle, "pa_context_set_state_callback")) == NULL) return NULL;
if ((ppa_mainloop_iterate = getModule(handle, "pa_mainloop_iterate")) == NULL) return NULL;
if ((ppa_mainloop_free = getModule(handle, "pa_mainloop_free")) == NULL) return NULL;
if ((ppa_context_disconnect = getModule(handle, "pa_context_disconnect")) == NULL) return NULL;
if ((ppa_context_unref = getModule(handle, "pa_context_unref")) == NULL) return NULL;
if ((ppa_strerror = getModule(handle, "pa_strerror")) == NULL) return NULL;
if ((ppa_context_get_state = getModule(handle, "pa_context_get_state")) == NULL) return NULL;
if ((ppa_context_get_sink_info_list = getModule(handle, "pa_context_get_sink_info_list")) == NULL) return NULL;
if ((ppa_context_get_source_info_list = getModule(handle, "pa_context_get_source_info_list")) == NULL) return NULL;
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);
if (!shandle)
{
fputs(dlerror(), stderr);
return NULL;
}
if ((ppa_simple_new = getModule(shandle, "pa_simple_new")) == NULL) return NULL;
if ((ppa_simple_get_latency = getModule(shandle, "pa_simple_get_latency")) == NULL) return NULL;
if ((ppa_simple_read = dlsym(shandle, "pa_simple_read")) == NULL) return NULL;
if ((ppa_simple_write = dlsym(shandle, "pa_simple_write")) == NULL) return NULL;
if ((ppa_simple_flush = dlsym(shandle, "pa_simple_flush")) == NULL) return NULL;
if ((ppa_simple_drain = dlsym(shandle, "pa_simple_drain")) == NULL) return NULL;
if ((ppa_simple_free = dlsym(shandle, "pa_simple_free")) == NULL) return NULL;
return shandle;
}
// Field list is here: http://0pointer.de/lennart/projects/pulseaudio/doxygen/structpa__sink__info.html
typedef struct pa_devicelist {
uint8_t initialized;
char name[512];
uint32_t index;
char description[256];
} pa_devicelist_t;
void pa_state_cb(pa_context *c, void *userdata);
void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata);
void pa_sourcelist_cb(pa_context *c, const pa_source_info *l, int eol, void *userdata);
int pa_get_devicelist(pa_devicelist_t *input, pa_devicelist_t *output);
// This callback gets called when our context changes state. We really only
// care about when it's ready or if it has failed
void pa_state_cb(pa_context *c, void *userdata) {
pa_context_state_t state;
int *pa_ready = userdata;
state = ppa_context_get_state(c);
switch (state) {
// There are just here for reference
case PA_CONTEXT_UNCONNECTED:
case PA_CONTEXT_CONNECTING:
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
default:
break;
case PA_CONTEXT_FAILED:
case PA_CONTEXT_TERMINATED:
*pa_ready = 2;
break;
case PA_CONTEXT_READY:
*pa_ready = 1;
break;
}
}
// pa_mainloop will call this function when it's ready to tell us about a sink.
// Since we're not threading, there's no need for mutexes on the devicelist
// structure
void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata)
{
UNUSED(c);
pa_devicelist_t *pa_devicelist = userdata;
int ctr = 0;
// If eol is set to a positive number, you're at the end of the list
if (eol > 0) {
return;
}
// We know we've allocated 16 slots to hold devices. Loop through our
// structure and find the first one that's "uninitialized." Copy the
// contents into it and we're done. If we receive more than 16 devices,
// they're going to get dropped. You could make this dynamically allocate
// space for the device list, but this is a simple example.
for (ctr = 0; ctr < 16; ctr++) {
if (!pa_devicelist[ctr].initialized) {
strncpy(pa_devicelist[ctr].name, l->name, 511);
strncpy(pa_devicelist[ctr].description, l->description, 255);
pa_devicelist[ctr].index = l->index;
pa_devicelist[ctr].initialized = 1;
break;
}
}
}
// See above. This callback is pretty much identical to the previous
void pa_sourcelist_cb(pa_context *c, const pa_source_info *l, int eol, void *userdata)
{
UNUSED(c);
pa_devicelist_t *pa_devicelist = userdata;
int ctr = 0;
if (eol > 0) {
return;
}
for (ctr = 0; ctr < 16; ctr++) {
if (!pa_devicelist[ctr].initialized) {
strncpy(pa_devicelist[ctr].name, l->name, 511);
strncpy(pa_devicelist[ctr].description, l->description, 255);
pa_devicelist[ctr].index = l->index;
pa_devicelist[ctr].initialized = 1;
break;
}
}
}
int pa_get_devicelist(pa_devicelist_t *input, pa_devicelist_t *output) {
// Define our pulse audio loop and connection variables
pa_mainloop *pa_ml;
pa_mainloop_api *pa_mlapi;
pa_operation *pa_op;
pa_context *pa_ctx;
// We'll need these state variables to keep track of our requests
int state = 0;
int pa_ready = 0;
// Initialize our device lists
memset(input, 0, sizeof(pa_devicelist_t) * 16);
memset(output, 0, sizeof(pa_devicelist_t) * 16);
// Create a mainloop API and connection to the default server
pa_ml = ppa_mainloop_new();
pa_mlapi = ppa_mainloop_get_api(pa_ml);
pa_ctx = ppa_context_new(pa_mlapi, "test");
// This function connects to the pulse server
ppa_context_connect(pa_ctx, NULL, 0, NULL);
// This function defines a callback so the server will tell us it's state.
// Our callback will wait for the state to be ready. The callback will
// modify the variable to 1 so we know when we have a connection and it's
// ready.
// If there's an error, the callback will set pa_ready to 2
ppa_context_set_state_callback(pa_ctx, pa_state_cb, &pa_ready);
// Now we'll enter into an infinite loop until we get the data we receive
// or if there's an error
for (;;) {
// We can't do anything until PA is ready, so just iterate the mainloop
// and continue
if (pa_ready == 0) {
ppa_mainloop_iterate(pa_ml, 1, NULL);
continue;
}
// We couldn't get a connection to the server, so exit out
if (pa_ready == 2) {
ppa_context_disconnect(pa_ctx);
ppa_context_unref(pa_ctx);
ppa_mainloop_free(pa_ml);
return -1;
}
// At this point, we're connected to the server and ready to make
// requests
switch (state) {
// State 0: we haven't done anything yet
case 0:
// This sends an operation to the server. pa_sinklist_info is
// our callback function and a pointer to our devicelist will
// be passed to the callback The operation ID is stored in the
// pa_op variable
pa_op = ppa_context_get_sink_info_list(pa_ctx,
pa_sinklist_cb,
output
);
// Update state for next iteration through the loop
state++;
break;
case 1:
// Now we wait for our operation to complete. When it's
// complete our pa_output_devicelist is filled out, and we move
// along to the next state
if (ppa_operation_get_state(pa_op) == PA_OPERATION_DONE) {
ppa_operation_unref(pa_op);
// Now we perform another operation to get the source
// (input device) list just like before. This time we pass
// a pointer to our input structure
pa_op = ppa_context_get_source_info_list(pa_ctx,
pa_sourcelist_cb,
input
);
// Update the state so we know what to do next
state++;
}
break;
case 2:
if (ppa_operation_get_state(pa_op) == PA_OPERATION_DONE) {
// Now we're done, clean up and disconnect and return
ppa_operation_unref(pa_op);
ppa_context_disconnect(pa_ctx);
ppa_context_unref(pa_ctx);
ppa_mainloop_free(pa_ml);
return 0;
}
break;
default:
// We should never see this state
fprintf(stderr, "in state %d\n", state);
return -1;
}
// Iterate the main loop and go again. The second argument is whether
// or not the iteration should block until something is ready to be
// done. Set it to zero for non-blocking.
ppa_mainloop_iterate(pa_ml, 1, NULL);
}
}
int listpulse()
{
int ctr;
PlaybackCount = 0;
CaptureCount = 0;
// This is where we'll store the input device list
pa_devicelist_t pa_input_devicelist[16];
// This is where we'll store the output device list
pa_devicelist_t pa_output_devicelist[16];
if (pa_get_devicelist(pa_input_devicelist, pa_output_devicelist) < 0) {
fprintf(stderr, "failed to get device list\n");
return 1;
}
printf("Pulse Playback Devices\n\n");
for (ctr = 0; ctr < 16; ctr++)
{
if (!pa_output_devicelist[ctr].initialized)
break;
printf("Name: %s\n", pa_output_devicelist[ctr].name);
strcpy(&PlaybackNames[PlaybackCount++][0], pa_output_devicelist[ctr].name);
}
printf("Pulse Capture Devices\n\n");
for (ctr = 0; ctr < 16; ctr++)
{
if (!pa_input_devicelist[ctr].initialized)
break;
printf("Name: %s\n", pa_input_devicelist[ctr].name);
strcpy(&CaptureNames[CaptureCount++][0], pa_input_devicelist[ctr].name);
}
return 0;
}
pa_simple * OpenPulsePlayback(char * Server)
{
pa_simple * s;
pa_sample_spec ss;
ss.format = PA_SAMPLE_S16NE;
ss.channels = 2;
ss.rate = 12000;
int error;
s = (*ppa_simple_new)(NULL, // Use the default server.
"QtSM", // Our application's name.
PA_STREAM_PLAYBACK,
Server,
"Playback", // Description of our stream.
&ss, // Our sample format.
NULL, // Use default channel map
NULL, // Use default buffering attributes.
&error
);
if (s == 0)
printf("Playback pa_simple_new() failed: %s\n", ppa_strerror(error));
else
printf("Playback Handle %x\n", (unsigned int)s);
return s;
}
pa_simple * OpenPulseCapture(char * Server)
{
pa_simple * s;
pa_sample_spec ss;
ss.format = PA_SAMPLE_S16NE;
ss.channels = 2;
ss.rate = 12000;
int error;
pa_buffer_attr attr;
attr.maxlength = -1;
attr.tlength = -1;
attr.prebuf = -1;
attr.minreq = -1;
attr.fragsize = 512;
s = (*ppa_simple_new)(NULL, // Use the default server.
"QtSM", // Our application's name.
PA_STREAM_RECORD,
Server,
"Capture", // Description of our stream.
&ss, // Our sample format.
NULL, // Use default channel map
&attr,
&error
);
if (s == 0)
printf("Capture pa_simple_new() failed: %s\n", ppa_strerror(error));
else
printf("Capture Handle %x\n", (unsigned int)s);
return s;
}
pa_simple * spc = 0; // Capure Handle
pa_simple * spp = 0; // Playback Handle
int pulse_audio_open(char * CaptureDevice, char * PlaybackDevice)
{
pa_usec_t latency;
int error;
spc = OpenPulseCapture(CaptureDevice);
spp = OpenPulsePlayback(PlaybackDevice);
if (spc && spp)
{
if ((latency = ppa_simple_get_latency(spc, &error)) == (pa_usec_t)-1) {
printf("cap simple_get_latency() failed: %s\n", ppa_strerror(error));
}
else
printf("cap %0.0f usec \n", (float)latency);
if ((latency = ppa_simple_get_latency(spp, &error)) == (pa_usec_t)-1) {
printf("play simple_get_latency() failed: %s\n", ppa_strerror(error));
}
else
printf("play %0.0f usec \n", (float)latency);
return 1;
}
else
return 0;
}
void pulse_audio_close()
{
int error;
ppa_simple_flush(spc, &error);
ppa_simple_free(spc);
spc = 0;
ppa_simple_drain(spp, &error);
ppa_simple_free(spp);
spp = 0;
}
int pulse_read(short * samples, int nSamples)
{
int error;
int nBytes = nSamples * 4;
if (spc == 0)
return 0;
if (ppa_simple_read(spc, samples, nBytes, &error) < 0)
{
printf("Pulse pa_simple_read() failed: %s\n", ppa_strerror(error));
return 0;
}
return nSamples;
}
int pulse_write(short * ptr, int len)
{
int k;
int error;
if (spp == 0)
return 0;
k = ppa_simple_write(spp, ptr, len * 4, &error);
if (k < 0)
{
printf("Pulse pa_simple_write() failed: %s\n", ppa_strerror(error));
return -1;
}
return 0;
}
void pulse_flush()
{
int error;
if (spp == 0)
return;
if (ppa_simple_flush(spp, &error) < 0)
printf("Pulse pa_simple_flush() failed: %s\n", ppa_strerror(error));
}

Binary file not shown.

View File

@ -0,0 +1 @@
9e6f7611858dc8e567b636b6c593a51b005762f2

Some files were not shown because too many files have changed in this diff Show More