} PACKED DltServiceConnectionInfo;
/**
+ * The structure of the DLT Service Timezone
+ */
+typedef struct
+{
+ uint32_t service_id; /**< service ID */
+ uint8_t status; /**< reponse status */
+ int32_t timezone; /**< Timezone in seconds */
+ uint8_t isdst; /**< Is daylight saving time */
+} PACKED DltServiceTimezone;
+
+/**
* Structure to store filter parameters.
* ID are maximal four characters. Unused values are filled with zeros.
* If every value as filter is valid, the id should be empty by having only zero values.
#define DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW 0x14 /**< Service ID: Message buffer overflow */\r
#define DLT_SERVICE_ID_UNREGISTER_CONTEXT 0xf01 /**< Service ID: Message unregister context */\r
#define DLT_SERVICE_ID_CONNECTION_INFO 0xf02 /**< Service ID: Message connection info */\r
+#define DLT_SERVICE_ID_TIMEZONE 0xf03 /**< Service ID: Timezone */\r
#define DLT_SERVICE_ID_CALLSW_CINJECTION 0xFFF /**< Service ID: Message Injection (minimal ID) */\r
\r
/*\r
daemon_local->timeoutOnSend = 4;
daemon_local->flags.sendECUSoftwareVersion = 0;
memset(daemon_local->flags.pathToECUSoftwareVersion, 0, sizeof(daemon_local->flags.pathToECUSoftwareVersion));
+ daemon_local->flags.sendTimezone = 0;
/* open configuration file */
if(daemon_local->flags.cvalue[0])
strncpy(daemon_local->flags.pathToECUSoftwareVersion,value,sizeof(daemon_local->flags.pathToECUSoftwareVersion) - 1);
//printf("Option: %s=%s\n",token,value);
}
-
+ else if(strcmp(token,"SendTimezone")==0)
+ {
+ daemon_local->flags.sendTimezone = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
else
{
fprintf(stderr, "Unknown option: %s=%s\n",token,value);
create_timer_fd(&daemon_local, 1, 1, &daemon_local.timer_timingpacket, "Timing packet");
// create fd for timer ecu version
- if(daemon_local.flags.sendECUSoftwareVersion > 0)
+ if(daemon_local.flags.sendECUSoftwareVersion > 0 || daemon_local.flags.sendTimezone > 0)
{
//dlt_daemon_init_ecuversion(&daemon_local);
create_timer_fd(&daemon_local, 60, 60, &daemon_local.timer_ecuversion, "ECU version");
{
dlt_log(LOG_DEBUG, "timingpacket\n");
dlt_daemon_control_message_time(j, daemon, daemon_local->flags.vflag);
+
}
}
}
&& (j!=daemon_local->timer_timingpacket) && (j!=daemon_local->timer_ecuversion))
{
dlt_log(LOG_DEBUG, "ecu_version\n");
- dlt_daemon_control_get_software_version(j, daemon, daemon_local->flags.vflag);
+ if(daemon_local->flags.sendECUSoftwareVersion > 0)
+ dlt_daemon_control_get_software_version(j, daemon, daemon_local->flags.vflag);
+
+ if(daemon_local->flags.sendTimezone > 0)
+ {
+ // send timezone information
+ time_t t = time(NULL);
+ struct tm lt = {0};
+ localtime_r(&t, <);
+ dlt_daemon_control_message_timezone(j,daemon,(int32_t) lt.tm_gmtoff,(uint8_t) lt.tm_isdst,daemon_local->flags.vflag);
+ }
}
}
}
dlt_daemon_control_message_connection_info(DLT_DAEMON_STORE_TO_BUFFER,daemon,DLT_CONNECTION_STATUS_DISCONNECTED,"",verbose);
}
+
/**
\}
*/
char loggingFilename[256]; /**< (String: Filename) The logging filename if internal logging mode is log to file (Default: /tmp/log) */\r
int sendECUSoftwareVersion; /**< (Boolean) Send ECU software version perdiodically */\r
char pathToECUSoftwareVersion[256]; /**< (String: Filename) The file from which to read the ECU version from. */\r
+ int sendTimezone; /**< (Boolean) Send Timezone perdiodically */\r
} DltDaemonFlags;\r
\r
/**\r
# Absolute path to file storing version info - otherwise DLT version is used
# PathToECUSoftwareVersion = <absolute-path-to-file>
+
+########################################################################
+# Timezone info #
+########################################################################
+
+# Send periodic timezone info (Default: 0)
+# SendTimezone = 0
\ No newline at end of file
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 */
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;
+}
* @param verbose if set to true verbose information is printed out.\r
*/\r
int dlt_daemon_control_message_connection_info(int sock, DltDaemon *daemon, uint8_t state, char* comid, int verbose);\r
+/**\r
+ * Send control message connection info (add on to AUTOSAR standard)\r
+ * @param sock connection handle used for sending response\r
+ * @param daemon pointer to dlt daemon structure\r
+ * @param timezone timezone on target\r
+ * @param verbose if set to true verbose information is printed out.\r
+ */\r
+int dlt_daemon_control_message_timezone(int sock, DltDaemon *daemon, int32_t timezone, uint8_t isdst, int verbose);\r
\r
#ifdef __cplusplus\r
}\r