Ejemplo n.º 1
0
HRESULT MV_CC_DSS_Inquiry(pMV_CC_DSS_ServiceInfo_t pSrvInfo)
{
	HRESULT res;
	pMV_CC_DSS_ServiceInfo_t pSrvInfo_Search;
	
	if (pSrvInfo == NULL)
		MV_CC_DBG_Error(E_INVALIDARG, "MV_CC_DSS_Inquiry", NULL);

	if (pMV_APP_DSS == NULL)
		MV_CC_DBG_Error(E_NOTREADY, "MV_CC_DSS_Inquiry", NULL);
		
	MV_OSAL_Mutex_Lock(pMV_APP_DSS->m_hGSListMutex);	
	
	res = MV_CC_DSS_GlobalServiceList_Get(pSrvInfo->m_ServiceID, &pSrvInfo_Search);
	if (res != S_OK)
	{
	    //MV_CC_DBG_Warning(res, "MV_CC_DSS_Inquiry MV_CC_DSS_GlobalServiceList_Get", NULL);	
	    goto MV_CC_DSS_Inquiry_Failure;
	}

	// Only for test
	//res = MV_CC_DSS_GlobalServiceList_Traversal(GSList_VisitFunc_Demo, NULL);
		
	if (pSrvInfo_Search != NULL)
		GaloisMemcpy(pSrvInfo, pSrvInfo_Search, sizeof(MV_CC_DSS_ServiceInfo_t));

MV_CC_DSS_Inquiry_Failure:
		
	MV_OSAL_Mutex_Unlock(pMV_APP_DSS->m_hGSListMutex);

	return res;
}
HRESULT MV_CC_DSS_Update(pMV_CC_DSS_ServiceInfo_t pSrvInfo)
{
	HRESULT res;
	pMV_CC_DSS_ServiceInfo_t pSrvInfo_Search;

	if (pSrvInfo == NULL)
		MV_CC_DBG_Error(E_INVALIDARG, "MV_CC_DSS_Update", NULL);

	if (pMV_APP_DSS == NULL)
		MV_CC_DBG_Error(E_NOTREADY, "MV_CC_DSS_Update", NULL);

	// check service id
	if (pSrvInfo->m_ServiceID == MV_CC_ServiceID_DynamicApply)
		MV_CC_DBG_Error(E_BADVALUE, "MV_CC_DSS_Update", NULL);

	MV_OSAL_Mutex_Lock(pMV_APP_DSS->m_hGSListMutex);

	res = MV_CC_DSS_GlobalServiceList_Get(pSrvInfo->m_ServiceID, \
					&pSrvInfo_Search);
	if (res != S_OK) {
		pMV_APP_DSS->m_Status.m_UpdateErrCount++;
		goto MV_CC_DSS_Update_Failure;
	}

	if (pSrvInfo_Search != NULL) {
		GaloisMemcpy(pSrvInfo_Search, pSrvInfo, \
		sizeof(MV_CC_DSS_ServiceInfo_t));
	} else {
		pMV_APP_DSS->m_Status.m_UpdateErrCount++;
		goto MV_CC_DSS_Update_Failure;
	}

	pMV_APP_DSS->m_Status.m_UpdateCount++;
	pMV_APP_DSS->m_Status.m_LastServiceID = pSrvInfo->m_ServiceID;

MV_CC_DSS_Update_Failure:

	MV_OSAL_Mutex_Unlock(pMV_APP_DSS->m_hGSListMutex);

	return res;
}
HRESULT MV_CC_DSS_Inquiry(pMV_CC_DSS_ServiceInfo_t pSrvInfo)
{
	HRESULT res;
	pMV_CC_DSS_ServiceInfo_t pSrvInfo_Search;

	if (pSrvInfo == NULL)
		MV_CC_DBG_Error(E_INVALIDARG, "MV_CC_DSS_Inquiry", NULL);

	if (pMV_APP_DSS == NULL)
		MV_CC_DBG_Error(E_NOTREADY, "MV_CC_DSS_Inquiry", NULL);

	MV_OSAL_Mutex_Lock(pMV_APP_DSS->m_hGSListMutex);

	res = MV_CC_DSS_GlobalServiceList_Get(pSrvInfo->m_ServiceID, \
						&pSrvInfo_Search);
	if (res != S_OK) {
		pMV_APP_DSS->m_Status.m_InquiryErrCount++;
		goto MV_CC_DSS_Inquiry_Failure;
	}

	if (pSrvInfo_Search != NULL)
		GaloisMemcpy(pSrvInfo, pSrvInfo_Search, \
			sizeof(MV_CC_DSS_ServiceInfo_t));
	else {
		pMV_APP_DSS->m_Status.m_InquiryErrCount++;
		goto MV_CC_DSS_Inquiry_Failure;
	}

	pMV_APP_DSS->m_Status.m_InquiryCount++;
	pMV_APP_DSS->m_Status.m_LastServiceID = pSrvInfo->m_ServiceID;

MV_CC_DSS_Inquiry_Failure:

	MV_OSAL_Mutex_Unlock(pMV_APP_DSS->m_hGSListMutex);

	return res;
}