#ifndef OEMRESOURCECTL_H
#define OEMRESOURCECTL_H

/*============================================================================
FILE: OEMResourceCtl.h

SERVICES:  BREW Resource Acess Control Services

DESCRIPTION:
   This file defines required to customize IResourceCtl interface that allows 
   BREW applications to acquire and relinquish access control over resources.

PUBLIC CLASSES:  Not Applicable

INITIALIZATION AND SEQUENCING REQUIREMENTS:  Not Applicable

        Copyright © 1999-2004 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
============================================================================*/
/*===============================================================================
    INCLUDES AND VARIABLE DEFINITIONS
===============================================================================*/

/*-------------------------------------------------------------------
      Include Files
-------------------------------------------------------------------*/
#include "AEEResourceCtl.h"
#include "AEEResArbiter.h"
#include "AEEShell.h"

/*-------------------------------------------------------------------
            Defines
-------------------------------------------------------------------*/

/*-------------------------------------------------------------------
      Type Declarations
-------------------------------------------------------------------*/
// Singleton resource mgr handle.
typedef void *    AEEResMgrHandle;

#define INHERIT_AEEResourceCtl(iname) \
   const AEEVTBL(iname) *m_pvt; \
   \
   uint32            m_nRefs;\
   \
   AEECallback       m_cbSysObj;\
   \
   IShell *          m_pIShell;\
   AEECLSID          m_clsSelf;\
   AEECLSID          m_clsPriv;\
   \
   ACONTEXT *        m_pac;\
   \
   IResourceCtl *    m_pNext;\
   AEEResMgrHandle   m_hMgr;\
   \
   AEECLSID          m_clsQI;\
   IBase *           m_pQIObject;\
   \
   AEEResCtlInfo     m_myInfo;\
   \
   uint32            m_dwNotifyMask;\
   AEECallback *     m_pcbStatus;\
   AEECallback       m_cbObj\

typedef struct AEEResourceCtl
{
   INHERIT_AEEResourceCtl(IResourceCtl);
} AEEResourceCtl;

//-------------------------------------------------------------------
// Global Constant Declarations
//-------------------------------------------------------------------

//-------------------------------------------------------------------
// Global Data Declarations
//-------------------------------------------------------------------

//=============================================================================
// FUNCTION DECLARATIONS and INLINE FUNCTION DEFINITIONS
//=============================================================================

//-------------------------------------------------------------------
// Interface Definitions - C Style
//-------------------------------------------------------------------

//*****************************************************************************
//
// AEEResMgr Interface
//
//*****************************************************************************
extern int     AEEResMgr_GetMgr(AEECLSID clsResCtl, AEEResMgrHandle * ph);
extern int     AEEResMgr_Acquire(AEEResMgrHandle h, IResourceCtl * pCtl, uint32 * pdwStatus, boolean delay);
extern int     AEEResMgr_Free(AEEResMgrHandle h, IResourceCtl * pCtl, uint32 * pdwStatus);
extern void    AEEResMgr_StatusNotify(AEEResMgrHandle h);
extern int     AEEResMgr_SetOwner(AEEResMgrHandle h, IResourceCtl * pCtl);
extern int     AEEResMgr_Add(AEEResMgrHandle h, IResourceCtl * pCtl);
extern int     AEEResMgr_Remove(AEEResMgrHandle h, IResourceCtl * pCtl);
extern boolean AEEResMgr_IsPresent(AEEResMgrHandle h, IResourceCtl * pCtl);

//*****************************************************************************
//
// IResourceCtl Interface
//
//*****************************************************************************
extern int     IResourceCtl_New(IShell * ps, AEECLSID clsResCtl, AEECLSID clsPriv, AEECLSID clsQI, IBase * pQIObject, void **ppif);
extern uint32  IResourceCtl_AddRef(IResourceCtl * pme);
extern uint32  IResourceCtl_Release(IResourceCtl * pme);
extern int     IResourceCtl_QueryInterface(IResourceCtl * pme, AEECLSID idReq, void ** ppo);
extern int     IResourceCtl_Request(IResourceCtl * pme, uint32 dwReason, uint32 * pdwStatus);
extern int     IResourceCtl_CanAcquire(IResourceCtl * pme, uint32 dwReason, uint32 * pdwStatus);
extern int     IResourceCtl_SetRelinquishCtl(IResourceCtl * pme, uint32 * pclsList, int nCount);
extern uint32  IResourceCtl_GetStatus(IResourceCtl * pme, uint32 * pdwReason);
extern int     IResourceCtl_OnStatusChangeNotify(IResourceCtl * pme, uint32 dwNotifyMask, AEECallback * pcb);

#endif // OEMRESOURCECTL_H
