This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NFC: Adding second ndef message

Hi,

I would like to combine NFC - BLE pairing and launch app record. Naively I thought I would write the second data right after the first:

uint32_t ndef_msg_len = sizeof(m_ndef_msg_buf);
uint32_t availLen = ndef_msg_len;
      
// Encode NDEF message with Secure Simple Pairing OOB optional data - TK value.
err_code = nfc_ble_pair_msg_updatable_tk_encode(NFC_BLE_PAIR_MSG_BLUETOOTH_LE_SHORT,
                                                  &m_oob_auth_key,
                                                  NULL,
                                                  m_ndef_msg_buf,
                                                  &ndef_msg_len,
                                                  m_tk_group,
                                                  TK_MAX_NUM);

uint32_t len = ndef_msg_len;
availLen -= len;

/* Encode launchapp message into buffer */
err_code = nfc_launchapp_msg_encode(m_android_package_name,  // todo test start app and pairing
                                  sizeof(m_android_package_name),
                                  m_windows_application_id,
                                  sizeof(m_windows_application_id),
                                  (m_ndef_msg_buf+ndef_msg_len),
                                  &availLen);
ndef_msg_len = len+ availLen;

// Update NFC tag data
err_code = nfc_t2t_payload_set(m_ndef_msg_buf, ndef_msg_len);

But this does not work. Reader app (NFC Tools, Android) does recognize tag but with no NDEF data.

How do you do that?

Thanks (again)...

Andreas

Parents Reply Children
No Data
Related