Process incoming stream packets

This commit is contained in:
Jeremy Lakeman 2013-02-15 09:11:08 +10:30
parent 4d674d06b9
commit 2193d8fb74
2 changed files with 7 additions and 4 deletions

View File

@ -595,8 +595,13 @@ static void interface_read_stream(struct overlay_interface *interface){
WHY_perror("read");
return;
}
struct slip_decode_state *state=&interface->slip_decode_state;
if (config.debug.slip)
dump("RX bytes",&state->src[state->src_offset],
state->src_size-state->src_offset);
state->src=buffer;
state->src_size=nread;
state->src_offset=0;
@ -604,7 +609,7 @@ static void interface_read_stream(struct overlay_interface *interface){
while (state->src_offset < state->src_size) {
int ret = slip_decode(state);
if (ret==1){
packetOkOverlay(interface, state->dst, state->dst_offset, -1, NULL, -1);
packetOkOverlay(interface, state->dst, state->packet_length, -1, NULL, -1);
state->dst_offset=0;
}
}

4
slip.c
View File

@ -235,8 +235,6 @@ int slip_decode(struct slip_decode_state *state)
case SLIP_FORMAT_UPPER7:
{
if (config.debug.slip) {
dump("RX bytes",&state->src[state->src_offset],
state->src_size-state->src_offset);
if (state->rssi_len<0) state->rssi_len=0;
if (state->rssi_len>=RSSI_TEXT_SIZE) state->rssi_len=RSSI_TEXT_SIZE-1;
state->rssi_text[state->rssi_len]=0;
@ -257,7 +255,7 @@ int slip_decode(struct slip_decode_state *state)
} else {
if (config.debug.packetradio)
DEBUGF("Accepted packet of %d bytes (CRC ok)",state->packet_length);
return state->packet_length;
return 1;
}
}
}