Search code examples
ioscore-nfciso-15693

Get total memory size of an iso-15693 nfc device


I have to get the total memory size in bytes of an iso-15693 NFC device. I downloaded several apps from App Store and they show me this information.

I'm new of NFC world, I looked at NFCISO15693Tag protocol in CoreNFC iOS framework but with no success.

Any help is appreciated.


Solution

  • You can find that by accessing the NFCISO15693SystemInfo with the help of this CoreNFC method

    Implementation

    func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
        if case let .iso15693(tag) = tags.first{
            nfcIntegration.shared.nfcTagReaderSession?.connect(to: tags.first!, completionHandler: { [self] error in
                guard error == nil else{
                    nfcIntegration.shared.nfcTagReaderSession?.alertMessage = "Problem with connection"
                    return
                }
                tag.getSystemInfo(requestFlags: [.highDataRate]) { systemInfo in
                    switch systemInfo {
                    case .success(let success):
                            print("\(success.uniqueIdentifier)")
                    case .failure(let failure):
                        print(failure.localizedDescription)
                    }
                }
            })
        }
    }
    

    if the method return success result, you will get the details of the tag like below.

    success(CoreNFC.NFCISO15693SystemInfo(uniqueIdentifier: 8 bytes, dataStorageFormatIdentifier: -1, applicationFamilyIdentifier: -1, blockSize: 8, totalBlocks: 244, icReference: -1))
    

    With Blocksize and Totalblocks you can caluclate the total memory in bytes.