COVESA / dlt-viewer

Diagnostic Log and Trace viewing program
Other
408 stars 236 forks source link

Value to String conversion in Non Verbose Mode #478

Open Thil000 opened 1 month ago

Thil000 commented 1 month ago

we are using non verbose mode for our logging. Often times, we are printing states and values for eg below function:

define INIT_STATE 0x01

define RUN_STATE 0x02

define DE_INIT_STATE 0x03

void main (void) { uint8 state = INIT_STATE;

switch(state):
    case INIT_STATE:
          func_a();
     break;
    case RUN_STATE:
        func_b();
     break;
    case DE_INIT_STATE:
        func_c();
     break;

 DLT_NONVERBOSE_MODE();
 DLT_LOG_ID(appid, DLT_LOG_INFO, msg_id, DLT_INIT(state);

}

we have updated fibex.xml as below:

        <!--=============== 1. Parameter ==================-->
        <fx:PDU ID="PDU_11_0">
            <ho:SHORT-NAME>PDU_11_0</ho:SHORT-NAME>
            <ho:DESC>STATE:</ho:DESC>
            <fx:BYTE-LENGTH>0</fx:BYTE-LENGTH>
            <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
        </fx:PDU>
        <!--=============== 2. Parameter ==================-->
        <fx:PDU ID="PDU_11_1">
            <ho:SHORT-NAME>PDU_11_1</ho:SHORT-NAME>
            <fx:BYTE-LENGTH>1</fx:BYTE-LENGTH>
            <fx:PDU-TYPE>OTHER</fx:PDU-TYPE>
            <fx:SIGNAL-INSTANCES>
                <fx:SIGNAL-INSTANCE ID="S_11_1">
                    <fx:SEQUENCE-NUMBER>0</fx:SEQUENCE-NUMBER>
                    <fx:SIGNAL-REF ID-REF="S_UINT8"/>
                </fx:SIGNAL-INSTANCE>
            </fx:SIGNAL-INSTANCES>
        </fx:PDU>

It is printed as below in DLT_Viewer after loading the plugin fibex.xml: 182339 2024/05/13 13:56:12.883000 87.8642 153 ECU APP CNT 0 log info non-verbose STATE: 1 182339 2024/05/13 13:56:12.883000 87.8642 153 ECU APP CNT 0 log info non-verbose STATE: 2 182339 2024/05/13 13:56:12.883000 87.8642 153 ECU APP CNT 0 log info non-verbose STATE: 3

Can we map it to the strings as below so it is readable and easily understandable? 182339 2024/05/13 13:56:12.883000 87.8642 153 ECU APP CNT 0 log info non-verbose STATE: INIT_STATE
182339 2024/05/13 13:56:12.883000 87.8642 153 ECU APP CNT 0 log info non-verbose STATE: RUN_STATE 182339 2024/05/13 13:56:12.883000 87.8642 153 ECU APP CNT 0 log info non-verbose STATE: DE_INIT_STATE

Is this possible? Should we update the plugin in such way? Could you please guide.

alexmucde commented 1 month ago

@Thil000 Yes thats an intersting feature. Please provide an update of the plugin if possible. Do you also have an idea how to extend the Fibex file? Is there a standard way?