Compare commits

...
20 Commits
Author SHA1 Message Date
fengzeroz 8f6d9d1c41 Merge pull request #1174 from fengzeroz/v2.4
version: 2.4.1
2023-04-07 16:52:38 +08:00
fengzero 3f75222410 version: 2.4.1 2023-04-07 08:52:01 +00:00
fengzeroz ddf5d252f6 Merge pull request #1173 from ZhouBox/feature-build-2.4
[v2.4]feature:use ghcr.io and use corresponding tag
2023-04-07 16:06:42 +08:00
zhouxiang 6e467f5f27 fix:use tag directly 2023-04-07 15:41:36 +08:00
zhouxiang fd1266bc9e [v2.4]feature:use ghcr.io and use corresponding tag 2023-04-07 14:39:44 +08:00
fengzeroz d8b605ef1c Merge pull request #1172 from fengzeroz/v2.4
serial: more baudrate 300/200/150
2023-04-07 14:23:16 +08:00
fengzero c9122b5b7c serial: more baudrate 300/200/150 2023-04-07 06:21:52 +00:00
fengzeroz 8c11cb3466 Merge pull request #1170 from gc87/spb-float-fix-v2.4
[v2.4]fix: determined f32 type data is treated as d64
2023-04-07 11:07:41 +08:00
gc87 80680c55f5 fix: determined f32 type data is treated as d64 2023-04-07 10:51:14 +08:00
fengzero 132c25b4ad serial: more baudrate 1800/1200/600 2023-04-06 08:14:38 +00:00
fengzeroz cc7e5d092a Merge pull request #1162 from lixiumei123/v2.4
fix(log debug):error reporting that the node does not exist
2023-04-06 14:38:56 +08:00
liyuxi 2e3f6d6db2 fix(log debug):error reporting that the node does not exist 2023-04-06 06:20:56 +00:00
fengzeroz 43a95b7910 Merge pull request #1156 from eeff/eeff/2.4
Pick to 2.4: schema use drop drown selection button for QoS setting
2023-04-06 13:01:09 +08:00
fengzeroz 053be086b0 Merge pull request #1158 from lixiumei123/v2.4
fix(file plugin):fix delay
2023-04-06 13:00:26 +08:00
fengzeroz 66dba0f69a Merge pull request #1160 from fengzeroz/v2.4
limit log size
2023-04-06 12:59:12 +08:00
fengzero c6752c5761 limit log size 2023-04-06 04:57:46 +00:00
liyuxi 53f5c496ea fix(file plugin):fix delay 2023-04-06 02:26:46 +00:00
eeff 1e28e4bc0e fix(mqtt): schema use drop drown selection button for QoS setting 2023-04-04 19:03:41 +08:00
fengzeroz 2bbcc6a154 Merge pull request #1154 from fengzeroz/v2.4
ci: branch v2.4
2023-03-31 17:34:16 +08:00
fengzero 00d6418288 ci: branch v2.4 2023-03-31 09:33:43 +00:00
11 changed files with 104 additions and 97 deletions
+7 -2
View File
@@ -7,6 +7,11 @@ on:
types:
- published
env:
BRANCH: v2.4
jobs:
clang_format_check:
runs-on: ubuntu-20.04
@@ -40,7 +45,7 @@ jobs:
ut:
runs-on: ubuntu-20.04
container: neugates/build:x86_64-main
container: ghcr.io/neugates/build:x86_64-v2.4
steps:
- uses: actions/checkout@v2
@@ -61,7 +66,7 @@ jobs:
ft:
runs-on: ubuntu-20.04
container: neugates/build:x86_64-main
container: ghcr.io/neugates/build:x86_64-v2.4
steps:
- uses: actions/checkout@v2
+5 -5
View File
@@ -8,9 +8,9 @@ on:
- published
env:
VERSION: 2.4.0
UI_VERSION: 2.4.0
BRANCH: main
VERSION: 2.4.1
UI_VERSION: 2.4.1
BRANCH: v2.4
jobs:
cross-build:
@@ -21,7 +21,7 @@ jobs:
- [aarch64-linux-gnu, aarch64, arm64]
- [arm-linux-gnueabihf, armv4, armhf]
- [x86_64-linux-gnu, x86_64, amd64]
container: neugates/build:${{ matrix.arch[1] }}-main
container: ghcr.io/neugates/build:${{ matrix.arch[1] }}-v2.4
steps:
- uses: actions/checkout@v3
@@ -64,7 +64,7 @@ jobs:
matrix:
arch:
- [x86_64-linux-gnu, x86_64, amd64]
container: neugates/build:${{ matrix.arch[1] }}-main
container: ghcr.io/neugates/build:${{ matrix.arch[1] }}-v2.4
steps:
- uses: actions/checkout@v3
+1 -1
View File
@@ -9,5 +9,5 @@ file_format = "%d [%V] %f:%L %m%n"
[rules]
*.* "./logs/%c.log", 100MB * 10 ~ "./logs/%c.#2s.log"; file_format
*.* "./logs/%c.log", 50MB * 1 ~ "./logs/%c.#2s.log"; file_format
*.* >stdout; stdout_format
@@ -40,6 +40,12 @@ typedef enum neu_conn_tty_baud {
NEU_CONN_TTY_BAUD_9600,
NEU_CONN_TTY_BAUD_4800,
NEU_CONN_TTY_BAUD_2400,
NEU_CONN_TTY_BAUD_1800,
NEU_CONN_TTY_BAUD_1200,
NEU_CONN_TTY_BAUD_600,
NEU_CONN_TTY_BAUD_300,
NEU_CONN_TTY_BAUD_200,
NEU_CONN_TTY_BAUD_150,
} neu_conn_tty_baud_e;
typedef enum neu_conn_tty_parity {
+8
View File
@@ -32,6 +32,10 @@ static void plugin_group_free(neu_plugin_group_t *pgp);
int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
{
neu_adapter_update_metric_cb_t update_metric =
plugin->common.adapter_callbacks->update_metric;
int64_t rtt = NEU_METRIC_LAST_RTT_MS_MAX;
struct file_group_data *gd = NULL;
int length = plugin->file_length;
@@ -83,6 +87,8 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
strncpy(dvalue.value.str, buf, strlen(buf));
fclose(f);
rtt = 1;
dvalue_result:
plugin->common.adapter_callbacks->driver.update(
plugin->common.adapter, group->group_name, tag->name, dvalue);
@@ -90,6 +96,8 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
free(buf);
}
update_metric(plugin->common.adapter, NEU_METRIC_LAST_RTT_MS, rtt, NULL);
return 0;
}
+15 -3
View File
@@ -16,12 +16,24 @@
"name_zh": "QoS 等级",
"description": "MQTT QoS level for message delivery",
"description_zh": "MQTT消息传输使用的服务质量等级",
"type": "int",
"type": "map",
"attribute": "optional",
"default": 0,
"valid": {
"min": 0,
"max": 2
"map": [
{
"key": "QoS 0",
"value": 0
},
{
"key": "QoS 1",
"value": 1
},
{
"key": "QoS 2",
"value": 2
}
]
}
},
"format": {
+29 -82
View File
@@ -42,8 +42,6 @@
#include "log_handle.h"
#include "utils/utarray.h"
UT_array *collect_log_files();
void handle_logs_files(nng_aio *aio)
{
void * data = NULL;
@@ -114,94 +112,43 @@ void handle_log_level(nng_aio *aio)
NEU_PROCESS_HTTP_REQUEST_VALIDATE_JWT(
aio, neu_json_update_log_level_req_t,
neu_json_decode_update_log_level_req, {
char node_name[NEU_NODE_NAME_LEN] = { 0 };
int ret = 0;
neu_reqresp_head_t header = { 0 };
neu_req_update_log_level_t cmd = { 0 };
zlog_category_t * ct = zlog_get_category(req->node_name);
zlog_category_t * neuron = zlog_get_category("neuron");
UT_array *log_files = collect_log_files();
utarray_foreach(log_files, char **, log_file)
{
if (strncmp(*log_file, req->node_name, strlen(*log_file) - 4) ==
0) {
strcpy(node_name, req->node_name);
}
}
if (strlen(node_name) == 0) {
NEU_JSON_RESPONSE_ERROR(NEU_ERR_NODE_NOT_EXIST, {
ret = zlog_level_switch(ct, ZLOG_LEVEL_DEBUG);
if (ret != 0) {
nlog_error("Modify node log level fail, node_name:%s, "
"ret: %d,",
req->node_name, ret);
NEU_JSON_RESPONSE_ERROR(NEU_ERR_EINTERNAL, {
neu_http_response(aio, error_code.error, result_error);
});
} else {
int ret = 0;
neu_reqresp_head_t header = { 0 };
neu_req_update_log_level_t cmd = { 0 };
zlog_category_t * ct = zlog_get_category(node_name);
zlog_category_t * neuron = zlog_get_category("neuron");
ret = zlog_level_switch(ct, ZLOG_LEVEL_DEBUG);
if (ret != 0) {
nlog_error("Modify node log level fail, node_name:%s, "
"ret: %d,",
node_name, ret);
NEU_JSON_RESPONSE_ERROR(NEU_ERR_EINTERNAL, {
neu_http_response(aio, error_code.error, result_error);
});
}
ret = zlog_level_switch(neuron, ZLOG_LEVEL_DEBUG);
if (ret != 0) {
nlog_error("Modify neuron log level fail, ret: %d", ret);
NEU_JSON_RESPONSE_ERROR(NEU_ERR_EINTERNAL, {
neu_http_response(aio, error_code.error, result_error);
});
}
header.ctx = aio;
header.type = NEU_REQ_UPDATE_LOG_LEVEL;
strcpy(cmd.node, req->node_name);
ret = neu_plugin_op(plugin, header, &cmd);
if (ret != 0) {
NEU_JSON_RESPONSE_ERROR(NEU_ERR_IS_BUSY, {
neu_http_response(aio, NEU_ERR_IS_BUSY, result_error);
});
}
}
utarray_free(log_files);
ret = zlog_level_switch(neuron, ZLOG_LEVEL_DEBUG);
if (ret != 0) {
nlog_error("Modify neuron log level fail, ret: %d", ret);
NEU_JSON_RESPONSE_ERROR(NEU_ERR_EINTERNAL, {
neu_http_response(aio, error_code.error, result_error);
});
}
header.ctx = aio;
header.type = NEU_REQ_UPDATE_LOG_LEVEL;
strcpy(cmd.node, req->node_name);
ret = neu_plugin_op(plugin, header, &cmd);
if (ret != 0) {
NEU_JSON_RESPONSE_ERROR(NEU_ERR_IS_BUSY, {
neu_http_response(aio, NEU_ERR_IS_BUSY, result_error);
});
}
})
}
static inline bool ends_with(const char *str, const char *suffix)
{
size_t m = strlen(str);
size_t n = strlen(suffix);
return m >= n && !strcmp(str + m - n, suffix);
}
UT_array *collect_log_files()
{
DIR *dp = opendir("./logs");
if (NULL == dp) {
nlog_error("open logs directory fail");
return NULL;
}
UT_array *log_files = NULL;
utarray_new(log_files, &ut_str_icd);
struct dirent *de = NULL;
while (NULL != (de = readdir(dp))) {
char *name = de->d_name;
if (ends_with(de->d_name, ".log")) {
utarray_push_back(log_files, &name);
}
}
closedir(dp);
return log_files;
}
int read_file(const char *file_name, void **datap, size_t *lenp)
{
int rv = 0;
+7 -2
View File
@@ -302,6 +302,8 @@ void neu_adapter_driver_write_tag(neu_adapter_driver_t *driver,
(double) (cmd->value.value.d64 / tag->decimal);
} else if (cmd->value.type == NEU_TYPE_DOUBLE) {
cmd->value.value.d64 = cmd->value.value.d64 / tag->decimal;
} else if (cmd->value.type == NEU_TYPE_FLOAT) {
cmd->value.value.f32 = cmd->value.value.f32 / tag->decimal;
}
break;
default:
@@ -360,8 +362,11 @@ void neu_adapter_driver_write_tag(neu_adapter_driver_t *driver,
}
break;
case NEU_TYPE_FLOAT:
cmd->value.type = NEU_TYPE_FLOAT;
cmd->value.value.f32 = (float) cmd->value.value.d64;
if (NEU_TYPE_FLOAT != cmd->value.type) {
cmd->value.value.f32 = (float) cmd->value.value.d64;
cmd->value.type = NEU_TYPE_FLOAT;
}
switch (tag->option.value32.endian) {
case NEU_DATATAG_ENDIAN_LB32:
neu_ntohs_p((uint16_t *) cmd->value.value.bytes);
+24
View File
@@ -728,6 +728,30 @@ static void conn_connect(neu_conn_t *conn)
cfsetospeed(&tty_opt, B2400);
cfsetispeed(&tty_opt, B2400);
break;
case NEU_CONN_TTY_BAUD_1800:
cfsetospeed(&tty_opt, B1800);
cfsetispeed(&tty_opt, B1800);
break;
case NEU_CONN_TTY_BAUD_1200:
cfsetospeed(&tty_opt, B1200);
cfsetispeed(&tty_opt, B1200);
break;
case NEU_CONN_TTY_BAUD_600:
cfsetospeed(&tty_opt, B600);
cfsetispeed(&tty_opt, B600);
break;
case NEU_CONN_TTY_BAUD_300:
cfsetospeed(&tty_opt, B300);
cfsetispeed(&tty_opt, B300);
break;
case NEU_CONN_TTY_BAUD_200:
cfsetospeed(&tty_opt, B200);
cfsetispeed(&tty_opt, B200);
break;
case NEU_CONN_TTY_BAUD_150:
cfsetospeed(&tty_opt, B150);
cfsetispeed(&tty_opt, B150);
break;
}
switch (conn->param.params.tty_client.parity) {
+1 -1
View File
@@ -1 +1 @@
2.4.0
2.4.1
+1 -1
View File
@@ -8,4 +8,4 @@ simple = "%d [%V] %f:%L %m%n"
[rules]
*.* "./logs/%c.log", 100MB * 10 ~ "./logs/%c.#2s.log"; simple
*.* "./logs/%c.log", 50MB * 1 ~ "./logs/%c.#2s.log"; simple