view src/aci2/aci/cmh_ssq.c @ 272:7e8aa98159ef

init.c: removed some unused definitions not appropriate to this module
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 06 Aug 2017 18:26:20 +0000
parents 93999a60b835
children
line wrap: on
line source

/* 
+----------------------------------------------------------------------------- 
|  Project :  GSM-PS (6147)
|  Modul   :  CMH_SSS
+----------------------------------------------------------------------------- 
|  Copyright 2002 Texas Instruments Berlin, AG 
|                 All rights reserved. 
| 
|                 This file is confidential and a trade secret of Texas 
|                 Instruments Berlin, AG 
|                 The receipt of or possession of this file does not convey 
|                 any rights to reproduce or disclose its contents or to 
|                 manufacture, use, or sell anything it may describe, in 
|                 whole, or in part, without the specific written consent of 
|                 Texas Instruments Berlin, AG. 
+----------------------------------------------------------------------------- 
|  Purpose :  This module provides the query functions related to the 
|             protocol stack adapter for SS.
+----------------------------------------------------------------------------- 
*/ 

#ifndef CMH_SSQ_C
#define CMH_SSQ_C
#endif

#include "aci_all.h"
/*==== INCLUDES ===================================================*/
#include "aci.h"
#include "aci_cmh.h"
#include "ati_cmd.h"
#include "aci_cmd.h"

#include "aci_ext_pers.h"    /* we are using personalisation extensions */
#include "aci_slock.h"          /* in order to asure interfaces */

#ifdef FAX_AND_DATA
#include "aci_fd.h"
#endif    /* of #ifdef FAX_AND_DATA */

#ifdef UART
#include "dti.h"
#include "dti_conn_mng.h"
#endif

#include "ksd.h"
#include "psa.h"
#include "psa_ss.h"
#include "psa_sim.h"
#include "cmh.h"
#include "cmh_ss.h"
#include "cmh_sim.h"

#include "aci_ext_pers.h"
#include "aci_slock.h"

/*==== CONSTANTS ==================================================*/

/*==== EXPORT =====================================================*/

/*==== VARIABLES ==================================================*/

/*==== FUNCTIONS ==================================================*/

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PlusCCFC             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +CCFC AT command
            which is responsible to query the parameters for call 
            forwarding supplementary services.

            <reason> : reason for CF.
            <class>  : class of basic service.
*/

GLOBAL T_ACI_RETURN qAT_PlusCCFC  ( T_ACI_CMD_SRC   srcId,
                                    T_ACI_CCFC_RSN  reason,
                                    T_ACI_CLASS     class_type  )
{
  SHORT sId;                /* holds service id */
  UBYTE ssCd;               /* holds ss code */

  T_ACI_RETURN   retVal;


  TRACE_FUNCTION ("qAT_PlusCCFC");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 )

    return( AT_BUSY );

/*
 *-------------------------------------------------------------------
 * check parameter <reason>
 *-------------------------------------------------------------------
 */  
  switch( reason )
  {
    case( CCFC_RSN_Uncond      ): ssCd = SS_CD_CFU;       break;
    case( CCFC_RSN_Busy        ): ssCd = SS_CD_CFB;       break;
    case( CCFC_RSN_NoReply     ): ssCd = SS_CD_CFNRY;     break;
    case( CCFC_RSN_NotReach    ): ssCd = SS_CD_CFNRC;     break;
    case( CCFC_RSN_Forward     ): ssCd = SS_CD_ALL_FWSS;  break;
    case( CCFC_RSN_CondForward ): ssCd = SS_CD_ALL_CFWSS; break;
    case( CCFC_RSN_NotPresent  ):
    default:
      ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
      return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * check parameter <class>
 *-------------------------------------------------------------------
 */  
  if( !cmhSS_CheckClassInterr(class_type) )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */

    retVal = cmhSS_CF_SAT_Handle( srcId, reason, CCFC_MOD_Query, NULL, NULL, class_type, NULL, NULL, 0);

    if( retVal NEQ AT_CMPL )
        return( retVal );

/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * start first transaction 
 *-------------------------------------------------------------------
 */  
  CCD_START;

  psaSS_asmInterrogateSS( ssCd, SS_NO_PRM, SS_NO_PRM );

  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].ssCode     = ssCd;
  ssShrdPrm.stb[sId].srvOwn     = srcId;
  ssShrdPrm.stb[sId].ClassType  = class_type;

  ssShrdPrm.stb[sId].curCmd = AT_CMD_CCFC;
  cmhSS_flagTrn( sId, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg));
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd                    = AT_CMD_CCFC;
  cmdLog.cmdType                  = CLOG_TYPE_Query;
  cmdLog.retCode                  = AT_EXCT;
  cmdLog.cId                      = ACI_NumParmNotPresent;
  cmdLog.sId                      = sId+1;
  cmdLog.cmdPrm.qCCFC.srcId       = srcId;
  cmdLog.cmdPrm.qCCFC.reason      = reason;
  cmdLog.cmdPrm.qCCFC.class_type       = class_type;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PlusCLCK             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +CLCK AT command
            which is responsible to query the parameters for call 
            barring supplementary services.

            <fac>  : CB facility.
            <class>: class of basic service.
*/

GLOBAL T_ACI_RETURN qAT_PlusCLCK  ( T_ACI_CMD_SRC  srcId,
                                    T_ACI_CLCK_FAC fac,
                                    T_ACI_CLASS    class_type,
                                    T_ACI_CLSSTAT *clsStat)
{
  UBYTE dummy_slockStat;
  TRACE_FUNCTION ("qAT_PlusCLCK");
  return qAT_PercentCLCK(srcId,fac,class_type, clsStat,&dummy_slockStat);
}

/*QAT_PERCENTCLCK add for Simlock in Riviear MFW

Added by Shen,Chao  April 16th, 2003
*/

GLOBAL T_ACI_RETURN qAT_PercentCLCK  ( T_ACI_CMD_SRC  srcId,
                                    T_ACI_CLCK_FAC fac,
                                    T_ACI_CLASS    class_type,
                                    T_ACI_CLSSTAT *clsStat,
                                    UBYTE *simClockStat)
{
  SHORT sId;                /* holds service id */
  UBYTE ssCd;               /* holds ss code */
  T_ACI_RETURN   retVal;
#ifdef SIM_PERS
  T_SIMLOCK_TYPE slocktype;
  T_SIMLOCK_STATUS rlockstatus;
#endif


  TRACE_FUNCTION ("qAT_PercentCLCK");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 )
    return( AT_BUSY );

/*
 *-------------------------------------------------------------------
 * check parameter <fac>
 *-------------------------------------------------------------------
 */  
  switch( fac )
  {
    case( CLCK_FAC_Ao ): ssCd = SS_CD_BAOC;     break;
    case( CLCK_FAC_Oi ): ssCd = SS_CD_BOIC;     break;
    case( CLCK_FAC_Ox ): ssCd = SS_CD_BOICXH;   break;
    case( CLCK_FAC_Ai ): ssCd = SS_CD_BAIC;     break;
    case( CLCK_FAC_Ir ): ssCd = SS_CD_BICRM;    break;
    case( CLCK_FAC_Ab ): ssCd = SS_CD_ALL_CBSS; break;
    case( CLCK_FAC_Ag ): ssCd = SS_CD_BOC;      break;
    case( CLCK_FAC_Ac ): ssCd = SS_CD_BIC;      break;

    case( CLCK_FAC_Sc ):
    case( CLCK_FAC_Fd ):
    case( CLCK_FAC_Al ):
    case( CLCK_FAC_Pn ):
    case( CLCK_FAC_Pu ):
    case( CLCK_FAC_Pc ):
    case( CLCK_FAC_Pp ):
    case( CLCK_FAC_Ps ):
    case( CLCK_FAC_Pf ): ssCd = NOT_PRESENT_8BIT; break;

    case( CLCK_FAC_NotPresent  ):
    default:

      ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
      return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * if action is related to SS
 *-------------------------------------------------------------------
 */  
  if( ssCd NEQ NOT_PRESENT_8BIT )
  {
  /*
   *-------------------------------------------------------------------
   * check parameter <class>
   *-------------------------------------------------------------------
   */  
    if( !cmhSS_CheckCbClassInterr(class_type))
    { 
      ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
      return( AT_FAIL );
    }

    if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 )

      return( AT_BUSY );
  /*
   *-------------------------------------------------------------------
   * check not allowed <fac> (only possible with mode=0 i.e unlock)   
   *-------------------------------------------------------------------
   */  
    if(fac EQ CLCK_FAC_Ab OR fac EQ CLCK_FAC_Ag OR fac EQ CLCK_FAC_Ac)
    {
      ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
      return( AT_FAIL );
    }

/* SIM TOOLKIT & FDN HANDLING */

    retVal = cmhSS_Call_Barr_SAT_Handle( srcId, CLCK_MODE_QUERY, fac, NULL, class_type);

    if( retVal NEQ AT_CMPL )
        return( retVal );
   
    
  /*
   *-------------------------------------------------------------------
   * get a new service table entry to interrogate SS
   *-------------------------------------------------------------------
   */  
    sId = psaSS_stbNewEntry();

    if( sId EQ NO_ENTRY )
    { 
      ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
      return( AT_FAIL );
    }

  /*
   *-------------------------------------------------------------------
   * start first transaction
   *-------------------------------------------------------------------
   */ 
    CCD_START;

    psaSS_asmInterrogateSS( ssCd, SS_NO_PRM, SS_NO_PRM );

    ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
    ssShrdPrm.stb[sId].ssCode     = ssCd;
    ssShrdPrm.stb[sId].srvOwn     = srcId;
    ssShrdPrm.stb[sId].ClassType  = class_type;

    ssShrdPrm.stb[sId].curCmd = AT_CMD_CLCK;
    cmhSS_flagTrn( sId, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg));
    psaSS_NewTrns(sId);

    CCD_END;
  }

  /*
   *-------------------------------------------------------------------
   * if action is related to SIM
   *-------------------------------------------------------------------
   */  
  else
  {
    switch (fac)
    {
      /*
       *---------------------------------------------------------------
       * access PIN 1 status
       *---------------------------------------------------------------
       */  
      case CLCK_FAC_Sc:
        clsStat -> class_type  = CLASS_NotPresent; 
        clsStat -> status = STATUS_NotPresent;

        switch( simShrdPrm.PEDStat )
        {
          case( PEDS_ENA ): clsStat -> status = STATUS_Active;
                                       return( AT_CMPL );
          case( PEDS_DIS ): clsStat -> status = STATUS_NotActive;
                                       return( AT_CMPL );
          default:                     

            ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimFail );
            return( AT_FAIL );
        }
        break;

      /*
       *---------------------------------------------------------------
       * access fixed dialling feature
       *---------------------------------------------------------------
       */
      case ( CLCK_FAC_Fd ):
        clsStat -> class_type  = CLASS_NotPresent; 
        clsStat -> status = STATUS_NotPresent;

        if( simShrdPrm.SIMStat EQ SS_OK )
        {
          switch( simShrdPrm.crdFun )
          {
            case( SIM_ADN_ENABLED     ): 
            case( SIM_ADN_BDN_ENABLED ): clsStat -> status = STATUS_NotActive;
                                         return( AT_CMPL );
            case( SIM_FDN_ENABLED     ): 
            case( SIM_FDN_BDN_ENABLED ): clsStat -> status = STATUS_Active;
                                         return( AT_CMPL );
            case( SIM_NO_OPERATION    ): 
            default:                     

              ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimFail );
              return( AT_FAIL );
          }
        }
        else
        { 
          ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimFail );
          return( AT_FAIL );
        }
        break;

      /*
       *---------------------------------------------------------------
       * lock ALS setting with PIN2
       *---------------------------------------------------------------
       */  
      case CLCK_FAC_Al:
        clsStat -> class_type  = CLASS_NotPresent; 
        clsStat -> status = STATUS_NotPresent;

        switch( ALSlock )
        {
          case( ALS_MOD_SPEECH     ): 
          case( ALS_MOD_AUX_SPEECH ): 
            clsStat -> status = STATUS_Active;
            return( AT_CMPL );
            
          case( ALS_MOD_NOTPRESENT ): 
            clsStat -> status = STATUS_NotActive;
            return( AT_CMPL );
            
          default:                     
            ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp );
            return( AT_FAIL );
        }
        break;

#ifdef SIM_PERS
      /*
       *---------------------------------------------------------------
       * ME Personalisation
       *---------------------------------------------------------------
       */
            
      case CLCK_FAC_Pn:
      case CLCK_FAC_Pu:
      case CLCK_FAC_Pp:
      case CLCK_FAC_Pc:
      case CLCK_FAC_Ps:
      case CLCK_FAC_Pf:
        clsStat -> class_type  = CLASS_NotPresent; 
        clsStat -> status = STATUS_NotPresent;
        switch (fac)
        {
          case CLCK_FAC_Pn: slocktype = SIMLOCK_NETWORK; break;
          case CLCK_FAC_Pu: slocktype = SIMLOCK_NETWORK_SUBSET; break;
          case CLCK_FAC_Pp: slocktype = SIMLOCK_SERVICE_PROVIDER; break;
          case CLCK_FAC_Pc: slocktype = SIMLOCK_CORPORATE; break;
          case CLCK_FAC_Ps: slocktype = SIMLOCK_SIM; break;
          case CLCK_FAC_Pf: slocktype = SIMLOCK_FIRST_SIM; break;
          default: slocktype = SIMLOCK_NETWORK;
        }
   aci_ext_personalisation_init();
        rlockstatus = aci_personalisation_get_status(slocktype);  /* Changed to aci_personalisatio_get_status 
                                                                 from aci_ext_personalisatio_get_status on 11/03/2005 */
   aci_ext_personalisation_free();
   if (rlockstatus EQ SIMLOCK_ENABLED)
   {
          clsStat -> status = STATUS_Active;
     return( AT_CMPL );
   }
   else if (rlockstatus EQ SIMLOCK_DISABLED)
   {
     clsStat -> status = STATUS_NotActive;
          return( AT_CMPL );
   }
   else
   {
          ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown );
          return( AT_FAIL );
   }

 #endif
    
      /*
       *---------------------------------------------------------------
       * Error handling
       *---------------------------------------------------------------
       */
      default:
        ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown );
        return( AT_FAIL );
    }
  }

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd                   = AT_CMD_CLCK;
  cmdLog.cmdType                 = CLOG_TYPE_Query;
  cmdLog.retCode                 = AT_EXCT;
  cmdLog.cId                     = ACI_NumParmNotPresent;
  cmdLog.sId                     = sId+1;
  cmdLog.cmdPrm.qCLCK.srcId      = srcId;
  cmdLog.cmdPrm.qCLCK.fac        = fac;
  cmdLog.cmdPrm.qCLCK.class_type = class_type;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PlusCCWA             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +CCWA AT command
            which is responsible to query the parameters for call
            waiting supplementary services.

            <class>   : class of basic service.
*/

GLOBAL  T_ACI_RETURN qAT_PlusCCWA (T_ACI_CMD_SRC  srcId, 
                                   T_ACI_CLASS    class_type)
{
  SHORT sId;         /* holds service id */

  T_ACI_RETURN   retVal;

  TRACE_FUNCTION ("qAT_PlusCCWA ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 )

    return( AT_BUSY );

/*
 *-------------------------------------------------------------------
 * check parameter <class>
 *-------------------------------------------------------------------
 */  
  if( !cmhSS_CheckClassInterr(class_type) )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_CW_SAT_Handle( srcId, CCWA_MOD_Query, class_type);

    if( retVal NEQ AT_CMPL )
        return( retVal );

/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * start first transaction
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_CW, SS_NO_PRM, SS_NO_PRM );

  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].ssCode     = SS_CD_CW;
  ssShrdPrm.stb[sId].srvOwn     = srcId;
  ssShrdPrm.stb[sId].ClassType  = class_type;

  ssShrdPrm.stb[sId].curCmd = AT_CMD_CCWA;
  cmhSS_flagTrn( sId, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg));
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd                   = AT_CMD_CCWA;
  cmdLog.cmdType                 = CLOG_TYPE_Query;
  cmdLog.retCode                 = AT_EXCT;
  cmdLog.cId                     = ACI_NumParmNotPresent;
  cmdLog.sId                     = sId+1;
  cmdLog.cmdPrm.qCCWA.srcId      = srcId;
  cmdLog.cmdPrm.qCCWA.class_type = class_type;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PlusCLIP             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +CLIP AT command
            which is responsible to query the setting for calling
            line indication supplementary services.

            <stat>   : CLIP status.
*/

GLOBAL T_ACI_RETURN qAT_PlusCLIP  ( T_ACI_CMD_SRC srcId,
                                    T_ACI_CLIP_STAT * stat)
{
  SHORT sId;                /* holds service id */

   T_ACI_RETURN   retVal;
 
  TRACE_FUNCTION ("qAT_PlusCLIP ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_CLIP_SAT_Handle( srcId);

    if( retVal NEQ AT_CMPL )
        return( retVal );
/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * set up  facility information element
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_CLIP, SS_NO_PRM, SS_NO_PRM );
/*
 *-----------------------------------------------------------------
 * declare service table entry as used and the owner of the service
 *-----------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].srvOwn     = srcId;

/*
 *-------------------------------------------------------------------
 * start a new transaction 
 *-------------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].curCmd = AT_CMD_CLIP;
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd              = AT_CMD_CLIP;
  cmdLog.cmdType            = CLOG_TYPE_Query;
  cmdLog.retCode            = AT_EXCT;
  cmdLog.cId                = ACI_NumParmNotPresent;
  cmdLog.sId                = sId+1;
  cmdLog.cmdPrm.qCLIP.srcId = srcId;
  cmdLog.cmdPrm.qCLIP.stat  = stat;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PlusCLIR             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +CLIR AT command
            which is responsible to query the setting for calling
            line restriction supplementary services.

            <mode>   : CLIR mode.
            <stat>   : CLIR status.
*/

GLOBAL T_ACI_RETURN qAT_PlusCLIR  ( T_ACI_CMD_SRC srcId,
                                    T_ACI_CLIR_MOD * mode,
                                    T_ACI_CLIR_STAT * stat)
{
  SHORT sId;                /* holds service id */

   T_ACI_RETURN   retVal;
 
  TRACE_FUNCTION ("qAT_PlusCLIR ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_CLIR_SAT_Handle( srcId);

    if( retVal NEQ AT_CMPL )
        return( retVal );


/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * set up  facility information element
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_CLIR, SS_NO_PRM, SS_NO_PRM );
/*
 *-----------------------------------------------------------------
 * declare service table entry as used and the owner of the service
 *-----------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].srvOwn     = srcId;

/*
 *-------------------------------------------------------------------
 * start a new transaction 
 *-------------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].curCmd = AT_CMD_CLIR;
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd              = AT_CMD_CLIR;
  cmdLog.cmdType            = CLOG_TYPE_Query;
  cmdLog.retCode            = AT_EXCT;
  cmdLog.cId                = ACI_NumParmNotPresent;
  cmdLog.sId                = sId+1;
  cmdLog.cmdPrm.qCLIR.srcId = srcId;
  cmdLog.cmdPrm.qCLIR.stat  = stat;
  cmdLog.cmdPrm.qCLIR.mode  = mode;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}


GLOBAL T_ACI_RETURN qAT_PercentCLIR  ( T_ACI_CMD_SRC srcId,
                                    T_ACI_CLIR_MOD * mode)
{
   T_CC_CMD_PRM  *pCCCmdPrm;  /* points to CC command parameters */
   TRACE_FUNCTION ("qAT_PercentCLIR ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

   pCCCmdPrm  = &cmhPrm[srcId].ccCmdPrm;   
   *mode = pCCCmdPrm->CLIRmode;
  
   return AT_CMPL;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PlusCOLP             |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the +COLP AT command
            which is responsible to query the setting for connected
            line presentation supplementary services.

            <stat>   : COLP status.
*/

GLOBAL T_ACI_RETURN qAT_PlusCOLP  ( T_ACI_CMD_SRC srcId,
                                    T_ACI_COLP_STAT * stat)
{
  SHORT sId;                /* holds service id */

  T_ACI_RETURN   retVal;

  TRACE_FUNCTION ("qAT_PlusCOLP ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_COLP_SAT_Handle( srcId);

    if( retVal NEQ AT_CMPL )
        return( retVal );


/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * set up  facility information element
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_COLP, SS_NO_PRM, SS_NO_PRM );
/*
 *-----------------------------------------------------------------
 * declare service table entry as used and the owner of the service
 *-----------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].srvOwn     = srcId;

/*
 *-------------------------------------------------------------------
 * start a new transaction 
 *-------------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].curCmd = AT_CMD_COLP;
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd              = AT_CMD_COLP;
  cmdLog.cmdType            = CLOG_TYPE_Query;
  cmdLog.retCode            = AT_EXCT;
  cmdLog.cId                = ACI_NumParmNotPresent;
  cmdLog.sId                = sId+1;
  cmdLog.cmdPrm.qCOLP.srcId = srcId;
  cmdLog.cmdPrm.qCOLP.stat  = stat;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PercentCOLR          |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the %COLR AT command
            which is responsible to query the setting for connected
            line restriction supplementary services.

            <stat>   : COLR status.
*/

GLOBAL T_ACI_RETURN qAT_PercentCOLR  ( T_ACI_CMD_SRC srcId )
{
  SHORT sId;                /* holds service id */

  T_ACI_RETURN   retVal;

  TRACE_FUNCTION ("qAT_PercentCOLR ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_COLR_SAT_Handle( srcId);

    if( retVal NEQ AT_CMPL )
        return( retVal );
/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * set up  facility information element
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_COLR, SS_NO_PRM, SS_NO_PRM );
/*
 *-----------------------------------------------------------------
 * declare service table entry as used and the owner of the service
 *-----------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].srvOwn     = srcId;

/*
 *-------------------------------------------------------------------
 * start a new transaction 
 *-------------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].curCmd = AT_CMD_COLR;
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd              = AT_CMD_COLR;
  cmdLog.cmdType            = CLOG_TYPE_Query;
  cmdLog.retCode            = AT_EXCT;
  cmdLog.cId                = ACI_NumParmNotPresent;
  cmdLog.sId                = sId+1;
  cmdLog.cmdPrm.qCOLR.srcId = srcId;
  
  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PercentCCBS          |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the %CCBS AT command
            which is responsible to query the setting for connected
            line restriction supplementary services.

*/

GLOBAL T_ACI_RETURN qAT_PercentCCBS  ( T_ACI_CMD_SRC srcId )
{
  SHORT sId;                /* holds service id */

   T_ACI_RETURN   retVal;
 

  TRACE_FUNCTION ("qAT_PercentCCBS ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_CCBS_SAT_Handle( srcId, CCFC_MOD_Query, -1);

    if( retVal NEQ AT_CMPL )
        return( retVal );
  


/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * set up  facility information element
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_CCBS, SS_NO_PRM, SS_NO_PRM );
/*
 *-----------------------------------------------------------------
 * declare service table entry as used and the owner of the service
 *-----------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].srvOwn     = srcId;

/*
 *-------------------------------------------------------------------
 * start a new transaction 
 *-------------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].curCmd = AT_CMD_CCBS;
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd              = AT_CMD_CCBS;
  cmdLog.cmdType            = CLOG_TYPE_Query;
  cmdLog.retCode            = AT_EXCT;
  cmdLog.cId                = ACI_NumParmNotPresent;
  cmdLog.sId                = sId+1;
  cmdLog.cmdPrm.qCCBS.srcId = srcId;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PercentCNAP          |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the %CNAP AT command
            which is responsible to query the setting for calling
            name presentation supplementary services.

*/

GLOBAL T_ACI_RETURN qAT_PercentCNAP  ( T_ACI_CMD_SRC srcId )
{
  SHORT sId;                /* holds service id */

  T_ACI_RETURN   retVal;

  TRACE_FUNCTION ("qAT_PercentCNAP ()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */  
  if(!cmh_IsVldCmdSrc (srcId)) 
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

/* SIM TOOLKIT & FDN HANDLING */
    retVal = cmhSS_CNAP_SAT_Handle( srcId);

    if( retVal NEQ AT_CMPL )
        return( retVal );

/*
 *-------------------------------------------------------------------
 * get a new service table entry to interrogate SS
 *-------------------------------------------------------------------
 */  
  sId = psaSS_stbNewEntry();

  if( sId EQ NO_ENTRY )
  { 
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull );
    return( AT_FAIL );
  }

/*
 *-------------------------------------------------------------------
 * set up  facility information element
 *-------------------------------------------------------------------
 */ 
  CCD_START;

  psaSS_asmInterrogateSS( SS_CD_CNAP, SS_NO_PRM, SS_NO_PRM ); 


/*
 *-----------------------------------------------------------------
 * declare service table entry as used and the owner of the service
 *-----------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].ntryUsdFlg = TRUE;
  ssShrdPrm.stb[sId].srvOwn     = srcId;

/*
 *-------------------------------------------------------------------
 * start a new transaction 
 *-------------------------------------------------------------------
 */  
  ssShrdPrm.stb[sId].curCmd = AT_CMD_CNAP;    
  psaSS_NewTrns(sId);

  CCD_END;

/*
 *-------------------------------------------------------------------
 * log command execution
 *-------------------------------------------------------------------
 */  
#if defined SMI OR defined MFW OR defined FF_MMI_RIV
  {
  T_ACI_CLOG cmdLog;        /* holds logging info */

  cmdLog.atCmd              = AT_CMD_CNAP;
  cmdLog.cmdType            = CLOG_TYPE_Query;
  cmdLog.retCode            = AT_EXCT;
  cmdLog.cId                = ACI_NumParmNotPresent;
  cmdLog.sId                = sId+1;
  cmdLog.cmdPrm.qCCBS.srcId = srcId;

  rAT_PercentCLOG( &cmdLog );
  }
#endif

  return( AT_EXCT );
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : CMH_SSQ                  |
| STATE   : code                  ROUTINE : qAT_PercentCSCN          |
+--------------------------------------------------------------------+

  PURPOSE : This is the functional counterpart to the %CSCN AT command
            which is responsible to query the settings.

*/
GLOBAL T_ACI_RETURN qAT_PercentCSCN ( T_ACI_CMD_SRC srcId,
                                   T_ACI_SS_CSCN_MOD_STATE     *ss_switch,
                                   T_ACI_SS_CSCN_MOD_DIRECTION *ss_direction,
                                   T_ACI_CC_CSCN_MOD_STATE     *cc_switch,
                                   T_ACI_CC_CSCN_MOD_DIRECTION *cc_direction )
{
  TRACE_FUNCTION ("qAT_PercentCSCN ()");

  if(!cmh_IsVldCmdSrc (srcId))
  { /* check command source */
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }

  *ss_switch    = cmhPrm[srcId].ssCmdPrm.CSCNss_mode.SsCSCNModeState;
  *ss_direction = cmhPrm[srcId].ssCmdPrm.CSCNss_mode.SsCSCNModeDirection;
  *cc_switch    = cmhPrm[srcId].ccCmdPrm.CSCNcc_mode.CcCSCNModeState;
  *cc_direction = cmhPrm[srcId].ccCmdPrm.CSCNcc_mode.CcCSCNModeDirection;

  return( AT_CMPL);
}

#ifdef SIM_PERS
/*
+===========================================================+
| PROJECT : GSM-PS (6147)      MODULE  : CMH_SSQ            |
| STATE   : code               ROUTINE : qAT_PercentMEPD    |
|                                                           |
|This is the functional counterpart to the %MEPD AT command |
|which is responsible to query MEPD Configuration Data.     |
+===========================================================+
*/



GLOBAL T_ACI_RETURN qAT_PercentMEPD( T_ACI_CMD_SRC srcId, T_SUP_INFO *sup_info)
{
  T_OPER_RET_STATUS rlockstatus;

  TRACE_FUNCTION ("qAT_ PercentMEPD()");

/*
 *-------------------------------------------------------------------
 * check command source
 *-------------------------------------------------------------------
 */
  if(!cmh_IsVldCmdSrc (srcId))
  {
    ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
    return( AT_FAIL );
  }
  rlockstatus=aci_slock_sup_info(sup_info);

  if (rlockstatus EQ OPER_SUCCESS)
  {
    return (AT_CMPL);
  }
  else if (rlockstatus EQ OPER_FAIL)
  {
    ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
    return( AT_FAIL );
  }
  return( AT_EXCT );
}
#endif //SIM_PERS
/*==== EOF ========================================================*/