get_app_info
1. Introduction
Get Blockly project directory information.
2. Request & Response
{
"cmd": "get_app_info",
"data": {
"userId": "test",
"version": "lite6"
},
"id": "1"
}
Name
Type
Required fields
Description
userId
String
No
pass 'test' by default
version
String
No
robot model
lite6: Lite6
null: others
code=0->success;
code!=0->Failed, refer to xarm_api_code;
3. Code Example
background
user_id = data.get('userId', 'test')
xarm_version = data.get('version', GLOBAL.XArm.xarm_type)
root_path = os.path.join(projects_path, user_id, xarm_version, 'app', 'myapp')
if not os.path.exists(root_path):
os.makedirs(root_path)
code, result_dir = get_app_config(root_path, xarm_version)
select_file_path = result_dir['config']['selectFilePath']
if not os.path.exists(os.path.join(root_path, select_file_path.lstrip('/'))):
result_dir['config']['selectFilePath'] = '/untitled'
uf_app_config = result_dir['children'][0]['children']
for item in uf_app_config:
if os.path.exists(os.path.join(root_path, item['name'])):
result_dir['config']['selectFilePath'] = item['uuid']
break
response(client, cmd_id, code, data=result_dir)
front_end
self.getAppInfo = (callback) => {
const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
// Object.assign(params.data, {
// folderName: folderName,
// });
self.sendCmd(window.GlobalConstant.APP_GET_INFO, params, (dict) => {
if (callback) {
callback(dict);
}
});
};
Last updated