+ const RFCOMM_MSC_Parameters_t* Params = (const RFCOMM_MSC_Parameters_t*)CommandData;\r
+\r
+ BT_RFCOMM_DEBUG(1, "<< MSC %s", (CommandHeader->CR) ? "Command" : "Response");\r
+ BT_RFCOMM_DEBUG(2, "-- DLCI: 0x%02X", Params->Channel.DLCI);\r
+ \r
+ /* Ignore status flags sent to the control channel */\r
+ if (Params->Channel.DLCI == RFCOMM_CONTROL_DLCI)\r
+ return;\r
+ \r
+ /* Retrieve existing channel configuration data, if already opened */\r
+ RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->Channel.DLCI); \r
+ \r
+ /* If the channel does not exist, abort */\r
+ if (RFCOMMChannel == NULL)\r
+ return;\r
+\r
+ /* Check if the MSC packet is a command or a response */\r
+ if (CommandHeader->CR)\r
+ {\r
+ /* Save the new channel signals to the channel state structure */\r
+ RFCOMMChannel->Remote.Signals = Params->Signals; \r
+ RFCOMMChannel->ConfigFlags |= RFCOMM_CONFIG_REMOTESIGNALS;\r
+ \r
+ /* If the command contains the optional break signals field, store the value */\r
+ if (CommandDataLen == sizeof(RFCOMM_MSC_Parameters_t))\r
+ RFCOMMChannel->Remote.BreakSignal = Params->BreakSignal;\r
+ \r
+ struct\r
+ {\r
+ RFCOMM_Command_t CommandHeader;\r
+ uint8_t Length;\r
+ RFCOMM_MSC_Parameters_t Params;\r
+ } MSResponse;\r
+\r
+ /* Fill out the MS response data */\r
+ MSResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_ModemStatus, .EA = true, .CR = false};\r
+ MSResponse.Length = (CommandDataLen << 1) | 0x01;\r
+ memcpy(&MSResponse.Params, Params, sizeof(RFCOMM_MSC_Parameters_t));\r
+\r
+ BT_RFCOMM_DEBUG(1, ">> MSC Response");\r
+\r
+ /* Send the MSC response to acknowledge the command */\r
+ RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH,\r
+ (sizeof(MSResponse) - sizeof(MSResponse.Params) + CommandDataLen), &MSResponse, Channel);\r
+ }\r
+ else\r
+ {\r
+ /* Indicate that the remote device has acknowledged the sent signals */\r
+ RFCOMMChannel->ConfigFlags |= RFCOMM_CONFIG_LOCALSIGNALS;\r
+ } \r