summaryrefslogtreecommitdiff
path: root/src/daemon/dlt_daemon_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/dlt_daemon_common.c')
-rw-r--r--src/daemon/dlt_daemon_common.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index be472a3..7b96a9d 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -2117,6 +2117,58 @@ void dlt_daemon_control_service_response( int sock, DltDaemon *daemon, uint32_t
dlt_message_free(&msg,0);
}
+void dlt_daemon_control_send_ecu_version(int sock, DltDaemon *daemon, const char *version, int verbose)
+{
+ DltMessage msg;
+ uint32_t len;
+ DltServiceGetSoftwareVersionResponse *resp;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ if (daemon==0 || version == NULL)
+ {
+ return;
+ }
+
+ /* initialise new message */
+ if (dlt_message_init(&msg,0)==-1)
+ {
+ dlt_daemon_control_service_response(sock, daemon, DLT_SERVICE_ID_GET_SOFTWARE_VERSION, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ return;
+ }
+
+ /* prepare payload of data */
+ len = strlen(version);
+
+ msg.datasize = sizeof(DltServiceGetSoftwareVersionResponse) + len;
+ if (msg.databuffer && (msg.databuffersize < msg.datasize))
+ {
+ free(msg.databuffer);
+ msg.databuffer=0;
+ }
+ if (msg.databuffer == 0){
+ msg.databuffer = (uint8_t *) malloc(msg.datasize);
+ msg.databuffersize = msg.datasize;
+ }
+ if (msg.databuffer==0)
+ {
+ dlt_daemon_control_service_response(sock, daemon, DLT_SERVICE_ID_GET_SOFTWARE_VERSION, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ return;
+ }
+
+ resp = (DltServiceGetSoftwareVersionResponse*) msg.databuffer;
+ resp->service_id = DLT_SERVICE_ID_GET_SOFTWARE_VERSION;
+ resp->status = DLT_SERVICE_RESPONSE_OK;
+ resp->length = len;
+ memcpy(msg.databuffer+sizeof(DltServiceGetSoftwareVersionResponse),version,len);
+
+ /* send message */
+ dlt_daemon_control_send_control_message(sock, daemon, &msg,"","", verbose);
+
+ /* free message */
+ dlt_message_free(&msg,0);
+}
+
void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* ctid, int verbose)
{
ssize_t ret;
@@ -2457,4 +2509,3 @@ void dlt_daemon_control_message_time(int sock, DltDaemon *daemon, int verbose)
/* free message */
dlt_message_free(&msg,0);
}
-