/*
 *	KDDI Brew Application Infrared Protocol Service APIs
 *	Copyright (C) 2004 Link Evolution Corp.
 *	Create : 2004/2/15   Gontaro Kitazumi (Link Evolution)
 *	Modify : 2004/2/17   Gontaro Kitazumi (Link Evolution)
 *	Modify : 2004/3/8   Gontaro Kitazumi (Link Evolution)
 *	Modify : 2004/5/10   Gontaro Kitazumi (Link Evolution)
 *	Modify : 2005/8/12   Katsuhiko Takagaki (ITXEG)
 *	$Id$
 */

#ifndef ___IIR_OBEX___
#define ___IIR_OBEX___

#include "AEE.h"			// Standard AEE definitions
#include "AEEShell.h"		// AEE Shell Services
#include "AEEAppGen.h"		// Mandatory include
#include "AEEModGen.h"		// Mandatory include
#include "IIROBEX.BID"

/********************************************** Type Declarations *************************************************/
typedef void	*IIRAPI_Handle;

/* define LinkDisconnectTime	*/
#define	IrDALM_QOS_DISCTIME_3S			3		/* 3sec									*/
#define	IrDALM_QOS_DISCTIME_8S			8		/* 8sec									*/
#define	IrDALM_QOS_DISCTIME_12S			12		/* 12sec								*/
#define	IrDALM_QOS_DISCTIME_16S			16		/* 16sec								*/
#define	IrDALM_QOS_DISCTIME_20S			20		/* 20sec								*/
#define	IrDALM_QOS_DISCTIME_25S			25		/* 25sec								*/
#define	IrDALM_QOS_DISCTIME_30S			30		/* 30sec								*/
#define	IrDALM_QOS_DISCTIME_40S			40		/* 40sec								*/

/* define OBEX Result Codes		*/
#define	OBEXRC_CONTINUE				0x10		/* Obex Continue						*/
#define	OBEXRC_OK					0x20		/* Obex OK, Success						*/
#define	OBEXRC_BADREQUEST			0x40		/* Obex Bad Request						*/
#define	OBEXRC_UNAUTH				0x41		/* Obex Unauthorized					*/
#define	OBEXRC_NOTFOUND				0x44		/* Obex Not Found						*/
#define	OBEXRC_NOTACCEPTABLE		0x46		/* Obex Not Acceptable					*/
#define	OBEXRC_NOTIMPLEMENT			0x51		/* Obex Not Implement					*/
#define	OBEXRC_SERVICEUNAVAIL		0x53		/* Obex Service Unavailable				*/
#define	OBEXRC_DBFULL				0x60		/* Obex Database Full					*/
#define	OBEXRC_DBLOCKED				0x61		/* Obex Database Locked					*/


/********************************************** IIROBEX Interface *************************************************/
typedef	uint8	IIrObexCode;
typedef struct  IIrObex IIrObex;

typedef void  (*PFNIIROBEX_TPCB)(	IIRAPI_Handle hObexHandle, void *pContext, int32 nReason );
typedef void  (*PFNIIROBEX_CNF)(	IIRAPI_Handle hObexHandle, void *pContext, int32 nResult );
typedef void  (*PFNIIROBEX_OBJCNF)(	IIRAPI_Handle hObexHandle, void *pContext, int32 nResult, uint16 *pwzUniName, int8 *pszType, int8 *pszTime, uint8 *pObject, uint32 nObject );
typedef int32 (*PFNIIROBEX_IND)(	IIRAPI_Handle hObexHandle, void *pContext, int32 nResult, uint32 nParam );
typedef void  (*PFNIIROBEX_OBJIND)(	IIRAPI_Handle hObexHandle, void *pContext, uint16 *pwzUniName, int8 *pszType, int8 *pszTime, uint32 nLength );
										
typedef struct tIIROBEX_SERVERFUNCS	{	
	PFNIIROBEX_IND		pfnCbConnectInd;
	PFNIIROBEX_IND		pfnCbDisconnectInd;
	PFNIIROBEX_OBJIND	pfnCbGetInd;
	PFNIIROBEX_OBJIND	pfnCbPutInd;
} IIROBEX_SERVERFUNCS, *PIIROBEX_SERVERFUNCS;

AEEINTERFACE(IIrObex)
{
	INHERIT_IBase(IIrObex);
	IIRAPI_Handle	(*ClientCreate)(			IIrObex *pIIROBEX, void *pContext, void *pReserve );
	int32			(*ClientDelete)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle );
	int32			(*ClientInitialize)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle,PFNIIROBEX_TPCB pfnTpDiscInd ) ;
	int32			(*ClientConnectReq)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, uint16 nLinkDisconnectTime,PFNIIROBEX_CNF pfnCbConnCnf );
	int32			(*ClientDisconnectReq)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, boolean isForce ,PFNIIROBEX_CNF pfnCbDiscCnf ) ;
	int32			(*ClientPutReq)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, uint16 *pwzUniName, int8 *pszType, int8 *pszTime, uint8 *pObject, uint32 nObject, PFNIIROBEX_CNF pfnCbPutCnf );
	int32			(*ClientGetReq)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, uint16 *pwzUniName, uint8 *pObject, uint32 nObject, PFNIIROBEX_OBJCNF pfnCbGetCnf );
	IIRAPI_Handle	(*ServerCreate)(			IIrObex *pIIROBEX, void *pContext, void *pReserve );
	int32			(*ServerDelete)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle );
	int32			(*ServerInitialize)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, PFNIIROBEX_TPCB pfnTpDiscInd, uint16 nLinkDisconnectTime,PIIROBEX_SERVERFUNCS ObexFuncsTable );
	int32			(*ServerAccept)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, boolean isEnable );
	int32			(*ServerPutRsp)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, int32 nResult, uint8 *pObject, uint32 nObject, PFNIIROBEX_IND pfnCbPutDone );
	int32			(*ServerGetRsp)(			IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, int32 nResult, uint16 *pwzUniName, int8 *pszType, int8 *pszTime, uint8 *pObject, uint32 nObject, PFNIIROBEX_IND pfnCbGetDone );
	int32			(*ServerDisconnectReq)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle ,boolean isForce ) ;
	int32			(*OppositeDeviceName)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, uint8 *pszOppositeDeviceName );
	IIrObexCode		(*QueryObexResponseCode)(	IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle);
	int32			(*SetObexResponseCode)(		IIrObex *pIIROBEX, IIRAPI_Handle hObexHandle, IIrObexCode code);
	int32			(*SetMcpcAuthMode)(			IIrObex *pIIROBEX,IIRAPI_Handle hObexHandle, uint8 *pMcpcAuthCode, uint32 nMcpcAuthCode );
	int32			(*ServerSetConnectAuthInd)(	IIrObex *pIIROBEX,IIRAPI_Handle hObexHandle, PFNIIROBEX_IND pfnConnectAuthInd );
	int32			(*ServerAuthRsp)(			IIrObex *pIIROBEX,IIRAPI_Handle hObexHandle, int32 nResult,uint8 *pMcpcAuthCode, uint32 nMcpcAuthCode );
};

#define IIROBEX_AddRef(	p)				     	 			AEEGETPVTBL((p),IIrObex)->AddRef((p))
#define IIROBEX_Release(p)									AEEGETPVTBL((p),IIrObex)->Release((p))
#define IIROBEX_ClientCreate(p, c, r )						AEEGETPVTBL((p),IIrObex)->ClientCreate((p), (c), (r) )
#define IIROBEX_ClientDelete(p, h)							AEEGETPVTBL((p),IIrObex)->ClientDelete((p), (h))
#define IIROBEX_ClientInitialize(p, h, f)					AEEGETPVTBL((p),IIrObex)->ClientInitialize((p), (h), (f))
#define IIROBEX_ClientConnectReq(p, h, l, f)				AEEGETPVTBL((p),IIrObex)->ClientConnectReq((p), (h), (l), (f))
#define IIROBEX_ClientDisconnectReq(p, h, i, f)				AEEGETPVTBL((p),IIrObex)->ClientDisconnectReq((p), (h), (i), (f))
#define IIROBEX_ClientPutReq(p, h, n, ty, tm, po,no, f)		AEEGETPVTBL((p),IIrObex)->ClientPutReq((p), (h), (n), (ty), (tm), (po),(no), (f))
#define IIROBEX_ClientGetReq(p, h, n, po, pn, f)			AEEGETPVTBL((p),IIrObex)->ClientGetReq((p), (h), (n), (po), (pn), (f))
#define IIROBEX_ServerCreate(p, c, r)						AEEGETPVTBL((p),IIrObex)->ServerCreate((p), (c), (r))
#define IIROBEX_ServerDelete(p, h)							AEEGETPVTBL((p),IIrObex)->ServerDelete((p), (h))
#define IIROBEX_ServerInitialize(p, h, tpd, l, f)			AEEGETPVTBL((p),IIrObex)->ServerInitialize((p), (h), (tpd), (l), (f))
#define IIROBEX_ServerAccept(p, h, i)						AEEGETPVTBL((p),IIrObex)->ServerAccept((p), (h), (i))
#define IIROBEX_ServerPutRsp(p, h, r, po, pn, f)			AEEGETPVTBL((p),IIrObex)->ServerPutRsp((p), (h), (r), (po), (pn), (f))
#define IIROBEX_ServerGetRsp(p, h, r, n, ty, tm, po, pn, f)	AEEGETPVTBL((p),IIrObex)->ServerGetRsp((p), (h), (r), (n), (ty), (tm), (po), (pn), (f))
#define IIROBEX_ServerDisconnectReq(p, h, i)				AEEGETPVTBL((p),IIrObex)->ServerDisconnectReq((p), (h), (i))
#define IIROBEX_OppositeDeviceName(p, h, n)					AEEGETPVTBL((p),IIrObex)->OppositeDeviceName((p), (h), (n))
#define IIROBEX_QueryObexResponseCode(p, h)					AEEGETPVTBL((p),IIrObex)->QueryObexResponseCode((p), (h))
#define IIROBEX_SetObexResponseCode(p, h, c)				AEEGETPVTBL((p),IIrObex)->SetObexResponseCode((p), (h), (c))
#define IIROBEX_SetMcpcAuthMode(p, h, pa, na)			AEEGETPVTBL((p),IIrObex)->SetMcpcAuthMode((p), (h), (pa), (na))
#define IIROBEX_ServerSetConnectAuthInd(p, h, pc)		AEEGETPVTBL((p),IIrObex)->ServerSetConnectAuthInd((p), (h), (pc))
#define IIROBEX_ServerAuthRsp(p, h, r, pa, na)				AEEGETPVTBL((p),IIrObex)->ServerAuthRsp((p), (h), (r), (pa), (na))

#endif  // ifndef ___IIR_OBEX___
