private void DispatchNfcFEvent(IntPtr pDeviceData) { DEVICE_DATA_NFC_18092_212_424K deviceData_F = (DEVICE_DATA_NFC_18092_212_424K)Marshal.PtrToStructure(pDeviceData, typeof(DEVICE_DATA_NFC_18092_212_424K)); FeliCaNfcDllWrapperClass.FeliCaLibNfcStartDevAccess(deviceData_F.target_number); DiscoverNfcFTag(this, new NfcFEventArgs(deviceData_F)); }
/// <summary> /// ポーリング結果がNFC-Aだった場合 /// </summary> /// <param name="pDeviceData">DEVICE_INFO.dev_infoへのポインタ</param> private void detectNfcA(IntPtr pDeviceData) { DEVICE_DATA_NFC_14443A_18092_106K DeviceData_A = (DEVICE_DATA_NFC_14443A_18092_106K)Marshal.PtrToStructure(pDeviceData, typeof(DEVICE_DATA_NFC_14443A_18092_106K)); mTargetNumber = DeviceData_A.target_number; mResult = mFeliCaNfcDllWrapperClass.FeliCaLibNfcStartDevAccess(mTargetNumber); if (mResult == false) { ErrorRoutine(); return; } mNfcId = new byte[DeviceData_A.NFCID1_size]; Buffer.BlockCopy(DeviceData_A.NFCID1, 0, mNfcId, 0, DeviceData_A.NFCID1_size); mRD = new byte[1]; mRD[RD_SELRES] = DeviceData_A.sel_res; }
public void messageHandlerFunc(object sender, MessageReceivedEventArgs e) { bRet = false; if (e.Message.Msg == card_find_message) { IntPtr pDevInfo = e.Message.LParam; IntPtr pDeviceData_A; if (IntPtr.Size == 8) { pDeviceData_A = (IntPtr)((Int64)pDevInfo + (Int64)Marshal.OffsetOf(typeof(DEVICE_INFO), "dev_info")); } else { pDeviceData_A = (IntPtr)((Int32)pDevInfo + (Int32)Marshal.OffsetOf(typeof(DEVICE_INFO), "dev_info")); } DEVICE_DATA_NFC_14443A_18092_106K DeviceData_A = (DEVICE_DATA_NFC_14443A_18092_106K) Marshal.PtrToStructure(pDeviceData_A, typeof(DEVICE_DATA_NFC_14443A_18092_106K)); target_number = DeviceData_A.target_number; bRet = FeliCaNfcDllWrapperClass.FeliCaLibNfcStartDevAccess(target_number); if (bRet == false) { Console.Write("Failed: FeliCaLibNfcStartDevAccess\n"); Application.Exit(); return; } } else if (e.Message.Msg == card_enable_message) { bRet = true; Application.Exit(); return; } return; }