/*======================================================
                    IMPORTANT NOTICE

                  OEM DISTRIBUTION ONLY

This file is covered by the licensing terms for CDMA 
ASIC licensees.  Under terms of those licensing agreements, 
this file MUST NOT be transmitted in whole or in part 
to any party who has not been licensed for use of the
QUALCOMM CDMA technologies. 

FILE:  OEMCM.h

SERVICES:  AEE OEM CM Interface header

GENERAL DESCRIPTION:

This file contains all of the function prototypes for
routines that are required by the AEE to function with
QC's Call Manager.


        Copyright © 1999-2002 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
=====================================================*/
#ifndef OEMCM_H
#define OEMCM_H

// BEGIN: The following block(s) are temporary until TAPI is ChIL-ed.
#if defined(PALMOS)

#include "AEEComdef.h"
#include "AEE_OEM.h"

//#define SECTION_OEMCM CODE_SECTION("oemcm")
#define SECTION_OEMCM

typedef enum cm_oprt_mode_e_ {

    CM_OPRT_MODE_NONE=-1,   /* FOR INTERNAL USE OF CM ONLY! */

    CM_OPRT_MODE_PWROFF,    /* phone is powering off */
    CM_OPRT_MODE_OFFLINE,   /* phone is offline Digital*/
#ifdef FEATURE_ACP
    CM_OPRT_MODE_OFFLINE_A, /* phone is offline analog */
#endif
    CM_OPRT_MODE_ONLINE,    /* phone is online */
    CM_OPRT_MODE_LPM,       /* phone is in LPM - Low Power Mode */
    CM_OPRT_MODE_RESET,     /* phone is resetting - i.e. power-cycling */

    CM_OPRT_MODE_MAX        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_oprt_mode_e_type;

typedef enum cm_srv_state_e {

    CM_SRV_STATE_NONE=-1,       /* FOR INTERNAL USE OF CM ONLY! */

    CM_SRV_STATE_NO_SRV,        /* phone has no service */
    CM_SRV_STATE_ANALOG,        /* phone has analog service */
    CM_SRV_STATE_DIGITAL,       /* phone has digital service */

    CM_SRV_STATE_MAX            /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_srv_state_e_type;

typedef enum cm_cdma_lock_mode_e {

    CM_CDMA_LOCK_MODE_NONE=-1,  /* FOR INTERNAL USE OF CM ONLY! */

    CM_CDMA_LOCK_MODE_OFF,      /* phone is NOT CDMA locked */
    CM_CDMA_LOCK_MODE_ON,       /* phone is CDMA locked until power-cycle */

    CM_CDMA_LOCK_MODE_MAX       /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_cdma_lock_mode_e_type;

typedef enum {
  DB_VOICE_AS_DATA_NEVER,         /* Never answer voice call as a data call */
  DB_VOICE_AS_FAX_ONCE,           /* Answer voice as fax once               */
  DB_VOICE_AS_FAX_ALWAYS,         /* Always answer voice as fax             */
  DB_VOICE_AS_MODEM_ONCE,         /* Answer voice as modem once             */
  DB_VOICE_AS_MODEM_ALWAYS        /* Always answer voice as modem           */
} db_voice_as_data_type;

typedef enum cm_answer_voice_e {

    CM_ANSWER_VOICE_NONE=-1,          /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_NEWCM

    CM_ANSWER_VOICE_AS_VOICE,         /* = DB_VOICE_AS_DATA_NEVER, */
        /* Answer voice as voice */

    CM_ANSWER_VOICE_AS_FAX_ONCE,      /* = DB_VOICE_AS_FAX_ONCE, */
        /* Answer voice as fax once (for the next 10 minutes) */

    CM_ANSWER_VOICE_AS_FAX_ALWAYS,    /* = DB_VOICE_AS_FAX_ALWAYS, */
         /* Answer voice as fax always */

    CM_ANSWER_VOICE_AS_MODEM_ONCE,    /* = DB_VOICE_AS_MODEM_ONCE, */
        /* Answer voice as modem once (for the next 10 minutes) */

    CM_ANSWER_VOICE_AS_MODEM_ALWAYS,  /* = DB_VOICE_AS_MODEM_ALWAYS, */
        /* Answer voice as modem always */

    CM_ANSWER_VOICE_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

#else /* FEATURE_NEWCM */
    CM_ANSWER_VOICE_AS_VOICE = DB_VOICE_AS_DATA_NEVER,
        /* Answer voice as voice */

    CM_ANSWER_VOICE_AS_FAX_ONCE = DB_VOICE_AS_FAX_ONCE,
        /* Answer voice as fax once (for the next 10 minutes) */

    CM_ANSWER_VOICE_AS_FAX_ALWAYS = DB_VOICE_AS_FAX_ALWAYS,
         /* Answer voice as fax always */

    CM_ANSWER_VOICE_AS_MODEM_ONCE = DB_VOICE_AS_MODEM_ONCE,
        /* Answer voice as modem once (for the next 10 minutes) */

    CM_ANSWER_VOICE_AS_MODEM_ALWAYS = DB_VOICE_AS_MODEM_ALWAYS,
        /* Answer voice as modem always */

    CM_ANSWER_VOICE_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#endif /* FEATURE_NEWCM */


} cm_answer_voice_e_type;

typedef enum {
  NV_MODE_DIGITAL_PREF,     /* CDMA then Analog */
  NV_MODE_DIGITAL_ONLY,     /* CDMA only */
  NV_MODE_ANALOG_PREF,      /* Analog then CDMA */
  NV_MODE_ANALOG_ONLY,      /* Analog only */
  NV_MODE_AUTOMATIC,        /* Determine mode automatically */
  NV_MODE_E911,             /* Emergency mode */
  NV_MODE_HOME_ONLY,        /* Restrict to home only */
  NV_MODE_PCS_CDMA_ONLY,
  NV_MODE_CELL_CDMA_ONLY,
  NV_MODE_ENUM_PAD = 0x7FFF /* Pad to 16 bits on ARM */
} nv_mode_enum_type; 

typedef enum cm_mode_pref_e {

    CM_MODE_PREF_PERSISTENT=-2,
        /* Return to persistent mode preference */

    CM_MODE_PREF_NONE=-1,     /* FOR INTERNAL USE OF CM ONLY! */


#ifdef FEATURE_NEWCM

    CM_MODE_PREF_ANALOG_ONLY, /* = NV_MODE_ANALOG_ONLY, */
        /* Service is limited to analog only */

    CM_MODE_PREF_DIGITAL_ONLY,/* = NV_MODE_DIGITAL_ONLY, */
        /* Service is limited to digital only */


    CM_MODE_PREF_AUTOMATIC,   /* = NV_MODE_AUTOMATIC, */
        /* Determine the mode automatically from the PRL order */

    CM_MODE_PREF_E911,        /* = NV_MODE_E911, */
        /* Emergency mode */

#if ( defined(FEATURE_CDMA_800) && defined(FEATURE_CDMA_1900) )
    CM_MODE_PREF_PCS_CDMA_ONLY, /* = NV_MODE_PCS_CDMA_ONLY, */
        /* PCS mode */
    
    CM_MODE_PREF_CELL_CDMA_ONLY, /*= NV_MODE_CELL_CDMA_ONLY, */
        /* Cellular mode */
#endif

    CM_MODE_PREF_MAX          /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

#else /* FEATURE_NEWCM */
    CM_MODE_PREF_ANALOG_ONLY  = NV_MODE_ANALOG_ONLY,
        /* Service is limited to analog only */

    CM_MODE_PREF_DIGITAL_ONLY = NV_MODE_DIGITAL_ONLY,
        /* Service is limited to digital only */


    CM_MODE_PREF_AUTOMATIC    = NV_MODE_AUTOMATIC,
        /* Determine the mode automatically from the PRL order */

    CM_MODE_PREF_E911         = NV_MODE_E911,
        /* Emergency mode */

#if ( defined(FEATURE_CDMA_800) && defined(FEATURE_CDMA_1900) )
    CM_MODE_PREF_PCS_CDMA_ONLY= NV_MODE_PCS_CDMA_ONLY,
        /* PCS mode */
    
    CM_MODE_PREF_CELL_CDMA_ONLY= NV_MODE_CELL_CDMA_ONLY,
        /* Cellular mode */
#endif

    CM_MODE_PREF_MAX          /* FOR INTERNAL USE OF CM ONLY! */
#endif /* FEATURE_NEWCM */

} cm_mode_pref_e_type;

typedef enum cm_mode_term_e {

  CM_MODE_TERM_NONE=-1,      /* FOR INTERNAL USE OF CM ONLY! */


  CM_MODE_TERM_PERMANENT,
      /* Permanent mode change */

  CM_MODE_TERM_PWR_CYCLE,
      /* Until power cycle */

  CM_MODE_TERM_1_CALL,
      /* Until end of next call or power-cycle */

  CM_MODE_TERM_1_CALL_OR_TIME,
      /* Until end of next call, specified timeout or power-cycle */

  CM_MODE_TERM_CM_1_CALL,
  CM_MODE_TERM_CM_1_CALL_PLUS,
      /* Mode terms that are assigned automatically by call manager
      ** when mode is forced on the fly during a call origination.
      **
      ** CM unforce the mode back to it original settings at end of
      ** call or some short time after end of call.
      **
      ** NOTE! These mode term should NOT be used by clients
      ** when changing the mode preference */


  CM_MODE_TERM_MAX           /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_mode_term_e_type;

typedef enum {
  NV_SP_A_ONLY=0,          /* A only */
  NV_SP_B_ONLY,            /* B only */
  NV_SP_HOME_ONLY,         /* Home only */
  NV_SP_STANDARD,          /* Home preferred */
  NV_SYS_PREF_ENUM_PAD = 0x7FFF /* Pad to 16 bits on ARM */
} nv_sys_pref_enum_type;

typedef enum cm_sys_pref_e {

    CM_SYS_PREF_NONE=-1,      /* FOR INTERNAL USE OF CM ONLY! */


#ifdef FEATURE_NEWCM

    CM_SYS_PREF_A_ONLY,       /* = NV_SP_A_ONLY, */
        /* Service is limited to A system only
        ** NOTE! SHOULD ONLY BE USED IN 800 MHz TARGETS */

    CM_SYS_PREF_B_ONLY,       /* = NV_SP_B_ONLY, */
        /* Service is limited to B system only
        ** NOTE! SHOULD ONLY BE USED IN 800 MHz TARGETS */

    CM_SYS_PREF_HOME_ONLY,    /* = NV_SP_HOME_ONLY, */
        /* Service is limited to home system only */

    CM_SYS_PREF_STANDARD,     /* = NV_SP_STANDARD, */
        /* Home service is preferred */


    CM_SYS_PREF_MAX           /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

#else /* FEATURE_NEWCM */
    CM_SYS_PREF_A_ONLY     = NV_SP_A_ONLY,
        /* Service is limited to A system only
        ** NOTE! SHOULD ONLY BE USED IN 800 MHz TARGETS */

    CM_SYS_PREF_B_ONLY     = NV_SP_B_ONLY,
        /* Service is limited to B system only
        ** NOTE! SHOULD ONLY BE USED IN 800 MHz TARGETS */

    CM_SYS_PREF_HOME_ONLY  = NV_SP_HOME_ONLY,
        /* Service is limited to home system only */

    CM_SYS_PREF_STANDARD   = NV_SP_STANDARD,
        /* Home service is preferred */


    CM_SYS_PREF_MAX           /* FOR INTERNAL USE OF CM ONLY! */

#endif /* FEATURE_NEWCM */

} cm_sys_pref_e_type;

typedef enum {
  DB_ROAM_OFF,
  DB_ROAM_ON,
  DB_ROAM_BLINK
} db_roam_type;

typedef enum cm_roam_status_e {

    CM_ROAM_STATUS_NONE=-1,   /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_NEWCM
    
    CM_ROAM_STATUS_OFF,       /* = DB_ROAM_OFF, */
    CM_ROAM_STATUS_ON,        /* = DB_ROAM_ON, */
    CM_ROAM_STATUS_BLINK,     /* = DB_ROAM_BLINK, */

    CM_ROAM_STATUS_MAX        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

#else /* FEATURE_NEWCM */
    CM_ROAM_STATUS_OFF   = DB_ROAM_OFF,
    CM_ROAM_STATUS_ON    = DB_ROAM_ON,
    CM_ROAM_STATUS_BLINK = DB_ROAM_BLINK,

    CM_ROAM_STATUS_MAX        /* FOR INTERNAL USE OF CM ONLY! */
#endif /* FEATURE_NEWCM */

} cm_roam_status_e_type;

typedef enum cm_nam_e {

    CM_NAM_NONE=-1,         /* FOR INTERNAL USE OF CM ONLY! */

    CM_NAM_1,               /* NAM 1*/
    CM_NAM_2,               /* NAM 2 - for targets with more than 1 NAM */
    CM_NAM_3,               /* NAM 3 - for targets with more than 2 NAM's */
    CM_NAM_4,               /* NAM 4 - for targets with more than 3 NAM's */
    CM_NAM_AUTO,          /* Auto NAM - for targets with more than 1 NAM */

    CM_NAM_MAX              /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_nam_e_type;

typedef struct cm_ph_info_s {

    boolean                     is_in_use;
         /* Indicate whether phone is currently in use */

    cm_oprt_mode_e_type         oprt_mode;
        /* Indicate current operating mode */

    cm_srv_state_e_type         srv_state;
        /* Indicate current service state */

    cm_cdma_lock_mode_e_type    cdma_lock_mode;
        /* Indicate whether phone is CDMA locked until power cycle */

    cm_answer_voice_e_type      answer_voice;
        /* Indicate whether phone should answer incoming
        ** voice calls as voice, fax or modem */

    cm_mode_pref_e_type         mode_pref;
        /* Indicate current mode preference */

    cm_mode_term_e_type         mode_term;
        /* Indicate the current mode preference term -
        ** one-call, power-cycle, etc.*/

    cm_sys_pref_e_type          sys_pref;
        /* Indicate current system preference */

    cm_roam_status_e_type       roam_status;
        /* Indicate current roaming status */

    cm_nam_e_type               nam_sel;
        /* Indicate the NAM selection */

    cm_nam_e_type               curr_nam;
        /* Indicate the current NAM -
        ** needed when NAM selection is set to AUTO-NAM */

    uint16                       rssi;
       /* RSSI in positive dBm i.e. 75 means -75dBm */

} cm_ph_info_s_type;

typedef enum cm_call_state_e {

    CM_CALL_STATE_NONE=-1,  /* FOR INTERNAL USE OF CM ONLY! */

    CM_CALL_STATE_IDLE,     /* Call is in idle state - i.e. no call */
    CM_CALL_STATE_ORIG,     /* Call is in origination state */
    CM_CALL_STATE_INCOM,    /* Call is in alerting state */
    CM_CALL_STATE_CONV,     /* Call is in conversation state */

    CM_CALL_STATE_MAX       /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_call_state_e_type;

#ifdef FEATURE_NEWCM
/* Client ID type to differentiate CM client objects from one another.
*/
typedef int  cm_client_id_type;

#else
/* Type for init mask variable.
*/
typedef byte cm_init_mask;



/* Client ID type to differentiate CM client objects from one another.
*/
typedef struct cm_client_s  *cm_client_id_type;
#endif

typedef enum cm_call_type_e {

    /* Call types for originating and answering calls.
    */

    CM_CALL_TYPE_NONE=-1,
        /* FOR INTERNAL USE OF CM ONLY! */

    CM_CALL_TYPE_VOICE,
        /* Voice call type.
        **
        ** NOTE! Answering with this type is only successful if the
        ** incoming call is of type VOICE */

    CM_CALL_TYPE_DATA,
        /* Data call type - (for modem, fax, packet, etc. calls).
        **
        ** NOTE! Answering with this call is only successful if the
        ** incoming call is of type DATA or VOICE (with AMPS service) */

    CM_CALL_TYPE_SMS,
        /* SMS call type (SMS SO-6 and SO-14)
        **
        ** NOTE! Answering with this call type is only successful
        ** if incoming call is of type SMS */

    #ifdef FEATURE_GPSONE_DBM
    CM_CALL_TYPE_PD,
        /* Position Determination call type (SO-35 and 36)
        ** This call type used to exchange IS-801 messages.
        **/
    #endif

    CM_CALL_TYPE_TEST,
        /* Test call type (for Markov, Loopback, etc.)
        **
        ** NOTE! Answering with this call type is only successful
        ** if incoming call is of type TEST */

    CM_CALL_TYPE_OTAPA,
        /* OTAPA call type (OTAPA SO-18 and SO-19)
        **
        ** NOTE! Answering with this call type is only successful
        ** if incoming call is of type OTAPA */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Call types that are automatically assigned by call manager when
    ** detecting an origination dial-string that matches one of the
    ** special numbers that are stored in the phone-book.
    **
    ** NOTE! This call types should not be used to originate
    ** or answer calls.
    */

    CM_CALL_TYPE_STD_OTASP,
        /* Standard OTASP call type.
        **
        ** This call type is automatically assigned by call manager when
        ** detecting an origination dial-string that matches one of the
        ** standard OTASP numbers that are stored in the phone-book.
        **
        ** NOTE! This call type should not be used to originate
        ** or answer calls */

    CM_CALL_TYPE_NON_STD_OTASP,
        /* None standard OTASP call type.
        **
        ** This call type is automatically assigned by call manager when
        ** detecting an origination dial-string that matches one of the none
        ** standard OTASP numbers that are stored in the phone-book.
        **
        ** NOTE! This call type should not be used to originate
        ** or answer calls */

    CM_CALL_TYPE_E911,
        /* Emergency call type.
        **
        ** This call type is automatically assigned by call manager when
        ** detecting an origination dial-string that matches one of the
        ** E911 numbers that are stored in the phone-book.
        **
        ** NOTE! this call type should not be used to originate
        ** or answer calls
        **
        ** NOTE! When call manager assigned this call type, the mode
        ** preference is forced to E911 before origination. if at the
        ** end of the call the phone is not in E911 callback mode,
        ** the mode is automatically restored to its original selection,
        ** else the E911 mode stays in effect until changed by a client
        ** or power-cycle */

    CM_CALL_TYPE_MAX
        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_call_type_e_type;

#define CM_MAX_CALLED_INFO_CHARS  64   /*  CM_MAX_DATA_DIGITS*/
    /* Max length of Called info string */

#define CM_MAX_NUMBER_CHARS      CM_MAX_CALLED_INFO_CHARS
    /* Max length of CM number string  This is the Maximum
       of CM_MAX_DIALED_DIGITS, CM_MAX_CALLER_ID_CHARS
       CM_MAX_CALLED_INFO_CHARS and CM_MAX_CALLED_INFO_CHARS */

typedef enum cm_digit_mode_e {

    CM_DIGIT_MODE_NONE=-1,      /* FOR INTERNAL USE OF CM ONLY! */

    CM_DIGIT_MODE_4BIT_DTMF,    /* 4-bit DTMF */
    CM_DIGIT_MODE_8BIT_ASCII,   /* 8-bit ASCII */

    CM_DIGIT_MODE_MAX           /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_digit_mode_e_type;

typedef struct cm_num_s {


    byte                    buf[CM_MAX_NUMBER_CHARS];
        /* Number buffer */

    byte                    len;
        /* Length of number stored in num_buf */

    cm_digit_mode_e_type    digit_mode;
        /* Origination digit mode - see J-STD-008 2.7.1.3.2.4 */

    byte                    number_type;
        /* Number type - see J-STD-008 2.7.1.3.2.4-2
        ** NOTE! ONLY VALID FOR CDMA CALLS */

    byte                    number_plan;
        /* Numbering Plan - see J-STD-008 2.7.1.3.2.4-3
        ** NOTE! ONLY VALID FOR CDMA CALLS */

    byte                    pi;
        /* Presentation Indicator - see J-STD-008  2.7.4.4-1 */

    byte                    si;
        /* Screening Indicator - see J-STD-008 2.7.4.4-2 */

} cm_num_s_type;

#define CM_MAX_ALPHA_LEN_FOR_DISPLAY_INFO   64  /* CM_MAX_DATA_DIGITS */

#define CM_MAX_ALPHA_TAG_CHARS    CM_MAX_ALPHA_LEN_FOR_DISPLAY_INFO
    /* Max length of CM alpha tag string. This is the maximum of
       CM_MAX_ALPHA_LEN_FOR_CALL_ORIG and
       CM_MAX_ALPHA_LEN_FOR_DISPLAY_INFO  */

typedef struct cm_alpha_s {

    byte    buf[CM_MAX_ALPHA_TAG_CHARS];
        /* Alpha buffer */

    byte    len;
        /* Length of alpha tag stored in alpha_buf */
} cm_alpha_s_type;

typedef struct cm_signal_s {

    boolean    is_signal_info_avail;
        /* Indicate whether signal information is available.
        **
        ** NOTE! if this variable is FALSE, the values found in other
        ** fields of this structure as NO meaning */

    byte       signal_type;
        /* Signal type - Tone Signal, ISDN Alerting or IS-54B Alerting */

    byte       alert_pitch;
        /* Alert pitch - Medium, High or Low */

    byte       signal;
        /* Indicate which Tone signals, ISDN Alerting or IS_54B Alerting */

} cm_signal_s_type;

typedef enum cm_call_end_e {

    CM_CALL_END_NONE=-1,            /* FOR INTERNAL USE OF CM ONLY! */

    CM_CALL_END_OFFLINE,            /* phone is offline */
    CM_CALL_END_CDMA_LOCK,          /* phone is CDMA locked until power cycle */
    CM_CALL_END_NO_SRV,             /* phone has no service */
    CM_CALL_END_FADE,               /* Call has ended abnormally */
    CM_CALL_END_INTERCEPT,          /* received intercept from BS - orig only */
    CM_CALL_END_REORDER,            /* received reorder from BS - orig only */
    CM_CALL_END_REL_NORMAL,         /* received release from BS - no reason given */
    CM_CALL_END_REL_SO_REJ,         /* received release from BS - SO reject */
    CM_CALL_END_INCOM_CALL,         /* received incoming call from BS */
    CM_CALL_END_ALERT_STOP,         /* received alert stop from BS - incom only */
    CM_CALL_END_CLIENT_END,         /* client ended the call */
    CM_CALL_END_ACTIVATION,         /* received end activation - OTASP call only */
    CM_CALL_END_MC_ABORT,           /* MC aborts the origination/conversation*/


#ifdef FEATURE_IS95B_NDSS
    CM_CALL_END_NDSS_FAIL,          /* Call orig or call failed due to NDSS failure */
#endif /*FEATURE_IS95B_NDSS */

#if (defined(FEATURE_CDMA_800) && defined(FEATURE_CDMA_1900))
    CM_CALL_END_MAX_ACCESS_PROBE,
#endif /* TriMode */

#ifdef FEATURE_RUIM
    CM_CALL_END_RUIM_NOT_PRESENT,
#endif /* FEATURE_RUIM */
    
    CM_CALL_END_MAX           /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_call_end_e_type;

typedef struct cm_call_info_s {

    cm_call_state_e_type   call_state;
        /* Call state - idle, orig, incom, conv */

    cm_client_id_type      call_client;
        /* Call client - originating/answering client */

    cm_call_type_e_type    call_type;
        /* Call type - VOICE, DATA, OTASP, etc */

    word                   srv_opt;
        /* Service option as defined in CAI.H file
        **
        ** NOTE! The service option takes on the CM_SO_ANALOG
        ** value (defined in this file) when the call is connected
        ** (or to be connected) over analog service */

    cm_num_s_type          num;
        /* Number buffer:
        ** CM_CALL_EVENT_ORIG      - contains dialed digits string.
        ** CM_CALL_EVENT_FLASH     - contains dialed digits string.
        ** CM_CALL_EVENT_INCOM     - contains caller ID string.
        ** CM_CALL_EVENT_CALLER_ID - contains caller ID string. */

    cm_alpha_s_type        alpha;
        /* Alpha tag to be displayed along with dialed address
        ** of an originated call.
        **
        ** NOTE! this is not a phone book name match, but rather
        ** an indication for the UI to display some text for an
        ** outgoing call
        **
        ** We probably need to change this one to a UI text component to
        ** support I18N
        **
        Alpha buffer:
        CM_CALL_EVENT_ORIG
        CM_CALL_EVENT_DISPLAY
        CM_CALL_EVENT_EXT_DISP        */

    cm_signal_s_type       signal;
        /* Alert signal information to be played for the incoming call */

    boolean                is_privacy;
        /* Indicate whether privacy mode is on */

    cm_call_end_e_type     end_status;
        /* Call end status (i.e. reason for ending a call in origination,
        incoming or conversation state) */

    boolean                is_otasp_commit;
        /* Indicate whether OTASP activation is successful */


    boolean                is_last_cdma_info_rec;
        /* this field indicates whether this is the last
           CDMA info record or not */

#ifdef FEATURE_IS95B_EXT_DISP
    byte                        ext_disp_type;
        /* display type for extended disaply info record */
#endif


#ifdef FEATURE_IS95B_ALERT_ANS_BYPASS
    boolean                 alert_ans_bypass;
         /* Indicate whether the incoming call need to be answered by the clients */
#endif

#ifdef FEATURE_IS95B_NDSS
    boolean                     ndss_in_progress;
        /* MC is perfoming NDSS redirection */
#endif

#ifdef FEATURE_IS2000
#error code not present
#endif /* FEATURE_IS2000 */

} cm_call_info_s_type;

typedef enum cm_band_class_e {

    CM_BAND_CLASS_NONE=-1,        /* FOR INTERNAL USE OF CM ONLY! */

 
    CM_BAND_CELLULAR,             /* 800 MHz cellular band */
    CM_BAND_PCS,                  /* 1.8 to 2.0 GHz band for PCS or Korean PCS see cai.h*/

    CM_BAND_CLASS_MAX             /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_band_class_e_type;

typedef enum cm_block_or_system_e {

    CM_BLOCK_OR_SYSTEM_NONE=-1,        /* FOR INTERNAL USE OF CM ONLY! */
 
    CM_PCS_BLOCK_A,                    /* PCS block A */
    CM_PCS_BLOCK_B,                    /* PCS block B */
    CM_PCS_BLOCK_C,                    /* PCS block C */
    CM_PCS_BLOCK_D,                    /* PCS block D */
    CM_PCS_BLOCK_E,                    /* PCS block E */
    CM_PCS_BLOCK_F,                    /* PCS block F */
    CM_CELLULAR_SYS_A,                 /* Cellular system A */
    CM_CELLULAR_SYS_B,                 /* Cellular system B */

    CM_BLOCK_OR_SYSTEM_MAX             /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_block_or_system_e_type;

typedef struct cm_ss_info_s {


  cm_srv_state_e_type   srv_state;
        /* analog or digital */
 
  boolean               is_registered;
        /* is mobile registered on the current system */

  cm_band_class_e_type  band_class;
       /* cellular or PCS */

  cm_block_or_system_e_type        block_or_system;
       /* PCS frequency block: A to F Cellular System A or B*/    

  
  word                  changed_fields;
      /* Bit mask indicating which of the following
      ** serving system fields were changed since 
      last notification  
      
      Bit mask:
        CM_SS_SID_MASK                ( 0x0001 )
        CM_SS_NID_MASK                ( 0x0002 )
        CM_SS_REG_ZONE_MASK           ( 0x0004 )
        CM_SS_PACKET_ZONE_MASK        ( 0x0008 )     
        CM_SS_BS_P_REV_MASK           ( 0x0010 )       
        CM_SS_P_REV_IN_USE_MASK       ( 0x0020 )         
      */


  word                  sid;
      /* 15 bit System ID */

  word                  nid;
      /* 16 bit Network ID */

  word                  reg_zone;
      /* 12 bit registration zone */

  byte                  packet_zone;
      /* 8  bit packet zone */

  byte                  bs_p_rev;
      /* 8  bit base station p_rev */
  
  byte                  p_rev_in_use;
      /* 8  bit p_rev in use the lessor of 
         BS p_rev and mobile p_rev */


} cm_ss_info_s_type;

typedef enum cm_srv_type_e {

    CM_SRV_TYPE_NONE,
        /* FOR INTERNAL USE OF CM ONLY! */

    CM_SRV_TYPE_AMPS,
        /* Call is to be connected over analog service.
        **
        ** Note that the client does NOT need to specify service option when
        ** originating with this call type.
        **
        ** NOTE! When originating with this service type, the mode preference
        ** might be forced to ANALOG ONLY before origination and returned to
        ** its original setting at the end of the call */

    CM_SRV_TYPE_CDMA_SPECIFIC,
        /* Call is to be connected over CDMA service with specific client
        ** designated CDMA service option.
        **
        ** Note that the client need to specify service option when
        ** originating with this call type.
        **
        ** NOTE! When originating with this service type, the mode preference
        ** might be forced to DIGITAL ONLY before origination and returned to
        ** its original setting at the end of the call */

    CM_SRV_TYPE_CDMA_AUTOMATIC,
        /* Call is to be connected over CDMA service where CM automatically
        ** originate with the best available service option for the specified
        ** call type.
        **
        ** Note that the client does NOT need to specify service option when
        ** originating with this call type */

    CM_SRV_TYPE_AUTOMATIC,
        /* Call is to be connected over available service - AMPS or CDMA
        ** with best available CDMA service option.
        **
        ** Note that the client does NOT need to specify service option when
        ** originating with this call type */

    CM_SRV_TYPE_MAX
        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_srv_type_e_type;

#ifdef FEATURE_NEWCM
typedef enum {
  CM_ABAND,
  CM_BBAND,
  CM_ABLOCK,
  CM_BBLOCK,
  CM_CBLOCK,
  CM_DBLOCK,
  CM_EBLOCK,
  CM_FBLOCK,
  CM_PREFERRED,
  CM_OTASP_ACT_CODE_NONE

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_activate_code_type;

#else /* FEATURE_NEWCM */
#ifdef FEATURE_OTASP
typedef enum {
  ABAND,
  BBAND,
  ABLOCK,
  BBLOCK,
  CBLOCK,
  DBLOCK,
  EBLOCK,
  FBLOCK,
  PREFERRED
} mc_activate_code_type;

typedef  mc_activate_code_type cm_activate_code_type;
#define CM_OTASP_ACT_CODE_NONE   ( (cm_activate_code_type) ((int)PREFERRED+1) )

#else

typedef enum {
 CM_OTASP_ACT_CODE_NONE
} cm_activate_code_type;

#endif /* FEATURE_OTASP */
#endif  /* FEATURE_NEWCM */

typedef enum cm_call_cmd_e {

    CM_CALL_CMD_NONE=-1,       /* FOR INTERNAL USE OF CM ONLY! */

    CM_CALL_CMD_ORIG,          /* Originate a call */
    CM_CALL_CMD_ANSWER,        /* Answer an incoming call */
    CM_CALL_CMD_END,           /* End a call in orig, incom or conv state */
    CM_CALL_CMD_FLASH,         /* Send a flash with information */
    CM_CALL_CMD_INFO_GET,      /* Get a sanpshot of the call inofrmation in the CM */

    CM_CALL_CMD_MAX            /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_call_cmd_e_type;

typedef enum cm_call_cmd_err_e {

    CM_CALL_CMD_ERR_NONE=-1,
        /* FOR INTERNAL USE OF CM ONLY! */


    CM_CALL_CMD_ERR_NOERR,
        /* No errors found */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from clients feeding a call command
    ** function with bad or inappropriate parameters.
    */

    CM_CALL_CMD_ERR_CLIENT_ID_P,
        /* invalid client ID - null or not initialized*/

    CM_CALL_CMD_ERR_CALL_TYPE_P,
        /* Bad call type parameter */

    CM_CALL_CMD_ERR_SRV_TYPE_P,
        /* Bad service type parameter */

    CM_CALL_CMD_ERR_SRV_OPT_P,
        /* Bad service option parameter */

    CM_CALL_CMD_ERR_NO_NUM_P,
        /* Expecting a number to be provided via the number parameter */

    CM_CALL_CMD_ERR_NULL_NUM_P,
        /* Number length is > 0, but number buffer points to NULL */

    CM_CALL_CMD_ERR_NUM_P,
        /* Invalid digits found in number buffer */

    CM_CALL_CMD_ERR_NUM_LEN_P,
        /* Out of range value found in number length field */

    CM_CALL_CMD_ERR_NULL_ALPHA_P,
        /* Alpha length is > 0, but alpha buffer points to NULL */

    CM_CALL_CMD_ERR_ALPHA_LEN_P,                                     /* 10 */
        /* Out of range value found in alpha length field */

#ifdef FEATURE_OTASP
    CM_CALL_CMD_ERR_ACTIVATE_CODE_P,
        /* Invalid OTASP activation code */
#endif
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from clients trying to instruct
    ** CM to perform inappropriate actions relative to the current
    ** state of the call and/or phone.
    */

    CM_CALL_CMD_ERR_OFFLINE_S,
        /* Phone is offline */

    CM_CALL_CMD_ERR_CDMA_LOCK_S,
        /* Phone is CDMA locked */

    CM_CALL_CMD_ERR_FLASH_S,
        /* Client tried to send a flash while a call that not supporting
        ** flashes is in progress */

    CM_CALL_CMD_ERR_ORIG_RES_S,
        /* Dialed number is not allowed under the current origination
        ** restriction */

    CM_CALL_CMD_ERR_E911_MODE_S,
        /* Client tried to originate a NONE E911 call while E911 mode
        ** preference is in effect */

    CM_CALL_CMD_ERR_IN_USE_S,
        /* Can't perform the command in question while phone is in-use */

    CM_CALL_CMD_ERR_SRV_TYPE_S,
        /* Client originated with service type that is currently not
        ** supported by the phone/PRL */

    CM_CALL_CMD_ERR_CALL_TYPE_S,
        /* Client answered with inappropriate call type relative to
        ** to the type of the incoming call */

    CM_CALL_CMD_ERR_CALL_STATE_S,
        /* The command in question is invalid in the current call state -
        ** e.g. answering a call that was already answered,
        ** ending a call that was already ended, etc. */
    
     CM_CALL_CMD_ERR_SRV_STATE_S,
        /* The command in question is invalid in the current Phone serving state -
           e.g answering a call but serving state is no service
         */    
    
    CM_CALL_CMD_ERR_NO_SO_S,
        /* no valid service found for origination with AUTOMACTIC 
           or CDMA_AUTOMATIC srv type  */
    
    #ifdef FEATURE_IS95B_ALERT_ANS_BYPASS
    
    CM_CALL_CMD_ERR_ALERT_ANS_BYPASS_S,
        /* Client is not allowed to answer the incoming call */
    #endif /* FEATURE_IS95B_ALERT_ANS_BYPASS */   

#ifdef FEATURE_RUIM
    CM_CALL_CMD_ERR_RUIM_NOT_PRESENT_S,
#endif /* FEATURE_RUIM */
    
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from operational limitation
    ** of CM.
    */

    
    CM_CALL_CMD_ERR_NO_BUF_L,
        /* No available CM command buffers to queue the command */

    CM_CALL_CMD_ERR_MC_COM_L,
        /* Communication problems with MC - e.g. MC buffer shortage */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    CM_CALL_CMD_ERR_OTHER,
        /* A problem other than the above was found */

    CM_CALL_CMD_ERR_MAX
        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_call_cmd_err_e_type;

typedef enum cm_call_event_e {

    CM_CALL_EVENT_NONE=-1,    /* FOR INTERNAL USE OF CM ONLY! */

    CM_CALL_EVENT_ORIG,       /* phone originated a call */
    CM_CALL_EVENT_ANSWER,     /* Incoming call was answered */
    CM_CALL_EVENT_END,        /* Originated/incoming call was ended */
    CM_CALL_EVENT_FLASH,      /* phone sent Flash / Flash with Info to BS */

    CM_CALL_EVENT_INCOM,      /* phone received an incoming call */
    CM_CALL_EVENT_CONNECT,    /* Originated/incoming call was connected */
    CM_CALL_EVENT_SRV_OPT,    /* Service option changed while in a call */
    CM_CALL_EVENT_PRIVACY,    /* Privacy mode changed while in a call */
    CM_CALL_EVENT_CALLER_ID,  /* Caller ID info was received from BS */

    /* Events added for CM 2.0 */
    CM_CALL_EVENT_ABRV_ALERT,     /* CMDA/AMPS abbrebriated alert */
    CM_CALL_EVENT_ABRV_REORDER,   /* AMPS abbrebriated reorder */
    CM_CALL_EVENT_ABRV_INTERCEPT, /* AMPS abbrebriated intercept */
    CM_CALL_EVENT_SIGNAL,         /* signal info was received from BS */
    CM_CALL_EVENT_DISPLAY,        /* disaply info was received from BS */
    CM_CALL_EVENT_CALLED_PARTY,   /* called party info was received from BS */
    CM_CALL_EVENT_CONNECTED_NUM,  /* connected number info was received from BS */
    CM_CALL_EVENT_INFO,           /* call information, this event only sent to the client
                                     that request this information through
                                     cm_call_cmd_get_call_info */
#ifdef FEATURE_IS95B_EXT_DISP
    CM_CALL_EVENT_EXT_DISP,       /* extended display was received from BS */
#endif

#ifdef FEATURE_IS95B_NDSS
    CM_CALL_EVENT_NDSS_START,     /* Start NDSS redirection */
    CM_CALL_EVENT_NDSS_CONNECT,   /* call was re-connected due to NDSS */
#endif /*FEATURE_IS95B_NDSS */


    CM_CALL_EVENT_MAX         /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_call_event_e_type;

typedef enum cm_ph_event_e {

    CM_PH_EVENT_NONE=-1,        /* FOR INTERNAL USE OF CM ONLY! */

    CM_PH_EVENT_OPRT_MODE,      /* Operating mode was changed */
    CM_PH_EVENT_MODE_PREF,      /* Mode preference was changed */
    CM_PH_EVENT_SYS_PREF,       /* System preference was changed */
    CM_PH_EVENT_ANSWER_VOICE,   /* Answer voice as data was changed */
    CM_PH_EVENT_NAM_SEL,        /* NAM selection was changed */
    CM_PH_EVENT_CURR_NAM,       /* Current NAM was changed */

    CM_PH_EVENT_IN_USE_STATE,   /* In use state was changed */
    CM_PH_EVENT_SRV_STATE,      /* Service state was changed */
    CM_PH_EVENT_CDMA_LOCK_MODE, /* CDMA lock mode was changed */
    CM_PH_EVENT_ROAM_STATUS,    /* Roaming status was changed */

    CM_PH_EVENT_MAINTREQ,       /* CDMA maintenance required command */
    CM_PH_EVENT_STANDBY_SLEEP,  /* Entering powerdown sleep mode */
    CM_PH_EVENT_STANDBY_WAKE,   /* Existing powerdown sleep mode */
    CM_PH_EVENT_RSSI,           /* RSSI change */
    CM_PH_EVENT_INFO,           /* Phone information, this event only sent to the client
                                   that request this information through
                                   cm_ph_cmd_get_ph_info */

    CM_PH_EVENT_INFO_AVAIL,     /* Phone information is now available */

    CM_PH_EVENT_MAX             /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_ph_event_e_type;

typedef enum cm_ss_event_e {

    CM_SS_EVENT_NONE=-1,        /* FOR INTERNAL USE OF CM ONLY! */

    CM_SS_EVENT_SRV_CHANGED,    /* Serving system information changed */

    CM_SS_EVENT_INFO,          /* Serving system information, this event only sent to the client
                                  that request this information through
                                  cm_ss_cmd_get_ss_info */


    CM_SS_EVENT_MAX             /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_ss_event_e_type;

typedef enum cm_client_status_e {

    CM_CLIENT_ERR_NONE=-1,          /* FOR INTERNAL USE OF CM ONLY! */

    CM_CLIENT_OK,                   /* No error, request was completed successfully */

    CM_CLIENT_ERR_CLIENT_ID_PTR,    /* Invalid client ID pointer*/

    CM_CLIENT_ERR_CLIENT_ID,        /* Invalid client ID */

    CM_CLIENT_ERR_EVENT_REG_TYPE,   /* Invalid event registration type */

    CM_CLIENT_ERR_FROM_EVENT,       /* Invalid from event */

    CM_CLIENT_ERR_TO_EVENT,         /* Invalid to event */

    CM_CLIENT_ERR_CLIENT_INIT_FAIL, /* Unable to initialize the client */


    CM_CLIENT_ERR_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_client_status_e_type;

extern cm_client_status_e_type cm_client_deact(

    cm_client_id_type               client
        /* Requesting client */

) SECTION_OEMCM;

typedef enum cm_ph_cmd_e {

    CM_PH_CMD_NONE=-1,          /* FOR INTERNAL USE OF CM ONLY! */

    CM_PH_CMD_OPRT_MODE,        /* Change the operating mode */
    CM_PH_CMD_MODE_PREF,        /* Change the mode preference */
    CM_PH_CMD_SYS_PREF,         /* Change the system preference */
    CM_PH_CMD_ANSWER_VOICE,     /* Change the answer-voice-as-data setting */
    CM_PH_CMD_NAM_SEL,          /* Change the NAM selection */
    CM_PH_CMD_CLIENT_ACT,       /* A CM client activated itself */
    CM_PH_CMD_INFO_GET,         /* Get a sanpshot of the phone inofrmation in the CM */
    CM_PH_CMD_RSSI_DELTA,       /* Set RSSI change delta threshold for RSSI reporting */

    CM_PH_CMD_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_ph_cmd_e_type;

typedef enum cm_ph_cmd_err_e {

    CM_PH_CMD_ERR_NONE=-1,
        /* FOR INTERNAL USE OF CM ONLY! */


    CM_PH_CMD_ERR_NOERR,
        
    
    /* No errors found */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from FEATURES_XXX not being defined.
    */

    CM_PH_CMD_ERR_ANSWER_VOICE_F,
        /* Answer voice feature is not defined */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from clients feeding a phone command
    ** function with bad or inappropriate parameters.
    */

    CM_PH_CMD_ERR_CLIENT_ID_P,
        /* Invalid client ID; null or not initialized */

    CM_PH_CMD_ERR_OPRT_MODE_P,
        /* Bad operating mode parameter */

    CM_PH_CMD_ERR_MODE_PREF_P,
        /* Bad mode preference parameter */

    CM_PH_CMD_ERR_MODE_TERM_P,
        /* Bad mode term parameter */

    CM_PH_CMD_ERR_SYS_PREF_P,
        /* Bad system preference parameter */

    CM_PH_CMD_ERR_ANSWER_VOICE_P,
        /* Bad answer voice parameter */

    CM_PH_CMD_ERR_ANSWER_DURATION_P,
        /* Bad answer duration parameter. When indicating a temp. setting,
        ** such as CM_ANSWER_VOICE_AS_FAX_ONCE or DB_VOICE_AS_MODEM_ONCE
        ** a non-zero duration must be indicated, as well */

    CM_PH_CMD_ERR_NAM_P,
        /* Bad NAM parameter */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from clients trying to instruct
    ** CM to perform inappropriate actions relative to the current
    ** state of the phone.
    */

    CM_PH_CMD_ERR_IN_USE_S,
        /* Phone is in-use (i.e. in a call) */

    CM_PH_CMD_ERR_ONLINE_S,
        /* Phone is offline */

    CM_PH_CMD_ERR_OPRT_MODE_S,
        /* Invalid operating mode switch relatively to the current
        ** operating mode - e.g. OFFLINE -> ONLINE */

    CM_PH_CMD_ERR_MODE_PREF_S,
        /* Invalid mode preference selection relatively to what we
        ** currently have in the PRL - e.g. ANALOG_ONLY when there are no
        ** analog entries in the PRL */

    CM_PH_CMD_ERR_SYS_PREF_S,
        /* Invalid system preference selection for this target
        ** - e.g. A_ONLY for a none 800 MHz target, etc. */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from operational limitation
    ** of CM.
    */

    CM_PH_CMD_ERR_NO_BUF_L,
        /* No available CM command buffers to queue the command */


    CM_PH_CMD_ERR_MC_COM_L,
        /* MC communication problems */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    CM_PH_CMD_ERR_OTHER,
        /* A problem other than the above was found */


    CM_PH_CMD_ERR_MAX
        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_ph_cmd_err_e_type;


typedef void (cm_ph_cmd_cb_f_type) (

    void                    *data_block_ptr,
        /* Pointer to client provided data block */

    cm_ph_cmd_e_type        ph_cmd,
        /* Indicate which phone command is this error status for */

    cm_ph_cmd_err_e_type    ph_cmd_err
        /* Phone command error code, indicating whether command
        ** is rejected and the reason */
);

extern boolean cm_ph_cmd_rssi_delta_threshold(

    cm_ph_cmd_cb_f_type    cmd_cb_func,
        /* client callback function */

    void                   *data_block_ptr,
        /* pointer to client callback data block */

    cm_client_id_type      client,
        /* requesting client ID */

    uint8                  delta
      /* RSSI change delta threshold for RSSI reporting */
) SECTION_OEMCM;

typedef void (cm_call_cmd_cb_f_type) (

    void                      *data_block_ptr,
        /* Pointer to client provided data block.
        **
        ** NOTE! Depending on the client implementation of this function
        ** the data block pointed by this pointer might be accessed from
        ** client, as well as, CM context simultaneously */

    cm_call_cmd_e_type        call_cmd,
        /* Indicate which command is this error status for */

    cm_call_cmd_err_e_type    call_cmd_err
        /* Call command error code, indicating whether command
        ** is rejected and the reason */
);

extern boolean cm_call_cmd_orig(

        cm_call_cmd_cb_f_type  cmd_cb_func,
            /* client callback function */

        void                   *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type      client,
            /* originating client */

        cm_call_type_e_type    call_type,
            /* call type - voice, data, etc. */

        cm_srv_type_e_type     srv_type,
            /* service type - AMPS, CDMA, automatic, etc. */

        word                   srv_opt,
            /* Service option as defined in CAI.H file */

        const byte             *num_buf,
            /* Dialed address buffer.
            **
            ** NOTE! In the case where the digit_mode parameter is set to
            ** CM_DIGIT_MODE_4BIT_DTMF the number buffer may only contain
            ** 0-9, "#", or "*" characters.
            **
            ** In the case where the digit_mode parameter is set to
            ** CM_DIGIT_MODE_8BIT_ASCII the number buffer may contain any
            ** 8-bit ASCII characters */

        byte                   num_len,
            /* dialed address length */

        cm_digit_mode_e_type   digit_mode,
            /* digit mode - see J-STD-008 2.7.1.3.2.4 */

        const byte             *alpha_buf,
            /* alpha tag to be displayed for the
            ** origination */

        byte                   alpha_len,
            /* alpha tag length */

        cm_activate_code_type  activate_code
            /* OTASP activation code */
) SECTION_OEMCM;

extern boolean cm_call_cmd_answer(

        cm_call_cmd_cb_f_type  cmd_cb_func,
            /* client callback function */

        void                   *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type      client,
            /* answering client */

        cm_call_type_e_type    call_type
            /* call type */

) SECTION_OEMCM;

extern boolean cm_ph_cmd_answer_voice(

        cm_ph_cmd_cb_f_type        cmd_cb_func,
            /* client callback function */

        void                       *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type          client,
            /* Requesting client */

        cm_answer_voice_e_type     answer_voice,
            /* Indicate whether phone should answer incoming
            ** voice calls as voice, fax or modem */

        dword                      answer_duration
            /* Indicate seconds duration for temp. setting, such as
            ** CM_ANSWER_VOICE_AS_FAX_ONCE or DB_VOICE_AS_MODEM_ONCE */
) SECTION_OEMCM;

extern boolean cm_call_cmd_end(

        cm_call_cmd_cb_f_type  cmd_cb_func,
            /* client callback function */

        void                   *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type       client
            /* ending client */

) SECTION_OEMCM;

extern boolean cm_call_cmd_flash(

        cm_call_cmd_cb_f_type    cmd_cb_func,
            /* client callback function */

        void                     *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type        client,
            /* sending client */

        const byte               *num_buf,
            /* dialed address buffer */

        byte                     num_len
            /* dialed address length */

) SECTION_OEMCM;

extern boolean cm_ph_cmd_mode_pref(

        cm_ph_cmd_cb_f_type        cmd_cb_func,
            /* client callback function */

        void                       *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type          client,
            /* Requesting client */

        cm_mode_pref_e_type        mode_pref,
            /* Switch to this mode preference */

        cm_mode_term_e_type        mode_term,
            /* indicate the mode term */

        dword                      mode_duration
            /* indicate seconds duration for temp. mode term */

) SECTION_OEMCM;

extern boolean cm_ph_cmd_sys_pref(

        cm_ph_cmd_cb_f_type        cmd_cb_func,
            /* client callback function */

        void                       *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type          client,
            /* Requesting client */

        cm_sys_pref_e_type         sys_pref
            /* Switch to this system preference */

) SECTION_OEMCM;

extern boolean cm_ph_cmd_nam_sel(

        cm_ph_cmd_cb_f_type        cmd_cb_func,
            /* client callback function */

        void                       *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type          client,
            /* Requesting client */

        cm_nam_e_type              nam_sel
            /* Change NAM selection to this NAM */

) SECTION_OEMCM;

extern boolean cm_ph_cmd_oprt_mode(

        cm_ph_cmd_cb_f_type    cmd_cb_func,
            /* client callback function */

        void                   *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type       client,
            /* Requesting client */

        cm_oprt_mode_e_type    oprt_mode
            /* Switch to this operating mode */

) SECTION_OEMCM;

typedef enum cm_inband_cmd_e {

    CM_INBAND_CMD_NONE=-1,          /* FOR INTERNAL USE OF CM ONLY! */

    CM_INBAND_CMD_BURST_DTMF,       /* request to send  a burst DTMF */
    CM_INBAND_CMD_START_CONT_DTMF,  /* request to start a continuous DTMF tone */
    CM_INBAND_CMD_STOP_CONT_DTMF,   /* request to stop  a continuous DTMF tone */


    CM_INBAND_CMD_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_inband_cmd_e_type;

typedef enum cm_inband_cmd_err_e {

    CM_INBAND_CMD_ERR_NONE=-1,      /* FOR INTERNAL USE OF CM ONLY! */


    CM_INBAND_CMD_ERR_NOERR,        /* No errors found */

    /* parameter related error */

    CM_INBAND_CMD_ERR_CLIENT_ID_P,   /* invalid client ID */
    CM_INBAND_CMD_ERR_ON_LEN_P,     /* invalid DTMF pulse width */
    CM_INBAND_CMD_ERR_OFF_LEN_P,    /* invalid DTMF inter-digit interval */
    CM_INBAND_CMD_ERR_NULL_BUF_P,   /* null digit buffer */
    CM_INBAND_CMD_ERR_DIGIT_P,      /* invalid digits */
    CM_INBAND_CMD_ERR_CNT_P,        /* the value of cnt exceeds the maximum allowed value */


    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from clients trying to instruct
    ** CM to perform inappropriate actions relative to the current
    ** state of the phone.
    */

    CM_INBAND_CMD_ERR_BAD_STATE_S,  /* invalid state for inband request */
    CM_INBAND_CMD_ERR_OFFLINE_S,    /* Phone is offline */  

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from operational limitation
    ** of CM.
    */

    CM_INBAND_CMD_ERR_NO_BUF_L,
        /* No available CM command buffers to queue the command */


    /* other error */
    CM_INBAND_CMD_ERR_OTHER,        /* A problem other than the above was found */


    CM_INBAND_CMD_ERR_MAX           /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_inband_cmd_err_e_type;

typedef void (cm_inband_cmd_cb_f_type) (

    void                        *data_block_ptr,
        /* Pointer to client provided data block */

    cm_inband_cmd_e_type        inband_cmd,
        /* Indicate which inband command is this error status for */

    cm_inband_cmd_err_e_type    inband_cmd_err
        /* Inband command error code, indicating whether command
        ** is rejected and the reason */
);

extern boolean cm_inband_cmd_burst_dtmf(

        cm_inband_cmd_cb_f_type     cmd_cb_func,
            /* client callback function */

        void                        *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type           client,
            /* Requesting client */

        uint8                       on_length,
            /* DTMF pulse width */

        uint8                       off_length,
            /* DTMF inter-digit interval */

        uint8                       cnt,
            /* DTMF digit count */

        const uint8                 *dtmf_digit_ptr
            /* Pointer to the DTMF digit buffer */

) SECTION_OEMCM;

extern boolean cm_inband_cmd_start_cont_dtmf(

        cm_inband_cmd_cb_f_type     cmd_cb_func,
            /* client callback function */

        void                        *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type           client,
            /* Requesting client */

        uint8                       digit
            /* DTMF digit */
) SECTION_OEMCM;

extern boolean cm_inband_cmd_stop_cont_dtmf(

        cm_inband_cmd_cb_f_type     cmd_cb_func,
            /* client callback function */

        void                        *data_block_ptr,
            /* pointer to client callback data block */

        cm_client_id_type           client,
            /* Requesting client */

        uint16                       duration
            /* DTMF duration */
) SECTION_OEMCM;

#ifdef FEATURE_NEWCM
extern cm_client_status_e_type cm_client_init(

    cm_client_type_e_type           client_type,
        /* Type of client */
    cm_client_id_type               *client_id_ptr
        /* Client ID pointer*/
) SECTION_OEMCM;
#else
extern cm_client_status_e_type cm_client_init(

    cm_client_id_type               *client_ptr
        /* Client ID pointer*/
) SECTION_OEMCM;
#endif /* FEATURE_NEWCM */

extern cm_client_status_e_type cm_client_act(

    cm_client_id_type               client
        /* Requesting client */

) SECTION_OEMCM;

typedef void (cm_call_event_f_type) (

    cm_call_event_e_type         call_event,
        /* Indicate call event */

    const cm_call_info_s_type    *call_info_ptr
        /* A pointer to a call state information struct */

);

typedef enum cm_client_event_reg_e {

    CM_CLIENT_EVENT_NONE=-1,          /* FOR INTERNAL USE OF CM ONLY! */

    CM_CLIENT_EVENT_REG,              /* event registration */

    CM_CLIENT_EVENT_DEREG,            /* event de-registration */

    CM_CLIENT_EVENT_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_client_event_reg_e_type;

typedef void (cm_call_cmd_err_f_type) (

    cm_client_id_type            client,
        /* Indicate which client caused the error */

    cm_call_cmd_e_type           cmd,
        /* Indicate for which call command this error is reported */

    cm_call_cmd_err_e_type       cmd_err
        /* Indicate nature of error */

);

cm_client_status_e_type cm_client_call_reg(

    cm_client_id_type           client,
        /* Requesting client */


    cm_call_event_f_type        *call_event_func,
        /* Pointer to a callback function to notify the client of call
        ** events */

    cm_client_event_reg_e_type  event_reg_type,

    cm_call_event_e_type        from_call_event,
        /* register from this event (including) */

    cm_call_event_e_type        to_call_event,
          /* to this event (including) */

    cm_call_cmd_err_f_type      *call_cmd_err_func
      /* pointer to a callback function to notify the client of call
      ** command errors of OTHER clients */
) SECTION_OEMCM;

typedef void (cm_ph_event_f_type) (

    cm_ph_event_e_type           ph_event,
        /* Indicate phone event */

    const cm_ph_info_s_type      *ph_info_ptr
        /* A pointer to a phone state information struct */

);

typedef void (cm_ph_cmd_err_f_type) (

    cm_client_id_type       client,
        /* Indicate which client caused the error */

    cm_ph_cmd_e_type        cmd,
        /* Indicate for which phone command this error is reported */

    cm_ph_cmd_err_e_type    cmd_err
        /* Indicate nature of error */

);

cm_client_status_e_type cm_client_ph_reg(

    cm_client_id_type           client,
        /* Requesting client */

    cm_ph_event_f_type          *ph_event_func,
        /* Pointer to a callback function to notify the client of phone
        ** events */

    cm_client_event_reg_e_type  event_reg_type,

    cm_ph_event_e_type          from_ph_event,
        /* register from this event (including) */

    cm_ph_event_e_type          to_ph_event,
          /* to this event (including) */

    cm_ph_cmd_err_f_type        *ph_cmd_err_func
      /* pointer to a callback function to notify the client of phone
      ** command errors of OTHER clients */
) SECTION_OEMCM;

typedef void (cm_ss_event_f_type) (

    cm_ss_event_e_type           ss_event,
        /* Indicate serving system event */

    const cm_ss_info_s_type      *ss_info_ptr
        /* A pointer to a serving system information struct */

);

typedef enum cm_ss_cmd_e {

    CM_SS_CMD_NONE=-1,          /* FOR INTERNAL USE OF CM ONLY! */

    CM_SS_CMD_INFO_GET,         /* Get serving system info */

    CM_SS_CMD_MAX               /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_ss_cmd_e_type;

typedef enum cm_ss_cmd_err_e {

    CM_SS_CMD_ERR_NONE=-1,
        /* FOR INTERNAL USE OF CM ONLY! */


    CM_SS_CMD_ERR_NOERR,
        /* No errors found */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from clients feeding a serving system command
    ** function with bad or inappropriate parameters.
    */

    CM_SS_CMD_ERR_CLIENT_ID_P,
        /* Bad client parameter */

    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* Error codes resulting from operational limitation
    ** of CM.
    */

    CM_SS_CMD_ERR_NO_BUF_L,
        /* No available CM command buffers to queue the command */


    CM_SS_CMD_ERR_OTHER,
        /* any other errors not listed above */


    CM_SS_CMD_ERR_MAX
        /* FOR INTERNAL USE OF CM ONLY! */

#ifdef FEATURE_RPC
#error code not present
#endif

} cm_ss_cmd_err_e_type;

typedef void (cm_ss_cmd_err_f_type) (

    cm_client_id_type       client,
        /* Indicate which client caused the error */

    cm_ss_cmd_e_type        cmd,
        /* Indicate for which serving system command this error is reported */

    cm_ss_cmd_err_e_type    cmd_err
        /* Indicate nature of error */

);

cm_client_status_e_type cm_client_ss_reg(

    cm_client_id_type           client,
        /* Requesting client */

    cm_ss_event_f_type          *ss_event_func,
        /* Pointer to a callback function to notify the client of serving system
           ** events */

    cm_client_event_reg_e_type  event_reg_type,

    cm_ss_event_e_type          from_ss_event,
        /* register from this event (including) */

    cm_ss_event_e_type          to_ss_event,
          /* to this event (including) */

    cm_ss_cmd_err_f_type        *ss_cmd_err_func
      /* pointer to a callback function to notify the client of serving system
      ** command errors of OTHER clients */
) SECTION_OEMCM;

#define CMPH_IS_E911_CALLBACK_MODE( ph_ptr ) \
                     ( (ph_ptr->mode_pref == CM_MODE_PREF_E911) && \
                       (ph_ptr->mode_term == CM_MODE_TERM_PWR_CYCLE) )

#else

#include "cm.h" 
//
// @@@ rwalker - Wed Dec 12 01:09:38 2001
//
// @@@ The handset header file cmi.h (included by cm.h) defines BETWEEN as 
//     something different than BREW does (in AEE.h).  Unfortunately this code 
//     still includes handset header files and includes them *after* 
//     including BREW headers.  This causes the build to fail.
//
//     Undeffing BETWEEN here does 2 things: it insures we get the BREW
//     BETWEEN for BREW code, and it fixes the build.
//
//     Once this code no longer includes cm.h, this undef can go away.
//     
#undef BETWEEN

#include "cmph.h"

#include "AEEComdef.h"







#endif   // #if defined(PALMOS)

#endif
