aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-06 19:04:29 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-06 19:04:29 +0000
commit15d67c4bef332035bc5daf53e7669680428804c1 (patch)
treeca9cad7a549267df1a8186d4d88d99fc08e38b56
parentf20cdcdc5909812192905bca6465fd46baa88bd2 (diff)
Merged revisions 89042 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89042 | oej | 2007-11-06 19:53:37 +0100 (Tis, 06 Nov 2007) | 2 lines Bug fixes to tdd support in zaptel. ........ (Small changes for trunk) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89043 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/tdd.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/main/tdd.c b/main/tdd.c
index 49c8b51dc..c8eb93edd 100644
--- a/main/tdd.c
+++ b/main/tdd.c
@@ -53,6 +53,7 @@ struct tdd_state {
int pos;
int modo;
int mode;
+ int charnum;
};
static float dr[4], di[4];
@@ -67,10 +68,10 @@ static int tdd_decode_baudot(struct tdd_state *tdd,unsigned char data) /* covert
'\n','D','R','J','N','F','C','K',
'T','Z','L','W','H','Y','P','Q',
'O','B','G','^','M','X','V','^' };
- static char figs[32] = { '<','3','\n','-',' ',',','8','7',
- '\n','$','4','\'',',','',':','(',
- '5','+',')','2','','6','0','1',
- '9','7','','^','.','/','=','^' };
+ static char figs[32] = { '<','3','\n','-',' ','\'','8','7',
+ '\n','$','4','\'',',','!',':','(',
+ '5','\"',')','2','=','6','0','1',
+ '9','?','+','^','.','/',';','^' };
int d = 0; /* return 0 if not decodeable */
switch (data) {
case 0x1f:
@@ -118,7 +119,8 @@ struct tdd_state *tdd_new(void)
tdd->fskd.xi0 = 0;
tdd->fskd.state = 0;
tdd->pos = 0;
- tdd->mode = 2;
+ tdd->mode = 0;
+ tdd->charnum = 0;
fskmodem_init(&tdd->fskd);
} else
ast_log(LOG_WARNING, "Out of memory\n");
@@ -187,7 +189,8 @@ int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int len)
tdd->oldlen = 0;
free(obuf);
if (res) {
- tdd->mode = 2; /* put it in mode where it
+ tdd->mode = 2;
+/* put it in mode where it
reliably puts teleprinter in correct shift mode */
return(c);
}
@@ -231,7 +234,7 @@ static inline float tdd_getcarrier(float *cr, float *ci, int bit)
} while(0)
#define PUT_TDD_BAUD(bit) do { \
- while(scont < tddsb) { \
+ while (scont < tddsb) { \
PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, bit)); \
scont += 1.0; \
} \
@@ -239,7 +242,7 @@ static inline float tdd_getcarrier(float *cr, float *ci, int bit)
} while(0)
#define PUT_TDD_STOP do { \
- while(scont < (tddsb * 1.5)) { \
+ while (scont < (tddsb * 1.5)) { \
PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \
scont += 1.0; \
} \
@@ -266,13 +269,17 @@ int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *str)
/*! Baudot letters */
static unsigned char lstr[31] = "\000E\nA SIU\rDRJNFCKTZLWHYPQOBG\000MXV";
/*! Baudot figures */
- static unsigned char fstr[31] = "\0003\n- \00787\r$4',!:(5\")2\0006019?&\000./;";
+ static unsigned char fstr[31] = "\0003\n- \00787\r$4',!:(5\")2\0006019?+\000./;";
/* Initial carriers (real/imaginary) */
float cr = 1.0;
float ci = 0.0;
float scont = 0.0;
for(x = 0; str[x]; x++) {
+ /* Do synch for each 72th character */
+ if ( (tdd->charnum++) % 72 == 0)
+ PUT_TDD(tdd->mode ? 27 /* FIGS */ : 31 /* LTRS */);
+
c = toupper(str[x]);
#if 0
printf("%c",c); fflush(stdout);