Not receiving the ADL_FCM_EVENT_FLOW_CLOSED event?

Hi all, I have an application where I connect a TCP socket to UART1 (i.e. tunnel data). I manage to subscribe to the port once etc, but when I unsubscribed (after switching to AT mode and receiving ADL_FCM_EVENT_V24_AT_MODE message) I never receive the ADL_FCM_EVENT_FLOW_CLOSED event?

So next time I want to open the UART I notice that my FCM never closed properly. However when I try and unsubscribe again I get a -5 result which means ADL_RET_ERR_NOT_SUBSCRIBED.

Below is a snapshot of my code. Does anyone have any ideas why I would not be receiving this message?

bool serial1FcmCtrlHandler(adl_fcmEvent_e event)
{
	//trace(2,"SOCKET: serial1FcmCtrlHandler %d", event);

	switch(event)
    {
        case ADL_FCM_EVENT_FLOW_OPENNED:
        	serial_state.serialState = SERIAL_SUBSCRIBED;
			break;
        case ADL_FCM_EVENT_FLOW_CLOSED:
            trace(2,"UART: ADL_FCM_EVENT_FLOW_CLOSED.");

        	serial_state.serialState = SERIAL_UNSUBSCRIBED;
			serial_state.serial1FcmHandle = -1;
        	break;
        case ADL_FCM_EVENT_V24_DATA_MODE:
            trace(2,"UART: Flow in Data Mode");
			/* sending data to the external application via V24 serial link */
            if (serial_state.serial1FcmHandle != -1)
            {
            	trace(2,"UART: Serial port opened.");
            	//serial1SendData(11, "Opened\n");
            	serial_state.serialState = SERIAL_DATAMODE;
            	Server_SerialTunnel_KickLoop();
            }
            else
            {
            	trace(2,"UART: Serial port closed, cannot send data.");
            	serial_state.ResetServer = TRUE;
            	Server_SerialTunnel_KickLoop();
            }
			break;
        case ADL_FCM_EVENT_V24_AT_MODE:
            trace(2,"UART: ADL_FCM_EVENT_V24_AT_MODE");
            //adl_fcmReleaseCredits( serial_state.serial1FcmHandle, 0XFF );
			s8 result = adl_fcmUnsubscribe(serial_state.serial1FcmHandle);
			if (result != OK)
			{
				trace(2, "SERIAL: Unsubscribe failed. %d . Forcing close.", result);
	        	serial_state.serialState = SERIAL_UNSUBSCRIBED;
				serial_state.serial1FcmHandle = -1;
			}
			else
				serial_state.serialState = SERIAL_UNSUBSCRIBING;
            break;
//other cases removed as irrelevant (just tracing event)
        default:
        	trace(2, "UART: serial1FcmCtrlHandler Unhandled event: %d", event);
        }

    return TRUE;
}

Thanks,

Karl

Following from my previous post, I am trying to unsubscribe from FCM and am not receiving the close event. I then try and unsubscribe again but get the already unsubscribed event. So on this basis I just clear handle and assume all is closed.

BUT alas it is not. When I try and subscribe again I get a -8 which means BAD_STATE. See my list of traced below. I am tracing ADL 25, which is where FCM traces some info. You can see the requests go through, but some how something is going funny…

[attachment=0]18-10-2013 09-00-46.png[/attachment]

Any idea?

Version info below:

"DWL","V10c05","","Sierra Wireless",62640,"051513 10:45","a0836b50","00010000"
"FW","FW_752_34_3.Q2687RDG","R7.52.0.201306260837.FXT009","Sierra Wireless",673436,"062613 08:37","89796368","001d0000"
"MODEM","1.3.36","201306260837.FXT009","Sierra Wireless",1713240,"062613 08:37","85a2fb97","00020000"
"OAT","0.1.0.20131018085029","GPRS Serial Gateway","",121336,"101813 08:51","7d3f0742","002a0000"
 -"Developer Studio","2.3.1.201306241059-R11859"
 -"Open AT Application Framework package","2.52.0.201307100830"
 -"Open AT OS Package","6.52.0.201306271400"
 -"Firmware Package","7.52.0.201306260837"
 -"Internet Library Package","5.56.0.201305170830"
"ROM","800000"
"RAM","200000"
"DWLNAME","FXT009"

Ok so after all that I have found and solved my own problem. The reason I was not getting the above event is because my UART had hardware flow control enabled and DTR was also being used. I discovered this when I noticed the problem only occurred when then Serial cable was not connected. So changing the settings for AT&D and AT+IFC corrected the problem.

Thanks anyway :neutral_face:

Hiya,

Thanks for letting us know what the problem was - and how to resolve it. It’s just solved an intermittent problem I was also scratching my head over.

Ta.

ciao, Dave