AutOK Ticket Format Specification
From AutOKwiki
This page details the specification of tickets used in the autOK system.
Details
Each Ticket contains
exactly 18
digits.
Digits 01-02: Ticket_Purpose:
A 1 byte value that specifies purpose. The 2 kinds of purposes that are
defined are: 00=Song Ticket, 01=User ID Ticket. (This could
be a 32-bit value, but we are making it a byte because purposes are going to
be real limited, and may very likely dependent on venue, which is a 32-bit
value already anyway)
Digits 03-10:
Venue_ID : A 32-bit (4 byte) value that is unique for any
given venue. This Venue_ID must match the value that is entered in the Venue
UID field in the AutoKDJ Karaoke Preferences Dialog box.
(7 Bamboo vs anywhere else. Venues are encouraged to pick a
sufficiently random number to avoid duplicates wiht other venues)
Digits 11-18: Ticket_ID
: A 32-bit (4 byte) value that is unique for any given ticket in that venue
and purpose.
(32 bit is chosen to avoid running out of valid values,
considering thousands of customers over years)
Given the above, a complete valid song ticket might look like
this:
00123456789ABCDEF1
Similarly, a complete valid user ticket might look like this:
011234567800000555
Note that each 4-byte value will amount to 8 characters that need to be read
from the barcode reader and transmitted to the server. The ticket purpose is
another 2 characters, for a total of 18 characters, plus header information.
An 'unsigned long' is a binary datatype that is 4 bytes
long, where each byte can contain a value between 0 and 255 (or 0x00 and
0xFF).
However, in order to transmit this information across an
HTTP post, those bytes need to be converted into a URL safe format. For
this project, we choose ASCII-hex.
In ASCII-hex, each character can only contain a value
between 0 and 16 (or '0' thru 'F').
So, each binary byte needs to be encoded into 2 ASCII-hex
characters.
Value_Hex___ASCII-encoded hex
0_____0x00__'0' '0'
15____0x0F__'0' 'F'
64
___0x40__'4' '0'
127___0x7F__'7' 'F'
255___0xFF__'F' 'F'
Note each value under the 'Value' column is a single byte
in an unsigned long.
An HTTP Post for a single ticket will therefore look like the following:
http://{server}/karaoke.txt?query=?TICKET_VENUEID=123456768
_TICKETPURP=12_TICKETID=123456768
