#include "cpa_std.h"
 
#include "MEC/mcamic.h" /* IdCard of Camera */
#include "MEC/mbase.h"	/* Base */
 
#include "hidcard.h"
 
#include "GEO.h"
 
/* Accessors            */
/* Author : JM Soudagne */
/* Date : 1996-01-30    */
/* Version : 1.00       */
/* Modify : yyyy-mm-dd  */
DNM_tdeMechanicsID DNM_fn_eIdentityCardGetType(DNM_tdxHandleToMecIdentityCard _hCurrent)
{
#ifdef DNM_DEBUG
  if(!DNM_fn_bIsIdentityCardValid(_hCurrent))
    return DNM_eMIC_Error;
#endif
 
  /* This field is shared by all identity card structure */
  /* return Walk identification for instance             */
  return DNM_M_eBaseIdCardGetIdentity((DNM_tdstMecBaseIdCard*)(_hCurrent));
}
 
 
/*----------------------*/
/* Create a handle      */
/*----------------------*/
/* Author : JM Soudagne */
/* Date : 1996-01-30    */
/* Version : 1.05       */
/* Modify : 1997-10-22  */
/* By : JMS             */
/*----------------------*/
DNM_tdxHandleToMecIdentityCard DNM_fn_xIdentityCardCreate(DNM_tdeMechanicsID _eType)
{
	void *p_stResult=NULL;
 
	switch(_eType)
	{
	case DNM_eCamera:
		{
            MMG_fn_vAddMemoryInfo (MMG_C_lTypeMEC , MMG_C_lSubTypeMecCameraCard , NULL);
			GEO_M_CPAMalloc( p_stResult, void * , sizeof(DNM_tdstMecCameraIdCard),E_uwGEONotEnoughtMemory);        
			DNM_M_eCameraIdCardSetIdentity((DNM_tdstMecCameraIdCard *)p_stResult,DNM_eCamera);
		}
		break;	
 
	case DNM_eBase:
		{
            MMG_fn_vAddMemoryInfo (MMG_C_lTypeMEC , MMG_C_lSubTypeMecBaseCard , NULL);
			GEO_M_CPAMalloc( p_stResult, void * , sizeof(DNM_tdstMecBaseIdCard),E_uwGEONotEnoughtMemory);       
			DNM_M_eBaseIdCardSetIdentity((DNM_tdstMecBaseIdCard *)p_stResult,DNM_eBase);     
		}
		break;
  
	default :  return NULL;
  }
 
  return (DNM_tdxHandleToMecIdentityCard)p_stResult;
}
