I have an application that sets up UART1 and GSM streams for FCM handling when a call comes in. If I don’t answer the call (cancel the atd before ‘CONNECT’) then the streams all close down properly and I can make another call.
If, however, I allow the session to connect the stream for the UART does not close, any ideas why?
Here’s a cut-down version of the code:
s8 CallEventHandler (u16 Event, u32 CallID)
{
s8 ReturnValue=ADL_CALL_FORWARD;
switch (Event)
{
case ADL_CALL_EVENT_RING_DATA:
if (adl_fcmIsAvailable(ADL_PORT_UART1)==TRUE)
{
//Listen for local comms events
UART_FlowControlHandle=adl_fcmSubscribe (ADL_PORT_UART1, (adl_fcmCtrlHdlr_f)UART_FCMControlHandler, (adl_fcmDataHdlr_f)UART_FCMDataHandler);
if (UART_FlowControlHandle<0)
{
OutputTraceAndNumber (1, "Failed to subscribe to UART flow control, response : ", UART_FlowControlHandle);
}
//Listen for GSM comms events
GSM_FlowControlHandle=adl_fcmSubscribe (ADL_PORT_GSM_BASE, (adl_fcmCtrlHdlr_f)GSM_FCMControlHandler, (adl_fcmDataHdlr_f)GSM_FCMDataHandler);
if (GSM_FlowControlHandle<0)
{
OutputTraceAndNumber (1, "Failed to subscribe to GSM flow control, response : ", GSM_FlowControlHandle);
}
OutputTrace (1, "UART switched to data mode");
OutputTrace (1, "Incoming data call, answering call ...");
//This answers the call
ReturnValue=ADL_CALL_NO_FORWARD_ATA;
}
else
{
OutputTrace (1, "Ignoring incoming call, UART unavailable");
}
break;
case ADL_CALL_EVENT_ANSWER_OK:
//Call set up after a ADL_CALL_NO_FORWARD_ATA
OutputTraceAndNumber (1, "Answered OK, speed : ", CallID);
//Switch the UART to data mode
adl_fcmSwitchV24State (UART_FlowControlHandle, ADL_FCM_V24_STATE_DATA);
break;
}
return ReturnValue;
}
//---------------------------------------------------------------------------------
void Hangup()
{
//Switch back to 'AT mode'
adl_fcmSwitchV24State (UART_FlowControlHandle, ADL_FCM_V24_STATE_AT);
OutputTrace (1, "UART returned to 'AT' mode");
//Release the flow control handle for UART
adl_fcmUnsubscribe (UART_FlowControlHandle);
OutputTrace (1, "UART stream unsubscribed");
//Release the flow control handle for GSM
adl_fcmUnsubscribe (GSM_FlowControlHandle);
OutputTrace (1, "GSM stream unsubscribed");
}
//---------------------------------------------------------------------------------
bool GSM_FCMControlHandler (adl_fcmEvent_e Event)
{
switch (Event)
{
case ADL_FCM_EVENT_FLOW_CLOSED:
OutputTrace (1, "GSM stream closed");
Hangup();
break;
}
return TRUE;
}
//---------------------------------------------------------------------------------
bool GSM_FCMDataHandler (u16 DataLength, u8 *Data)
{
OutputTraceAndNumber (2, "GSM:", DataLength);
return TRUE;
}
//---------------------------------------------------------------------------------
bool UART_FCMDataHandler (u16 DataLength, u8 *Data)
{
adl_fcmSendData (GSM_FlowControlHandle, Data, DataLength);
return TRUE;
}
//---------------------------------------------------------------------------------
Debug :
//Incoming call
Trace L3RR 1 Unable to find the string of the remote trace in the file (ID = 875186)
Trace IP 1 06/01/2000,19:14:44 UART switched to data mode
Trace IP 1 06/01/2000,19:14:44 Incoming data call, answering call …
Trace IP 1 06/01/2000,19:14:44 UART stream opened
Trace IP 1 06/01/2000,19:14:44 GSM stream opened
Trace 1 Unable to find the string of the remote trace in the file (ID = 878588)
Trace MMT 1 Unable to find the string of the remote trace in the file (ID = 872087)
//Hung the call
Trace IP 1 06/01/2000,19:14:45 GSM stream closed
Trace IP 1 06/01/2000,19:14:45 UART returned to ‘AT’ mode
Trace IP 1 06/01/2000,19:14:45 UART stream unsubscribed
Trace IP 1 06/01/2000,19:14:45 GSM stream unsubscribed
Trace IP 1 06/01/2000,19:14:45 No carrier
Trace IP 1 06/01/2000,19:14:45 Released ID
Trace IP 1 06/01/2000,19:14:45 UART stream closed
//Another incoming call
Trace L3RR 1 Unable to find the string of the remote trace in the file (ID = 875186)
Trace IP 1 06/01/2000,19:14:54 UART switched to data mode
Trace IP 1 06/01/2000,19:14:54 Incoming data call, answering call …
Trace IP 1 06/01/2000,19:14:55 UART stream opened
Trace IP 1 06/01/2000,19:14:55 GSM stream opened
Trace 1 Unable to find the string of the remote trace in the file (ID = 878588)
Trace 1 Unable to find the string of the remote trace in the file (ID = 877977)
//This time we connect
Trace IP 1 06/01/2000,19:15:07 Answered OK, speed : 9600
Trace IP 1 06/01/2000,19:15:07 UART in V24 data mode
//Send +++ then an ATH
Trace IP 2 06/01/2000,19:15:09 GSM:1
Trace IP 2 06/01/2000,19:15:10 GSM:1
Trace IP 2 06/01/2000,19:15:10 GSM:1
Trace MMT 1 Unable to find the string of the remote trace in the file (ID = 872087)
Trace IP 1 06/01/2000,19:15:11 GSM stream closed
Trace IP 1 06/01/2000,19:15:11 UART returned to ‘AT’ mode
Trace IP 1 06/01/2000,19:15:12 UART stream unsubscribed
Trace IP 1 06/01/2000,19:15:12 GSM stream unsubscribed
Trace IP 1 06/01/2000,19:15:12 No carrier
Trace IP 1 06/01/2000,19:15:12 Released ID
Trace IP 1 06/01/2000,19:15:12 UART in V24 AT mode
//No UART closure!! The ADL_FCM_EVENT_FLOW_CLOSED isn’t called