@@ -68,7 +68,6 @@ public class Modem implements Runnable {
6868 public boolean BlockActive = false ;
6969 public boolean possibleCwFrame = false ;
7070 private StringBuilder cwStringBuilder = new StringBuilder (100 );
71- //private int stxcount = 0;
7271 static String [] fldigimodes = {"unknown" , "THOR 8>" , "MFSK-16>" , "THOR 22>" , "MFSK-32>" ,
7372 "PSK-250R>" , "PSK-500R>" , "BPSK-500>" , "BPSK-250>" , "BPSK-125>" ,
7473 "BPSK-63>" , "PSK-125R>" , "MFSK-64>" , "THOR 11>" , "THOR 4>" , "Contestia>" ,
@@ -127,7 +126,12 @@ public class Modem implements Runnable {
127126 public boolean commToFldigiOpened = false ; // Use this to suppress errors when the port is closed
128127 public RMsgObject txMessage = null ;
129128 public long expectedReturnToRxTime = 0L ;
130-
129+
130+ public static final char SOH = 1 ;
131+ public static final char EOT = 4 ;
132+ public static final char DC1 = 17 ; //Olivia SOH replacement (used in jPskmail due to Fldigi limitations of Olivia's character set)
133+ public static final char DC2 = 18 ;
134+ public static final char DC3 = 19 ; //Olivia EOT replacement of
131135
132136 //RadioMsg stuff
133137 //Picture transfer conversion of speed to SPP (Samples Per Pixel) and vice-versa
@@ -720,7 +724,6 @@ public void Sendln(String outLine, String modemString, String TxRsidString) {
720724 }
721725 }
722726 if (!outLine .equals ("" )) {
723- pout .println (outLine );
724727 if (!outLine .contains ("<cmd>" )) {
725728 //Must be a data block, reset receive marker of RSID for next RX
726729 //VK2ETA: TO-DO: check if logic (and place of decision) is consistent with RadioMsg
@@ -730,7 +733,12 @@ public void Sendln(String outLine, String modemString, String TxRsidString) {
730733 long txTime = (3000 * (long )(getTxTimeEstimate (txMode , outLine .getBytes ("UTF-8" ).length )));
731734 System .out .println ("txTime: " + txTime );
732735 expectedReturnToRxTime = System .currentTimeMillis () + txTime ;
736+ //Olivia and MT-63 modes, replace SOH by DC1 and EOT by DC3 due to limitation in Olivia's and MT-63's character set in Fldigi (ch > 7 only)
737+ if (modemString .startsWith ("OLIV" ) || modemString .startsWith ("MT63" )) {
738+ outLine = outLine .replace (SOH , DC1 ).replace (EOT , DC3 );
739+ }
733740 }
741+ pout .println (outLine );
734742 }
735743 }
736744 } catch (Exception ex ) {
@@ -1289,7 +1297,9 @@ private void GetBlock() {
12891297 switch (inChar ) {
12901298 case 0 :
12911299 break ; // ignore
1292- case 1 : //SOH
1300+ case DC1 :
1301+ inChar = SOH ; //Valid Olivia SOH replacement. Exchange and fall through to processing of normal SOH
1302+ case SOH :
12931303 Main .lastCharacterTime = blockstart = System .currentTimeMillis ();
12941304 Main .haveSOH = true ;
12951305 //Just received RSID, restart counting Radio Msg header timeout from now
@@ -1322,7 +1332,9 @@ private void GetBlock() {
13221332 //VK2ETA not here
13231333 //Main.DCD = 0;
13241334 break ;
1325- case 4 : //EOT
1335+ case DC3 :
1336+ inChar = EOT ; //Valid Olivia EOT replacement. Exchange and fall through to processing of normal EOT
1337+ case EOT :
13261338 // System.out.println("EOT:" + BlockString);
13271339 blocktime = (System .currentTimeMillis () - blockstart );
13281340 //VK2ETA debug extra status send when TXing long data in slow mode from server
@@ -1423,20 +1435,19 @@ private void GetBlock() {
14231435 //VK2ETA not here
14241436 //Main.DCD = 0;
14251437 break ;
1426- case 18 :
1427- // DC2 received
1438+ case DC2 :
14281439 DC2_rcvd = true ;
14291440 break ;
14301441 default :
14311442 if (DC2_rcvd ) {
1432- notifier += (char )inChar ;
1443+ notifier += (char ) inChar ;
14331444 //Not found char(62) ">" yet, check length
14341445 if (notifier .length () > 35 ) {
14351446 //Too long, false positive
14361447 DC2_rcvd = false ;
14371448 notifier = "" ;
14381449 }
1439- if ((char )inChar == 62 ) { // ">" character
1450+ if ((char ) inChar == 62 ) { // ">" character
14401451 DC2_rcvd = false ;
14411452// System.out.println(notifier);
14421453 // <s2n: 58, 100.0, 0.0>
@@ -1490,7 +1501,7 @@ private void GetBlock() {
14901501 notifier = "" ;
14911502 }
14921503 }
1493- if ((char )inChar > 31 & !DC2_rcvd ) {
1504+ if ((char ) inChar > 31 & !DC2_rcvd ) {
14941505 if (Main .wantbulletins ) {
14951506 try {
14961507// Main.Bul.get("" + inChar);
@@ -1502,12 +1513,12 @@ private void GetBlock() {
15021513 //Build sequence for CW APRS messages
15031514 if (possibleCwFrame ) {
15041515 //Continue building the sequence and reject if does not conform to expected format
1505- cwStringBuilder .append ((char )inChar );
1516+ cwStringBuilder .append ((char ) inChar );
15061517 if (cwStringBuilder .length () > 68 ) { //Around 50 characters max for status or message
15071518 //Too long, erase and reset flag
15081519 cwStringBuilder .setLength (0 );
15091520 possibleCwFrame = false ;
1510- } else if (cwStringBuilder .length () > 5
1521+ } else if (cwStringBuilder .length () > 5
15111522 && cwStringBuilder .toString ().contains ("VVV--" )) {
15121523 //Align start at last discovery of header start (in the case of
15131524 // a send error, the opertor can ignore the rest of the message and
@@ -1527,7 +1538,7 @@ private void GetBlock() {
15271538 } catch (NumberFormatException e ) {
15281539 sentDataLen = 0 ;
15291540 }
1530- int dataLen = (cwBeaconMatcher .group (1 ) + "/"
1541+ int dataLen = (cwBeaconMatcher .group (1 ) + "/"
15311542 + cwBeaconMatcher .group (2 ) + "/"
15321543 + cwBeaconMatcher .group (3 ) + "/" ).length ();
15331544 //Check the conversion to GPS coordinates
@@ -1540,12 +1551,12 @@ private void GetBlock() {
15401551 BlockString = "00u" + scall
15411552 + ":26 !" + gpsLatLon + cwBeaconMatcher .group (5 )
15421553 + cwBeaconMatcher .group (3 );
1543- String check = Main .q .checksum (BlockString );
1544- BlockString = "<SOH>" + BlockString + check + "<EOT>" ;
1545- possibleCwFrame = false ; //Reset flag
1546- Main .isCwFrame = true ;
1547- putMessage (BlockString );
1548- BlockString = "" ;
1554+ String check = Main .q .checksum (BlockString );
1555+ BlockString = "<SOH>" + BlockString + check + "<EOT>" ;
1556+ possibleCwFrame = false ; //Reset flag
1557+ Main .isCwFrame = true ;
1558+ putMessage (BlockString );
1559+ BlockString = "" ;
15491560 } else {
15501561 //Send NACK
15511562 Main .isCwFrame = true ;
@@ -1564,8 +1575,8 @@ private void GetBlock() {
15641575 sentDataLen = Integer .parseInt (cwAprsMsgMatcher .group (6 ));
15651576 } catch (NumberFormatException e ) {
15661577 sentDataLen = 0 ;
1567- }
1568- int dataLen = (cwAprsMsgMatcher .group (1 ) + "/25/"
1578+ }
1579+ int dataLen = (cwAprsMsgMatcher .group (1 ) + "/25/"
15691580 + cwAprsMsgMatcher .group (2 ) + "/"
15701581 + cwAprsMsgMatcher .group (3 ) + "/"
15711582 + cwAprsMsgMatcher .group (4 ) + "/"
@@ -1575,34 +1586,34 @@ private void GetBlock() {
15751586 //Build the new block with the received information
15761587 //"00u" + scall + ":25" + spaces1 + email + spaces2 + body + "\n";
15771588 BlockString = "00u" + scall
1578- + ":25 " + cwAprsMsgMatcher .group (2 ) + "@"
1589+ + ":25 " + cwAprsMsgMatcher .group (2 ) + "@"
15791590 + cwAprsMsgMatcher .group (3 ) + "."
15801591 + cwAprsMsgMatcher .group (4 ) + " "
15811592 + cwAprsMsgMatcher .group (5 ) + "\n " ;
1582- String check = Main .q .checksum (BlockString );
1583- BlockString = "<SOH>" + BlockString + check + "<EOT>" ;
1584- possibleCwFrame = false ; //Reset flag
1585- Main .isCwFrame = true ;
1586- putMessage (BlockString );
1587- BlockString = "" ;
1593+ String check = Main .q .checksum (BlockString );
1594+ BlockString = "<SOH>" + BlockString + check + "<EOT>" ;
1595+ possibleCwFrame = false ; //Reset flag
1596+ Main .isCwFrame = true ;
1597+ putMessage (BlockString );
1598+ BlockString = "" ;
15881599 } else {
15891600 //Send NACK
15901601 Main .isCwFrame = true ;
15911602 Main .q .send_NACK_reply ();
15921603 }
15931604 //Consume data
15941605 cwStringBuilder .setLength (0 );
1595- }
1606+ }
15961607 }
1597- } else if ((char )inChar == 'V' ) {
1608+ } else if ((char ) inChar == 'V' ) {
15981609 possibleCwFrame = true ;
1599- cwStringBuilder .append ((char )inChar );
1600- }
1601- WriteToMonitor ((char )inChar );
1610+ cwStringBuilder .append ((char ) inChar );
1611+ }
1612+ WriteToMonitor ((char ) inChar );
16021613 }
16031614 if (BlockActive ) {
1604- BlockString += (char )inChar ;
1605- newLine += (char )inChar ;
1615+ BlockString += (char ) inChar ;
1616+ newLine += (char ) inChar ;
16061617 Main .lastCharacterTime = System .currentTimeMillis ();
16071618 // System.out.println("BS:" + BlockString);
16081619 //Determine if this is a status frame coming
@@ -1614,7 +1625,7 @@ private void GetBlock() {
16141625 // single character to "<SOH>" or "<EOT>" string (Fldigi specific)
16151626 if (BlockString .length () > 280 ) {
16161627 BlockActive = false ;
1617- BlockString = "" ;
1628+ BlockString = "" ;
16181629 }
16191630 }
16201631 break ;
0 commit comments