// Callback function for state changed callback
    function (state, idle) {
        if(state == Tinkerforge.BrickletNFCRFID.STATE_REQUEST_TAG_ID_READY) {
            nr.getTagID(
                function (tagType, tidLength, tid) {
                    var s = 'Found tag of type ' + tagType +
                            ' with ID [' + tid[0].toString(16);

                    for(var i = 1; i < tidLength; i++) {
                        s += ' ' + tid[i].toString(16);
                    }

                    s += ']';
                    console.log(s);
                },
                function (error) {
                    console.log('Error: ' + error);
                }
            )
        }

        // Cycle through all types
        if(idle) {
            tagType = (tagType + 1) % 3;
            nr.requestTagID(tagType);
        }
    }
 function (connectReason) {
     // Start scan loop
     nr.requestTagID(Tinkerforge.BrickletNFCRFID.TAG_TYPE_MIFARE_CLASSIC);
 }