Macas Open VMC Interface - EN
Macas Open VMC Interface - EN
MANUAL
CONTENTS
1 CONCEPT..................................................................................................................................................................3
1.1 OVERVIEW............................................................................................................................................................3
1.2 TERMS AND ABBREVIATIONS................................................................................................................................3
1.2.1 Machine product, ingredient and recipe..........................................................................................................3
1.2.2 GVMC Client:..................................................................................................................................................4
1.2.3 venduid monitor:.............................................................................................................................................4
1.2.4 Mqtt broker server,..........................................................................................................................................4
1.3 VENDUID...............................................................................................................................................................4
1.4 VENDUID_MONITOR..............................................................................................................................................5
1.5 APPLICATION PROTOCOL.......................................................................................................................................5
1.6 DEFINITION...........................................................................................................................................................5
3 PROTOCOL...............................................................................................................................................................7
Version 1.1.42
[Type here]
2
[Type here]
7.1 V1.4.1................................................................................................................................................................36
7.2 V1.4.2:...............................................................................................................................................................36
7.3 V1.4.3:...............................................................................................................................................................36
7.4 V1.4.4................................................................................................................................................................36
Version 1.4.4
[Type here]
1 Concept
1.1 Overview
Product id
It means the product identify that support by the machine, every product has unique id.
Normally, it is three digital number, like 801,802, etc.
Product name
It means the product name with multi-language support.
Ingredient name
Normally it is the ingredient name, for example, like Coffee bean, milk powder, cacao
powder etc.
Ingredient id
It means the ingredient identify in the machine, normally it is 4 digital number,
like 1001,1002 etc.
Recipe
It means the product recipe information about the all of ingredient information of the
product.
Component
The VMC SDK use abstract component to build a whole machine, and also use this
concept to configure the machine. For example about the table top machine components
list, include grinder, brewer, canister, mixer etc.
Component Gate
The machine uses some components and synchronized to make product, the component
gate is an abstract concept to communicate with another component.
Parameter
Component parameter
The component parameter is used for different products, normally all of the products
share same setting of the parameter.
Product parameter
normally different product uses different setting of the parameter.
Connection
All of component use connection to communicate with each other. SDK use this concept
4
[Type here]
It is an TCP/IP socket server and also is Mqtt client that connected with MQTT broker.
It is means the message center on the cloud platform. It provides a keep alive connection for
the machine, so any mqtt client can communicate in any time.
1.3 venduid
This application response for the user interface and machine beverage making engine
management.
1.4 venduid_monitor
This application is used for communicated with venduid app with TCP/IP socket, and also
communicate with cloud platform that use MQTT protocol.
The TCP/IP socket and mqtt protocol use same application protocol that base on the JSON
command format. There is difference about the packet head.
Version 1.4.4
[Type here]
1.6 Definition
head
length seqno body
Head:
length:4 bytes,The data frame length that include the data head with asci code decimal
format.
seqno:8 bytes,sequence number with asci decimal code, and increment automatically.
Body:application layer data with json format with code UTF-8.
PS: Only in the TCP/IP socket data layer, the login command and heart beat command is
needed.
The GVMC application play rules of the web socket server rule, so any another third client
can connect this web socket server to communicate with the GVMC application. There is
any another frame head of the message, only with message body.
addr head
address length seqno body check_sum
address: 1 byte
6
[Type here]
The machine RS485 slave address, now the machine slave address is 7.
PS: The RS485 Modbus is supported, if the machine only response the data when
get the command from the master.
And the master need send command to the machine period, otherwise can't get the
machine data.
Suggest poll command is 3.11 command to get the machine state.
length : 4 bytes , The data frame length that include the data head with asci code
decimal format.
(PS: this length not includes the check_sum length).
seqno : 8 bytes , sequence number with asci decimal code, and increment
automatically.
Body:
application layer data with json format with code UTF-8.
check_sum: 2 bytes
check_sum is sum value for all of the data in the frame.
it is presented by asci hex value. for example, if the value is 0xA9, that will present as
asci code with first byte is “A” and second asci code is “9” with hex format. and for the
hex value presentation, the value “a”-”f” is not allowed to used, only use “A”-”F”.
This interface is worked in half duplex mode, and the machine is master, if the RS485
interface is used.
The slave device can’t send the data unless the master had sent data to the slave,
once the slave gets the master data, it will have maximum 500ms time to occupy the
bus to send data.
Version 1.4.4
[Type here]
</CoffeeMachine>
</Macas>
The “serverUart port” data field that define which port is used for serial communication.
TCP/IP packet:
013100000110{“cmd”:”products”,”vmc_no”:700000,”recipe_adjust”:”true”,”make_product_
session_id”:1001,”product_id”:[807],”count”:[1]}
Frame header length:0131:
Frame header seqno: 00000110
Body:
Serial port packet:
7013100000110{“cmd”:”products”,”vmc_no”:700000,”recipe_adjust”:”true”,”make_product
_session_id”:1001,”product_id”:[807],”count”:[1]} EF
Serial data address:7
Frame header length:0131:
Frame header seqno: 00000110
Body:
The frame header sum information: EF
Websocket packet:
{“cmd”:”products”,”vmc_no”:700000,”recipe_adjust”:”true”,”make_product_session_id”:100
1,”product_id”:[807],”count”:[1]}
Only message body is transferred.
3 Protocol
8
[Type here]
3.2 login
Version 1.4.4
[Type here]
The client sends a machine status report packet to the server after successful login or after the
status changes.
10
[Type here]
“HourFlush"
“WakingUp"
“state”: Same value of the “vmc_state”
“ui”: Current UI sate, should QT or H5.
State feedback result package:
direction: GVMC Client(Client) <- - - venduid monitor(Server)
{
“cmd”:” status_r”,
“vmc_no”:100997,
“ret”:0
}
“vmc_no”: your machine number. (100997)
“ret”: zero is server received.
"doorOpen": if the machine door is open or not.
"deliveryDoorOpen": if the machine delivery door is open or not.
"isCupExist": if there is cup in the machine delivery area.
{
“error_list”:
[{
“is_fatal_error”:true,
“is_pessistance_error”:true,
“error_description”: “Water air break is empty”
}
]}
“is_set”:
Setting or clearing error codes, return true is setting error; return false is cleaning error。
“ is_fatal_error”:[true]
Determine whether it is a serious error, a serious error will enter the fault state and stop
working;
[false]Record error.
Version 1.4.4
[Type here]
“is_pessistance_error”:[true]
Determine whether the error is saved after power failure. If yes, the error will still be saved
after power-off, unless there is manual clearing, or the machine sends the corresponding
error code to clear the command automatically.
“error_code”:
“ECH_04” error code.
“error_description”:
“Water air break is empty” error describe.
{
“cmd”:”product_info”,
“action”:”get”
}
This command will feedback the command if the machine is online as bellowed.
After the boot and machine status changes, or when the instructions listed in are received, the
vending machine will update the list of products supported by the machine to the server.
“products_info”: [
{
“product_id”: “810”,
“parents_product”: “960”,
“status”: “ok”,
“product_ipd_name”: “Hot milk”,
“product_name”: “Dutch pure milk”,
“is_hide”:”false”,
“product_recipe”: [
{
“ing_name”: “Cup”,
“value”: “1”,
“ingrident_id”: “10011”
},
{
“ing_name”: “Milk”,
“value”: “200”,
12
[Type here]
“ingrident_id”: “10005”
},
{
“ing_name”: “ES water”,
“value”: “220”,
“ingrident_id”: “10007”
}
]
},
“product_name”:
product name.
“product_id”:
product ID.
“status”:
product status.
“ok”:
Product support production.
“is_hide”:
Is the product hidden in the client.
“error”:
The product cannot be made due to machine reasons or insufficient raw materials.
“no_support”:
The product configuration on the machine is unsupported.
“product_recipe”:
Product recipe information.
“ing_name”:
Ingredient name.
“ingrident_id”:
Ingredient ID.
“value”:
Raw material Recipe parameters.
{
“cmd”:”product_info”,
“action”:”set”
}
{"cmd":"product_info","action":"remove","id":"323","group id":"0"}
Version 1.4.4
[Type here]
14
[Type here]
After receiving the successful payment message, the server will send the instructions for coffee
production to the client, and the client will generate the corresponding coffee according to the
instructions.
direction: GVMC Client(Client) <- - - venduid monitor(Server)
{
“cmd”:”products”,
“vmc_no”:33232,
“recipe_adjust”:”true”,
“make_product_session_id”:1001,
“fake_making”:”false”,
“wait_for_payment”:”true”,
“product_id”:[917],
“count”:[1],
“product_recipe”: [
{
“ing_name”: “Cup”,
“value”: “1”,
“ingrident_id”: “10011”
},
{
“ing_name”: “Milk”,
“value”: “200”,
“ingrident_id”: “10005”
},
{
“ing_name”: “ES water”,
“value”: “220”,
“ingrident_id”: “10007”
}
]
}
“vmc_no”: your machine number.(33232)
“make_product_session_id”:The product creates a session ID, which is a random
number that uniquely identifies the product production command. Also known as the
order number. If receive two product creation commands with the same id, make only
one.(1001)
“product_id”: Makeing coffee ID (Configured by the client deployment)
“count”: Number,(Unit: a Cup of)
“product_receipe”: Product formulation,Please check 3.3.2
“recipe_adjust”: Shows if it is a recipe adjustment interface.
“fake_making”: It is just for product making check, no real product making.
“wait_for_payment”: Wait for payment with venduid.
Version 1.4.4
[Type here]
The client responds to the server to generate the coffee command, Return two responses
been received
16
[Type here]
“fail_info”:
{
“fail_product_id”:[917,910],
“msg”:[“缺水”,”缺糖”]
}
}
“vmc_no”: your machine number.(100997)
“make_product_session_id”: Product production session ID.(1001)
“make_result”: Production results
0: All successful
1: Partial fail
-1: Fail
“fail_info”: Failure message
“fail_product_id”: List of failed products
“msg”: Detailed Failure Reasons for the List of Failed Products
{“cmd”:”json_key”,”type”:”1”,”nr”:”1000001”,”followNr”:”1000”}
The highest level open dialog pops up request command,Password:5651.
{
“cmd”:”eva”,
“action”:”reset”,
};
Version 1.4.4
[Type here]
{
“cmd”:”state”,
“action”:”get”
};
{
“cmd”:”error”,
“action”:”get”,
};
{
“cmd”:”state”,
“action”:”set”,
“new_state”:”Administration”
};
If the client want to set the machine state, use this command to set the machine state.
The supported states are as bellowed:
“Administration”:
“ReturnHome”:If machine in non-vendilde state, send this command to return the
vending home state.(return the main menu vend idle state).
“Ok”: If send this state, it will simulate the OK button in the vendui customer UI.
“OperService”: Force machine to enter the operator top level state.
“H5”: Force the machine use H5 version customer user interface.
“QT”: Force the machine use QT version customer user interface.
{"cmd":"shell","shell_script":"reboot"}
18
[Type here]
This command will cause the whole system to restart, not only the Android board.
{
“cmd”:”shell”,
“shell_script”:”./ssh_server.sh &”
};
no longer supported)
{
“cmd”:”shell”,
“shell_script”:”./ssh_server_stop.sh &”
};
{
“cmd”:”eva”,
“action”:”get”,
“eva_data”:”“PA7*971*0*0*0*0*0*0*0”
};
971 is Product ID.
{
“cmd”:”json_sql”,
“function_name”:”get_day_sale_ammount”,
“sql_file”:”./back_office/eva/chargelist.db”,
“statement”:”select sum(sale_price)as sumvalue from ChargesList where SaleTime like
Version 1.4.4
[Type here]
20161021%”
};
“function_name”: SQL query function name.
“sql_file”: Machine-side SQL name
“statement”: Database SQL statement.
3.20: Machine password management settings.
var cmd =
{
“cmd”:”json_password”,
“action”:”set”,
“AuthOper1Code”:”1001”,
“AuthOper2Code”:”1002”,
“AuthOper3Code”:”1003”,
“AuthServ1Code”:”1004”,
“AuthServ2Code”:”1005”,
“AuthDevCode”:”1006”,
“DoorPassword”:”189288”
}
{
“cmd”:”json_password”,
“action”:”get”
}
{
var cmd =
20
[Type here]
{
“cmd”:”sftp_batch_file”,
“ftp_batch_file”:”“
“sftp_server”:”115.47.123.97”,
“sftp_username”:”Coffee”,
“sftp_password”:”macascoffeetea”
}
var batch_file_cmd = “put /vmc_new/VMC/machine/SL1000/* “ + machine_id+”\n”;
batch_file_cmd = batch_file_cmd + “put /vmc_new/VMC/machine/productmenu/*.pmf “ +
machine_id + “\n”;
batch_file_cmd = batch_file_cmd + “put /vmc_new/VMC/machine/mconfig.xml “ + machine_id + “\
n”;
cmd[“ftp_batch_file”] = batch_file_cmd;
this.send_cmd(machine_id,cmd);
side file.
{
“cmd”:”sftp_batch_file”,
“ftp_batch_file”:”get ./” + machine_id + “/*.ipd /vmc_new/VMC/machine/SL1000 \n”;
“sftp_server”:”115.47.123.97”,
“sftp_username”:”Coffee”,
“sftp_password”:”macascoffeetea”
}
Version 1.4.4
[Type here]
{
“cmd”:”products_info”,
“action”:”get”
}
{"products_info":[{"product_id":"405","parents_product":"0","status":"ok","product_ipd_name":"America
Coffee Ice","product_name":"America Coffee Ice","is_hide":"false","product_recipe":
[{"ing_name":"Cup","value":"1","ingrident_id":"10011"},
{"ing_name":"Coffee","value":"140","ingrident_id":"10009"},
{"ing_name":"ICE","value":"1","ingrident_id":"10012"},
{"ing_name":"Water","value":"300","ingrident_id":"10019"}]}]}
{
"cmd":"product_info",
"action":"set",
"products info":
[
{
"id": "319",
22
[Type here]
"name":"Double ES CW",
"lang1 name":"Hot water",
"lang2 name":"双份意式",
"lang3 name":"Hot water",
"product_name":"Matcha",
"icon_id":"218",
"icon_name":"product.png",
"permit_jug":"0",
"hide_flag":"0",
"style_index":"0",
"dosage_id":"217",
"dosage_name":"involve.png",
"product_ratio":"100",
"evoca machine recipe
file":"/data/VMC/machine/EVOCA/Customer/json/EVOCAProduct319Double_ES_CW.jso
n",
"is new":"true",
"shortID": "0",
"groupID": "0",
"parents info": "",
"recipe info": [
{
"product": "319",
"ingredient": "10001",
"options": "1",
"min": "10",
"std": "130",
"max": "160"
},
{
"product": "319",
"ingredient": "10002",
"options": "0",
"min": "0",
"std": "190",
"max": "220"
}
],
"preorder info": [
{
"product": "319",
"ingredient": "10002",
"order": "0",
"options": "0"
},
{
Version 1.4.4
[Type here]
"product": "319",
"ingredient": "10001",
"order": "0",
"options": "0"
}
]
}
]
}
24
[Type here]
{“cmd”:”price”,”action”:”get”,”product_id”:”283”}
product_id: Product ID.
PriceListA: Price A
PriceListB: Price B
PriceListC: Price C
PriceListD: Price D
{
“cmd”:”sftp_batch_file_r”,
“status”:0,
“msg”:”uploadInfo=>JsonSftp MySftpThread startIO outputStream.write
finished:\/data\/sftp\/app_monitor.sh”
}
Remotely check if there is an updateable firmware package on the machine side, and if so,
perform an automatic update.
{
“cmd”:”shell”,
“shell_script”:”./check_update”
};
Version 1.4.4
[Type here]
For the automatic update firmware package, it must be the macas_cm.dat file name.
{
"cmd":"sensors",
"componentId":501,
}
Get the sensor value of the machine.
Machine response:
{
“machine_sensors”:
[
"boiler temp":93.5,
"boiler pressure":10.0
]
}
For example, about boiler temperature sensor:
"boiler temp":93.5,
"boiler pressure":10,
26
[Type here]
{
"cmd":"adb_cmd",
"adb_cmd_script":"ps"
}
The machine opens the door command, does not need to pop up the dialog box to enter the
password.
{"cmd":"json_key","type":"0","nr":"831","followNr":"1"}
Send command:
{"cmd":"payment","action":"get"}
{"cmd":"payment","info":"devices","devices":[{"isOnline":"true","deviceProperities":
{"Manufacturer":"UVM","Model":"BINGO007 ","Serial":"163964
","Version":"202","FeatureLevel":"2","ScaleFactor":"10","DecimalPlace":"0","Country":"82"
}}]}
Version 1.4.4
[Type here]
{
"software_version": [
{
"board": "0",
"softwareType": "UD_APP",
"version": "1.11.88.H"
},
{
"board": "2",
"softwareType": "ISP_0",
"version": "2.0.51"
}
],
"hardware_version": [
{
"board": "2",
"version": "751688V31"
}
]
}
{
"cmd":"component",
"sub_cmd":"component test",
"boardId":2,
"componentId":501,
"testIndex": 0
28
[Type here]
}
"componentId": Component id
"testIndex": Component test index。
针对机器某个部件执行测试命令,具体部件 id 和测试索引见附件或者 IPDDesigner. 对如当前麦凯斯台式机参见 mdmachine.json 文件。
If the machine can start the machine testing, the machine state will be CM_TESTING state from
CMS_IDLE, and if the testing is finished, the return the CMS_IDLE again. Only send this
command will machine is in CMS_IDLE state.
{
"cmd":"component",
"sub_cmd":"parameter set",
"component_id":501,
"product_id":-1,
"adjust_id": 0,
"fluid_id":0,
"value":100
}
"componentId":部件 ID。
"testIndex": 测试索引号。
"adjsut_id":可调参数 ID
"fluid_id": 在某些产品具有多次泵水的情况下,代表每次出水的 ID.
"value":可调参数值
Machine response:
{
"cmd":"component",
"sub_cmd":"parameter set",
"component_id":501,
"product_id":-1,
"adjust_id": 0,
"fluid_id":0,
"value":100,
“set result”:”ok”
}
Version 1.4.4
[Type here]
"cmd":"component",
"sub_cmd":"parameter get",
"component_id":501,
"adjsut_id": 0,
"fluid_id":0
}
设定参数完成之后,或者在收制定机器部件或者制造产品的工艺参数,机器将会回应以下数据包:
{
"set result":"ok",
"component_id":501,
"adjsut_id": 0,
"fluid_id":0,
"value":100
}
"set result":参数设定结果。
PS:机器额外定义的用户部件参数与工艺参数不能超过 100 个。
{
"cmd":"component",
"sub_cmd":"parameter remove",
"component_id":501,
"product_id":-1,
}
If component_id is -1, it means erase all of product parameter, if the product_id is -1, will erase
all of component parameter.
"sub_cmd": 机器维护命令:
{
"cmd":"component",
"sub_cmd":"rinsing set",
}
sub_cmd: 一些相关机器清洗及维护命令:
"rinsing":机器清洗。
"freshmilk rinsing":牛退役管道清洗
"purification":机器全自动除垢。
"empty air break":排空水箱。
"service on": 进入维护员模式。
30
[Type here]
"service off":退出维护员模式。
"sub_cmd": 机器维护命令:
{
"cmd":"component",
"boardId":2,
"sub_cmd":"test key",
"key":"start"
}
"key": 具体按键
"start": 启动按键,一般不需要发送此命令到后台
"stop": 停止按键
"next": 下一步按键
"cancle": 取消按键
3.19.5:
{"cmd":"IoTestReport","line":1,"Info":"start test"}
在测试过程中,如收到相关信息,需要将 Info 的内容刷新到信息显示框,
line: 显示信息第几行。
{
"cmd":"io_cmd",
"board_id":"2",
"sub_cmd":"MSG_MAKE_PRODUCT",
"cmd_data":“”,
"req_reply":true
}
注意:
sub_cmd 为命令字符串
cmd_data 都为 UUCODE 编码的二进制数据,具体命令格式与命令包见有关 SVMC 的命令文档,
req_reply: 此命令是否需要 IO 板返回数据。
有一些命令需要带参数,有一些命令不需带任何参数。
{
"board_id":"2",
"cmd":"io_cmd",
Version 1.4.4
[Type here]
"sub_cmd":"1",
"respones_data":"acde"
}
"response_data":从 IO 板返回的以 UUCODE 编码的二进制数据。
进入维护模块,无需参数
{"board_id":"2","cmd":"io_cmd","sub_cmd":"MSG_SERVICE_ON","cmd_data":"","req_reply":false}
退出维护模式,无需带参数。
{"board_id":"2","cmd":"io_cmd","sub_cmd":"MSG_SERVICE_OFF","cmd_data":"","req_reply":false}
control board:
When machine control is in testing state, maybe some test information will reported by this
command packet.
{
"cmd::"product_test",
"sub cmd":"recipe update"
"product_id":"900",
};
32
[Type here]
"sub cmd":
"recipe update": 产品配方更新,对机器产品配方进行更新,SDK 将会读取 product_customer.json 文件,并在系统内验证当
前产品在当前机器配置上能否支持
"product check": 检查该产品是否支持制作。
制作。机器回应如下:
{
"cmd":"recipe_result",
"result":"ok",
"err msg":""
}
result:
"ok":机器支持产品制作。
"fail":机器产品不支持制作。
"err msg": 产品制作错误信息。
Version 1.4.4
[Type here]
description:
/data/VMC:
/data/VMC/Credit
/data/VMC/Credit
34
[Type here]
4.7.2 mconfig.xml:
<ServerIP address = "192.168.1.7" />:TCP/IP Socket IP address, if MQTT client and SDK is in
same board, the address will be 127.0.0.1
<ServerPort port="8888" />:The Socket port number
The mconfig.xml Ipd file and Mpd file data fields define the Mpd and Ipd files, and the directory
position depends the machine type and machine name data field.
Version 1.4.4
[Type here]
/data/VMC/machine/coffeemachineconfig.xml:
info"
36
[Type here]
Version 1.4.4
[Type here]
38
[Type here]
],
"preorder info": [
{
"product": "811",
"ingredient": "10002", //水
"order": "1", //第二步
"options": "0"
},
{
"product": "811",
"ingredient": "10001", //第二步出咖啡,使用用咖啡豆和水。
"order": "1", //第二步
"options": "0"
},
{
"product": "811",
"ingredient": "10003", //第一步先出奶粉和水
"order": "0", //第一步
"options": "0"
},
{
"product": "811",
"ingredient": "10002", //水
"order": "0", //第一步
"options": "0"
}
],
"adjustment info": [ //产品工艺参数 Waterpart 定义。此参数代表在多次出水的产品中,每次出水在总出水量的百分比。
{
"product": "811",
"fluid": "0",
"scheme": "1",
"component": "701",
"adjustId": "1",
"stuffed": "0",
"defaultVal": "77" //第一次出水占 77%
},
{
"product": "811",
"fluid": "1",
"scheme": "1",
"component": "701",
"adjustId": "1",
"stuffed": "0",
"defaultVal": "22" //第一次出水占 22%
}
Version 1.4.4
[Type here]
]
}
If customer want to overwrite the machine ingredient, can change the product.json file and
then rename the file name to product_customer.json, the file is located in application data
dir.
SDK will read this file to modify the machine ingredient configuration。
40
[Type here]
{
"cmd":"product_info",
"action":"set",
"description": {
"IPDId": "10000001",
"longName": "Macas demo"
},
"product group info": [
{
"group id": "4",
Version 1.4.4
[Type here]
42
[Type here]
}
]
}
]
}
]
}
Version 1.4.4
[Type here]
If there is any MQTT client want to get the another MQTT client local file system information,
just publish message as bellowed.
/200000/data/VMC/machine/lang.xml
{
"cmd":"mqtt_file",
"file":"touchless.mp4",
"sub_cmd":"receive",
"store_dir":"E:/TEST/",
"req_id":"1001"
}
The MQTT client will publish the local file system contents with this topic
“/Post/req_id/length/offset/destinationfilepathname”
Send command to the destination directory to the received client that want to download the file
from another mqtt machine client.
{"cmd":"mqtt_file","file":"E:/touchless.mp4","sub_cmd":"send","req_id":"1001"}
1. MQTT Client:
2. PHP Client
3. C++ Client
4. Java Client
5. JS Client
44
[Type here]
https://tendor.icoffee-tea.com/machineDatabase/701900/VMC/sys/SysConfig.xml
8.1 V1.4.1
Version 1.4.4
[Type here]
8.2 V1.4.2:
8.3 V1.4.3:
8.4 V1.4.4
46