#if !defined(OEMSMS_priv_H)
#define OEMSMS_priv_H
/*======================================================
                    IMPORTANT NOTICE

                  OEM DISTRIBUTION ONLY

FILE:  OEMSMS_priv.h

SERVICES:  AEE OEM SMS Interface header

GENERAL DESCRIPTION:

This file contains all of the function prototypes for
routines that are required by the AEE to function with
SMS.

        Copyright © 1999-2004 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
=====================================================*/
#include "customer.h"

#if defined (FEATURE_WMS)
#include "wms.h"
#elif defined (FEATURE_UASMS)
#include "uasmsx.h"
#endif

#include "OEMSMS.h"
#include "AEEComdef.h"

// The additional +3 and ~3 is added to ensure that data size is a multiple
// of 4
#if defined (FEATURE_UASMS)
# define SMSWORK_BUFF_SIZE      ((sizeof(uasms_client_bd_type) + 3) & ~3)
int Xlate_Encoding(uasms_user_data_encoding_e_type enc);
uasms_user_data_encoding_e_type Xlate_2_NativeEncoding( int enc );
#elif defined (FEATURE_WMS)
#  define SMSWORK_BUFF_SIZE     ((sizeof(wms_client_ts_data_s_type) + 3) & ~3)
#endif

typedef struct
{
   uint16                     wStatus;                          // Cache Status

   uint32                     dwTransactionId;                  // Transaction Id

   byte                       data[SMSWORK_BUFF_SIZE];          // Bearer Data
   byte *                     pText;                            // Pointer to text data
   int                        nText;                            // Text Data Length

   int                        ts;                               // Teleservice
   int                        nEncoding;                        // Encoding
   int                        nPriority;                        // Priority
   int                        nPrivacy;                         // Privacy
   int                        nNumMsgs;                         // Message Count in voice mail message
   uint32                     dwLang;                           // Language
   uint32                     dwTimeStamp;                      // Time Stamp
   char                       szFrom[MAX_DEVICE_ADDRESS];       // From Address
   char                       szCallback[MAX_DEVICE_ADDRESS];   // Callback Number
   uint32                     dwTag;                            // Message Tag
   uint32                     dwMsgID;                          // Message ID
   boolean                    bRequestUserAck:1;                // User Ack is requested
   boolean                    bRequestDLAck:1;                  // Delivery Ack is requested
   boolean                    bIsMOSMS:1;                       // Is MO SMS
   boolean                    bIsSCAddress:1;                   // szCallback contains SC address
   boolean                    bRequestReadAck:1;                // Read Ack is requested
   boolean                    bIsDLAck:1;                       // Message is DL Ack
   boolean                    bIsUserAck:1;                     // Message is User Ack
   boolean                    bIsReadAck:1;                     // Message is Read Ack
} SMSCacheEntry;

/* Internal representation of SMS Message */
typedef struct _OEMMsg OEMMsg;

// Internal representation for SMS Broadcast Configuration
typedef struct _OEMBcCfg OEMBcCfg;

typedef enum
{
   OEMSMSBCConfig_GetBCConfigRequest,
   OEMSMSBCConfig_GetBCPrefRequest,
   OEMSMSBCConfig_SetBCPrefRequest,
   OEMSMSBCConfig_GetNumberOfServiceIDsRequest,
   OEMSMSBCConfig_GetServiceOptsRequest,
   OEMSMSBCConfig_SetServiceOptsRequest,
   OEMSMSBCConfig_GetNumberOfServiceOptsRequest,
   OEMSMSBCConfig_DeleteServiceRequest,
   OEMSMSBCConfig_MaxRequest
} OEMSMSBCRequestType;

#if defined(__cplusplus)
extern "C" {
#endif

/* Implemented in OEMWSMS.c and OEMUASMS.c */
OEMMsg * OEMSMS_NewMessage( OEMMsgData * pMsgData, OEMMsgPayload * pMsgPayload );

AEE_EXPORTS int         OEMSMS_Init( void );
AEE_EXPORTS void        OEMSMS_SendSMS( OEMMsg* hMsg, AEECallback *pcb, uint32 *pdwStatus );
AEE_EXPORTS void        OEMSMS_DeleteMessage( OEMMsg* hMsg );
AEE_EXPORTS int         OEMSMS_Cleanup( void );
AEE_EXPORTS void        OEMSMS_SetMsgAckStatus( uint32 cs, uint32 mt);
AEE_EXPORTS void        OEMSMS_GetUDHData(SMSCacheEntry * pce, int * pnBytes, byte * pBuffer);

/* Implemented in OEMSMS.c */
AEE_EXPORTS SMSCacheEntry *OEMSMSCache_GetEntry( void );
AEE_EXPORTS void           OEMSMSCache_Release( SMSCacheEntry *pce );
AEE_EXPORTS void           OEMSMSCache_Ready( SMSCacheEntry *pce );
AEE_EXPORTS boolean        OEMSMS_IsInitialized(void);

AEE_EXPORTS char           GetDigit(byte ch);
AEE_EXPORTS byte           GetDTMF (char ch); 
AEE_EXPORTS uint32         GetASCII2DTMF (char * pcBuf, byte * pBuf, uint32 dwLen);

// BCD to integer
#define BCD2INT(x)  (((((x) & 0xf0) >> 4) * 10) + ((x) & 0x0f))

// integer to BCD
#define INT2BCD(x)  (((((x) / 10) << 4) & 0xf0) | (((x) % 10) & 0x0f))

// YEAR of when the century start
#define YEAR_2000   2000
#define YEAR_1900   1900

// Following define need to come from OEMConfig file
#define OEM_CONFIG_ALLOW_INTERNATIONAL    TRUE
#define OEM_CONFIG_INTERNATIONAL_PREFIX   "011"

#define DIALER_PLUS_CHAR    ((char)'+')

#if defined(__cplusplus)
}
#endif

#endif /*OEMSMS_priv_H*/
