Can adl_fcmSendData() be called outside the the FCM Control Handler?
The example in the documentation (AirPrime_Open_AT_Tutorial_Rev1.0.pdf, pp 187-188), it is called inside the Control Handler in case ADL_FCM_EVENT_V24_DATA_MODE.
bool fcmCtrlH ( adl_fcmEvent_e event )
{
TRACE ((1, "Control event received --> %d", event));
switch(event)
{
case ADL_FCM_EVENT_FLOW_OPENNED:
TRACE (( 1, "Flow Opened" ));
/* Switching V24 state from AT to Data. */
adl_fcmSwitchV24State(Handle, ADL_FCM_V24_STATE_DATA);
break;
case ADL_FCM_EVENT_V24_DATA_MODE:
TRACE (( 1, "Flow in Data Mode" ));
/* sending data to the external application via V24 serial link */
adl_fcmSendData(Handle, "This is a test case", 20);
break;
}
return TRUE;
}
I tried calling this function in void adl_main() but it is not firing even though I have already subscribed to fcm and already set to data mode.
I also have a follow-up question, but I’ll state the scenario first. Only UART1 is used.
Subscribe to fcm handle.
Send my first data (data1).
Process the received data from the first data.
After process of the received data from the first data, send another data (data2).
Process the received data from the second data.
Questions:
Should I create 2 control handlers and 2 data handlers, one for each process?
Or, create only 1 control handler and 1 data handler for both process? This is my current implementation thought I have a problem because when I send the second data, nothing happen.
Should I unsubscribe to fcm handle after receiving the first data, then subscribe again to fcm handle prior to sending the second data?