Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

GH-120: Add NFC API#131

Closed
mattleibow wants to merge 4 commits intoxamarin:masterfrom
mattleibow:feature/nfc
Closed

GH-120: Add NFC API#131
mattleibow wants to merge 4 commits intoxamarin:masterfrom
mattleibow:feature/nfc

Conversation

@mattleibow
Copy link
Copy Markdown
Member

@mattleibow mattleibow commented Mar 29, 2018

DISCLAIMER: I have no iOS device or any official tags. I am testing with an Android-based tag emulator. Things may not work. 😉

Description of Change

Adding the NFC API.

Bugs Fixed

API Changes

public static partial class Nfc {
    // when a tag comes near
    public static event NfcTagEventHandler TagArrived;
    public static event NfcTagEventHandler TagDeparted;
    public static event NdefMessageReceivedEventHandler NdefMessageReceived;

    // basically enable/disable events
    public static bool IsListening { get; set; }

    // writing (not supported on iOS)
    public static void PublishMessage(string messageType, byte[] message);
    public static void StopPublishing();

    // helpers for writing NDEF tags (uses PublishMessage under the hood)
    public static void WriteTag(byte[] message);
    public static void ShareTag(byte[] message);
}

public delegate void NfcTagEventHandler(NfcTagEventArgs e);

public delegate void NdefMessageReceivedEventHandler(NdefMessageReceivedEventArgs e);

public class NfcTagEventArgs : EventArgs {
    public static new readonly NfcTagEventArgs Empty;
    public NfcTagEventArgs();
}

public class NdefMessageReceivedEventArgs : EventArgs {
    public NdefMessageReceivedEventArgs(byte[] message);
    public byte[] Message { get; }
}

Behavioral Changes

Adding the NFC API.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

@mattleibow mattleibow added enhancement DO-NOT-MERGE Don't merge it.... don't do it! labels Mar 29, 2018
@mattleibow mattleibow added this to the V2 milestone Mar 29, 2018
@mattleibow mattleibow self-assigned this Mar 29, 2018
@mattleibow mattleibow removed this from the V2 milestone Mar 29, 2018
@jamesmontemagno jamesmontemagno added this to the vNext milestone Apr 24, 2018
@mattleibow mattleibow mentioned this pull request May 31, 2018
@mattleibow
Copy link
Copy Markdown
Member Author

Based on some looking around, if appears that we will leave out writing to tags as this is not easy to do with iOS.

@Redth
Copy link
Copy Markdown
Member

Redth commented Jun 25, 2018

I'm going to close this for now, we can re-open it at a later date.

@Redth Redth closed this Jun 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

DO-NOT-MERGE Don't merge it.... don't do it!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants