summaryrefslogtreecommitdiff
path: root/src/daemon/dlt_daemon_common.c
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-12-09 13:52:31 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-01-10 07:16:04 +0100
commitbff03e36c4ef0fe7f49403bbbcb49d48493293b7 (patch)
tree33685b60ed90d0830b9708af97394e2ecb0e3686 /src/daemon/dlt_daemon_common.c
parent302499439d5cdfab0ed7a2bf850e644eb98874df (diff)
downloadDLT-daemon-bff03e36c4ef0fe7f49403bbbcb49d48493293b7.tar.gz
Added new control message timezone.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/daemon/dlt_daemon_common.c')
-rw-r--r--src/daemon/dlt_daemon_common.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index bbd058d..df9ccbe 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -2631,7 +2631,7 @@ int dlt_daemon_control_message_unregister_context(int sock, DltDaemon *daemon, c
resp->service_id = DLT_SERVICE_ID_UNREGISTER_CONTEXT;
resp->status = DLT_SERVICE_RESPONSE_OK;
dlt_set_id(resp->apid, apid);
- dlt_set_id(resp->apid, ctid);
+ dlt_set_id(resp->ctid, ctid);
dlt_set_id(resp->comid, comid);
/* send message */
@@ -2704,3 +2704,61 @@ int dlt_daemon_control_message_connection_info(int sock, DltDaemon *daemon, uint
return 0;
}
+
+int dlt_daemon_control_message_timezone(int sock, DltDaemon *daemon, int32_t timezone, uint8_t isdst, int verbose)
+{
+ DltMessage msg;
+ DltServiceTimezone *resp;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ if (daemon==0)
+ {
+ return -1;
+ }
+
+ /* initialise new message */
+ if (dlt_message_init(&msg,0)==-1)
+ {
+ dlt_daemon_control_service_response(sock, daemon, DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ return -1;
+ }
+
+ /* prepare payload of data */
+ msg.datasize = sizeof(DltServiceTimezone);
+ 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)
+ {
+ if (sock!=DLT_DAEMON_STORE_TO_BUFFER)
+ {
+ dlt_daemon_control_service_response(sock, daemon, DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW, DLT_SERVICE_RESPONSE_ERROR, verbose);
+ }
+ return -1;
+ }
+
+ resp = (DltServiceTimezone*) msg.databuffer;
+ resp->service_id = DLT_SERVICE_ID_TIMEZONE;
+ resp->status = DLT_SERVICE_RESPONSE_OK;
+ resp->timezone = timezone;
+ resp->isdst = isdst;
+
+ /* send message */
+ if(dlt_daemon_control_send_control_message(sock,daemon,&msg,"","", verbose))
+ {
+ dlt_message_free(&msg,0);
+ return -1;
+ }
+
+ /* free message */
+ dlt_message_free(&msg,0);
+
+ return 0;
+}