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

fix type inconsistencies in send API #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/isotp/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ IsoTpSendHandle isotp_send_multi_frame(IsoTpShims* shims, IsoTpMessage* message,
return handle;
}

IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint16_t arbitration_id,
IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint32_t arbitration_id,
const uint8_t payload[], uint16_t size,
IsoTpMessageSentHandler callback) {
IsoTpMessage message = {
Expand All @@ -73,7 +73,7 @@ IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint16_t arbitration_id,
}

bool isotp_continue_send(IsoTpShims* shims, IsoTpSendHandle* handle,
const uint16_t arbitration_id, const uint8_t data[],
const uint32_t arbitration_id, const uint8_t data[],
const uint8_t size) {
// TODO this will need to be tested when we add multi-frame support,
// which is when it'll be necessary to pass in CAN messages to SENDING
Expand Down
4 changes: 2 additions & 2 deletions src/isotp/send.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef struct {
* multi-frame messages. The 'completed' field in the returned IsoTpSendHandle
* will be true when the message is completely sent.
*/
IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint16_t arbitration_id,
IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint32_t arbitration_id,
const uint8_t payload[], uint16_t size,
IsoTpMessageSentHandler callback);

Expand All @@ -76,7 +76,7 @@ IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint16_t arbitration_id,
* it was successful.
*/
bool isotp_continue_send(IsoTpShims* shims, IsoTpSendHandle* handle,
const uint16_t arbitration_id, const uint8_t data[],
const uint32_t arbitration_id, const uint8_t data[],
const uint8_t size);

#ifdef __cplusplus
Expand Down
6 changes: 3 additions & 3 deletions tests/test_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern void setup();
START_TEST (test_send_empty_payload)
{
SHIMS.frame_padding = false;
uint16_t arbitration_id = 0x2a;
uint32_t arbitration_id = 0x2a;
IsoTpSendHandle handle = isotp_send(&SHIMS, arbitration_id, NULL, 0, message_sent);
fail_unless(handle.success);
fail_unless(handle.completed);
Expand All @@ -49,7 +49,7 @@ START_TEST (test_send_single_frame)
{
SHIMS.frame_padding = false;
const uint8_t payload[] = {0x12, 0x34};
uint16_t arbitration_id = 0x2a;
uint32_t arbitration_id = 0x2a;
isotp_send(&SHIMS, arbitration_id, payload, sizeof(payload), message_sent);
ck_assert_int_eq(last_message_sent_arb_id, arbitration_id);
fail_unless(last_message_sent_status);
Expand All @@ -70,7 +70,7 @@ START_TEST (test_send_multi_frame)
{
const uint8_t payload[] = {0x12, 0x34, 0x56, 0x78, 0x90, 0x01, 0x23,
0x45, 0x67, 0x89};
uint16_t arbitration_id = 0x2a;
uint32_t arbitration_id = 0x2a;
IsoTpSendHandle handle = isotp_send(&SHIMS, arbitration_id, payload, sizeof(payload),
message_sent);
fail_unless(handle.completed);
Expand Down