break;\r
}\r
}\r
+\r
+/** RFCOMM layer callback for when a packet is received on an open RFCOMM channel.\r
+ *\r
+ * \param[in] RFCOMMChannel RFCOMM channel that the data was directed to\r
+ * \param[in] DataLen Length of the received data, in bytes\r
+ * \param[in] Data Pointer to a buffer where the received data is stored\r
+ */\r
+void RFCOMM_DataReceived(RFCOMM_Channel_t* const RFCOMMChannel, uint16_t DataLen, const uint8_t* Data)\r
+{\r
+ /* Write the received bytes to the serial port */\r
+ for (uint8_t i = 0; i < DataLen; i++)\r
+ putchar(Data[i]);\r
+}\r
BT_RFCOMM_DEBUG(1, "<< UIH Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
BT_RFCOMM_DEBUG(2, "-- Length 0x%02X", FrameLength);
-
- puts("RFCOMM Data: ");
- for (uint8_t i = 0; i < FrameLength; i++)
- printf("0x%02X (%c) ", FrameData[i], FrameData[i]);
+ RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
- printf("\r\n");
+ if (RFCOMMChannel != NULL)
+ RFCOMM_DataReceived(RFCOMMChannel, FrameLength, FrameData);
}
void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
Bluetooth_Channel_t* const BluetoothChannel);
+ void RFCOMM_DataReceived(RFCOMM_Channel_t* const RFCOMMChannel, uint16_t DataLen, const uint8_t* Data);
+
RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI);
RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI);
uint16_t RFCOMM_GetVariableFieldValue(const uint8_t** BufferPos);