Posts tagged ‘Programming’

Beispiel Kunden-Programmierung: Honeywell BasicTE

Ein Honeywell Kunde möchte von CK3, Windows Mobile 6, Intermec Terminal Emulation zu Honeywell CK65, Android 9, Honeywell BasicTE wechseln.

Für die SAP Telnet/VT Anwendung werden zwei spezielle Anpassung notwendig:

  1. Beim  Drücken der F5 Taste soll die Zeichenfolge “~[35” (F21) zum Host gesendet werden
  2. Wenn GS1-128 Barcode Typen gescannt werden, sollen diese mit dem Präfix [C1 versehen werden.
  3. Das GS Symbol in GS1-128 Barcode Typen muß durch “#” ersetz werden.

Die oben genannten Bedingungen sind auf dem CK3 implementiert. Dort kann man zB den Symbology Identifier (Aim ID) nur für GS1-128 einsetzen lassen. Auf dem CK65 ist diese Aim ID Einfügung nur global für alle Barcode Typen einschaltbar. Die Ersetzung des GS Symbols (hex: 0x1D) ist auf dem CK3 ebenfalls von Haus aus möglich. Der CK65 bietet dies Möglichkeit im Zusammenhand mit Honeywell BasicTE nicht.

Die Tastenbelgung F5->”~[35″ ist in der BasicTE Anwendung über die Anpassung der CustomKeyboard.xml möglich, welche auch das Tastenlayout und die Funktionen der BasicTE Software Tastatur bestimmt.

Da die BasicTE den Barcode Scanner direkt ansteuert muß die Aim ID Einsetzung und die GS Symbol ersetzung über ein sogenanntes DataEdit Plugin realisiert werden. Dazu ist etwas Android Programmierung notwendig. Diese Android Programm erhält dann die Barcode Daten und den Typ über einen Broadcast und kann die Daten dann verändert zurückliefern.

Nach erstenTests und Korrekturen kann der Kunde nun das CK65 uneingeschränkt statt dem CK3 verwenden.

Android: Print PDF to Thermal Portable Wireless Printer

Recently I got the request to write an application that prints a PDF file on a portable Thermal printer.

Normally that does not make sense, as the protable printers come with 2, 3, 4 or 5 inch paper width only. But the PDF files are created for 3 inch paper and os this Receipt printing makes sense.

The idea was to render the PDF to a bitmap and then print the bitmap to the printer. These printers do not support PDF or Postscript, they come with special Printer Language support as called ZPL, ESP/P, CPCL or others. So we need to create a Bitmap of the PDF first and then print the Bitmap.

I started using the Android Google PDFRenderer but this fails with two issues: the bitmaps created are always transparent and print with black background where white has to be; the text was not rendered as the Fonts did not render.

Among others I found PDFbox and after fixing a small issue with scaling of bitmaps the solution works very well.

The CPCL_Sample code and application can load a PDF file. This is then converted to a scaled bitmap which can then be printed to a CPCL compatible printer. The CPCL performance is very different and printing on a Zebra takes about a minute for a 3 by 4 inch sized bitmap.

The code has to use a lot of intents and background tasks as most processing takes some time. The bitmap is created by an IntentService. The Sewoo SDK prints the bitmap first to a queue buffer and there is no control or feedback about the status of the print job. So it hopefully prints after some time.

By replacing the print SDK you should be able to print the bitmap of the rendered PDF to any Bitmap-Printing capable printer.

Be warned: there are Printers that are compatible with a Printer Language like CPCL but may not support Bitmap printing.

Source code and apk at github.

FHEM: serielle Devices über Netzwerk anschliessen

Zu Testzwecken brauche ich ab und an neben meinen Haupt FHEM System ein zweites FHEM System, zB auf meinem Netbook. Nun sind drei Devices (nanoCUL 433MHz, nanoCUL 868MHz und ein Jeelink) direkt am Hauptserver über USB (serial) angeschlossen. Wenn ich diese in einem Testsystem benötige, müsste ich die Geräte vom Hauptserver trennen. Wie praktisch wäre es, wenn ich diese USB Devices über das Netzwerk anbinden könnte, so wie dies über EspLink mit dem angschlossenen Arduino Nano mit SignalDuino Firmware möglich ist.

Nun zur Anbindung von seriellen Geräten an das Netzwerk gibt es für Linux ser2net. Leider ist die Original-Version nicht multi-Client tauglich und würde nur einem Client die Verbindung erlauben. Bei EspLink sind jedoch mehrere Clients möglich. Obwohl die meisten ser2net Quellen nur einen Client unterstützen, gibt es ein oder zwei Quellen, deren Implementierung mehrer Clients unterstützen.

Nachdem ich einen Quellcode von ser2net mit multi-Client Support geladen und nach geringen Modifikationen auch erfolgreich implementieren konnte, kann ich nun alle Geräte, die am Haupt FHEM Server angeschlossen sind auch über mein Netzwerk nutzen. Die Geräte mussten nur in der ser2net conf Datei mit verschiedenen Netzwerkports eingetragen werden:

2301:raw:0:/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9YDLRJV-if00-port0:38400,8DATABITS,NONE,1STOPBIT
2302:raw:0:/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A94BBD91-if00-port0:38400,8DATABITS,NONE,1STOPBIT

In der fhem.cfg wurden die Geräte entsprechend umdefiniert:

#define nanoCUL433 CUL /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9YDLRJV-if00-port0@38400 1234
define nanoCUL433 CUL 192.168.0.40:2301 1234
#define nanoCUL868 CUL /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A94BBD91-if00-port0@38400 3421
define nanoCUL868 CUL 192.168.0.40:2302 4321

Die original EspLink Anbindung des Arduino Nano mit SignalDuino Firmware:

define sduinoIP SIGNALduino 192.168.0.99:23

Mit diesen Änderungen kann ich diese USB Geräte nun auch über das Netzwerk benutzen.

Meine Abwandlung von ser2net findet sich auf Github.

adsbox stopped showing airplane labels on GMap

Some time ago I wrote about the great free adsbox. Now the GMap display stopped showing any labels or airplanes for no reason.

The root cause is that google code hosting is stopped and the source for markerwithlabel.js moved away from code.google.com.

...        
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3"></script>
<!--    <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerwithlabel/src/markerwithlabel.js"></script>
-->
        <script type="text/javascript" src="./markerwithlabel.js"></script>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <title>ADSBox</title>
</head>
...

As you see, I changed adsbox/htdocs/index.html to use a local copy of markerwithlabel.js. You may also use the new source code location https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerwithlabel/src/markerwithlabel.js

With the above change my adsbox did show the planes and airports etc. again.

The source of adsbox is at http://diseqc.alh.org.ua/projects/hard/adsb/
or translated to english