TACS support (variations added to AMPS code)

These are:

- Bandwidth only 25 KHz, so lower deviations
- Data rate only 8000 KHz
- SID is called AID (Area ID)
- MIN1 coding is different
This commit is contained in:
Andreas Eversberg
2017-05-30 12:49:40 +02:00
parent d52f4cd29d
commit 3788b3e8a5
23 changed files with 19810 additions and 478 deletions

21
src/tacs/Makefile.am Normal file
View File

@@ -0,0 +1,21 @@
AM_CPPFLAGS = -Wall -Wextra -g $(all_includes)
bin_PROGRAMS = \
tacs
tacs_SOURCES = \
tones.c \
outoforder.c \
stations.c \
image.c \
main.c
tacs_LDADD = \
$(COMMON_LA) \
../amps/libamps.a \
$(top_builddir)/src/common/libcommon.a \
$(ALSA_LIBS) \
$(UHD_LIBS) \
$(SOAPY_LIBS) \
-lm

66
src/tacs/image.c Normal file
View File

@@ -0,0 +1,66 @@
#include <stdio.h>
#include <string.h>
#include "image.h"
const char *image[] = {
" @B(@g#@B)",
" @g#",
" #",
" #",
" # @R_____",
" _@g#@R--- _._ ---__",
" |_____(_|_)_____|",
" | @WTELEPHONE@R |",
" |###############|",
" |###############|",
" |## | | ##|",
" |## @B1@R | @B2@R | @B3@R ##|",
" |##___|___|___##| @WTACS@R",
" |## | | ##|",
" |## @B4@R | @B5@R | @B6@R ##|",
" |##___|___|___##|",
" |## | | ##|",
" |## @B7@R | @B8@R | @B9@R ##|",
" |##___|___|___##|",
" |## | | ##|",
" |## @B*@R | @B0@R | @B#@R ##|",
" |##___|___|___##|",
" |###############|",
" |##+---------+##|",
" |##+---------+##|",
" |###############|",
" @g+++++++++++++++++",
"@W",
NULL
};
void print_image(void)
{
int i, j;
for (i = 0; image[i]; i++) {
for (j = 0; j < (int)strlen(image[i]); j++) {
if (image[i][j] == '@') {
j++;
switch(image[i][j]) {
case 'R': /* red */
printf("\033[1;31m");
break;
case 'g': /* gray */
printf("\033[0;37m");
break;
case 'W': /* white */
printf("\033[1;37m");
break;
case 'B': /* blue */
printf("\033[1;34m");
break;
}
} else
printf("%c", image[i][j]);
}
printf("\n");
}
printf("\033[0;39m");
}

3
src/tacs/image.h Normal file
View File

@@ -0,0 +1,3 @@
void print_image(void);

14
src/tacs/main.c Normal file
View File

@@ -0,0 +1,14 @@
#include "../amps/main.h"
#include "../amps/tones.h"
#include "../amps/outoforder.h"
const int tacs = 1;
int main(int argc, char *argv[])
{
/* init common tones */
init_tones();
init_outoforder();
return main_amps_tacs(argc, argv);
}

8199
src/tacs/outoforder.c Normal file

File diff suppressed because it is too large Load Diff

89
src/tacs/stations.c Normal file
View File

@@ -0,0 +1,89 @@
#include <stdio.h>
#include <string.h>
#include "../amps/stations.h"
/* area codes */
static struct tacs_areas {
const char *number; /* country code (first 3 digits of subscriber number) + area code */
const char *carrier; /* name of carrier */
const char *country; /* name of country */
const char *national_prefix; /* digits to dial inside country */
} tacs_areas[] = {
{ "2220", "Telecom Italia Mobile", "Italy", "0336" },
{ "2222", "Telecom Italia Mobile", "Italy", "0337" },
{ "2224", "Telecom Italia Mobile", "Italy", "0330" },
{ "2225", "Telecom Italia Mobile", "Italy", "0360" },
{ "2226", "Telecom Italia Mobile", "Italy", "0368" },
{ "2340", "Vodafone", "United Kingdom", "0836" },
{ "2341", "Vodafone", "United Kingdom", "0421" },
{ "2342", "CellNet", "United Kingdom", "0860" },
{ "2343", "Vodafone", "United Kingdom", "0378" },
{ "2344", "Vodafone", "United Kingdom", "0831" },
{ "2345", "Vodafone", "United Kingdom", "0374" },
{ "2346", "CellNet", "United Kingdom", "0850" },
{ "2347", "CellNet", "United Kingdom", "0589" },
{ "2348", "CellNet", "United Kingdom", "0402" },
{ "2349", "CellNet", "United Kingdom", "0585" },
{ NULL, NULL, NULL, NULL }
};
void numbering(const char *number, const char **carrier, const char **country, const char **national_number)
{
int i;
static char digits[64];
for (i = 0; tacs_areas[i].carrier; i++) {
if (!strncmp(number, tacs_areas[i].number, 4)) {
*carrier = tacs_areas[i].carrier;
*country = tacs_areas[i].country;
if (tacs_areas[i].national_prefix) {
strcpy(digits, tacs_areas[i].national_prefix);
strcat(digits, number + 4);
*national_number = digits;
}
}
}
}
/*
1: the AID, system Identification number
2: the telephone company name
3: the country
*/
static struct tacs_stations {
int aid;
const char *carrier, *country;
} tacs_stations[] = {
{ -1, "Telecom Italia Mobile", "Italy" },
{ 3600, "CellNet", "United Kingdom" },
{ 2051, "VodaFone", "United Kingdom" },
{ 0, NULL, NULL }
};
void list_stations(void)
{
int i;
for (i = 0; tacs_stations[i].carrier; i++) {
if (tacs_stations[i].aid >= 0)
printf("AID:%5d", tacs_stations[i].aid);
else
printf("AID: ???");
printf(" Carrier: %s, %s\n", tacs_stations[i].carrier, tacs_stations[i].country);
}
}
void sid_stations(int aid)
{
int i, first = 1;
for (i = 0; tacs_stations[i].carrier; i++) {
if (aid == tacs_stations[i].aid) {
if (first)
printf("Selected Area ID (AID) %d belongs to:\n", tacs_stations[i].aid);
first = 0;
printf("\t%s, %s\n", tacs_stations[i].carrier, tacs_stations[i].country);
}
}
}

10718
src/tacs/tones.c Normal file

File diff suppressed because it is too large Load Diff