/*******************************************************************************

					CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		Call
 $File:		    mmiCall.h
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:
                        
********************************************************************************

 $History: mmiCall.h

 	Mar 11, 2006   REF:DR:OMAPS00061467  x0035544
	Description:   27.22.4.13.3 SET UP CALL (display of icons) fails.
	Solution: created a variable of type T_SAT_IconData at the structure T_call to store the Icon data
	inorder to display it on calling screen.

  	xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
 	Description:	Support for various audio profiles
 	Solution:	The support for audio device's carkit/headset/loudspeaker/handheld.
 			The audio device is enabled as per the user actions.
 			
	25/10/00			Original Condat(UK) BMI version.	
	   
 $End

*******************************************************************************/

#ifndef _DEF_MMI_CALL_H_
#define _DEF_MMI_CALL_H_

#define ALLOC_MEMORY mfwAlloc
#define FREE_MEMORY  mfwFree

//  	xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
#ifdef FF_MMI_AUDIO_PROFILE
#include "mfw_mme.h"
#endif
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "MmiMmi.h"
#include "MmiDialogs.h" //GW 29/11/01 - Added 
#include "MmiIdle.h" // SPR#0630 - SH - EDITOR_SIZE now defined in MmiIdle.h

typedef enum
{
    CallNone=CallDummy,
    CallNormal,
    CallDone,
	CallNew,
    CallSingle,
    CallTwo,
    CallConference,
	CallPrivateCall,
	CallSingleMultiparty,
	CallMultipartySingle

};

typedef enum
{
    ViewConnect,
    ViewEnd,
    ViewMenu,
    ViewCalling,
    ViewIncoming,
    ViewDTMF,
	ViewDTMFMenu,
	ViewCallError,
	ViewSelectPrivateCall,
	ViewScratchPad,
	ViewWaitingAnswer,
	ViewAutoRedial,
	ViewSendingDTMF,
	ViewShortWait,		//GW Added 
	ViewMulticallControl, 
	ViewMulticallControlCallWaiting,
	ViewMulticallControlIncomingCall

};

typedef enum
{
    CallActive,
    CallInactive
    
};

extern UBYTE callStatus;
extern int idwithheld;

#define true 1
#define false 0

#define MAX_CALLS 6 

/*mc, SPR 1319*/
#ifdef LSCREEN
#define MAX_CHAR PHB_MAX_LEN	/*MC SPR 1442*/
#else
#define MAX_CHAR 12
#endif
#define MAX_LINE 14


#define FIRST_TYPED  20000

typedef struct{
    short id;
    char number[MAX_CHAR];
    char name[MAX_CHAR];
    UBYTE state;
} tMmiCall;

typedef struct{
    int mode;
    UBYTE muted;
    UBYTE view;
    UBYTE numCalls;
    SHORT selected;
	long time[MAX_CALLS];
    T_MFW_CM_STATUS status[MAX_CALLS];

} tMmiCallTable;

typedef enum
{
	CALL_INIT,
	CALL_SCRATCHPAD_INIT,
	CALL_CALLSELECT_INIT,		//GW Added ????
	CALL_DESTROY_WAITING,
	CALL_OUTGOING_SAT,
	CALL_DESTROY_CALLING_WINDOW
};


/* SPR#1352 - SH - Possible status values for TTY */
#ifdef MMI_TTY_ENABLED
typedef enum
{
	CALL_TTY_OFF = 0,	/* TTY always off */
	CALL_TTY_ALWAYSON,	/* TTY always on */
	CALL_TTY_ONNEXTCALL	/* TTY on for next call only */
};
#endif
/* end SH */

/*
** This is a tri-state flag, to ensure that the Vocoder is not disabled
** when a waiting call is notified while already in call.
*/
typedef enum
{
	CALL_VOCODER_IDLE = 0,		/* BMI in Idle State, Vocoder not under BMI control */
	CALL_VOCODER_DISABLED,	/* Vocoder is disabled prior to the call being connected */
	CALL_VOCODER_INCALL		/* Vocoder is enabled and In-Call */
} tMmiVcState;

struct QUEUETYPE
{
  SHORT          call_number;
  struct QUEUETYPE*   next;	
};

typedef struct QUEUETYPE TYPEQUEUE;

typedef struct
{
    T_MMI_CONTROL   mmi_control;
	T_MFW_HND win;     // window handle
	T_MFW_HND kbd;
    T_MFW_HND kbd_long;
	T_MFW_HND win_search;
	T_MFW_HND cm;
	T_MFW_HND win_incoming;
	T_MFW_HND win_calling;
	T_MFW_HND win_ending;
	T_MFW_HND win_menu;
	T_MFW_HND win_waiting;
	T_MFW_HND win_sending_dtmf;
#ifdef NEW_EDITOR
	T_ED_DATA *editorCall;	/* SPR#1428 - SH - New Editor changes */
#else /* NEW_EDITOR */
	T_MFW_HND editCall;
#endif /* NEW_EDITOR */
	T_MFW_HND win_redial;
    T_MFW_HND timer;

	/*SPR 1392*/
	T_MFW_HND win_deflectEdit; 		/*handle for call deflect editor.*/
	T_MFW_HND win_deflecting; 		/*"Deflecting to..." window*/
	T_MFW_HND win_deflectSearch; 	/*Call deflection phonebook search window*/
	char editor_buffer[20];			/*call deflection number buffer*/
	T_DISPLAY_DATA inc_call_data;	/*incoming call dialogue display info*/
	/*1392 end*/
	T_MFW_PHB_ENTRY entry;
	int current_command;
	UBYTE callStatus;
	tMmiCallTable calls;
	int accessEnd;			// controls when several calls are to be ended
	int callWaitingEnd;
	int emergencyCall;
	int callsToEnd;
	long timeEnded;
	TYPEQUEUE *endQueue;
	SHORT incCall;
	SHORT outCall;
	int refreshConnect;
	int firstChar;
	int currentModule;
	int currentVolume;
	SHORT singleCall;
	unsigned char charSent;
	char sendingDTMF;
	T_MFW_CM_CW_INFO globalCWInfo;   /* information about incoming call */
	char phbNameNumber[EDITOR_SIZE];
	char edtBufDTMF[EDITOR_SIZE];    /* edit buffer              */
#ifdef NEW_EDITOR
	T_ED_ATTR editorAttrCall;	/* SPR#1428 - SH - New Editor changes */
	T_ED_ATTR editorAttrDTMF;
#else /* NEW_EDITOR */
	MfwEdtAttr edtAttrCall;
	MfwEdtAttr edtAttrDTMF;          /* edit attributes:         */
#endif /* NEW_EDITOR */
	T_MFW_CM_AOC_INFO aocInfo;
	USHORT ignore_disconnect;
	T_MFW_CM_CALL_DIR call_direction;
	UBYTE colp_number[MFW_NUM_LEN];  /* colp number     */
	int animationScreen;
#ifdef MMI_TTY_ENABLED
	UBYTE tty;	/* SPR#1352 - SH - TTY status */
#endif
//x0035544 Mar 09, 2006 DR:OMAPS00061467
#ifdef FF_MMI_SAT_ICON
  T_SAT_IconData       IconData; //Sat icon information
#endif
	tMmiVcState vocoderState;
} T_call;
                                        /* PROTOTYPES               */
void callInit (MfwHnd parent);
void callExit (void);

T_MFW_HND call_create (T_MFW_HND parent_window);
void call_destroy (T_MFW_HND own_window);


void callExec (int reason, MmiState next);

void callNumber(UBYTE* number);

UBYTE call_status(void);
MfwHnd call_get_window(void);

void StartsendDTMFString(char * String);
int menuInCallTimerOn(MfwMnu* m, MfwMnuItem* i);
int menuInCallTimerOff(MfwMnu* m, MfwMnuItem* i);

int call_ccbs(MfwMnu* menu, MfwMnuItem* item); /* Marcus: CCBS: 1/11/2002 */

/*MC, SPR 1392*/
int call_deflection_on(MfwMnu* m, MfwMnuItem* i);
int call_deflection_off(MfwMnu* m, MfwMnuItem* i);
/*end*/
/* SPR#1352 - SH - TTY */
#ifdef MMI_TTY_ENABLED
void call_tty_init();
UBYTE call_tty_get();
void call_tty_set(UBYTE tty);
int call_tty_menu(MfwMnu* menu, MfwMnuItem* item);
int call_tty_menuselect(MfwMnu* menu, MfwMnuItem* item);
void call_tty_statuswin();
void call_tty_revert();
#endif
/* end SH */
//  	xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
#ifdef FF_MMI_AUDIO_PROFILE
USHORT item_headset_status( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi );
USHORT item_handheld_status( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi );
USHORT item_loudspeaker_status( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi );
USHORT item_carkit_status( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi );
int M_exeHandheld (MfwMnu* m, MfwMnuItem* i);
int M_exeLoudspeaker (MfwMnu* m, MfwMnuItem* i);
int M_exeHeadset (MfwMnu* m, MfwMnuItem* i);
int M_exeCarkit (MfwMnu* m, MfwMnuItem* i);
void mmi_hook_handle();
#endif
#endif
