0% found this document useful (0 votes)
203 views

HTTPF Communication Protocol

This document describes the HttpF communication protocol used between printers and servers. The protocol is based on HTTP and uses GET requests with parameters to send data from printers to servers. It also defines the format for server responses, which use special characters like # and % to indicate commands for the printer to display text, print output, show menus, or wait for user input. Parameters convey information about the user, selected options, and input values. This allows for dynamic interactions where the printer and server can exchange multiple requests and responses to complete operations like loading account balances, selecting a voucher, and printing the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
203 views

HTTPF Communication Protocol

This document describes the HttpF communication protocol used between printers and servers. The protocol is based on HTTP and uses GET requests with parameters to send data from printers to servers. It also defines the format for server responses, which use special characters like # and % to indicate commands for the printer to display text, print output, show menus, or wait for user input. Parameters convey information about the user, selected options, and input values. This allows for dynamic interactions where the printer and server can exchange multiple requests and responses to complete operations like loading account balances, selecting a voucher, and printing the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

HttpF Communication Protocol

(Zambia)

Xiamen Goodcom Technology Co.,Ltd.


www.gsm-printer.com www.GoodCom.cn

-1-

This protocol is used to define the communications content between printer and server, and it is a
simple protocol and based on http protocol, as shown below :

Goodcom HttpF protocol


Http
Tcp/Ip

This protocol includes sending and receiving.

I. Parameter in ini file


Parameter settings in ini file are as follows (for reference):
IP address(INI 8): goodcom.cn
IP port(INI 9): 80
New line text(INI 27): %%
Order address(INI 36): 0
Login Web UserName(INI 58): user
Login Web Password(INI 59): pwd

II. Sending protocol


It is the protocol that Printer send a request to server,which uses the http Get method and
with some parameters, as follows:
GET /order/menu_req.php?u=user&p=pwd&r=142c327c6&xxx=yyy HTTP/1.1
RANGE: bytes=0-1023
Host: goodcom.cn:80

Parameter defined:
u= means user name,decided by INI. [58];
p= means password,decided by INI.[59];
r= random numbers for cache protection. Every time when user presses F1, the
printer will generate a random number.
id=means ResId,set in INI.[5]
dsp= when one display is confirm(see the #d#Text# defined),printer will send
dsp=times,times means how many times be confirmed.
prn= when some data is printed(see the #p#test# defined), printer will

-2-

send prn=times. times means how many times be printed.


m=means select menu
The xxx and yyy defined by follows:
tp=means type,it have 3 types:EVouchers,MovileTop and Reports,ex.tp=Reports
st= means Subtype,it can be:Airtel,MTN,Zamtel,DayRep,MulRep,AvaVoucher
(DayRep means Day Report,MulRep means MultiDay Report,AvaVoucher
means Available Vocher)
mi=means money item,it will be:z5,z10,z20,z50,z100,z500(z5 means ZMW 5.00)
num=means Mobile No.
amt=means Amount
pin=means Pin code.

III. Receive protocol


It defines the content of server
s response,which is based on http 200 OK or http
206 Partial content,as follows:
HTTP/1.1 206 Partial content
Content-Length: 17
Content-Range: bytes 0-16/17

#command#content#
The return content from the server should be in UTF-8 format.
The fixed format for the server return is:
#command#content#
Special char in content:
%% --- new line
/--- one line ----------------
/r --- big font
Defined command:
#D#Text#
---- D = Display only,the Text will be shown;
#d#Text#
---- d = Display only,the Text will be shown. After pressing ok, it will
reconnect to the server, and add &dsp=timesto GET
protocol;
eg. /printer.cgi?u=user&p=password&action=create&dsp=1
#P#Text#
#p#Text#

-----

P = Print out only,the Text will be printed;


p = Print out only,the Text will be printed. After printing the text,
it will reconnect to the server,and add &prn=timesto GET
protocol;
eg. /printer.cgi?u=user&p=password&action=create&prn=1

-3-

#M#Text#

---

M = show menu,menu format is menu1*menu2*menu3


e.g.#M#a;menue*b;menuk*c;menul#, it will display:
a menue
b menuk
c menul
when user select one menu(eg.select b menuk), printer will send to server with a
new parameter: &m=selected number, like this:
/printer.cgi?u=user&p=password&action=create&m=b
At this time,if server response#M#b1;menue*b2;menuk*b3;menul#, the printer
will display :
b1 menue
b2 menuk
b3 menul
When user selects one menu(eg.select b1 menue), the printer will send to server like
this: /printer.cgi?u=user&p=password&action=create&m=b1
#i#Text#

---

i = wait for inputting, the Text will be displayed. The length of


text SHALL NOT be too long. it can input digit number ONLY.
When return to server,the printer will add &s=input number:
/printer.cgi?u=testuser&p=test&r=142c327c6&action=create&m=2&&s=999

#I#Text#

---

I = wait for inputting,the Text will be displayed. The max length


of text is 14. it can input characters.When return to server,the
printer will add &s=input number,it like #i#Text#.
/printer.cgi?u=testuser&p=test&r=142c327c6&action=create&m=2&&s=abc

IV. The Example of Communication:


1. printer in idle.
2. press F1,input password.
Lcd show :
1>.E Vouchers
2>Mobile top
3>Reports
3. Do some operations.ex:select E Vouchers---->select MTN---->select ZMW50.00----OK
The parameter will be:

tp= Evouchers
st= MTN
mi= z50
4. printer send :

-4-

GET /order/menu_req.php?u=user&p=pwd&r=142c327c6&tp= Evouchers&st=MTN&mi= z50 HTTP/1.1


RANGE: bytes=0-1023
Host: goodcom.cn:80

5. server response as follows:


HTTP/1.1 206 Partial content
Content-Length: 26
Content-Range: bytes 0-25/26

#P#this is for print test#

6. printer will print out the textthis is for print testand quit.

V. PHP sample code for server


1.get parameter from printer

2.check the account and password

//Do something

-5-

3.response data to printer:


Menu:

Display:

Wait for input:

Print:

Here,/-means one line ------,%%means new line,/r is big font;

-6-

You might also like