Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDS Client #37

Open
guru0808 opened this issue Jul 23, 2024 · 4 comments
Open

UDS Client #37

guru0808 opened this issue Jul 23, 2024 · 4 comments

Comments

@guru0808
Copy link

Hi
I cannot find any example related to UDS Client usage. However i have figured out a way to read the response data and would like to verify if there is any other way. In simple terms I wait for idle state after executing request then read data from buffer

 case JOB_FUNC_W8_RESP:
            // IVEC_BSW_LOG(LOG_STRING, "Waiting for resp %d\n", l_i32Error);
            if(UDSClientPoll(&__gprv_UdsClient)==UDS_CLIENT_IDLE)
            {
                IVEC_BSW_LOG(LOG_STRING, "Request Complete.\n");
                **for (int i = 0; i < __gprv_UdsClient.recv_size; i++) 
                    printf("%02X ", __gprv_UdsClient.recv_buf[i]); // my data
                printf("\n");**//
                 __lprv_i32JobStepNo = JOB_FUNC_FINISH;
            }
        
        break;
@driftregion
Copy link
Owner

Looks about right. There is an example here: https://github.com/driftregion/iso14229/blob/main/examples/linux_server_0x27/client.c

@guru0808
Copy link
Author

Right.
I also faced a scenario where i am requesting to change session from client to server. And i am receiving data bytes as following
[0x7f,0x10,0x11] which is right as per my implementation. In such case, Am i supposed to parse response from recv_buff data because i'm not getting any failure notification. As per this block, my response is probably getting into the else block. Belowis a snippet from function _ClientHandleResponse.

 if (0x7F == client->recv_buf[0]) {
        if (kRequestCorrectlyReceived_ResponsePending == client->recv_buf[2]) {
            UDS_DBG_PRINT("got RCRRP, setting p2 timer\n");
            client->p2_timer = UDSMillis() + client->p2_star_ms;
            memset(client->recv_buf, 0, client->recv_buf_size);
            client->recv_size = 0;
            UDSTpAckRecv(client->tp);
            changeState(client, kRequestStateAwaitResponse);
            return;
        } else {
            ;
        }
    } 

Also, i don't see the inokation of UDSClient.fn .

@driftregion
Copy link
Owner

You can use the UDS_NEG_RESP_IS_ERR option to enable errors in response to server NRCs. See:

https://github.com/driftregion/iso14229/blob/24c60fdab402765eb8ef6cabad111534827cbc9d/test/test_client_0x11_ECU_reset.c#L31C19-L31C38

Also, i don't see the inokation of UDSClient.fn .

yes, that API is unfinished. Sorry about that.

@momet83
Copy link

momet83 commented Oct 11, 2024

is it possible to upload the *.sln?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants