mqtt default version: V311

This commit is contained in:
hxy7yx
2024-09-10 11:19:38 +08:00
parent a64e844349
commit f0638afa3b
5 changed files with 5 additions and 59 deletions
-19
View File
@@ -1,23 +1,4 @@
{
"version": {
"name": "MQTT Version",
"name_zh": "MQTT 版本",
"type": "map",
"attribute": "optional",
"default": 5,
"valid": {
"map": [
{
"key": "3.1.1",
"value": 4
},
{
"key": "5.0",
"value": 5
}
]
}
},
"client-id": {
"name": "Client ID",
"name_zh": "客户端 ID",
-19
View File
@@ -1,23 +1,4 @@
{
"version": {
"name": "MQTT Version",
"name_zh": "MQTT 版本",
"type": "map",
"attribute": "optional",
"default": 5,
"valid": {
"map": [
{
"key": "3.1.1",
"value": 4
},
{
"key": "5.0",
"value": 5
}
]
}
},
"device-id": {
"name": "Device ID",
"name_zh": "设备 ID",
+1 -15
View File
@@ -73,12 +73,6 @@ static int azure_parse_config(neu_plugin_t *plugin, const char *setting,
char * write_resp_topic = NULL;
char * username = NULL;
neu_json_elem_t version = {
.name = "version",
.t = NEU_JSON_INT,
.v.val_int = NEU_MQTT_VERSION_V5, // default to V5
.attribute = NEU_JSON_ATTRIBUTE_OPTIONAL, // for backward compatibility
};
neu_json_elem_t client_id = { .name = "device-id", .t = NEU_JSON_STR };
neu_json_elem_t qos = { .name = "qos", .t = NEU_JSON_INT };
neu_json_elem_t format = { .name = "format", .t = NEU_JSON_INT };
@@ -101,14 +95,6 @@ static int azure_parse_config(neu_plugin_t *plugin, const char *setting,
goto error;
}
ret = neu_parse_param(setting, &err_param, 1, &version);
if (0 != ret) {
plog_error(
plugin,
"parsing mqtt version fail, key: `%s`. Set default version: mqttv5",
err_param);
}
// client-id, required
if (0 == strlen(client_id.v.val_str)) {
plog_error(plugin, "setting empty client-id");
@@ -179,7 +165,7 @@ static int azure_parse_config(neu_plugin_t *plugin, const char *setting,
goto error;
}
config->version = version.v.val_int;
config->version = NEU_MQTT_VERSION_V311;
config->client_id = client_id.v.val_str;
config->qos = qos.v.val_int;
config->format = format.v.val_int;
+1 -1
View File
@@ -4,7 +4,7 @@
"name_zh": "MQTT 版本",
"type": "map",
"attribute": "optional",
"default": 5,
"default": 4,
"valid": {
"map": [
{
+3 -5
View File
@@ -221,7 +221,7 @@ int mqtt_config_parse(neu_plugin_t *plugin, const char *setting,
neu_json_elem_t version = {
.name = "version",
.t = NEU_JSON_INT,
.v.val_int = NEU_MQTT_VERSION_V5, // default to V5
.v.val_int = NEU_MQTT_VERSION_V311, // default to V311
.attribute = NEU_JSON_ATTRIBUTE_OPTIONAL, // for backward compatibility
};
neu_json_elem_t client_id = { .name = "client-id", .t = NEU_JSON_STR };
@@ -276,10 +276,8 @@ int mqtt_config_parse(neu_plugin_t *plugin, const char *setting,
ret = neu_parse_param(setting, &err_param, 1, &version);
if (0 != ret) {
plog_error(
plugin,
"parsing mqtt version fail, key: `%s`. Set default version: mqttv5",
err_param);
plog_error(plugin, "parsing mqtt version fail, key: `%s`.", err_param);
goto error;
}
// client-id, required