1
0

Grunddaten

This commit is contained in:
2018-06-01 10:49:06 +02:00
parent 7034fec407
commit a5987b00cb
76 changed files with 20446 additions and 2 deletions

13
pc-software/test/Makefile Normal file
View File

@@ -0,0 +1,13 @@
all: cept.o main.o
gcc -Werror ./*.o -o miniBTX -lcodebananas
main.o: main.c
gcc -Werror -c main.c
cept.o: cept.c
gcc -Werror -c cept.c
clean:
rm ./*.o
rm ./miniBTX

175
pc-software/test/cept.c Normal file
View File

@@ -0,0 +1,175 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V1.0.0 #
# a (poor) cept protocol implementation #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ttybanana.h> /* TTY-Functions of libCodebananas */
#include <toolbanana.h> /* Tool-Functions of libCodebananas */
#include <unistd.h>
#include <string.h>
#include "cept.h" /* Include own header file */
/* #################################################################################### */
/* #################################################################################### */
/* Query CEPT terminal */
void systemCeptQuery(char *string, int length, char *response, char *port, int linkLayer)
{
int i;
int crc16 = 0;
memset(response, 0x00, sizeof(response));
printf("\n\r\n\rPerforming terminal query:\n\r");
if(length == 0)
printf("* Length of transmission data is null - omitting transmission pass ...\n\r");
else
{
if(linkLayer == CEPT_LINKLAYER)
printf("* Transmitting CEPT data block (linklayer secured) ...\n\r");
else
printf("* Transmitting CEPT data block ...\n\r");
if(linkLayer == CEPT_LINKLAYER)
{
printf("* Sending STX 0x%02x...\n\r", CEPT_STX);
ttyPutchar(port,CEPT_STX); /* Transmit STX-Token, form now on the transmission begins */
}
printf("* Sending Data...\n\r");
hexBinAsciiDump(string,length);
for(i=0;i<length;i++) /* Transmit data and calculate CRC */
{
ttyPutchar(port,string[i]);
crc16 = crcComputationCycle(string[i], 0xA001, crc16);
}
if(linkLayer == CEPT_LINKLAYER)
{
crc16 = crcComputationCycle(CEPT_ETX, 0xA001, crc16); /* Send the STX token - the token goes with in the CRC-calculation */
printf("* Sending ETX 0x%02x...\n\r", CEPT_ETX);
ttyPutchar(port,CEPT_ETX);
printf("* Adding lower CRC16 byte %02hhx...\n\r", (char)crc16);
ttyPutchar(port,(char)crc16); /* Transmit the CRC */
printf("* Adding higher CRC16 byte %02hhx...\n\r", (char)(crc16 >> 8));
ttyPutchar(port,(char)(crc16 >> 8));
}
}
printf("* Receiving response...\n\r");
usleep(CEPT_RESPONSE_TIMOUT); /* Wait some time to be sure that some response data is already in buffer when we start receiving) */
ttyReadNonblocking(port, response, CEPT_RESPONSE_TIMOUT); /* Read the data */
if(response[0] == '\0')
printf(" (no data received)\n\r");
else
hexBinAsciiDump(response,strlen(response));
printf("done!\n\r");
fflush(stdout);
return;
}
/* Filter keyboard input from terminal response (Rip off non printable chars and known protocol patterns) */
void systemCeptFilterKeyboardinput(char *responsedata, char *keyboarddata)
{
printf("\n\r\n\rFilter keyboard-data from Transmission response\n\r");
char *keyboarddataPointer;
char *responsedataPointer;
char *keyboarddataAheadPointer;
printf("* Ripping protocol fragments...\n\r");
keyboarddataPointer = keyboarddata;
responsedataPointer = responsedata;
do
{
/* Rip off the CEPT_DLE, 0x30/0x31 acknoledgement token */
if((*responsedataPointer == CEPT_DLE)&&((*(responsedataPointer+1) == 0x30)||(*(responsedataPointer+1) == 0x31)))
responsedataPointer+=2;
else
{
/* Replace Terminator and Initiator with printable characters */
if(*responsedataPointer == CEPT_INI)
*keyboarddataPointer = '*';
else if(*responsedataPointer == CEPT_TER)
*keyboarddataPointer = '#';
else
*keyboarddataPointer = *responsedataPointer;
/* Note: In a serious Videotex application you should NOT replace terminator and initiator
with thier printable pendants to avoid missunderstandings. */
keyboarddataPointer++;
responsedataPointer++;
}
} while(*responsedataPointer != '\0');
*keyboarddataPointer = '\0';
printf("* Ripping non printable characters...\n\r");
keyboarddataPointer = keyboarddata;
keyboarddataAheadPointer = keyboarddata;
do
{
if((*keyboarddataAheadPointer >= 0x20)&&(*keyboarddataAheadPointer <= 0x7E))
{
*keyboarddataPointer = *keyboarddataAheadPointer;
keyboarddataPointer++;
}
keyboarddataAheadPointer++;
} while(*keyboarddataAheadPointer != '\0');
*keyboarddataPointer = '\0';
printf("* The remaining data is:\n\r");
if(keyboarddata[0] == '\0')
printf(" (the string contained no keyboard data)\n\r");
else
hexBinAsciiDump(keyboarddata,strlen(keyboarddata));
fflush(stdout);
return;
}
/* #################################################################################### */

289
pc-software/test/cept.h Normal file
View File

@@ -0,0 +1,289 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V1.0.0 #
# a (poor) cept protocol implementation #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Warning==
This implementation of CEPT T/CD 6-1 is incomplete and for test proposes only.
A complete inplementation would requie much more protocol - so do not wonder
about unexpected effects. Besides you should not use this code in own projects
because this implementation is not really straight forward so you better write
your own implementation */
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* Combined sequences to make the programmers cept-life easyer */
#define CEPTSEQ_C1P F_CEPT_ESC "\x22\x41" /* Invoke C1P Set */
#define CEPTSEQ_C1S F_CEPT_ESC "\x22\x40" /* Invoke C1S Set */
#define CEPTSEQ_CRLF F_CEPT_APD F_CEPT_APR /* Do a carrige-return/line-feed */
#define CEPTSEQ_G0 F_CEPT_ESC "\x28\x40" /* Invoke G0 Set */
#define CEPTSEQ_G1 F_CEPT_ESC "\x28\x63" /* Invoke G1 Set */
#define CEPTSEQ_G2 F_CEPT_ESC "\x28\x62" /* Invoke G2 Set */
#define CEPTSEQ_G3 F_CEPT_ESC "\x28\x64" /* Invoke G3 Set */
/* Linklayer configuration types */
#define CEPT_LINKLAYER 1 /* Use CRC secured connection 0=OFF, 1=ON */
#define CEPT_NOLINKLAYER 0 /* Use no linklayler (recommanded) */
/* Hardcoded Linklayer configuration */
#define CEPT_RESPONSE_TIMOUT 200000 /* Response timout for terminal response */
/* NOTE: The linklayer implementation does not secure the data automaticly. You get
the raw terminal data back and then you can transmit the data again. Automatic
retransmission is not supported. In this case linkleayer means that start/stop
tokens and CRC16 ars automaticly added to the datastream.
/* ==Control functions==
This function set shall provide a hassle free interface to a CEPT terminal. You can send
strings without worring about CRC for example... */
/* Query CEPT terminal */
void systemCeptQuery(char *string, int length, char *response, char *port, int linkLayer);
/* Filter keyboard input from terminal response (Rip off non printable chars and known protocol patterns) */
void systemCeptFilterKeyboardinput(char *responsedata, char *keyboarddata);
#endif /*CEPT_H*/
/* #################################################################################### */

231
pc-software/test/main.c Normal file
View File

@@ -0,0 +1,231 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V2.0.0 #
# Main-Program #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ttybanana.h>
#include <toolbanana.h>
#include <string.h>
#include "cept.h" /* Include CEPT protocol layer */
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_LINKLAYER CEPT_NOLINKLAYER /* Configrue linklayer */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
#define MINIBTX_PORT "/dev/ttyUSB1" /* Serial port - change if needed */
/* Special parameters */
#define MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA 0 /* Force the terminal to transmit the keyboard data by sending DCT (1=ON,0=OFF) */
/* Note: The software has been tested with the following terminals:
* BtxTV (MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA should be set to 1)
* Multitel11/Bitel */
/* #################################################################################### */
/* #################################################################################### */
/* Main program: Perform some testpages */
int main(void)
{
char transmissionBuffer[255]; /* Here we store the data that is sent to the terminal */
char trsnsmissionResponseBuffer[255]; /* Here we store the date that comes from the terminal */
char keyboardInput[255]; /* The users keyboard input */
printf("_____________________________________________________________________________________________\n\r");
printf("MiniBTX Copyright(c) Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
printf("Note: This is a small example application to explore some features of CEPT/BTX Terminals. \n\r");
printf(" Please notify that this tools requies the miniBTX hardware. \n\r");
printf("\n\r");
printf("Initalizing...\n\r");
printf("* Opening serial port...\n\r");
ttyInitProf(MINIBTX_PORT,MINIBTX_BAUDRATE,8,NONE); /* Initalize tty */
ttyClearBuffer(MINIBTX_PORT); /* Clear buffer */
printf("* Serial port is set to %s at %i Baud - edit the sourcecode to alter this setting.\n\r",MINIBTX_PORT,MINIBTX_BAUDRATE);
printf("\n\r");
printf("Waiting for BTX-Terminal...\n\r");
if(ttyGetchar(MINIBTX_PORT) == MINIBTX_HOOKOFF) /* Wait for hook-off token */
printf("* Hook off\n\r");
else
printf("* Warning: Incorrect hook off token (should be %02hhx)\n\r",MINIBTX_HOOKOFF);
if(ttyGetchar(MINIBTX_PORT) == MINIBTX_CONNECT) /* Wait for connection-ok token */
printf("* Connection ok\n\r");
else
printf("* Warning: Incorrect connection start token (should be %02hhx)\n\r",MINIBTX_CONNECT);
printf("\n\r");
printf("\n\r");
printf("__________________________________\n\r");
printf("Transmitting testpage...\n\r"); /* Transmit testpage */
while(1)
{
/* ==TRANSMISSION TEST== */
/* Note: for a better understanding of the concept of CEPT control codes the most control
codes are sent seperately. This causes a leak of performance because every single
block that is transmitted causes an startup code which must be sent back through
the slow 75-baud line. If you pack the controlcodes within the textblocks you can
get a much faster page transmission */
sprintf(transmissionBuffer, F_CEPT_CS CEPTSEQ_G0); /* Clear screen and switch to G0 set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, F_CEPT_ANW CEPTSEQ_C1P F_CEPT_DBS F_CEPT_BLB F_CEPT_APR "*BILDSCHIRMTRIX# ");
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* The headline is double hight and covers the next line, so we must add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_C1P F_CEPT_NSZ "miniBTX Testbild nach CEPT T/CD 6-1 ");
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G1); /* Switch to G1 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G2); /* Switch to G2 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G3); /* Switch to G2 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF); /* Add some blank lines blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G0); /* Switch to G0 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, F_CEPT_DBH "Testbild neu aufbauen mit # (Terminator)" CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
/* ==RECEIVE TEST== */
printf("__________________________________\n\r");
printf("Retrieve keyboard input...\n\r"); /* Receive keyboard data */
/* Note: BTX Terminals are a bit more complex than normal dump terminals - they store the keyboard
input in a buffer. The content of this buffer is transmitted when a DCT-Token is sent
to the terminal. Otherwise the terminal will only transmit the ACK tokens. */
/* Note: Many BTX-Terminal (for example the BtxTV) are equipped with an auto-login function
so the first thing you might see is a long forgotton login password. */
for(;;)
{
/* Note: A terminal can transmit more than one character at a time if you
give the terminal some time it is able to gather some chars */
if(MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA == 1)
{
/* Here we force the terminal to transmit the keyboard buffer data
by sending a DCT token. Warning! This is a cludge! */
sprintf(transmissionBuffer, F_CEPT_DCT);
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
}
else
{
/* Here we got a friendly terminal that talks wihout kicking it */
systemCeptQuery(0,0,trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
}
/* Now we filter out printable characters */
systemCeptFilterKeyboardinput(trsnsmissionResponseBuffer, keyboardInput);
/* Show keyboard data if some data received */
if(keyboardInput[0] != '\0')
printf("\n\r Keyboard input ==>%s<==", keyboardInput);
/* When terminator is pressed - redraw screen */
if(keyboardInput[0] == '#') /* Quick and dirty Terminator detection */
break;
fflush(stdout);
}
}
return 0;
}
/* #################################################################################### */

BIN
pc-software/test/miniBTX Normal file

Binary file not shown.