private void RegisterTagDiscoveredEvent() { _tagDiscoveredCallback = (int type, IntPtr tagHandle, IntPtr userData) => { NfcDiscoveredType tagType = (NfcDiscoveredType)type; TagDiscoveredEventArgs e = new TagDiscoveredEventArgs(tagType, tagHandle); _tagDiscovered.SafeInvoke(null, e); }; int ret = Interop.Nfc.SetTagDiscoveredCallback(_tagDiscoveredCallback, IntPtr.Zero); if (ret != (int)NfcError.None) { Log.Error(Globals.LogTag, "Failed to set tag discovered callback, Error - " + (NfcError)ret); } }
private void RegisterP2pTargetDiscoveredEvent() { _p2pTargetDiscoveredCallback = (int type, IntPtr p2pTargetHandle, IntPtr userData) => { NfcDiscoveredType tagType = (NfcDiscoveredType)type; P2pTargetDiscoveredEventArgs e = new P2pTargetDiscoveredEventArgs(tagType, p2pTargetHandle); _p2pTargetDiscovered.SafeInvoke(null, e); }; int ret = Interop.Nfc.SetP2pTargetDiscoveredCallback(_p2pTargetDiscoveredCallback, IntPtr.Zero); if (ret != (int)NfcError.None) { Log.Error(Globals.LogTag, "Failed to set p2p target discovered callback, Error - " + (NfcError)ret); } }
internal P2pTargetDiscoveredEventArgs(NfcDiscoveredType _type, IntPtr p2pTargetHandle) { _p2pTarget = new NfcP2p(p2pTargetHandle); }
internal TagDiscoveredEventArgs(NfcDiscoveredType _type, IntPtr tagHandle) { _tag = new NfcTag(tagHandle); }