WHICH VERSION OF openAT?


#1

I found this sample code on th net.
Please can U tell me which version of openAT supports it.

/********************************************************************************************/
/*  Appli.c   -  Copyright Wavecom S.A. (c) 2002										    */
/*																							*/
/*																							*/
/* DISCLAIMER OF WARRANTY																    */
/* ======================																    */
/* This Software is provided free of charge on an 'as is' basis. No warranty is given       */
/* by Wavecom S.A. in relation to the Software of the uses to which it may be put by you,   */
/* the user, or its merchantability, fitness or suitability for any particular purpose      */
/* or conditions; and/or that the use of the Software and all documentation relating        */
/* thereto by the Licensee will not infringe any third party copyright or other             */
/* intellectual property rights. Wavecom S.A. shall furthermore be under no obligation      */
/* to provide support of any nature for the Software and the Documentation.				    */
/*																						    */
/* LIMIT OF LIABILITY																	    */
/* ==================																		*/
/* In no event shall Wavecom S.A. be liable for any loss or damages whatsoever or howsoever	*/
/* caused arising directly or indirectly in connection with this licence, the Software,		*/
/* its use or otherwise except to the extent that such liability may not be lawfully		*/
/* excluded. Notwithstanding the generality of the foregoing, Wavecom S.A. expressly		*/
/* excludes liability for indirect, special, incidental or consequential loss or damage		*/
/* which may arise in respect of the Software or its use, or in respect of other equipment	*/
/* or property, or for loss of profit, business, revenue, goodwill or anticipated savings.	*/
/*																						    */
/********************************************************************************************/

/***************************************************************************/
/*  File       : Appli.c                                                   */
/*-------------------------------------------------------------------------*/
/*  Object     : Customer application                                      */
/*                                                                         */
/*  contents   : Customer main procedures                                  */
/*                                                                         */
/*  Change     :                                                           */
/***************************************************************************/
/*
    $LogWavecom: G:\projet\mmi\pvcsarch\archives\open-mmi\SAMPLES\adl\New_Project\src\appli.c-arc $
 * --------------------------------------------------------------------------
 *  Date     | Author | Revision       | Description
 * ----------+--------+----------------+-------------------------------------
 *  16.12.02 | dpo    | 1.0            | Initial revision.                  
 * ----------+--------+----------------+-------------------------------------
*/

#include "adl_global.h" 

/***************************************************************************/ 
/*  Mandatory variables                                                    */ 
/*-------------------------------------------------------------------------*/ 
/*  wm_apmCustomStack                                                      */ 
/*  wm_apmCustomStackSize                                                  */ 
/*-------------------------------------------------------------------------*/ 
/***************************************************************************/ 
u32 wm_apmCustomStack [ 256 ]; 
const u16 wm_apmCustomStackSize = sizeof ( wm_apmCustomStack ); 

/* Handle used to control UART2 */ 
s8 uart1FcmHandle = -1; 
s8 uart2FcmHandle = -1; 

bool uart1AtMode = TRUE; 
bool uart2AtMode = TRUE; 

#define SEND_TRACE(x)   TRACE(( 1, x )); adl_atSendResponse ( ADL_AT_UNS, x ); 


void PrintFcmState(int i) 
{ 
/* 
    ADL_FCM_EVENT_FLOW_OPENNED, 
    ADL_FCM_EVENT_FLOW_CLOSED, 
    ADL_FCM_EVENT_V24_DATA_MODE, 
    ADL_FCM_EVENT_V24_DATA_MODE_EXT, 
    ADL_FCM_EVENT_V24_AT_MODE, 
    ADL_FCM_EVENT_V24_AT_MODE_EXT, 
    ADL_FCM_EVENT_RESUME, 
    ADL_FCM_EVENT_MEM_RELEASE, 
    ADL_FCM_EVENT_V24_DATA_MODE_FROM_CALL, 
    ADL_FCM_EVENT_V24_AT_MODE_FROM_CALL 
*/ 
} 

bool Uart1ControlHandler(adl_fcmEvent_e event) 
{ 
   char string[100]; 
   s8 returnValue; 

   wm_sprintf(string, "(Uart1ControlHandler) Event: %d\r\n", event); 
   SEND_TRACE(string); 
    
   switch(event) 
   { 
      case ADL_FCM_EVENT_FLOW_OPENNED: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_FLOW_OPENNED\r\n"); 
          
         returnValue = adl_fcmSwitchV24State(uart1FcmHandle, ADL_FCM_V24_STATE_DATA); 
         if (returnValue != OK) 
         { 
            wm_sprintf(string, "(Uart1ControlHandler) ERROR: adl_fcmSwitchV24State(ADL_FCM_V24_STATE_DATA) failed. returnValue = %d\r\n", returnValue); 
            SEND_TRACE(string); 
         } 
         else 
         { 
            SEND_TRACE("(Uart1ControlHandler) adl_fcmSwitchV24State(ADL_FCM_V24_STATE_DATA) Success\r\n"); 
         } 
      break; 
      
      case ADL_FCM_EVENT_FLOW_CLOSED: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_FLOW_OPENNED\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_DATA_MODE: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_V24_DATA_MODE\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_DATA_MODE_EXT: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_V24_DATA_MODE_EXT\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_AT_MODE: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_V24_AT_MODE\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_AT_MODE_EXT: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_V24_AT_MODE_EXT\r\n"); 
      break; 
      case ADL_FCM_EVENT_RESUME: 
         SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_RESUME\r\n"); 
      break; 
      case ADL_FCM_EVENT_MEM_RELEASE: 
          SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_MEM_RELEASE\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_DATA_MODE_FROM_CALL: 
          SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_V24_DATA_MODE_FROM_CALL\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_AT_MODE_FROM_CALL: 
          SEND_TRACE("(Uart1ControlHandler) Handle: ADL_FCM_EVENT_V24_AT_MODE_FROM_CALL\r\n"); 
      break; 
      
      default: 
          SEND_TRACE("(Uart1ControlHandler) Error: Unknown Event\r\n"); 
      break; 
    } 
    
    return TRUE; 
} 

bool Uart1DataHandler(u16 dataLen, u8 *data) 
{ 
   s8 returnValue; 
   char string[100]; 
   wm_sprintf(string, "(Uart1DataHandler)Bytes Received: %d\r\n", dataLen); 
   SEND_TRACE(string); 

   returnValue = adl_fcmSendData(uart2FcmHandle, data, dataLen); 
   if (returnValue < 0) 
   { 
      wm_sprintf(string, "(Uart1DataHandler) adl_fcmSendData() failed. returnValue=%d\r\n", returnValue); 
      SEND_TRACE(string);      
   } 

   return TRUE; 
} 

bool Uart2ControlHandler(adl_fcmEvent_e event) 
{ 
   char string[100]; 
   s8 returnValue; 

   wm_sprintf(string, "(Uart2ControlHandler) Event: %d\r\n", event); 
   SEND_TRACE(string); 
    
   switch(event) 
   { 
      case ADL_FCM_EVENT_FLOW_OPENNED: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_FLOW_OPENNED\r\n"); 
          
         returnValue = adl_fcmSwitchV24State(uart2FcmHandle, ADL_FCM_V24_STATE_DATA); 
         if (returnValue != OK) 
         { 
            wm_sprintf(string, "(Uart2ControlHandler) ERROR: adl_fcmSwitchV24State(ADL_FCM_V24_STATE_DATA) failed. returnValue = %d\r\n", returnValue); 
            SEND_TRACE(string); 
         } 
         else 
         { 
            SEND_TRACE("(Uart2ControlHandler) adl_fcmSwitchV24State(ADL_FCM_V24_STATE_DATA) Success\r\n"); 
         } 
      break; 
      
      case ADL_FCM_EVENT_FLOW_CLOSED: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_FLOW_OPENNED\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_DATA_MODE: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_V24_DATA_MODE\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_DATA_MODE_EXT: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_V24_DATA_MODE_EXT\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_AT_MODE: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_V24_AT_MODE\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_AT_MODE_EXT: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_V24_AT_MODE_EXT\r\n"); 
      break; 
      case ADL_FCM_EVENT_RESUME: 
         SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_RESUME\r\n"); 
      break; 
      case ADL_FCM_EVENT_MEM_RELEASE: 
          SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_MEM_RELEASE\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_DATA_MODE_FROM_CALL: 
          SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_V24_DATA_MODE_FROM_CALL\r\n"); 
      break; 
      case ADL_FCM_EVENT_V24_AT_MODE_FROM_CALL: 
          SEND_TRACE("(Uart2ControlHandler) Handle: ADL_FCM_EVENT_V24_AT_MODE_FROM_CALL\r\n"); 
      break; 
      
      default: 
          SEND_TRACE("(Uart2ControlHandler) Error: Unknown Event\r\n"); 
      break; 
    } 
    
    return TRUE; 
} 

bool Uart2DataHandler(u16 dataLen, u8 *data) 
{ 
   s8 returnValue; 
   char string[100]; 
   wm_sprintf(string, "(Uart2DataHandler)Bytes Received: %d\r\n", dataLen); 
   SEND_TRACE(string); 
    
   returnValue = adl_fcmSendData(uart1FcmHandle, data, dataLen); 
   if (returnValue < 0) 
   { 
      wm_sprintf(string, "(Uart2DataHandler) adl_fcmSendData() failed. returnValue=%d\r\n", returnValue); 
      SEND_TRACE(string);      
   } 
    
   return TRUE; 
} 

bool HandleWmfmSetBaudRate(adl_atResponse_t *response) 
{ 
   bool isFcmAvailable; 
    
   SEND_TRACE("AT+IPR=115200: %s"); 
   SEND_TRACE(response->StrData); 

   isFcmAvailable = adl_fcmIsAvailable(ADL_PORT_UART1); 
   if (isFcmAvailable) 
   { 
      SEND_TRACE("Before: adl_fcmIsAvailable(ADL_PORT_UART1) == TRUE\r\n"); 
   } 
   else 
   { 
      SEND_TRACE("Before: adl_fcmIsAvailable(ADL_PORT_UART1) == FALSE\r\n"); 
   } 
    
   isFcmAvailable = adl_fcmIsAvailable(ADL_PORT_UART2); 
   if (isFcmAvailable) 
   { 
      SEND_TRACE("Before: adl_fcmIsAvailable(ADL_PORT_UART2) == TRUE\r\n"); 
   } 
   else 
   { 
      SEND_TRACE("Before: adl_fcmIsAvailable(ADL_PORT_UART2) == FALSE\r\n"); 
   } 

   uart1FcmHandle = adl_fcmSubscribe(ADL_PORT_UART1, Uart1ControlHandler, Uart1DataHandler); 
   if (uart1FcmHandle < 0) 
   { 
      char string[100]; 
      wm_sprintf(string, "ERROR: adl_fcmSubscribe(ADL_PORT_UART1)failed. returnValue = %d\r\n", uart1FcmHandle); 
      SEND_TRACE(string); 
   } 
   else 
   { 
      char string[100]; 
      wm_sprintf(string, "adl_fcmSubscribe(ADL_PORT_UART1)Success! uart2FcmHandle = %d\r\n", uart1FcmHandle); 
      SEND_TRACE(string); 
   } 

   uart2FcmHandle = adl_fcmSubscribe(ADL_PORT_UART2, Uart2ControlHandler, Uart2DataHandler); 
   if (uart2FcmHandle < 0) 
   { 
      char string[100]; 
      wm_sprintf(string, "ERROR: adl_fcmSubscribe(ADL_PORT_UART2)failed. returnValue = %d\r\n", uart2FcmHandle); 
      SEND_TRACE(string); 
   } 
   else 
   { 
      char string[100]; 
      wm_sprintf(string, "adl_fcmSubscribe(ADL_PORT_UART2)Success! uart2FcmHandle = %d\r\n", uart2FcmHandle); 
      SEND_TRACE(string); 
   } 

   isFcmAvailable = adl_fcmIsAvailable(ADL_PORT_UART1); 
   if (isFcmAvailable) 
   { 
      SEND_TRACE("After: adl_fcmIsAvailable(ADL_PORT_UART1) == TRUE\r\n"); 
   } 
   else 
   { 
      SEND_TRACE("After: adl_fcmIsAvailable(ADL_PORT_UART1) == FALSE\r\n"); 
   } 
    
   isFcmAvailable = adl_fcmIsAvailable(ADL_PORT_UART2); 
   if (isFcmAvailable) 
   { 
      SEND_TRACE("After: adl_fcmIsAvailable(ADL_PORT_UART2) == TRUE\r\n"); 
   } 
   else 
   { 
      SEND_TRACE("After: adl_fcmIsAvailable(ADL_PORT_UART2) == FALSE\r\n"); 
   } 
    
   return(FALSE); 
} 

void WorkAroundTitmerHandler( u8 whatever) 
{ 
   s8 returnValue; 

   /* Set the baud rate for UART 2 */ 
   SEND_TRACE("AT+IPR=115200: Start\r\n"); 
   returnValue = adl_atCmdCreate("AT+IPR=115200", 
      ADL_AT_PORT_TYPE (ADL_PORT_UART2, FALSE), 
      HandleWmfmSetBaudRate, "*", NULL); 
   if (returnValue != OK) 
   { 
      char string[100]; 
      wm_sprintf(string, "ERROR: adl_atCmdCreate(AT+IPR=115200) returned %d\r\n", returnValue); 
      SEND_TRACE(string); 
   } 
} 

#define COMMAND_BUG  1 

bool HandleWmfmUart2Enable(adl_atResponse_t *response) 
{ 

   SEND_TRACE("AT+WMFM=0,1,2:"); 
   SEND_TRACE(response->StrData); 

#if COMMAND_BUG 
   adl_tmrSubscribe(FALSE, 1, ADL_TMR_TYPE_100MS, WorkAroundTitmerHandler); 
#else 
    WorkAroundTitmerHandler(0); 
#endif 

   return(FALSE); 
} 

bool HandleWmfmUart2Disable(adl_atResponse_t *response) 
{ 
   s8 returnValue; 
    
   SEND_TRACE("AT+WMFM=0,0,2:"); 
   SEND_TRACE(response->StrData); 
    
   /* For <Physical Port>, <Activate>, <UART 2> */ 
   SEND_TRACE("AT+WMFM=0,1,2: Start\r\n" ); 
   returnValue = adl_atCmdCreate("AT+WMFM=0,1,2", FALSE, 
      HandleWmfmUart2Enable, "*", NULL); 
   if (returnValue != OK) 
   { 
      char string[100]; 
      wm_sprintf(string, "ERROR: adl_atCmdCreate(AT+WMFM=0,1,2) returned %d\r\n", returnValue); 
      SEND_TRACE(string); 
   } 
    
   return(FALSE); 
} 

void AtUart2LoopbackCmdHandler(adl_atCmdPreParser_t *parser) 
{ 
   s8 returnValue; 
   char *parameter; 
   int startStop; 
    
   SEND_TRACE("(AtUart2LoopbackCmdHandler) Enter.\r\n"); 

   parameter = wm_lstGetItem(parser->ParaList, 0); 
   startStop = atoi(parameter); 
   if (startStop == 1) 
   { 
      if ((uart1FcmHandle != -1) || (uart2FcmHandle != -1)) 
      { 
         SEND_TRACE("Application Active: UART1 or UART2 still has active handle.\r\n"); 
      } 
      
      /* Disable UART 2 just in case it wasn't disable in the previous run. */ 
      SEND_TRACE("AT+WMFM=0,0,2: Start\r\n"); 
      adl_atCmdCreate("AT+WMFM=0,0,2", FALSE, HandleWmfmUart2Disable, "*", NULL); 
   } 
   else 
   if (startStop == 0) 
   { 
      char string[100]; 
      
      if (uart1FcmHandle != -1) 
      { 
         returnValue = adl_fcmUnsubscribe(uart1FcmHandle); 
         if (returnValue < 0) 
         { 
            wm_sprintf(string, "(AtUart2LoopbackCmdHandler) adl_fcmUnsubscribe(uart1FcmHandle) failed. returnValue=%d\r\n", returnValue); 
            SEND_TRACE(string);      
         } 
         else 
         { 
            uart1FcmHandle = -1; 
         } 
      } 
      else 
      { 
         SEND_TRACE("UART1 already Unsubscribed.\r\n"); 
      } 
      
      if (uart1FcmHandle != -1) 
      { 
         returnValue = adl_fcmUnsubscribe(uart2FcmHandle); 
         if (returnValue < 0) 
         { 
            wm_sprintf(string, "(AtUart2LoopbackCmdHandler) adl_fcmUnsubscribe(uart2FcmHandle) failed. returnValue=%d\r\n", returnValue); 
            SEND_TRACE(string);      
         } 
         else 
         { 
            uart2FcmHandle = -1; 
         } 
      } 
      else 
      { 
         SEND_TRACE("UART2 already Unsubscribed.\r\n"); 
      } 
   } 
   else 
   { 
      adl_atSendResponse ( ADL_AT_RSP, "\r\nERROR\r\n" ); 
      return; 
   } 

   adl_atSendResponse ( ADL_AT_RSP, "\r\nOK\r\n" );    
} 

void adl_main ( adl_InitType_e  InitType ) 
{ 
   SEND_TRACE("Embedded : Appli Init\r\n"); 

   adl_atCmdSubscribe("AT+UART2", AtUart2LoopbackCmdHandler, ADL_CMD_TYPE_PARA | 0x11); 
}

#2

Hi,

I know that you started out looking for basic API code. This is ADL. It should run on any > 3.0, but I would not start with anything less than version 3.03.

Best Regards,
Jan


#3

You’re still SHOUTING in your Subject lines! :angry:

Where did you find it?

Did it not say which version of Open-AT was required?

It has the form of the standard Wavecom samples; every standard Wavecom sample includes an HTML file that describes it - including which Open-AT version it uses.

And, as Jan says, this is for ADL - but you said before that you don’t want ADL?! :confused:
wavecom.com/modules/movie/sc … php?t=1435