mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: Add csv report support in Bulkdata mqtt
This commit is contained in:
parent
d01f484999
commit
0714c79917
3 changed files with 41 additions and 9 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=obuspa
|
PKG_NAME:=obuspa
|
||||||
PKG_VERSION:=9.0.4.6
|
PKG_VERSION:=9.0.4.7
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
|
|
|
||||||
|
|
@ -455,16 +455,37 @@ index 915b282..f799793 100755
|
||||||
|
|
||||||
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
|
||||||
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
|
||||||
@@ -2547,7 +2729,7 @@ void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp)
|
@@ -2547,11 +2729,24 @@ void bulkdata_process_profile_mqtt(bulkdata_profile_t *bp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit if unable to generate the report
|
// Exit if unable to generate the report
|
||||||
- report = bulkdata_generate_json_report(bp, ctrl.report_timestamp);
|
- report = bulkdata_generate_json_report(bp, ctrl.report_timestamp);
|
||||||
+ report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
- if (report == NULL)
|
||||||
if (report == NULL)
|
- {
|
||||||
{
|
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||||
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
- return;
|
||||||
@@ -2762,7 +2944,7 @@ int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *ou
|
+ if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
|
||||||
|
+ report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
|
||||||
|
+ if (report == NULL)
|
||||||
|
+ {
|
||||||
|
+ USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ } else if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_CSV) == 0) {
|
||||||
|
+ report = bulkdata_generate_csv_report(bp, ctrl.field_separator, ctrl.row_separator, ctrl.escape_char,
|
||||||
|
+ ctrl.csv_format, ctrl.row_timestamp);
|
||||||
|
+ if (report == NULL)
|
||||||
|
+ {
|
||||||
|
+ USP_ERR_SetMessage("%s: bulkdata_generate_csv_report failed", __FUNCTION__);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ USP_ERR_SetMessage("%s: bulkdata invalid report encoding type %s", __FUNCTION__, ctrl.encoding_type);
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print out the JSON report, if debugging is enabled
|
||||||
|
@@ -2762,7 +2957,7 @@ int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *ou
|
||||||
** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
@ -473,7 +494,7 @@ index 915b282..f799793 100755
|
||||||
{
|
{
|
||||||
JsonNode *top; // top of report
|
JsonNode *top; // top of report
|
||||||
JsonNode *array; // array of reports (retained + current)
|
JsonNode *array; // array of reports (retained + current)
|
||||||
@@ -2867,6 +3049,483 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
@@ -2867,6 +3062,483 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -957,7 +978,7 @@ index 915b282..f799793 100755
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
**
|
**
|
||||||
** bulkdata_compress_report
|
** bulkdata_compress_report
|
||||||
@@ -3070,6 +3729,20 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
@@ -3070,6 +3742,20 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
|
||||||
flags |= BDC_FLAG_DATE_HEADER;
|
flags |= BDC_FLAG_DATE_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
11
obuspa/patches/1002-mqtt-qos.patch
Normal file
11
obuspa/patches/1002-mqtt-qos.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- a/src/core/device_bulkdata.c 2025-02-18 16:49:27.507575767 +0530
|
||||||
|
+++ b/src/core/device_bulkdata.c 2025-02-18 16:51:45.535693108 +0530
|
||||||
|
@@ -374,6 +374,8 @@
|
||||||
|
// Device.BulkData.Profile.{i}.MQTT
|
||||||
|
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.Reference", "", Validate_BulkDataMqttReference, NULL, DM_STRING);
|
||||||
|
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.PublishTopic", "", NULL, NULL, DM_STRING);
|
||||||
|
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.PublishQoS", TO_STR(MQTT_FALLBACK_QOS), NULL, NULL, DM_UINT);
|
||||||
|
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.MQTT.PublishRetain", "false", NULL, NULL, DM_BOOL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Register Push! Event
|
||||||
Loading…
Add table
Reference in a new issue