1/****************************************************************************** 2 * 3 * Copyright 2018 NXP 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19#include <log/log.h> 20 21#include "NxpNfc.h" 22#include "phNxpNciHal_Adaptation.h" 23 24extern bool nfc_debug_enabled; 25 26namespace vendor { 27namespace nxp { 28namespace nxpnfc { 29namespace V1_0 { 30namespace implementation { 31// Methods from ::vendor::nxp::nxpnfc::V1_0::INxpNfc follow. 32Return<void> NxpNfc::ioctl(uint64_t ioctlType, 33 const hidl_vec<uint8_t>& inOutData, 34 ioctl_cb _hidl_cb) { 35 int status; 36 nfc_nci_IoctlInOutData_t inpOutData; 37 NfcData outputData; 38 nfc_nci_IoctlInOutData_t* pInOutData = 39 (nfc_nci_IoctlInOutData_t*)&inOutData[0]; 40 41 /*data from proxy->stub is copied to local data which can be updated by 42 * underlying HAL implementation since its an inout argument*/ 43 memcpy(&inpOutData, pInOutData, sizeof(nfc_nci_IoctlInOutData_t)); 44 status = phNxpNciHal_ioctl(ioctlType, &inpOutData); 45 /*copy data and additional fields indicating status of ioctl operation 46 * and context of the caller. Then invoke the corresponding proxy callback*/ 47 inpOutData.out.ioctlType = ioctlType; 48 inpOutData.out.context = pInOutData->inp.context; 49 inpOutData.out.result = status; 50 outputData.setToExternal((uint8_t*)&inpOutData.out, 51 sizeof(nfc_nci_ExtnOutputData_t)); 52 _hidl_cb(outputData); 53 return Void(); 54} 55 56} // namespace implementation 57} // namespace V1_0 58} // namespace nxpnfc 59} // namespace nxp 60} // namespace vendor 61