Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WriteToNFCCard v1.21.0 ñ grava se informar senha #15

Open
marcioqmaciel opened this issue Jul 20, 2022 · 0 comments
Open

WriteToNFCCard v1.21.0 ñ grava se informar senha #15

marcioqmaciel opened this issue Jul 20, 2022 · 0 comments

Comments

@marcioqmaciel
Copy link

Olá a todos

Alguém teria um exemplo funcional de como gravar em cartão NFC informando uma senha?

Tentei o exemplo que a PagSeguro enviou, ele compila e roda na POS sem problema, mas se eu informar uma senha a POS bipa repetidamente e retorna erro.

Exemplo que estou me baseando:

private val timeout = 5 // seconds
private val demoSlot = 0
private val charsetUTF8 = Charset.forName("UTF-8")
private val DEFAULT_KEY_NFC = byteArrayOf(
0x01.toByte(),
0x02.toByte(),
0x03.toByte(),
0x04.toByte(),
0x05.toByte(),
0x06.toByte()
)

    // len = 16
    private val demoText = arrayOf(
        "_TESTANDO_1_2_3_".toByteArray(charsetUTF8),
        "demo_text  02   ".toByteArray(charsetUTF8),
        "demo_text     03".toByteArray(charsetUTF8)
    )

val cardData = PlugPagNearFieldCardData().apply {
startSlot = demoSlot
endSlot = demoSlot
slots[demoSlot]["pwd"] = DEFAULT_KEY_NFC
slots[demoSlot]["data"] = demoText[0]
timeOutRead = timeout
}

        val write = plugpag.writeToNFCCard(cardData)

Se eu deixar a DEFAULT_KEY_NFC como byte[6] 0xFF a gravação ocorre sem problemas

Se alguém puder ajudar eu serei eternamente grato.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant