NFCSTATUS phFriNfc_LlcpMac_ChkLlcp (phFriNfc_LlcpMac_t *LlcpMac, phHal_sRemoteDevInformation_t *psRemoteDevInfo, phFriNfc_LlcpMac_Chk_CB_t ChkLlcpMac_Cb, void *pContext) { NFCSTATUS status = NFCSTATUS_SUCCESS; if (NULL == LlcpMac || NULL == psRemoteDevInfo) { status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_INVALID_PARAMETER); } else { /* Store the Remote Device info received from Device Discovery */ LlcpMac->psRemoteDevInfo = psRemoteDevInfo; if(LlcpMac->psRemoteDevInfo->RemDevType == phHal_eNfcIP1_Initiator) { /* Set the PeerRemoteDevType variable to the Target type */ LlcpMac->PeerRemoteDevType = phFriNfc_LlcpMac_ePeerTypeTarget; } else if(LlcpMac->psRemoteDevInfo->RemDevType == phHal_eNfcIP1_Target) { /* Set the PeerRemoteDevType variable to the Initiator type */ LlcpMac->PeerRemoteDevType = phFriNfc_LlcpMac_ePeerTypeInitiator; } switch(LlcpMac->psRemoteDevInfo->RemDevType) { case phHal_eNfcIP1_Initiator: case phHal_eNfcIP1_Target: { /* Set the MAC mapping type detected */ LlcpMac->MacType = phFriNfc_LlcpMac_eTypeNfcip; /* Register the lower layer to the MAC mapping component */ status = phFriNfc_LlcpMac_Nfcip_Register (LlcpMac); if(status == NFCSTATUS_SUCCESS) { status = LlcpMac->LlcpMacInterface.chk(LlcpMac,ChkLlcpMac_Cb,pContext); } else { status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_FAILED); } }break; default: { status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_INVALID_DEVICE); }break; } } return status; }
NFCSTATUS phFriNfc_LlcpMac_ChkLlcp( _Inout_ phFriNfc_LlcpMac_t *LlcpMac, _In_ phHal_sRemoteDevInformation_t *psRemoteDevInfo, _In_ phFriNfc_LlcpMac_Chk_CB_t ChkLlcpMac_Cb, _In_ void *pContext ) { NFCSTATUS status = NFCSTATUS_SUCCESS; PH_LOG_LLCP_FUNC_ENTRY(); if (NULL == LlcpMac || NULL == psRemoteDevInfo) { PH_LOG_LLCP_INFO_STR("Invalid input parameter"); status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_INVALID_PARAMETER); } else { /* Store the Remote Device info received from Device Discovery */ LlcpMac->psRemoteDevInfo = psRemoteDevInfo; if(LlcpMac->psRemoteDevInfo->RemDevType == phHal_eNfcIP1_Initiator) { PH_LOG_LLCP_INFO_STR("PeerRemoteDevType is set to phFriNfc_LlcpMac_ePeerTypeTarget"); /* Set the PeerRemoteDevType variable to the Target type */ LlcpMac->PeerRemoteDevType = phFriNfc_LlcpMac_ePeerTypeTarget; } else if(LlcpMac->psRemoteDevInfo->RemDevType == phHal_eNfcIP1_Target) { PH_LOG_LLCP_INFO_STR("PeerRemoteDevType is set to phFriNfc_LlcpMac_ePeerTypeInitiator"); /* Set the PeerRemoteDevType variable to the Initiator type */ LlcpMac->PeerRemoteDevType = phFriNfc_LlcpMac_ePeerTypeInitiator; } switch(LlcpMac->psRemoteDevInfo->RemDevType) { case phHal_eNfcIP1_Initiator: case phHal_eNfcIP1_Target: { /* Set the MAC mapping type detected */ LlcpMac->MacType = phFriNfc_LlcpMac_eTypeNfcip; PH_LOG_LLCP_INFO_STR("Register the lower layer to the MAC mapping component"); /* Register the lower layer to the MAC mapping component */ status = phFriNfc_LlcpMac_Nfcip_Register (LlcpMac); if(status == NFCSTATUS_SUCCESS) { PH_LOG_LLCP_INFO_STR("Invoking 'phFriNfc_LlcpMac_Nfcip_Chk'"); status = LlcpMac->LlcpMacInterface.chk(LlcpMac,ChkLlcpMac_Cb,pContext); } else { PH_LOG_LLCP_INFO_STR("phFriNfc_LlcpMac_Nfcip_Register failed!"); status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_FAILED); } }break; case phHal_eISO14443_A_PICC: case phHal_eISO14443_B_PICC: { /* Set the MAC mapping type detected */ LlcpMac->MacType = phFriNfc_LlcpMac_eTypeIso14443; status = NFCSTATUS_SUCCESS; }break; default: { status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_INVALID_DEVICE); }break; } } PH_LOG_LLCP_INFO_X32MSG("Return status:",status); PH_LOG_LLCP_FUNC_EXIT(); return status; }