- RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, BluetoothChannel);
+ RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, ACLChannel);
+}
+
+/** Sends new data through an open logical RFCOMM channel. This should be used to transmit data through a
+ * RFCOMM channel once it has been opened.
+ *
+ * \param[in] DataLen Length of the RFCOMM data to send, in bytes
+ * \param[in] Data Pointer to a buffer where the data to send is located
+ * \param[in] RFCOMMChannel RFCOMM logical channel which is to be transmitted to
+ * \param[in] ACLChannel ACL channel which has been opened to carry RFCOMM traffic between devices
+ */
+void RFCOMM_SendData(const uint16_t DataLen,
+ const uint8_t* Data,
+ const RFCOMM_Channel_t* const RFCOMMChannel,
+ Bluetooth_Channel_t* const ACLChannel)
+{
+ if (RFCOMMChannel->State != RFCOMM_Channel_Open)
+ return;
+
+ BT_RFCOMM_DEBUG(1, ">> UIH Frame");
+ BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", RFCOMMChannel->DLCI);
+
+ /* Send the MSC command to the remote device */
+ RFCOMM_SendFrame(RFCOMMChannel->DLCI, false, RFCOMM_Frame_UIH, DataLen, Data, ACLChannel);