SVN r8748
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
/* RAND-SRC.C - Generate random message bits. */
|
||||
|
||||
/* Copyright (c) 1995-2012 by Radford M. Neal.
|
||||
*
|
||||
* Permission is granted for anyone to copy, use, modify, and distribute
|
||||
* these programs and accompanying documents for any purpose, provided
|
||||
* this copyright notice is retained and prominently displayed, and note
|
||||
* is made of any changes made to these programs. These programs and
|
||||
* documents are distributed without any warranty, express or implied.
|
||||
* As the programs were written for research purposes only, they have not
|
||||
* been tested to the degree that would be advisable in any important
|
||||
* application. All use of these programs is entirely at the user's own
|
||||
* risk.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "open.h"
|
||||
#include "rand.h"
|
||||
|
||||
void usage(void);
|
||||
|
||||
|
||||
/* MAIN PROGRAM. */
|
||||
|
||||
int main
|
||||
( int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
int seed, bs, nb;
|
||||
char *file, *n_bits;
|
||||
char junk;
|
||||
int i, j;
|
||||
FILE *f;
|
||||
|
||||
if (!(file = argv[1])
|
||||
|| !argv[2] || sscanf(argv[2],"%d%c",&seed,&junk)!=1
|
||||
|| !(n_bits = argv[3])
|
||||
|| argv[4])
|
||||
{ usage();
|
||||
}
|
||||
|
||||
if (sscanf(n_bits,"%d%c",&nb,&junk)==1)
|
||||
{ if (nb<=0) usage();
|
||||
bs = 1;
|
||||
}
|
||||
else if (sscanf(n_bits,"%dx%d%c",&bs,&nb,&junk)==2)
|
||||
{ if (nb<=0 || bs<=0) usage();
|
||||
}
|
||||
else
|
||||
{ usage();
|
||||
}
|
||||
|
||||
f = open_file_std(file,"w");
|
||||
if (f==NULL)
|
||||
{ fprintf(stderr,"Can't create source file: %s\n",file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rand_seed(10*seed+2);
|
||||
|
||||
for (i = 0; i<nb; i++)
|
||||
{ for (j = 0; j<bs; j++)
|
||||
{ fprintf(f,"%d",rand_int(2));
|
||||
}
|
||||
fprintf(f,"\n");
|
||||
}
|
||||
|
||||
if (ferror(f) || fclose(f)!=0)
|
||||
{ fprintf(stderr,"Error writing random source blocks to %s\n",file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* PRINT USAGE MESSAGE AND EXIT. */
|
||||
|
||||
void usage(void)
|
||||
{ fprintf(stderr,"Usage: rand-src source-file seed n-bits\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
program jt65
|
||||
|
||||
! Test the JT65 decoder for WSJT-X
|
||||
|
||||
use options
|
||||
use timer_module, only: timer
|
||||
use timer_impl, only: init_timer
|
||||
use jt65_test
|
||||
use readwav
|
||||
|
||||
character c,mode
|
||||
logical :: display_help=.false.,nrobust=.false.,single_decode=.false., ljt65apon=.false.
|
||||
type(wav_header) :: wav
|
||||
integer*2 id2(NZMAX)
|
||||
real*4 dd(NZMAX)
|
||||
character*80 infile
|
||||
character(len=500) optarg
|
||||
character*12 mycall,hiscall
|
||||
character*6 hisgrid
|
||||
|
||||
type (option) :: long_options(12) = [ &
|
||||
option ('aggressive',.true.,'a','aggressiveness [0-10], default AGGR=0','AGGR'), &
|
||||
option ('depth',.true.,'d','depth=5 hinted decoding, default DEPTH=0','DEPTH'), &
|
||||
option ('freq',.true.,'f','signal frequency, default FREQ=1270','FREQ'), &
|
||||
option ('help',.false.,'h','Display this help message',''), &
|
||||
option ('mode',.true.,'m','Mode A, B, C. Default is A.','MODE'), &
|
||||
option ('ntrials',.true.,'n','number of trials, default TRIALS=10000','TRIALS'), &
|
||||
option ('robust-sync',.false.,'r','robust sync',''), &
|
||||
option ('my-call',.true.,'c','my callsign',''), &
|
||||
option ('his-call',.true.,'x','his callsign',''), &
|
||||
option ('his-grid',.true.,'g','his grid locator',''), &
|
||||
option ('experience-decoding',.true.,'X' &
|
||||
,'experience decoding options (1..n), default FLAGS=0','FLAGS'), &
|
||||
option ('single-signal-mode',.false.,'s','decode at signal frequency only','') ]
|
||||
|
||||
naggressive=10
|
||||
nfqso=1500
|
||||
ntrials=100000
|
||||
nexp_decode=0
|
||||
ntol=20
|
||||
nsubmode=0
|
||||
nlow=200
|
||||
nhigh=4000
|
||||
n2pass=1
|
||||
ndepth=1
|
||||
nQSOProgress=6
|
||||
|
||||
do
|
||||
call getopt('a:d:f:hm:n:rc:x:g:X:s',long_options,c,optarg,narglen,nstat,noffset,nremain,.true.)
|
||||
if( nstat .ne. 0 ) then
|
||||
exit
|
||||
end if
|
||||
select case (c)
|
||||
case ('a')
|
||||
read (optarg(:narglen), *) naggressive
|
||||
case ('d')
|
||||
read (optarg(:narglen), *) ndepth
|
||||
case ('f')
|
||||
read (optarg(:narglen), *) nfqso
|
||||
case ('h')
|
||||
display_help = .true.
|
||||
case ('m')
|
||||
read (optarg(:narglen), *) mode
|
||||
if( mode .eq. 'b' .or. mode .eq. 'B' ) then
|
||||
nsubmode=1
|
||||
endif
|
||||
if( mode .eq. 'c' .or. mode .eq. 'C' ) then
|
||||
nsubmode=2
|
||||
endif
|
||||
case ('n')
|
||||
read (optarg(:narglen), *) ntrials
|
||||
case ('r')
|
||||
nrobust=.true.
|
||||
case ('c')
|
||||
read (optarg(:narglen), *) mycall
|
||||
case ('x')
|
||||
read (optarg(:narglen), *) hiscall
|
||||
case ('g')
|
||||
read (optarg(:narglen), *) hisgrid
|
||||
case ('X')
|
||||
read (optarg(:narglen), *) nexp_decode
|
||||
case ('s')
|
||||
single_decode=.true.
|
||||
ntol=100
|
||||
nlow=nfqso-ntol
|
||||
nhigh=nfqso+ntol
|
||||
n2pass=1
|
||||
end select
|
||||
end do
|
||||
|
||||
if(single_decode) nexp_decode=ior(nexp_decode,32)
|
||||
if(display_help .or. nstat.lt.0 .or. nremain.lt.1) then
|
||||
print *, ''
|
||||
print *, 'Usage: jt65 [OPTIONS] file1 [file2 ...]'
|
||||
print *, ''
|
||||
print *, ' JT65 decode pre-recorded .WAV file(s)'
|
||||
print *, ''
|
||||
print *, 'OPTIONS:'
|
||||
print *, ''
|
||||
do i = 1, size (long_options)
|
||||
call long_options(i) % print (6)
|
||||
end do
|
||||
go to 999
|
||||
endif
|
||||
|
||||
call init_timer ('timer.out')
|
||||
call timer('jt65 ',0)
|
||||
|
||||
ndecoded=0
|
||||
do ifile=noffset+1,noffset+nremain
|
||||
nfa=nlow
|
||||
nfb=nhigh
|
||||
minsync=0
|
||||
call get_command_argument(ifile,optarg,narglen)
|
||||
infile=optarg(:narglen)
|
||||
call timer('read ',0)
|
||||
call wav%read (infile)
|
||||
i1=index(infile,'.wav')
|
||||
if( i1 .eq. 0 ) i1=index(infile,'.WAV')
|
||||
read(infile(i1-4:i1-1),*,err=998) nutc
|
||||
npts=52*12000
|
||||
read(unit=wav%lun) id2(1:npts)
|
||||
close(unit=wav%lun)
|
||||
call timer('read ',1)
|
||||
dd(1:npts)=id2(1:npts)
|
||||
dd(npts+1:)=0.
|
||||
call test(dd,nutc,nfa,nfb,nfqso,ntol,nsubmode, &
|
||||
n2pass,nrobust,ntrials,naggressive,ndepth, &
|
||||
mycall,hiscall,hisgrid,nexp_decode,nQSOProgress,ljt65apon)
|
||||
! if(nft.gt.0) exit
|
||||
enddo
|
||||
|
||||
call timer('jt65 ',1)
|
||||
call timer('jt65 ',101)
|
||||
! call four2a(a,-1,1,1,1) !Free the memory used for plans
|
||||
! call filbig(a,-1,1,0.0,0,0,0,0,0) ! (ditto)
|
||||
go to 999
|
||||
|
||||
998 print*,'Cannot read from file:'
|
||||
print*,infile
|
||||
|
||||
999 continue
|
||||
end program jt65
|
||||
@@ -0,0 +1,483 @@
|
||||
#ifndef NETWORK_MESSAGE_HPP__
|
||||
#define NETWORK_MESSAGE_HPP__
|
||||
|
||||
/*
|
||||
* WSJT-X Message Formats
|
||||
* ======================
|
||||
*
|
||||
* All messages are written or read using the QDataStream derivatives
|
||||
* defined below, note that we are using the default for floating
|
||||
* point precision which means all are double precision i.e. 64-bit
|
||||
* IEEE format.
|
||||
*
|
||||
* Message is big endian format
|
||||
*
|
||||
* Header format:
|
||||
*
|
||||
* 32-bit unsigned integer magic number 0xadbccbda
|
||||
* 32-bit unsigned integer schema number
|
||||
*
|
||||
* Payload format:
|
||||
*
|
||||
* As per the QDataStream format, see below for version used and
|
||||
* here:
|
||||
*
|
||||
* http://doc.qt.io/qt-5/datastreamformat.html
|
||||
*
|
||||
* for the serialization details for each type, at the time of
|
||||
* writing the above document is for Qt_5_0 format which is buggy
|
||||
* so we use Qt_5_4 format, differences are:
|
||||
*
|
||||
* QDateTime:
|
||||
* QDate qint64 Julian day number
|
||||
* QTime quint32 Milli-seconds since midnight
|
||||
* timespec quint8 0=local, 1=UTC, 2=Offset from UTC
|
||||
* (seconds)
|
||||
* 3=time zone
|
||||
* offset qint32 only present if timespec=2
|
||||
* timezone several-fields only present if timespec=3
|
||||
*
|
||||
* we will avoid using QDateTime fields with time zones for simplicity.
|
||||
*
|
||||
* Type utf8 is a utf-8 byte string formatted as a QByteArray for
|
||||
* serialization purposes (currently a quint32 size followed by size
|
||||
* bytes, no terminator is present or counted).
|
||||
*
|
||||
* The QDataStream format document linked above is not complete for
|
||||
* the QByteArray serialization format, it is similar to the QString
|
||||
* serialization format in that it differentiates between empty
|
||||
* strings and null strings. Empty strings have a length of zero
|
||||
* whereas null strings have a length field of 0xffffffff.
|
||||
*
|
||||
* Schema Negotiation
|
||||
* ------------------
|
||||
*
|
||||
* The NetworkMessage::Builder class specifies a schema number which
|
||||
* may be incremented from time to time. It represents a version of
|
||||
* the underlying encoding schemes used to store data items. Since the
|
||||
* underlying encoding is defined by the Qt project in it's
|
||||
* QDataStream stream operators, it is essential that clients and
|
||||
* servers of this protocol can agree on a common scheme. The
|
||||
* NetworkMessage utility classes below exchange the schema number
|
||||
* actually used. The handling of the schema is backwards compatible
|
||||
* to an extent, so long as clients and servers are written
|
||||
* correctly. For example a server written to any particular schema
|
||||
* version can communicate with a client written to a later schema.
|
||||
*
|
||||
* Schema Version 1:- this schema used the QDataStream::Qt_5_0 version
|
||||
* which is broken.
|
||||
*
|
||||
* Schema Version 2:- this schema uses the QDataStream::Qt_5_2 version.
|
||||
*
|
||||
* Schema Version 3:- this schema uses the QDataStream::Qt_5_4 version.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Message Direction Value Type
|
||||
* ------------- --------- ---------------------- -----------
|
||||
* Heartbeat Out/In 0 quint32
|
||||
* Id (unique key) utf8
|
||||
* Maximum schema number quint32
|
||||
* version utf8
|
||||
* revision utf8
|
||||
*
|
||||
* The heartbeat message shall be sent on a periodic basis every
|
||||
* NetworkMessage::pulse seconds (see below), the WSJT-X
|
||||
* application does that using the MessageClient class. This
|
||||
* message is intended to be used by servers to detect the presence
|
||||
* of a client and also the unexpected disappearance of a client
|
||||
* and by clients to learn the schema negotiated by the server
|
||||
* after it receives the initial heartbeat message from a client.
|
||||
* The message_aggregator reference server does just that using the
|
||||
* MessageServer class. Upon initial startup a client must send a
|
||||
* heartbeat message as soon as is practical, this message is used
|
||||
* to negotiate the maximum schema number common to the client and
|
||||
* server. Note that the server may not be able to support the
|
||||
* client's requested maximum schema number, in which case the
|
||||
* first message received from the server will specify a lower
|
||||
* schema number (never a higher one as that is not allowed). If a
|
||||
* server replies with a lower schema number then no higher than
|
||||
* that number shall be used for all further outgoing messages from
|
||||
* either clients or the server itself.
|
||||
*
|
||||
* Note: the "Maximum schema number" field was introduced at the
|
||||
* same time as schema 3, therefore servers and clients must assume
|
||||
* schema 2 is the highest schema number supported if the Heartbeat
|
||||
* message does not contain the "Maximum schema number" field.
|
||||
*
|
||||
*
|
||||
* Status Out 1 quint32
|
||||
* Id (unique key) utf8
|
||||
* Dial Frequency (Hz) quint64
|
||||
* Mode utf8
|
||||
* DX call utf8
|
||||
* Report utf8
|
||||
* Tx Mode utf8
|
||||
* Tx Enabled bool
|
||||
* Transmitting bool
|
||||
* Decoding bool
|
||||
* Rx DF qint32
|
||||
* Tx DF qint32
|
||||
* DE call utf8
|
||||
* DE grid utf8
|
||||
* DX grid utf8
|
||||
* Tx Watchdog bool
|
||||
* Sub-mode utf8
|
||||
* Fast mode bool
|
||||
*
|
||||
* WSJT-X sends this status message when various internal state
|
||||
* changes to allow the server to track the relevant state of each
|
||||
* client without the need for polling commands. The current state
|
||||
* changes that generate status messages are:
|
||||
*
|
||||
* Application start up,
|
||||
* "Enable Tx" button status changes,
|
||||
* Dial frequency changes,
|
||||
* Changes to the "DX Call" field,
|
||||
* Operating mode, sub-mode or fast mode changes,
|
||||
* Transmit mode changed (in dual JT9+JT65 mode),
|
||||
* Changes to the "Rpt" spinner,
|
||||
* After an old decodes replay sequence (see Replay below),
|
||||
* When switching between Tx and Rx mode,
|
||||
* At the start and end of decoding,
|
||||
* When the Rx DF changes,
|
||||
* When the Tx DF changes,
|
||||
* When the DE call or grid changes (currently when settings are exited),
|
||||
* When the DX call or grid changes,
|
||||
* When the Tx watchdog is set or reset.
|
||||
*
|
||||
*
|
||||
* Decode Out 2 quint32
|
||||
* Id (unique key) utf8
|
||||
* New bool
|
||||
* Time QTime
|
||||
* snr qint32
|
||||
* Delta time (S) float (serialized as double)
|
||||
* Delta frequency (Hz) quint32
|
||||
* Mode utf8
|
||||
* Message utf8
|
||||
* Low confidence bool
|
||||
* Off air bool
|
||||
*
|
||||
* The decode message is sent when a new decode is completed, in
|
||||
* this case the 'New' field is true. It is also used in response
|
||||
* to a "Replay" message where each old decode in the "Band
|
||||
* activity" window, that has not been erased, is sent in order
|
||||
* as a one of these messages with the 'New' field set to false.
|
||||
* See the "Replay" message below for details of usage. Low
|
||||
* confidence decodes are flagged in protocols where the decoder
|
||||
* has knows that a decode has a higher than normal probability
|
||||
* of being false, they should not be reported on publicly
|
||||
* accessible services without some attached warning or further
|
||||
* validation. Off air decodes are those that result from playing
|
||||
* back a .WAV file.
|
||||
*
|
||||
*
|
||||
* Clear Out 3 quint32
|
||||
* Id (unique key) utf8
|
||||
*
|
||||
* This message is send when all prior "Decode" messages in the
|
||||
* "Band activity" window have been discarded and therefore are
|
||||
* no long available for actioning with a "Reply" message. It is
|
||||
* sent when the user erases the "Band activity" window and when
|
||||
* WSJT-X closes down normally. The server should discard all
|
||||
* decode messages upon receipt of this message.
|
||||
*
|
||||
*
|
||||
* Reply In 4 quint32
|
||||
* Id (target unique key) utf8
|
||||
* Time QTime
|
||||
* snr qint32
|
||||
* Delta time (S) float (serialized as double)
|
||||
* Delta frequency (Hz) quint32
|
||||
* Mode utf8
|
||||
* Message utf8
|
||||
* Low confidence bool
|
||||
* Modifiers quint8
|
||||
*
|
||||
* In order for a server to provide a useful cooperative service
|
||||
* to WSJT-X it is possible for it to initiate a QSO by sending
|
||||
* this message to a client. WSJT-X filters this message and only
|
||||
* acts upon it if the message exactly describes a prior decode
|
||||
* and that decode is a CQ or QRZ message. The action taken is
|
||||
* exactly equivalent to the user double clicking the message in
|
||||
* the "Band activity" window. The intent of this message is for
|
||||
* servers to be able to provide an advanced look up of potential
|
||||
* QSO partners, for example determining if they have been worked
|
||||
* before or if working them may advance some objective like
|
||||
* award progress. The intention is not to provide a secondary
|
||||
* user interface for WSJT-X, it is expected that after QSO
|
||||
* initiation the rest of the QSO is carried out manually using
|
||||
* the normal WSJT-X user interface.
|
||||
*
|
||||
* The Modifiers field allows the equivalent of keyboard
|
||||
* modifiers to be sent "as if" those modifier keys where pressed
|
||||
* while double-clicking the specified decoded message. The
|
||||
* modifier values (hexadecimal) are as follows:
|
||||
*
|
||||
* no modifier 0x00
|
||||
* SHIFT 0x02
|
||||
* CTRL 0x04 CMD on Mac
|
||||
* ALT 0x08
|
||||
* META 0x10 Windows key on MS Windows
|
||||
* KEYPAD 0x20 Keypad or arrows
|
||||
* Group switch 0x40 X11 only
|
||||
*
|
||||
*
|
||||
* QSO Logged Out 5 quint32
|
||||
* Id (unique key) utf8
|
||||
* Date & Time Off QDateTime
|
||||
* DX call utf8
|
||||
* DX grid utf8
|
||||
* Tx frequency (Hz) quint64
|
||||
* Mode utf8
|
||||
* Report send utf8
|
||||
* Report received utf8
|
||||
* Tx power utf8
|
||||
* Comments utf8
|
||||
* Name utf8
|
||||
* Date & Time On QDateTime
|
||||
* Operator call utf8
|
||||
* My call utf8
|
||||
* My grid utf8
|
||||
*
|
||||
* The QSO logged message is sent to the server(s) when the
|
||||
* WSJT-X user accepts the "Log QSO" dialog by clicking the "OK"
|
||||
* button.
|
||||
*
|
||||
*
|
||||
* Close Out 6 quint32
|
||||
* Id (unique key) utf8
|
||||
*
|
||||
* Close is sent by a client immediately prior to it shutting
|
||||
* down gracefully.
|
||||
*
|
||||
*
|
||||
* Replay In 7 quint32
|
||||
* Id (unique key) utf8
|
||||
*
|
||||
* When a server starts it may be useful for it to determine the
|
||||
* state of preexisting clients. Sending this message to each
|
||||
* client as it is discovered will cause that client (WSJT-X) to
|
||||
* send a "Decode" message for each decode currently in its "Band
|
||||
* activity" window. Each "Decode" message sent will have the
|
||||
* "New" flag set to false so that they can be distinguished from
|
||||
* new decodes. After all the old decodes have been broadcast a
|
||||
* "Status" message is also broadcast. If the server wishes to
|
||||
* determine the status of a newly discovered client; this
|
||||
* message should be used.
|
||||
*
|
||||
*
|
||||
* Halt Tx In 8
|
||||
* Id (unique key) utf8
|
||||
* Auto Tx Only bool
|
||||
*
|
||||
* The server may stop a client from transmitting messages either
|
||||
* immediately or at the end of the current transmission period
|
||||
* using this message.
|
||||
*
|
||||
*
|
||||
* Free Text In 9
|
||||
* Id (unique key) utf8
|
||||
* Text utf8
|
||||
* Send bool
|
||||
*
|
||||
* This message allows the server to set the current free text
|
||||
* message content. Sending this message with a non-empty "Text"
|
||||
* field is equivalent to typing a new message (old contents are
|
||||
* discarded) in to the WSJT-X free text message field or "Tx5"
|
||||
* field (both are updated) and if the "Send" flag is set then
|
||||
* clicking the "Now" radio button for the "Tx5" field if tab one
|
||||
* is current or clicking the "Free msg" radio button if tab two
|
||||
* is current.
|
||||
*
|
||||
* It is the responsibility of the sender to limit the length of
|
||||
* the message text and to limit it to legal message
|
||||
* characters. Despite this, it may be difficult for the sender
|
||||
* to determine the maximum message length without reimplementing
|
||||
* the complete message encoding protocol. Because of this is may
|
||||
* be better to allow any reasonable message length and to let
|
||||
* the WSJT-X application encode and possibly truncate the actual
|
||||
* on-air message.
|
||||
*
|
||||
* If the message text is empty the meaning of the message is
|
||||
* refined to send the current free text unchanged when the
|
||||
* "Send" flag is set or to clear the current free text when the
|
||||
* "Send" flag is unset. Note that this API does not include a
|
||||
* command to determine the contents of the current free text
|
||||
* message.
|
||||
*
|
||||
*
|
||||
* WSPRDecode Out 10 quint32
|
||||
* Id (unique key) utf8
|
||||
* New bool
|
||||
* Time QTime
|
||||
* snr qint32
|
||||
* Delta time (S) float (serialized as double)
|
||||
* Frequency (Hz) quint64
|
||||
* Drift (Hz) qint32
|
||||
* Callsign utf8
|
||||
* Grid utf8
|
||||
* Power (dBm) qint32
|
||||
* Off air bool
|
||||
*
|
||||
* The decode message is sent when a new decode is completed, in
|
||||
* this case the 'New' field is true. It is also used in response
|
||||
* to a "Replay" message where each old decode in the "Band
|
||||
* activity" window, that has not been erased, is sent in order
|
||||
* as a one of these messages with the 'New' field set to
|
||||
* false. See the "Replay" message below for details of
|
||||
* usage. The off air field indicates that the decode was decoded
|
||||
* from a played back recording.
|
||||
*
|
||||
*
|
||||
* Location In 11
|
||||
* Id (unique key) utf8
|
||||
* Location utf8
|
||||
*
|
||||
* This message allows the server to set the current current
|
||||
* geographical location of operation. The supplied location is
|
||||
* not persistent but is used as a session lifetime replacement
|
||||
* loction that overrides the Maidenhead grid locater set in the
|
||||
* application settings. The intent is to allow an external
|
||||
* application to update the operating location dynamically
|
||||
* during a mobile period of operation.
|
||||
*
|
||||
* Currently only Maidenhead grid squares or sub-squares are
|
||||
* accepted, i.e. 4- or 6-digit locators. Other formats may be
|
||||
* accepted in future.
|
||||
*
|
||||
*
|
||||
* Logged ADIF Out 12 quint32
|
||||
* Id (unique key) utf8
|
||||
* ADIF text utf8
|
||||
*
|
||||
* The logged ADIF message is sent to the server(s) when the
|
||||
* WSJT-X user accepts the "Log QSO" dialog by clicking the "OK"
|
||||
* button. The "ADIF text" field consists of a valid ADIF file
|
||||
* such that the WSJT-X UDP header information is encapsulated
|
||||
* into a valid ADIF header. E.g.:
|
||||
*
|
||||
* <magic-number><schema-number><type><id><32-bit-count> # binary encoded fields
|
||||
* # the remainder is the contents of the ADIF text field
|
||||
* <adif_ver:5>3.0.7
|
||||
* <programid:6>WSJT-X
|
||||
* <EOH>
|
||||
* ADIF log data fields ...<EOR>
|
||||
*
|
||||
* Note that receiving applications can treat the whole message
|
||||
* as a valid ADIF file with one record without special parsing.
|
||||
*
|
||||
*
|
||||
* Highlight Callsign In 13 quint32
|
||||
* Id (unique key) utf8
|
||||
* Callsign utf8
|
||||
* Background Color QColor
|
||||
* Foreground Color QColor
|
||||
* Highlight last bool
|
||||
*
|
||||
* The server may send this message at any time. The message
|
||||
* specifies the background and foreground color that will be
|
||||
* used to highlight the specified callsign in the decoded
|
||||
* messages printed in the Band Activity panel. The WSJT-X
|
||||
* clients maintain a list of such instructions and apply them to
|
||||
* all decoded messages in the band activity window. To clear
|
||||
* highlighting send an invalid QColor value for either or both
|
||||
* of the background and foreground fields.
|
||||
*
|
||||
* The "Highlight last" field allows the sender to request that
|
||||
* the last instance only instead of all instances of the
|
||||
* specified call be highlighted or have it's highlighting
|
||||
* cleared.
|
||||
*/
|
||||
|
||||
#include <QDataStream>
|
||||
|
||||
#include "pimpl_h.hpp"
|
||||
|
||||
class QIODevice;
|
||||
class QByteArray;
|
||||
class QString;
|
||||
|
||||
namespace NetworkMessage
|
||||
{
|
||||
// NEVER DELETE MESSAGE TYPES
|
||||
enum Type
|
||||
{
|
||||
Heartbeat,
|
||||
Status,
|
||||
Decode,
|
||||
Clear,
|
||||
Reply,
|
||||
QSOLogged,
|
||||
Close,
|
||||
Replay,
|
||||
HaltTx,
|
||||
FreeText,
|
||||
WSPRDecode,
|
||||
Location,
|
||||
LoggedADIF,
|
||||
HighlightCallsign,
|
||||
maximum_message_type_ // ONLY add new message types
|
||||
// immediately before here
|
||||
};
|
||||
|
||||
quint32 constexpr pulse {15}; // seconds
|
||||
|
||||
//
|
||||
// NetworkMessage::Builder - build a message containing serialized Qt types
|
||||
//
|
||||
class Builder
|
||||
: public QDataStream
|
||||
{
|
||||
public:
|
||||
static quint32 constexpr magic {0xadbccbda}; // never change this
|
||||
|
||||
// increment this if a newer Qt schema is required and add decode
|
||||
// logic to the Builder and Reader class implementations
|
||||
#if QT_VERSION >= 0x050400
|
||||
static quint32 constexpr schema_number {3};
|
||||
#elif QT_VERSION >= 0x050200
|
||||
static quint32 constexpr schema_number {2};
|
||||
#else
|
||||
// Schema 1 (Qt_5_0) is broken
|
||||
#error "Qt version 5.2 or greater required"
|
||||
#endif
|
||||
|
||||
explicit Builder (QIODevice *, Type, QString const& id, quint32 schema);
|
||||
explicit Builder (QByteArray *, Type, QString const& id, quint32 schema);
|
||||
Builder (Builder const&) = delete;
|
||||
Builder& operator = (Builder const&) = delete;
|
||||
|
||||
private:
|
||||
void common_initialization (Type type, QString const& id, quint32 schema);
|
||||
};
|
||||
|
||||
//
|
||||
// NetworkMessage::Reader - read a message containing serialized Qt types
|
||||
//
|
||||
// Message is as per NetworkMessage::Builder above, the schema()
|
||||
// member may be used to determine the schema of the original
|
||||
// message.
|
||||
//
|
||||
class Reader
|
||||
: public QDataStream
|
||||
{
|
||||
public:
|
||||
explicit Reader (QIODevice *);
|
||||
explicit Reader (QByteArray const&);
|
||||
Reader (Reader const&) = delete;
|
||||
Reader& operator = (Reader const&) = delete;
|
||||
~Reader ();
|
||||
|
||||
quint32 schema () const;
|
||||
Type type () const;
|
||||
QString id () const;
|
||||
|
||||
private:
|
||||
class impl;
|
||||
pimpl<impl> m_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copy the LPDC programs to the directory specified. The program file
|
||||
# might be the name of the program, or (eg, on Cygwin) the name of the
|
||||
# program with .exe appended.
|
||||
|
||||
if [ x$1 == x -o x$2 != x ]; then
|
||||
echo Usage: LDPC-install bin-directory
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Installing LPDC programs in $1
|
||||
|
||||
mkdir -p $1
|
||||
|
||||
for prog in make-pchk alist-to-pchk pchk-to-alist \
|
||||
make-ldpc print-pchk make-gen print-gen \
|
||||
rand-src encode transmit decode extract verify; do
|
||||
if [ -f $prog ]; then
|
||||
cp $prog $1
|
||||
elif [ -f $prog.exe ]; then
|
||||
cp $prog.exe $1
|
||||
else
|
||||
echo No program $prog to install
|
||||
fi
|
||||
done
|
||||
|
||||
echo Done
|
||||
Reference in New Issue
Block a user