POSXML is organized and structured in the form of tags, showing levels and subsets of a set of commands and instructions, that form the logical structure of a POSXML application.
Example:
Similar to the vast majority of existing programming languages, POSXML is compiled in a specific format to reduce the file size which allows the application to be run on a POS terminal using a framework (virtual machine).
When compiled, a program written in POSXML, becomes a set of bytecodes that are interpreted by the virtual machine on the POS terminal which results in the implementation on the POS terminal.
Example:
Compiled bytecode:
d0 x0A 0 x0A Bytecode example x0A x0D
The commands and instructions of POSXML, such as the compliance on the use of capital letters and lowercase letters (case sensitive), are acquired through training. Some commands that belong to the language do not require parameters, unlike other commands that need input to interact with the machine.
Examples:
Commands that do not require instructions or parameters.
Commands that require instructions and parameters to interact with the equipment.
The names given to functions, variables, and pages should also obey the rules written in capital letters and lowercase letters, so if a developer creates a function called "calcula_digito" he will not be able to call on the variable via "Calcula_Digito". The call of a function, or variable page must meet the exact name that was assigned by the programmer.
Commands and instructions
Because it is a structured language based on XML, POSXML is a language that is constantly evolving, new commands and instructions can be added to your library at any time. Initially, the language had only two dozen basic commands to create a functional application on a POS terminal, using few resources: only the basic display (LCD), keypad, magnetic card reader and printer.
With the evolution of language, there are now almost one hundred commands and instructions available to deal with files, pictures, mathematical operators, functions to manipulate variables of the String type, definition of variables, logical operators, classes for working with protocol ISO 8583 (Protocol standard for exchanging information in transactions with credit cards), among others.
Command list
ifInstruction of decision making or logical comparison
elseLogical condition in a block of the if statement
whileInstruction that allows the execution of a code multiple times
breakThe break command allows immediate exit from while loop
functionDefines a block of code that can be executed later
callfunctionMakes a call on a previously defined function
executeExecute a POSXML application stored on the device
exitImmediately closes the execution of the POSXML application
getcardvariableGets the card number and stores it directly on a variable
system.readcardWaits until a card is passed or a key is pressed
system.inputtransactionInstruction to receive the data card on a contactless transaction
menuDisplays a menu based on the device screen (number of lines)
menuwithheaderDisplays a header with a menu based on the device screen (number of lines)
displaybitmapDisplays a monochromatic bitmap on the display
displayDisplays a custom message on device's display
cleandisplayClean the device display (like a clear or cls)
system.gettouchscreenCaptures the coordinates (x and y) where the display was pressed
printPrints a custom message in the default font size
printbigPrints a custom message in the double font size
printbitmapPrints a monochromatic bitmap
printbarcodePrints a bar code in the I25 format, horizontal or vertical
checkpaperoutChecks if the paper compartment still contains paper
paperfeedSends a signal to the printer by adding blank lines on the ticket
inputfloatAllows the entry of a value with dot (.) by pressing (*)
inputformatAllows the entry of a value based on a pre-defined format
inputintegerAllows the entry of an integer
inputoptionStores in a variable the option of a menu item
inputmoneyAllows the entry of a monetary value
crypto.crc16-bit CRC calculation, support CRC-CCITT
crypto.encryptdecryptEncryption routines with algorithms DES, 3DES or NEWDES
crypto.lrcGenerates a LRC byte of the string in the buffer
crypto.xorPerforms a binary XOR operation between the bytes of two strings
downloadfileDownloads a file previously registered on the WALK Manager
filesystem.filesizeReturns the size of a file in the memory of the POS
filesystem.listfilesLists the files of a directory by saving them in a file
filesystem.spaceChecks the space (free and used) and the number of files in memory
file.openOpens a file for reading or writing
file.closeCloses a file that was previously opened by file.open
file.readReads a file that was previously opened by file.open
file.writeWrites a file that was previously opened by file.open
readfileReads a dbfile WALK file (key/value)
readfilebyindexReads a key from a file WALK dbfile
editfileAllows write a file in WALK dbfile format (key/value)
deletefileDeletes a file from the device memory
iso8583.initfieldtableStarts field table ISO8583 based on a specified file
iso8583.initmessageInitiates assembly of the ISO message
iso8583.putfieldInserts a field in the message, necessarily in ascending order
iso8583.endmessageEnds assembly of the ISO message
iso8583.transactmessageAdds size, header and trailer and sends the ISO message to the authorizer
iso8583.analyzemessageStarts the process of analysis and decomposition of the fields of the message
iso8583.getfieldExtracts a field of the previously analyzed message
openserialportOpens the serial port for communication with external peripherals
writeserialportWrites a buffer on the serial port
readserialportReads a buffer from an external device captured by the serial port
closeserialportCloses the serial port
getdatetimeStores in a variable date and time at runtime
time.calculateCalculates time. Supports addition, subtraction and difference
adjustdatetimeUpdates the device internal clock
predialPerforms a dial-up connection with the provider
preconnectConnects to the host authorizer
shutdownmodemTurns off the modem and cancels the operations
network.checkgprssignalChecks the status of the connection, if the POS supports GPRS
network.hostdisconnectDisconnects the device from the host, keeping it connected to the network
network.pingChecks the status of the connection with the host
network.sendSends a buffer to the host previously connected
network.receiveReceives from the host buffer previously connected
pinpad.openEnables communication with the external or internal pinpad
pinpad.loadipekRecords an initial key and an initial ksn on the memory of pinpad
pinpad.getkeyCaptures a key that is pressed on the external pinpad
pinpad.getpindukptCatches a PIN and encrypts it using DUKPT standard
pinpad.displayDisplays a custom message on the display of the pinpad
pinpad.closeTerminates communication with the external or internal pinpad
emv.openInitializes EMV library
emv.loadtablesLoad tables EMV and PKI of the file for the buyer
emv.cleanstructuresClears all input and output parameters
emv.adddataAdds parameters to EMV process
emv.getinfoReturns information parameters after the execution of the EMV process
emv.inittransactionInitializes the EMV process with inserted parameters
emv.processtransactionStarts the execution of the EMV process
emv.finishtransactionTerminates the execution of the EMV process
emv.removecardWaits for card removal
emv.settimeoutDefine timeout (in seconds) of the library of the EMV process
system.readcardWaits until a card is passed or a key is pressed
system.inputtransactionInstruction to receive the data card on a contactless transaction
integervariableCreates an instance of the variable of integer type
stringvariableCreates an instance of the variable of string type
integerconvertConversion from integer to binary, octal or hexadecimal
convert.tointConverts binary, decimal or hexadecimal to integer
inttostringConversion from integer to string
stringtointConversion from string to integer
integeroperatorIncreases by 1 (+1) or decrements by 1 (-1) a variable of integer type
string.tohexConverts a string to its hexadecimal representation
string.fromhexConverts a hexadecimal representation to a string
string.charatExtracts specified string character
string.elementatReturns a specific element in the string
string.elementsReturns how many elements there are in the specified string
string.findSearches for a substring in the specified string
string.getvaluebykeySearches in the string for a value based on key/value
string.trimEliminates the blanks on the left and right of the string
string.insertatInserts an element at specific index in string
string.lengthReturns length of the specified string
string.padAdds a padding with specific character in string
string.removeatRemoves an element from specific index in string
string.replaceReplace all occurrences of the specified substring
string.replaceatReplaces an element at a specific index in string
string.substringCapture a specific part of string
substringCopies part of a variable string to another variable
joinstringConcatenates in a string the value of another 2 strings
input.getvalueCaptures a string and displays it on the screen in any position
smartcard.insertedcardChecks if the card is inserted in the smart card reader
smartcard.closereaderTerminates communication process of with the smart card
smartcard.startreaderStarts the smart card reader and try to start the card
smartcard.transmitapduSends an APDU command to the smart card
mathematicaloperationPerforms a mathematical operation between two values
system.beepProduces a short beep
system.checkbatteryChecks the device battery status
system.backlightAllows to control the backlight level of the terminal
system.infoGets device information (MAC Address, SIM ID, etc
system.restartRestarts the device
unzipfileUnpacks a zip file
waitkeyPauses execution until a button is pressed
waitkeytimeoutSame as command waitkey but has a timeout
readkeySame as command waitkey, but holds the pressed key
waitPauses execution for a set time
Tens of commands and instructions complete the set of language.
Variables and data types
Variables in POSXML are typed; there are only two types, integer and string. POSXML limits the number of declared variables to 512.
These variables are declared global, i.e. They are shared throughout all the scheduled pages of the POSXML program in runtime process.
Examples:
String type variable:
Integer type variable:
A call to a variable that is declared in the memory, is made by $(name_of_the_variable), regardless of its type.
It is also possible to covert a variable of one type into the other type. In POSXML the commands inttostring and stringtoint are used for this.
Examples:
When writing an application for a POS terminal, the developer is faced with the need to write to the specific file system of the equipment. The POSXML language works with files of type WALK dbFile (A file system defined by the framework that interprets a program compiled POSXML). This file system WALK dbFile uses the format: key = buffer n key = buffer n, basically the format of text files in a Unix environment, where n is used to wrap. There are 8 basic commands in the POSXML language to work with files in the POS terminal, they are.
* editfile* readfile* readfilebyindex* deletefile* file.open* file.write* file.read* file.close
Examples: