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

correction for the bug due to the name of the function end() #62

Merged
merged 1 commit into from
Dec 14, 2016
Merged
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/telemetry/c/framing.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void outgoing_storage(uint8_t * buf, uint32_t bufSize)
outgoingStorage.size = bufSize;
}

void begin()
void begin_frame()
{
if(outgoingStorage.size == 0 || outgoingStorage.ptr == NULL)
return;
Expand Down Expand Up @@ -97,7 +97,7 @@ void append4(uint32_t fourbytes)
append(ptr[3]);
}

uint32_t end()
uint32_t end_frame()
{
if(outgoingStorage.size == 0 || outgoingStorage.ptr == NULL)
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/telemetry/c/telemetry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ uint16_t payload(const void * p, uint32_t size, uint16_t crc)
void frame(const char * t, TM_type type, const void * data, uint32_t datasize)
{
// start new frame
begin();
begin_frame();

// header
uint16_t crc = header(type);
Expand All @@ -207,7 +207,7 @@ void frame(const char * t, TM_type type, const void * data, uint32_t datasize)
append2(crc);

// complete frame
uint32_t bytesAmount = end();
uint32_t bytesAmount = end_frame();

// send data
send(outgoingBuffer, bytesAmount);
Expand Down
4 changes: 2 additions & 2 deletions src/telemetry/headers/framing.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ void initialize_framing();
// Set storage for the outgoing frame
void outgoing_storage(uint8_t * buf, uint32_t bufSize);

void begin();
void begin_frame();
void append(uint8_t byte);
void append2(uint16_t twobytes);
void append4(uint32_t fourbytes);
uint32_t end();
uint32_t end_frame();

// Incoming data
// Set storage for the incoming data
Expand Down
12 changes: 6 additions & 6 deletions test/c/framing_outgoing_suite.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ TEST framing_simple_frame()
initialize_framing();
outgoing_storage(outgoingBuffer,12);

begin();
begin_frame();
append(0xFF);
uint32_t amount = end();
uint32_t amount = end_frame();

ASSERT_EQ_FMT(3,amount,"%d");

Expand All @@ -33,11 +33,11 @@ TEST framing_with_escaping()
initialize_framing();
outgoing_storage(outgoingBuffer,12);

begin();
begin_frame();
append(0xF7);
append(0x7F);
append(0x7D);
uint32_t amount = end();
uint32_t amount = end_frame();

ASSERT_EQ_FMT(8,amount,"%d");

Expand All @@ -59,10 +59,10 @@ TEST framing_overflow()
initialize_framing();
outgoing_storage(outgoingBuffer,3);

begin();
begin_frame();
append(0xFF);
append(0xFF);
uint32_t amount = end();
uint32_t amount = end_frame();

ASSERT_EQ_FMT(0,amount,"%d");

Expand Down