NFC Reader/Writer/Bar code scanner Help

Thanks for visiting this page. This page is intended towards developer or users of NFC Reader/Writer - Bar code/QR code reader app who intend to retrieve data being sent on a server. Sent data may be use as inventory management or to provide door access etc.

Read: How to send and retrieve data to a server along with its format.

Sample Bar code scan result posted on the server

["data:B07KDDKDNN","source:Camera","type:CODE_128","timeStamp:1579362426142"]

data: read value

source: Camera for bar code/qr code

type: bar code type or QR_CODE

timeStamp: Local time at which bar code was scanned


Sample NFC scan result posted on the server

["id:044f63f23c2a80","data:123xyz","source:NFC","timeStamp:1579362207294"]

ID: key value

data: NDEF data as text

source: NFC in this case

timeStamp: Local time at which NFC tag was read


Test server

A test post server can be created using http://ptsv2.com/


Sample PHP script to read data

function getRealPOST() {
    $pairs = explode("&", file_get_contents("php://input"));
    $vars = array();
    foreach ($pairs as $pair) {
        $nv = explode("=", $pair);
        $name = urldecode($nv[0]);
        $value = urldecode($nv[1]);
        $vars[$name] = $value;
    }
    return $vars;
}

function getNFC_ID($realpost) {
    $object = json_decode(json_encode($realpost), FALSE);
    return ltrim(key($object),"ID:");
}

$realpost = getRealPOST(); //Can only be used once, because php://input is a stream.
$NFC_ID = getNFC_ID($realpost);


Read: How to write multiple tags using JSON.

Create a JSON file and download it on your phone.

Open the app and select Write Multiple Tags from JSON. Now select Write From Json File. This requires file read permission. Once the permission has been granted, select the required JSON file.

JSON file will be parsed and upon successful read, data will be ready for writing. You can either manually use NFC chips to write data or use a machine reel to write the data.

Please note : Currently only two record types are supported 1) Text 2) Url

Sample Json file

{
  "TAG": [
    {
      "id": 1,
      "type": "text",
      "lock_tag": false,
      "NdefMessage": [
        {
          "NdefRecord": "Sample text 1"
        },
        {
          "NdefRecord": "Sample text 2"
        },
        {
          "NdefRecord": "Sample text 3"
        }
      ]
    },
    {
      "id": 2,
      "type": "url",
      "lock_tag": false,
      "NdefMessage": [
        {
          "NdefRecord": "https://www.google.com/"
        }
      ]
    },
    {
      "id": 3,
      "type": "url",
      "lock_tag": false,
      "NdefMessage": [
        {
          "NdefRecord": "https://www.en.wikipedia.com/"
        }
      ]
    }
  ]
}

Data types

"id" : Unique Integer format eg. 100

"type" : Record type you want to write in String format eg. text or url

"lock_tag" : true if you want to lock the tag else false. Must be in boolean format. This will permanently lock the tag.

"NdefMessage" : Wrapper list format object which can hold Strings of NdefRecords. If type is url and there are multiple NdefRecord, only first url will be written.

"NdefRecords" : String data format which can be written as tag.

Any other data will be ignored. If there is no TYPE found, default type will be TEXT.