1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
/*
* Copyright (C) 2002-2004 by Jonathan Naylor G4KLX
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "FSK441Lookups.h"
struct toneStruct {
wxString text;
int t1;
int t2;
int t3;
};
static const struct toneStruct singleToneTable[] = {
{wxT("R26"), 0, 0, 0},
{wxT("R27"), 1, 1, 1},
{wxT("RRR"), 2, 2, 2},
{wxT("73"), 3, 3, 3}
};
static const struct toneStruct multiToneTable[] = {
{wxT("0"), 2, 2, 3}, {wxT("1"), 0, 0, 1}, {wxT("2"), 0, 0, 2},
{wxT("3"), 0, 0, 3}, {wxT("4"), 0, 1, 0}, {wxT("5"), 0, 1, 1},
{wxT("6"), 0, 1, 2}, {wxT("7"), 0, 1, 3}, {wxT("8"), 0, 2, 0},
{wxT("9"), 0, 2, 1}, {wxT("."), 0, 2, 2}, {wxT(","), 0, 2, 3},
{wxT("?"), 0, 3, 0}, {wxT("/"), 0, 3, 1}, {wxT("#"), 0, 3, 2},
{wxT(" "), 0, 3, 3}, {wxT("$"), 1, 0, 0}, {wxT("A"), 1, 0, 1},
{wxT("a"), 1, 0, 1}, {wxT("B"), 1, 0, 2}, {wxT("b"), 1, 0, 2},
{wxT("C"), 1, 0, 3}, {wxT("c"), 1, 0, 3}, {wxT("D"), 1, 1, 0},
{wxT("d"), 1, 1, 0}, {wxT("E"), 2, 3, 0}, {wxT("e"), 2, 3, 0},
{wxT("F"), 1, 1, 2}, {wxT("f"), 1, 1, 2}, {wxT("G"), 1, 1, 3},
{wxT("g"), 1, 1, 3}, {wxT("H"), 1, 2, 0}, {wxT("h"), 1, 2, 0},
{wxT("I"), 1, 2, 1}, {wxT("i"), 1, 2, 1}, {wxT("J"), 1, 2, 2},
{wxT("j"), 1, 2, 2}, {wxT("K"), 1, 2, 3}, {wxT("k"), 1, 2, 3},
{wxT("L"), 1, 3, 0}, {wxT("l"), 1, 3, 0}, {wxT("M"), 1, 3, 1},
{wxT("m"), 1, 3, 1}, {wxT("N"), 1, 3, 2}, {wxT("n"), 1, 3, 2},
{wxT("O"), 1, 3, 3}, {wxT("o"), 1, 3, 3}, {wxT("P"), 2, 0, 0},
{wxT("p"), 2, 0, 0}, {wxT("Q"), 2, 0, 1}, {wxT("q"), 2, 0, 1},
{wxT("R"), 2, 0, 2}, {wxT("r"), 2, 0, 2}, {wxT("S"), 2, 0, 3},
{wxT("s"), 2, 0, 3}, {wxT("T"), 2, 1, 0}, {wxT("t"), 2, 1, 0},
{wxT("U"), 2, 1, 1}, {wxT("u"), 2, 1, 1}, {wxT("V"), 2, 1, 2},
{wxT("v"), 2, 1, 2}, {wxT("W"), 2, 1, 3}, {wxT("w"), 2, 1, 3},
{wxT("X"), 2, 2, 0}, {wxT("x"), 2, 2, 0}, {wxT("Y"), 2, 2, 1},
{wxT("y"), 2, 2, 1}, {wxT("Z"), 2, 3, 1}, {wxT("z"), 2, 3, 1}
};
CFSK441Lookups::CFSK441Lookups()
{
}
CFSK441Lookups::~CFSK441Lookups()
{
}
bool CFSK441Lookups::lookupChar(const wxString& text, int& t1, int& t2, int& t3) const
{
for (int i = 0; i < 69; i++) {
if (multiToneTable[i].text == text) {
t1 = multiToneTable[i].t1;
t2 = multiToneTable[i].t2;
t3 = multiToneTable[i].t3;
return true;
}
}
return false;
}
bool CFSK441Lookups::lookupSingleTones(int t1, int t2, int t3, wxString& text) const
{
for (int i = 0; i < 4; i++) {
if (t1 == singleToneTable[i].t1 &&
t2 == singleToneTable[i].t2 &&
t3 == singleToneTable[i].t3) {
text = singleToneTable[i].text;
return true;
}
}
return false;
}
bool CFSK441Lookups::lookupMultiTones(int t1, int t2, int t3, wxString& text) const
{
for (int i = 0; i < 69; i++) {
if (t1 == multiToneTable[i].t1 &&
t2 == multiToneTable[i].t2 &&
t3 == multiToneTable[i].t3) {
text = multiToneTable[i].text;
return true;
}
}
return false;
}
|