l2cap.c (675e6881a7fc83a76c055a359c267dd5590a5d09) l2cap.c (bdbe2e4960ce52956c85f51a3bd00b3edcbcf273)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2449 unchanged lines hidden (view full) ---

2458 // TODO: trigger retransmission or something like that
2459 break;
2460 }
2461
2462 // switch on packet type
2463 uint16_t control = little_endian_read_16(packet, COMPLETE_L2CAP_HEADER);
2464 uint8_t req_seq = (control >> 8) & 0x3f;
2465 if (control & 1){
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2449 unchanged lines hidden (view full) ---

2458 // TODO: trigger retransmission or something like that
2459 break;
2460 }
2461
2462 // switch on packet type
2463 uint16_t control = little_endian_read_16(packet, COMPLETE_L2CAP_HEADER);
2464 uint8_t req_seq = (control >> 8) & 0x3f;
2465 if (control & 1){
2466 // int poll = (control >> 7) & 0x01;
2467 log_info("S-Frame not not implemented yet");
2468 // S-Frame
2466 // S-Frame
2467 // int poll = (control >> 7) & 0x01;
2468 l2cap_supervisory_function_t s = (l2cap_supervisory_function_t) ((control >> 2) & 0x03);
2469 l2cap_ertm_tx_packet_state_t * tx_state;
2470 switch (s){
2471 case L2CAP_SUPERVISORY_FUNCTION_RR_RECEIVER_READY:
2472 tx_state = &l2cap_channel->tx_packets_state[l2cap_channel->tx_read_index];
2473 if ( ((req_seq - 1) & 0x3f) == tx_state->tx_seq){
2474 log_info("RR seq %u == seq of oldest tx packet -> packet done", req_seq);
2475 l2cap_channel->tx_read_index++;
2476 if (l2cap_channel->tx_read_index >= l2cap_channel->num_rx_buffers){
2477 l2cap_channel->tx_read_index = 0;
2478 }
2479 } else {
2480 log_info("RR seq %u != seq of oldest tx packet %u ???", req_seq, tx_state->tx_seq);
2481 }
2482 break;
2483 default:
2484 break;
2485 }
2469 break;
2470 } else {
2471 // I-Frame
2472 // get control
2473 l2cap_segmentation_and_reassembly_t sar = (l2cap_segmentation_and_reassembly_t) (control >> 14);
2474 uint8_t tx_seq = (control >> 1) & 0x3f;
2475 log_info("Control: 0x%04x => SAR %u, ReqSeq %02u, R?, TxSeq %02u", control, (int) sar, req_seq, tx_seq);
2476 log_info("SAR: pos %u", l2cap_channel->rx_packets_state->pos);

--- 501 unchanged lines hidden ---
2486 break;
2487 } else {
2488 // I-Frame
2489 // get control
2490 l2cap_segmentation_and_reassembly_t sar = (l2cap_segmentation_and_reassembly_t) (control >> 14);
2491 uint8_t tx_seq = (control >> 1) & 0x3f;
2492 log_info("Control: 0x%04x => SAR %u, ReqSeq %02u, R?, TxSeq %02u", control, (int) sar, req_seq, tx_seq);
2493 log_info("SAR: pos %u", l2cap_channel->rx_packets_state->pos);

--- 501 unchanged lines hidden ---