locked
How to get the Mac id from NFC using windows phone 10. RRS feed

  • Question

  • Hi All,

    I am developing a program which extracts all the details of the NFC tag, especially the "Mac ID",

    I am able to read the NFC tag from a Device on my windows phone 10, i am able to get the device name but i am not able to get the device id, please find the code below.

    void NFCConnect()
            {
                device = ProximityDevice.GetDefault();
                device.DeviceArrived += Device_DeviceArrived;
                device.SubscribeForMessage("WindowsMime", messageReceived);

    }

    private void messageReceived(ProximityDevice sender, ProximityMessage message)
            {
                var buffer = message.Data.ToArray();
                int mimesize = 0;
                //search first '\0' charactere
                for (mimesize = 0; mimesize < 256 && buffer[mimesize] != 0; ++mimesize)
                {
                };

                //extract mimetype
                var messageType = Encoding.UTF8.GetString(buffer, 0, mimesize);

                //convert data to string. This depends on mimetype value.
                var scanned_message = Encoding.UTF8.GetString(buffer, 256, buffer.Length - 256);          

            }

    OutPut:

    application/vnd.bluetooth.ep.oob\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\u001c\0?\u0016?%?\0\n\tDX30-1693\u0004\r\0\u001f\0\u0003\u0002\u0001\u0011"

    Thanks,

    Praveen.N

    Wednesday, March 9, 2016 7:35 AM

All replies