张卓写的代码
This commit is contained in:
@ -0,0 +1,76 @@
|
||||
{
|
||||
"version": {
|
||||
"major": 1,
|
||||
"minor": 0
|
||||
},
|
||||
"hms_database": {
|
||||
"hms_position_desc": "负载%position_index",
|
||||
"hms_error_code_list": [
|
||||
{
|
||||
"hms_error_code": "0x1E020000",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS测试文案: 我是错误码标题0",
|
||||
"message_content": "HMS测试文案: 我是错误码内容0"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS测试文案: 我在地面发生了错误0",
|
||||
"is_keep_history_on_the_ground": false,
|
||||
"message_in_the_sky": "HMS测试文案: 我在空中发生了错误0",
|
||||
"is_keep_history_in_the_sky": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020001",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS测试文案: 我是错误码标题1",
|
||||
"message_content": "HMS测试文案: 我是错误码内容1"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS测试文案: 我在地面发生了错误1",
|
||||
"is_keep_history_on_the_ground": false,
|
||||
"message_in_the_sky": "HMS测试文案: 我在空中发生了错误1",
|
||||
"is_keep_history_in_the_sky": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020002",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS测试文案: 我是错误码标题2",
|
||||
"message_content": "HMS测试文案: 我是错误码内容2"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS测试文案: 我在地面发生了错误2",
|
||||
"is_keep_history_on_the_ground": true,
|
||||
"message_in_the_sky": "HMS测试文案: 我在空中发生了错误2",
|
||||
"is_keep_history_in_the_sky": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020003",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS测试文案: 我是错误码标题3",
|
||||
"message_content": "HMS测试文案: 我是错误码内容3"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS测试文案: 我在地面发生了错误3",
|
||||
"is_keep_history_on_the_ground": true,
|
||||
"message_in_the_sky": "HMS测试文案: 我在空中发生了错误3",
|
||||
"is_keep_history_in_the_sky": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020004",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS测试文案: 我是错误码标题4",
|
||||
"message_content": "HMS测试文案: 我是错误码内容4"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS测试文案: 我在地面发生了错误4",
|
||||
"is_keep_history_on_the_ground": true,
|
||||
"message_in_the_sky": "HMS测试文案: 我在空中发生了错误4",
|
||||
"is_keep_history_in_the_sky": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
{
|
||||
"version": {
|
||||
"major": 1,
|
||||
"minor": 0
|
||||
},
|
||||
"hms_database": {
|
||||
"hms_position_desc": "Payload %position_index",
|
||||
"hms_error_code_list": [
|
||||
{
|
||||
"hms_error_code": "0x1E020000",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS test text: I am error code Title 0",
|
||||
"message_content": "HMS test text: I am error code Content 0"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS test text: I got error on the ground 0",
|
||||
"is_keep_history_on_the_ground": false,
|
||||
"message_in_the_sky": "HMS test text: I got error in the sky 0",
|
||||
"is_keep_history_in_the_sky": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020001",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS test text: I am error code Title 1",
|
||||
"message_content": "HMS test text: I am error code Content 1"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS test text: I got error on the ground 1",
|
||||
"is_keep_history_on_the_ground": false,
|
||||
"message_in_the_sky": "HMS test text: I got error in the sky 1",
|
||||
"is_keep_history_in_the_sky": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020002",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS test text: I am error code Title 2",
|
||||
"message_content": "HMS test text: I am error code Content 2"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS test text: I got error on the ground 2",
|
||||
"is_keep_history_on_the_ground": true,
|
||||
"message_in_the_sky": "HMS test text: I got error in the sky 2",
|
||||
"is_keep_history_in_the_sky": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020003",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS test text: I am error code Title 3",
|
||||
"message_content": "HMS test text: I am error code Content 3"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS test text: I got error on the ground 3",
|
||||
"is_keep_history_on_the_ground": true,
|
||||
"message_in_the_sky": "HMS test text: I got error in the sky 3",
|
||||
"is_keep_history_in_the_sky": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"hms_error_code": "0x1E020004",
|
||||
"hms_interface": {
|
||||
"message_title": "HMS test text: I am error code Title 4",
|
||||
"message_content": "HMS test text: I am error code Content 4"
|
||||
},
|
||||
"fpv_interface": {
|
||||
"message_on_the_ground": "HMS test text: I got error on the ground 4",
|
||||
"is_keep_history_on_the_ground": true,
|
||||
"message_in_the_sky": "HMS test text: I got error in the sky 4",
|
||||
"is_keep_history_in_the_sky": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
/* Generated by file2c, do not edit manually */
|
||||
#ifndef __hms_text_config_json_h_included
|
||||
#define __hms_text_config_json_h_included
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Contents of file hms_text_config.json */
|
||||
#define hms_text_config_json_fileName "hms_text_config.json"
|
||||
#define hms_text_config_json_fileSize 2783
|
||||
|
||||
static const uint8_t hms_text_config_json_fileBinaryArray[2783] = {
|
||||
0x7B, 0x0A, 0x20, 0x20, 0x22, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x22, 0x3A, 0x20, 0x7B,
|
||||
0x0A, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x61, 0x6A, 0x6F, 0x72, 0x22, 0x3A, 0x20, 0x31, 0x2C,
|
||||
0x0A, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x69, 0x6E, 0x6F, 0x72, 0x22, 0x3A, 0x20, 0x30, 0x0A,
|
||||
0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x64, 0x61, 0x74, 0x61,
|
||||
0x62, 0x61, 0x73, 0x65, 0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D,
|
||||
0x73, 0x5F, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x64, 0x65, 0x73, 0x63, 0x22,
|
||||
0x3A, 0x20, 0x22, 0x50, 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x20, 0x25, 0x70, 0x6F, 0x73, 0x69,
|
||||
0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20,
|
||||
0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x5F, 0x63, 0x6F, 0x64, 0x65,
|
||||
0x5F, 0x6C, 0x69, 0x73, 0x74, 0x22, 0x3A, 0x20, 0x5B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x65,
|
||||
0x72, 0x72, 0x6F, 0x72, 0x5F, 0x63, 0x6F, 0x64, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x30, 0x78, 0x31,
|
||||
0x45, 0x30, 0x32, 0x30, 0x30, 0x30, 0x30, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
|
||||
0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x69, 0x74, 0x6C, 0x65, 0x22, 0x3A, 0x20,
|
||||
0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20,
|
||||
0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20,
|
||||
0x54, 0x69, 0x74, 0x6C, 0x65, 0x20, 0x30, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x63, 0x6F, 0x6E,
|
||||
0x74, 0x65, 0x6E, 0x74, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74,
|
||||
0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F,
|
||||
0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x30,
|
||||
0x22, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x66, 0x70, 0x76, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66,
|
||||
0x61, 0x63, 0x65, 0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68,
|
||||
0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20,
|
||||
0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74,
|
||||
0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x6F, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72,
|
||||
0x6F, 0x75, 0x6E, 0x64, 0x20, 0x30, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74,
|
||||
0x6F, 0x72, 0x79, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E,
|
||||
0x64, 0x22, 0x3A, 0x20, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x69, 0x6E,
|
||||
0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20,
|
||||
0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74,
|
||||
0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x6B,
|
||||
0x79, 0x20, 0x30, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79,
|
||||
0x5F, 0x69, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x66, 0x61,
|
||||
0x6C, 0x73, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x65, 0x72, 0x72, 0x6F,
|
||||
0x72, 0x5F, 0x63, 0x6F, 0x64, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x30, 0x78, 0x31, 0x45, 0x30, 0x32,
|
||||
0x30, 0x30, 0x30, 0x31, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x68, 0x6D, 0x73, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3A, 0x20,
|
||||
0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x69, 0x74, 0x6C, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D,
|
||||
0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61,
|
||||
0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x54, 0x69, 0x74,
|
||||
0x6C, 0x65, 0x20, 0x31, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x63, 0x6F, 0x6E, 0x74, 0x65, 0x6E,
|
||||
0x74, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65,
|
||||
0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x63,
|
||||
0x6F, 0x64, 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x31, 0x22, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x22, 0x66, 0x70, 0x76, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
|
||||
0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67,
|
||||
0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73,
|
||||
0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74, 0x20, 0x65, 0x72,
|
||||
0x72, 0x6F, 0x72, 0x20, 0x6F, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6F, 0x75, 0x6E,
|
||||
0x64, 0x20, 0x31, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79,
|
||||
0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A,
|
||||
0x20, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x69, 0x6E, 0x5F, 0x74, 0x68,
|
||||
0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73,
|
||||
0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74, 0x20, 0x65, 0x72,
|
||||
0x72, 0x6F, 0x72, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x6B, 0x79, 0x20, 0x31,
|
||||
0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73,
|
||||
0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79, 0x5F, 0x69, 0x6E,
|
||||
0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x66, 0x61, 0x6C, 0x73, 0x65,
|
||||
0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x5F, 0x63,
|
||||
0x6F, 0x64, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x30, 0x78, 0x31, 0x45, 0x30, 0x32, 0x30, 0x30, 0x30,
|
||||
0x32, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73,
|
||||
0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x5F, 0x74, 0x69, 0x74, 0x6C, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74,
|
||||
0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61, 0x6D, 0x20, 0x65,
|
||||
0x72, 0x72, 0x6F, 0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x20,
|
||||
0x32, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x63, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x22, 0x3A,
|
||||
0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A,
|
||||
0x20, 0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x63, 0x6F, 0x64, 0x65,
|
||||
0x20, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x32, 0x22, 0x0A, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x66, 0x70, 0x76, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3A, 0x20,
|
||||
0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75,
|
||||
0x6E, 0x64, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72,
|
||||
0x20, 0x6F, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x20, 0x32,
|
||||
0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73,
|
||||
0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79, 0x5F, 0x6F, 0x6E,
|
||||
0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A, 0x20, 0x74, 0x72,
|
||||
0x75, 0x65, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x69, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B,
|
||||
0x79, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65,
|
||||
0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20,
|
||||
0x69, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x6B, 0x79, 0x20, 0x32, 0x22, 0x2C, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65,
|
||||
0x70, 0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79, 0x5F, 0x69, 0x6E, 0x5F, 0x74, 0x68, 0x65,
|
||||
0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x74, 0x72, 0x75, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x68, 0x6D, 0x73, 0x5F, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x5F, 0x63, 0x6F, 0x64, 0x65, 0x22, 0x3A,
|
||||
0x20, 0x22, 0x30, 0x78, 0x31, 0x45, 0x30, 0x32, 0x30, 0x30, 0x30, 0x33, 0x22, 0x2C, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x69, 0x6E, 0x74, 0x65,
|
||||
0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x69, 0x74,
|
||||
0x6C, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20,
|
||||
0x63, 0x6F, 0x64, 0x65, 0x20, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x20, 0x33, 0x22, 0x2C, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x5F, 0x63, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53,
|
||||
0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61, 0x6D,
|
||||
0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x74,
|
||||
0x65, 0x6E, 0x74, 0x20, 0x33, 0x22, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D,
|
||||
0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x66, 0x70, 0x76, 0x5F, 0x69,
|
||||
0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F,
|
||||
0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A, 0x20,
|
||||
0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20,
|
||||
0x49, 0x20, 0x67, 0x6F, 0x74, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x6F, 0x6E, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x20, 0x33, 0x22, 0x2C, 0x0A, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70,
|
||||
0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F,
|
||||
0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2C, 0x0A, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x5F, 0x69, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x22,
|
||||
0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49,
|
||||
0x20, 0x67, 0x6F, 0x74, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68,
|
||||
0x65, 0x20, 0x73, 0x6B, 0x79, 0x20, 0x33, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73,
|
||||
0x74, 0x6F, 0x72, 0x79, 0x5F, 0x69, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22,
|
||||
0x3A, 0x20, 0x74, 0x72, 0x75, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D,
|
||||
0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x65,
|
||||
0x72, 0x72, 0x6F, 0x72, 0x5F, 0x63, 0x6F, 0x64, 0x65, 0x22, 0x3A, 0x20, 0x22, 0x30, 0x78, 0x31,
|
||||
0x45, 0x30, 0x32, 0x30, 0x30, 0x30, 0x34, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x22, 0x68, 0x6D, 0x73, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
|
||||
0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x69, 0x74, 0x6C, 0x65, 0x22, 0x3A, 0x20,
|
||||
0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20,
|
||||
0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20,
|
||||
0x54, 0x69, 0x74, 0x6C, 0x65, 0x20, 0x34, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x63, 0x6F, 0x6E,
|
||||
0x74, 0x65, 0x6E, 0x74, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74, 0x65, 0x73, 0x74,
|
||||
0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x61, 0x6D, 0x20, 0x65, 0x72, 0x72, 0x6F,
|
||||
0x72, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x34,
|
||||
0x22, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x2C, 0x0A, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x66, 0x70, 0x76, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66,
|
||||
0x61, 0x63, 0x65, 0x22, 0x3A, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68,
|
||||
0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E, 0x64, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20,
|
||||
0x74, 0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74,
|
||||
0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x6F, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72,
|
||||
0x6F, 0x75, 0x6E, 0x64, 0x20, 0x34, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74,
|
||||
0x6F, 0x72, 0x79, 0x5F, 0x6F, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x67, 0x72, 0x6F, 0x75, 0x6E,
|
||||
0x64, 0x22, 0x3A, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x22, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5F, 0x69, 0x6E, 0x5F,
|
||||
0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x22, 0x48, 0x4D, 0x53, 0x20, 0x74,
|
||||
0x65, 0x73, 0x74, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3A, 0x20, 0x49, 0x20, 0x67, 0x6F, 0x74, 0x20,
|
||||
0x65, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x6B, 0x79,
|
||||
0x20, 0x34, 0x22, 0x2C, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22,
|
||||
0x69, 0x73, 0x5F, 0x6B, 0x65, 0x65, 0x70, 0x5F, 0x68, 0x69, 0x73, 0x74, 0x6F, 0x72, 0x79, 0x5F,
|
||||
0x69, 0x6E, 0x5F, 0x74, 0x68, 0x65, 0x5F, 0x73, 0x6B, 0x79, 0x22, 0x3A, 0x20, 0x74, 0x72, 0x75,
|
||||
0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x5D, 0x0A, 0x20, 0x20, 0x7D, 0x0A, 0x7D
|
||||
};
|
||||
|
||||
#endif /* __hms_text_config_json_h_included */
|
343
PSDK/samples/sample_c/module_sample/hms/test_hms.c
Normal file
343
PSDK/samples/sample_c/module_sample/hms/test_hms.c
Normal file
@ -0,0 +1,343 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_hms.c
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2021 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s authorization, you may not
|
||||
* further disseminate the information, and you must immediately remove the
|
||||
* source code and notify DJI of its removal. DJI reserves the right to pursue
|
||||
* legal actions against you for any loss(es) or damage(s) caused by your
|
||||
* failure to do so.
|
||||
*
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <widget_interaction_test/test_widget_interaction.h>
|
||||
#include <utils/util_misc.h>
|
||||
#include "test_hms.h"
|
||||
#include "dji_hms.h"
|
||||
#include "dji_hms_info_table.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_platform.h"
|
||||
#include "dji_fc_subscription.h"
|
||||
#include "hms_text_c/en/hms_text_config_json.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define MAX_HMS_PRINT_COUNT (150)
|
||||
#define MAX_BUFFER_LEN (256)
|
||||
#define MIN_HMS_ERROR_LEVEL (0)
|
||||
#define MID_HMS_ERROR_LEVEL (3)
|
||||
#define MAX_HMS_ERROR_LEVEL (6)
|
||||
#define HMS_DIR_PATH_LEN_MAX (256)
|
||||
|
||||
#define DJI_CUSTOM_HMS_CODE_INJECT_ON (0)
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static const char *oldReplaceAlarmIdStr = "%alarmid";
|
||||
static const char *oldReplaceIndexStr = "%index";
|
||||
static const char *oldReplaceComponentIndexStr = "%component_index";
|
||||
static T_DjiHmsFileBinaryArray s_EnHmsTextConfigFileBinaryArrayList[] = {
|
||||
{hms_text_config_json_fileName, hms_text_config_json_fileSize, hms_text_config_json_fileBinaryArray},
|
||||
};
|
||||
static bool s_hmsServiceRunFlag = false;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_HmsInit(void);
|
||||
static T_DjiReturnCode DjiTest_HmsDeInit(void);
|
||||
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void);
|
||||
static bool DjiTest_ReplaceStr(char *buffer, uint32_t bufferMaxLen, const char *target, const char *dest);
|
||||
static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable);
|
||||
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_HmsRunSample(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler;
|
||||
|
||||
USER_LOG_INFO("Hms Sample Start");
|
||||
DjiTest_WidgetLogAppend("Hms Sample Start");
|
||||
|
||||
USER_LOG_INFO("--> Step 1: Init hms sample");
|
||||
DjiTest_WidgetLogAppend("--> Step 1: Init hms sample");
|
||||
returnCode = DjiTest_HmsInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms sample init error, error code:0x%08llX", returnCode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
osalHandler = DjiPlatform_GetOsalHandler();
|
||||
USER_LOG_INFO("--> Step 2: Register callback function of push HMS information");
|
||||
DjiTest_WidgetLogAppend("--> Step 2: Register callback function of push HMS information");
|
||||
returnCode = DjiHms_RegHmsInfoCallback(DjiTest_HmsInfoCallback);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Register callback function of push HMS information failed, error code:0x%08llX", returnCode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(10000);
|
||||
|
||||
out:
|
||||
USER_LOG_INFO("--> Step 3: Deinit hms sample");
|
||||
DjiTest_WidgetLogAppend("--> Step 3: Deinit hms sample");
|
||||
returnCode = DjiTest_HmsDeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms sample deinit error, error code:0x%08llX", returnCode);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Hms Sample End");
|
||||
DjiTest_WidgetLogAppend("Hms Sample End");
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
char curFileDirPath[HMS_DIR_PATH_LEN_MAX];
|
||||
char tempPath[HMS_DIR_PATH_LEN_MAX];
|
||||
#endif
|
||||
|
||||
returnCode = DjiHms_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms init error, error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
//Step 2 : Set hms text Config (Linux environment)
|
||||
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, HMS_DIR_PATH_LEN_MAX, curFileDirPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/en", curFileDirPath);
|
||||
|
||||
//set default hms text config path
|
||||
returnCode = DjiHms_RegDefaultHmsTextConfigByDirPath(tempPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
//set hms text config for English language
|
||||
returnCode = DjiHms_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_ENGLISH,
|
||||
tempPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
//set hms text config for Chinese language
|
||||
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/cn", curFileDirPath);
|
||||
returnCode = DjiHms_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_CHINESE,
|
||||
tempPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
#else
|
||||
//Step 2 : Set hms text Config (RTOS environment)
|
||||
T_DjiHmsBinaryArrayConfig enHmsTextBinaryArrayConfig = {
|
||||
.binaryArrayCount = sizeof(s_EnHmsTextConfigFileBinaryArrayList) / sizeof(T_DjiHmsFileBinaryArray),
|
||||
.fileBinaryArrayList = s_EnHmsTextConfigFileBinaryArrayList
|
||||
};
|
||||
|
||||
//set default hms text config
|
||||
returnCode = DjiHms_RegDefaultHmsTextConfigByBinaryArray(&enHmsTextBinaryArrayConfig);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DJI_CUSTOM_HMS_CODE_INJECT_ON
|
||||
DjiHms_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
||||
#endif
|
||||
|
||||
s_hmsServiceRunFlag = true;
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_HmsInit(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
|
||||
returnCode = DjiFcSubscription_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms sample init data subscription module failed, error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/*! subscribe fc data */
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
|
||||
DJI_DATA_SUBSCRIPTION_TOPIC_10_HZ,
|
||||
NULL);
|
||||
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("HMS sample subscribe topic flight status error, error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
if (s_hmsServiceRunFlag == true) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
return DjiHms_Init();
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_HmsDeInit(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
|
||||
returnCode = DjiFcSubscription_DeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Deinit data subscription module failed, error code:0x%08llX",
|
||||
returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
if (s_hmsServiceRunFlag == true) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
return DjiHms_DeInit();
|
||||
}
|
||||
|
||||
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiFcSubscriptionFlightStatus flightStatus;
|
||||
T_DjiDataTimestamp flightStatusTimestamp = {0};
|
||||
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
|
||||
(uint8_t *) &flightStatus,
|
||||
sizeof(T_DjiFcSubscriptionFlightStatus),
|
||||
&flightStatusTimestamp);
|
||||
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get value of topic flight status failed, error code:0x%08llX", returnCode);
|
||||
flightStatus = 0;
|
||||
} else {
|
||||
USER_LOG_DEBUG("Timestamp: millisecond %u microsecond %u.", flightStatusTimestamp.millisecond,
|
||||
flightStatusTimestamp.microsecond);
|
||||
USER_LOG_DEBUG("Flight status: %d.", flightStatus);
|
||||
}
|
||||
|
||||
return flightStatus;
|
||||
}
|
||||
|
||||
static bool DjiTest_ReplaceStr(char *buffer, uint32_t bufferMaxLen, const char *target, const char *dest)
|
||||
{
|
||||
char printBuffHeader[MAX_BUFFER_LEN] = {0};
|
||||
uint32_t printBuffHeaderCpyCnt = 0;
|
||||
char printBuffTail[MAX_BUFFER_LEN] = {0};
|
||||
uint32_t printBuffTailCpyCnt = 0;
|
||||
char *targetOffset = NULL;
|
||||
|
||||
targetOffset = strstr(buffer, target);
|
||||
if (!targetOffset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
printBuffHeaderCpyCnt = targetOffset - buffer;
|
||||
if (printBuffHeaderCpyCnt > sizeof(printBuffHeader)) {
|
||||
printBuffHeaderCpyCnt = sizeof(printBuffHeader);
|
||||
}
|
||||
memcpy(printBuffHeader, buffer, printBuffHeaderCpyCnt);
|
||||
|
||||
printBuffTailCpyCnt = strlen(targetOffset + strlen(target));
|
||||
if (printBuffTailCpyCnt > sizeof(printBuffTail)) {
|
||||
printBuffTailCpyCnt = sizeof(printBuffTail);
|
||||
}
|
||||
memcpy(printBuffTail, targetOffset + strlen(target), printBuffTailCpyCnt);
|
||||
|
||||
snprintf(buffer, bufferMaxLen, "%s%s%s", printBuffHeader, dest, printBuffTail);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable)
|
||||
{
|
||||
char alarmIdStr[20] = {0};
|
||||
char sensorIdStr[20] = {0};
|
||||
char componentIdStr[20] = {0};
|
||||
char printBuff[256] = {0};
|
||||
const char *originalAlarmInfo = NULL;
|
||||
uint8_t hmsCodeMatchFlag = 0;
|
||||
|
||||
if (!hmsInfoTable.hmsInfo) {
|
||||
USER_LOG_ERROR("Hms info table is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < hmsInfoTable.hmsInfoNum; i++) {
|
||||
hmsCodeMatchFlag = 0;
|
||||
for (int j = 0; j < sizeof(hmsErrCodeInfoTbl) / sizeof(T_DjiHmsErrCodeInfo); j++) {
|
||||
if (hmsInfoTable.hmsInfo[i].errorCode == hmsErrCodeInfoTbl[j].alarmId) {
|
||||
hmsCodeMatchFlag = 1;
|
||||
snprintf(alarmIdStr, sizeof(alarmIdStr), "%u", hmsInfoTable.hmsInfo[i].errorCode);
|
||||
//note:sensor_idx:[0,5].In order to be consistent with the display of pilot, add one.
|
||||
snprintf(sensorIdStr, sizeof(sensorIdStr), "%d", hmsInfoTable.hmsInfo[i].componentIndex + 1);
|
||||
snprintf(componentIdStr, sizeof(componentIdStr), "0x%02X", hmsInfoTable.hmsInfo[i].componentIndex + 1);
|
||||
if (DjiTest_GetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR) {
|
||||
originalAlarmInfo = hmsErrCodeInfoTbl[j].flyAlarmInfo;
|
||||
} else {
|
||||
originalAlarmInfo = hmsErrCodeInfoTbl[j].groundAlarmInfo;
|
||||
}
|
||||
originalAlarmInfo = hmsErrCodeInfoTbl[j].groundAlarmInfo;
|
||||
if (strlen(originalAlarmInfo)) {
|
||||
snprintf(printBuff, sizeof(printBuff), "%s", originalAlarmInfo);
|
||||
DjiTest_ReplaceStr(printBuff, sizeof(printBuff), oldReplaceAlarmIdStr, alarmIdStr);
|
||||
DjiTest_ReplaceStr(printBuff, sizeof(printBuff), oldReplaceIndexStr, sensorIdStr);
|
||||
DjiTest_ReplaceStr(printBuff, sizeof(printBuff), oldReplaceComponentIndexStr, componentIdStr);
|
||||
if (hmsInfoTable.hmsInfo[i].errorLevel > MIN_HMS_ERROR_LEVEL &&
|
||||
hmsInfoTable.hmsInfo[i].errorLevel < MID_HMS_ERROR_LEVEL) {
|
||||
USER_LOG_WARN("[ErrorCode:0x%2x] %s", hmsInfoTable.hmsInfo[i].errorCode, printBuff);
|
||||
} else if (hmsInfoTable.hmsInfo[i].errorLevel >= MID_HMS_ERROR_LEVEL &&
|
||||
hmsInfoTable.hmsInfo[i].errorLevel < MAX_HMS_ERROR_LEVEL) {
|
||||
USER_LOG_ERROR("[ErrorCode:0x%2x] %s", hmsInfoTable.hmsInfo[i].errorCode, printBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hmsCodeMatchFlag) {
|
||||
USER_LOG_WARN("[ErrorCode:0x%2x] There are no matching documents in the current hmsErrCodeInfoTbl for now.",
|
||||
hmsInfoTable.hmsInfo[i].errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable)
|
||||
{
|
||||
if (!DjiTest_MarchErrCodeInfoTable(hmsInfoTable)) {
|
||||
USER_LOG_ERROR("March HMS Information failed.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
if (hmsInfoTable.hmsInfoNum == 0) {
|
||||
USER_LOG_INFO("All systems of drone are running well now.");
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
50
PSDK/samples/sample_c/module_sample/hms/test_hms.h
Normal file
50
PSDK/samples/sample_c/module_sample/hms/test_hms.h
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_hms.h
|
||||
* @brief This is the header file for "test_hms.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2021 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s authorization, you may not
|
||||
* further disseminate the information, and you must immediately remove the
|
||||
* source code and notify DJI of its removal. DJI reserves the right to pursue
|
||||
* legal actions against you for any loss(es) or damage(s) caused by your
|
||||
* failure to do so.
|
||||
*
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef TEST_HMS_H
|
||||
#define TEST_HMS_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "dji_typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_HmsRunSample(void);
|
||||
T_DjiReturnCode DjiTest_HmsStartService(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TEST_HMS_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
Reference in New Issue
Block a user