summaryrefslogtreecommitdiffstats
path: root/src/isotp/receive.c
blob: 1d623384f325c148138ab54b4f9ffe3a2867e1d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <isotp/receive.h>

void isotp_handle_single_frame(IsoTpHandle* handle,
        IsoTpMessage* message) {
    isotp_complete_receive(handle, message);
}

void isotp_complete_receive(IsoTpHandle* handle, IsoTpMessage* message) {
    handle->receive_handle.message_received_callback(message);
}

IsoTpHandle isotp_receive(IsoTpShims* shims,
        const uint16_t arbitration_id, IsoTpMessageReceivedHandler callback) {
    IsoTpReceiveHandle receive_handle = {
        arbitration_id: arbitration_id,
        message_received_callback: callback
    };

    IsoTpHandle handle = {
        success: false,
        completed: true,
        receive_handle: receive_handle,
        type: ISOTP_HANDLE_RECEIVING
    };
    return handle;
}