AML KDT750 series User Manual

Price lookup protocol

Advertisement

Quick Links

For models:
KDT750-XXXX

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the KDT750 series and is the answer not in the manual?

Questions and answers

Summary of Contents for AML KDT750 series

  • Page 1 For models: KDT750-XXXX...
  • Page 2: Revision History

    KDT750 APL Guide Revision History September 2008 - Initial revision November 2008 - Add POST documentation, reformat and restructure PRE-1...
  • Page 3 KDT750 APL Guide © 2009 American Microsystems, Ltd. All rights reserved. American Microsystems, Ltd. reserves the right to make changes in specifications and other information contained in this document without prior notice, and the reader should in all cases consult American Microsystems, Ltd. to determine whether any such changes have been made.
  • Page 4: Table Of Contents

    Transaction Overview Protocol Overview AML Price Lookup Protocol APL via TCP APL via HTTP Chapter 2 – AML Price Lookup Protocol Transaction Overview General Data Format Lookup Request from Client to Server Client to Server Event Names Example APL Client to Server Events...
  • Page 5 KDT750 APL Guide Chapter 5 – PCDemo Introduction to PCDemo PCDemo Operational Loop Command Line Interface Local Image Slide Show Lookup Screen Lookup Screen Background and Error Images Text Fields PRC Field Font Colors Example PCDemo Implementation PCDemo on the KDT750 Appendix A –...
  • Page 6: About This Document

    PRELIMINARY ONLY This document is provided as and is not intended as a complete product reference. AML reserves the right to make changes to this document and to any hardware, software or product it describes. Chapter Descriptions Chapter 1 – gives brief overview of APL and its intended uses Chapter 2 –...
  • Page 7: Chapter 1 - Getting Started

    KDT750 APL Guide Getting Started This chapter gives a brief overview of APL and its intended uses. 1 - 1...
  • Page 8: Theory Of Operation

    It is tailored for use where some given input data will be sent to a network server followed by a meaningful response. Generally, this response will be parsed into text based fields and displayed on an AML price checking kiosk terminal such as the KDT750. Figure 1.1 - High Level Price Checking Implementation...
  • Page 9: Apl Via Tcp

    KDT750 APL Guide APL via TCP APL can utilize a standard raw TCP stream socket connection initiated by the client device (KDT750) to a database server. In this method, the client opens the socket to the server, sends the bar code data, receives a reply packet from the server and closes the connec- tion.
  • Page 10 KDT750 APL Guide This chapter describes the AML Price Lookup (APL) protocol, which provides communication between AML kiosk devices and a database lookup server or some other network device. 2 - 1...
  • Page 11: Transaction Overview

    KDT750 APL Guide Transaction Overview APL is a packet based, connection oriented protocol. For each lookup to the server, a new connection is created, the request made, a reply sent and the connection destroyed. Figure 2.1 - Typical AP Transaction General Data Format APL defines all messages between two devices as item/value pairs.
  • Page 12: Lookup Request From Client To Server

    KDT750 APL Guide Lookup Request from Client to Server A general request from a client device will have a single item/value pair. The ITEM (left of equals sign) will denote the source of some event, and the VALUE (right of the equals sign) will give the server the event's data.
  • Page 13: Example Apl Client To Server Events

    KDT750 APL Guide Example APL Client to Server Events A user scans a bar code with data of “1234567890” with the internal bar code reader: A user swipes a magnetic stripe card with data of “John Doe” with the external MSR: A user presses the left-most pushbutton on the front panel: *Note: From left to right, the buttons on the front of the KDT750 are conventionally called buttons A, B,...
  • Page 14: Lookup Reply From Server To Client

    KDT750 APL Guide Lookup Reply from Server to Client In response to a lookup request, the server should reply with meaningful data. In the most basic of situations, the server will lookup the given data in a retail price database and reply with the price of the item to be drawn on the LCD.
  • Page 15: Special Output Pairs

    KDT750 APL Guide output). These action pairs will tell the client device to act on some hardware, and will not result in any data being drawn on the screen. A list of restricted names can be found in the Available Action Pairs section of this document. Special Output Pairs Two special output names exist: “PRC”...
  • Page 16 KDT750 APL Guide 2 - 7...
  • Page 17: Formatting Text Output

    KDT750 APL Guide Formatting Text Output To define a format for any given text output field, a special '@ITEM=VALUE' pair is used. The name element will be the '@' symbol (ASCII 0x40) followed by the field name. For example, the format name element for a 'PRC' field will be simply '@PRC'. If no format '@ITEM=VALUE' pair exists in the packet, the client device will either ignore the 'ITEM=VALUE' pair or attempt to draw it using the following rules: 1.) If the PRC and DES fields exists, they will be drawn at their default locations with...
  • Page 18: Example Field Format Pair

    KDT750 APL Guide Example Field Format Pair The DES field will be located at x=70, y=200, width=500, height=150, foreground color is 0 and background of 120: 2 - 9...
  • Page 19: Chapter 3 - Using Apl Over Http

    KDT750 APL Guide Using APL Over HTTP This chapter describes how to implement APL via HTTP POST. 3 - 1...
  • Page 20: Overview

    KDT750 APL Guide Overview HTTP (Hypertext Transfer Protocol) is the most common of all Internet protocols. Although it is used primarily to fetch pages from web servers to display in a browser, it is actually a general purpose transmission protocol. Since many large scale networks do not support opening new TCP sockets but already host web based portals, APL has been designed to use the HTTP POST method of sending and receiving data to and from a server.
  • Page 21: Url Encoding Data

    KDT750 APL Guide URL Encoding Data APL will URL encode data being sent to the server-side script, and the server should URL encode all replies. That is, all data in a single ITEM=VALUE pair should be URL encoded, leav- ing the new line between ITEM=VALUE pairs intact as ASCII. URL encoding is necessary to allow passing special characters that are normally not allowed in URL data.
  • Page 22: Example Server Source Code

    KDT750 APL Guide Example Server Source Code import os import cgi import urllib form = cgi.FieldStorage() inputdata = "" ### Note that urllib.quote method is used to URL encode all outbound data # Handle button presses (just reply with the button name) if form.has_key('BUT') : button = form["BUT"] print "Content-type: text/html\n\n"...
  • Page 23: Chapter 4 - Using Apl Over A Tcp Socket

    KDT750 APL Guide Using APL Over a TCP Socket This chapter describes using APL over a raw TCP socket connection. 4 - 1...
  • Page 24 KDT750 APL Guide Packet Format To use APL over a TCP socket, the following general packet format is used: NOTE: All wireless SECURITY settings are configured in the wifi.conf file described in Chapter 5. General Payload Format The payload of an APL TCP packet consists of 'ITEM=VALUE' pairs in readable ASCII format. Multiple pairs can be in any given payload with each pair being separated by an ASCII 0x00 (NULL) character.
  • Page 25 KDT750 APL Guide Lookup Request Example Packets A user scans a bar code with data of “1234567890” with the internal bar code reader: A user swipes a magnetic stripe card with data of “John Doe” with the external MSR: A user presses the left-most pushbutton on the front panel: Note: From left to right, the buttons on the front of the KDT750 are conventionally called buttons A, B, C and D.
  • Page 26 KDT750 APL Guide The server responds to a magnetic stripe read with a screen containing three fields: an employee’s name, their employee number and their clock-in status. 4 - 4...
  • Page 27: Example Tcp Server Design

    KDT750 APL Guide Example APL Server Design As a general case, the host server application can be realized very simply: Figure 4.1 - Sample Server Flowchart 4 - 5...
  • Page 28 KDT750 APL Guide Server-side Source Code # Use threads and sockets import socket import thread # Lookup thread function to be called when a client connects def lookup_thread ( client_socket, address ): # Read the request up to 512 bytes data = client_socket.recv ( 512 ) # We don't care about which input device it came from for this example data = data.lstrip( '\002' ) # Remove <STX>...
  • Page 29 KDT750 APL Guide PCDemo - APL Client Application This chapter describes the KDT750 APL client application PCDemo. 5 - 1...
  • Page 30 KDT750 APL Guide Overview PCDemo is a versatile client application designed to run natively on the AML KDT750 price checking unit. PCDemo handles data capture and processing, network communication with a database server, and all user interface and display attributes for data lookup and verification applications.
  • Page 31 KDT750 APL Guide When the device is idle (i.e., No input device is being utilized), PCDemo displays a slide show of images. In the most general case, when input is received from any input device (internal bar code scanner, magnetic stripe reader, pushbuttons, etc...), the data lookup will be performed with the host server and a lookup screen will be shown containing the server response.
  • Page 32 KDT750 APL Guide Command Line Interface PCDemo is normally located at /usr/bin/pcdemo of the KDT750 Linux file system. Note that the application binary name is all lowercase, and Linux has a case sensitive operating environment. The following is a list and explanation of the command line flags for PCDemo. 5 - 4...
  • Page 33 KDT750 APL Guide < > - Denotes mandatory flag argument [ ] - Denotes optional flag argument Local Image Slide Show PCDemo will display a slide show of images when idle. These images will normally reside on the user supplied internal SD card and will be loaded into memory for fast display during operation.
  • Page 34 KDT750 APL Guide Lookup Screen Basics When displaying a server response to a lookup request, the lookup screen of PCDemo will contain a basic background image along with any number of customizable text based fields. Figure 5.3 - Lookup Screen Lookup Screen Background and Error Images The background image of the standard lookup screen and image to display on lookup error can be customized with standard 640x480 pixel JPEGs following the same stipulations as the...
  • Page 35 KDT750 APL Guide Special Text Fields Two special field names exist: the PRC field and the DES field. These fields are predefined with certain enhancements to allow more flexibility in “price+description” environments. PRC Field Fonts The PRC field uses PNG format graphics to display the numbers, decimal point and currency mark.
  • Page 36 KDT750 APL Guide Default PRC Numeral Images 5 - 8...
  • Page 37 KDT750 APL Guide Colors The foreground text color and the field background color can be selected from a 256 color palette. Figure 5.4 - Color Map Example PCDemo Implementation To create a fully customized PCDemo solution, a secondary storage device should be used such as the SD card slot on the KDT750 or a USB “thumb”...
  • Page 38 KDT750 APL Guide Figure 5.5 - Example SD Card Contents With this SD card installed into a KDT750 unit, the autorun.sh script will be executed upon boot (see the KDT750 User's Guide for more information). This script contains the following PCDemo execution command: /usr/bin/pcdemo -H 192.168.100.1 -P 5000 -u /mnt/sd/error.jpg -l /mnt/ sd/lookup.jpg -n /mnt/sd/numerals -i /mnt/sd/slide show -p 02b...
  • Page 39 KDT750 APL Guide Appendix A Packet Examples with Screenshots A - 1...
  • Page 40 KDT750 APL Guide Example 1 – Price Lookup via HTTP Post Client Lookup POST: BAR=1641-115 Server Reply: Content-type: text/html PRC=0.187 DES=Screw. Torx, Plastic Thrd 04 @DES=45,150,500,35,255,220 PN=P/N: 1641115 @PN=200,200,240,35,35,50 RELAY=1,3,2 NOTE: To enhance readability, these APL messages are not URL encoded A - 2...
  • Page 41 KDT750 APL Guide Example 2 – MSR Read via HTTP POST Client Lookup POST: MSR=;0000003075393868=0408799? Server Reply: Content-type: text/html FIELD1=Employee: FIELD2= ;0000003075393868=0408799? @FIELD1=20,200,250,150,219,255 @FIELD2=20,250,600,45,0,50 NOTE: To enhance readability, these APL messages are not URL encoded A - 3...

Table of Contents