}
} } } // Tizen::Net::Nfc
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-_OSP_EXPORT_ ByteBuffer*
-_NfcManagerImpl_GetCachedByteBufferMessageN(void)
-{
- Tizen::Net::Nfc::_NfcSystemAdapter* __pSystemAdapter = Tizen::Net::Nfc::_NfcSystemAdapter::GetInstance();
- SysTryReturn(NID_NET_NFC, __pSystemAdapter != null, null, E_SYSTEM, "Failed to get the instance of _NfcSystemAdapter.");
-
- return __pSystemAdapter->GetCachedByteBufferMessageN();
-}
-
-#ifdef __cplusplus
-}
-#endif
return _NdefMessageUtil::ToNdefMessageN(byteMessage);
}
-ByteBuffer*
-_NfcSystemAdapter::GetCachedByteBufferMessageN(void)
-{
- int res = NFC_ERROR_NONE;
- result r = E_SUCCESS;
- nfc_ndef_message_h msgHandle = null;
- byte* pTempBuffer = null;
- int bufSize = 0;
-
- res = nfc_manager_get_cached_message(&msgHandle);
- _NfcConvertErrorResult(res != NFC_ERROR_NONE, r, E_SYSTEM);
- _NfcConvertErrorResult(res == NFC_ERROR_OUT_OF_MEMORY, r, E_OUT_OF_MEMORY);
- _NfcConvertErrorResult(res == NFC_ERROR_INVALID_NDEF_MESSAGE, r, E_INVALID_FORMAT);
- SysTryReturn(NID_NET_NFC, r == E_SUCCESS, null, r,
- "[%s] Failed to get the cached NDEF message. [0x%08X]", GetErrorMessage(r), res);
-
- res = nfc_ndef_message_get_rawdata(msgHandle, &pTempBuffer, &bufSize);
- nfc_ndef_message_destroy(msgHandle);
- _NfcConvertErrorResult(pTempBuffer == NULL || res != NFC_ERROR_NONE, r, E_SYSTEM);
- _NfcConvertErrorResult(res == NFC_ERROR_INVALID_NDEF_MESSAGE, r, E_INVALID_FORMAT);
- _NfcConvertErrorResult(res == NFC_ERROR_OUT_OF_MEMORY, r, E_OUT_OF_MEMORY);
- SysTryReturn(NID_NET_NFC, r == E_SUCCESS, null, r,
- "[%s] Failed to get the raw data of the NDEF message. [0x%08X]", GetErrorMessage(r), res);
-
- ByteBuffer* byteMessage = new (std::nothrow) ByteBuffer();
- SysTryReturn(NID_NET_NFC, byteMessage != null, null, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
-
- byteMessage->Construct(pTempBuffer, 0, bufSize, bufSize);
-
- return byteMessage;
-}
-
_NfcTagImpl*
_NfcSystemAdapter::GetNfcTagImplN(nfc_tag_h tagHandle)
{
*/
static NdefMessage* GetCachedNdefMessageN(void);
- /**
- * Gets the ByteBuffer message cached when the tag is detected.
- *
- * @return The cached %ByteBuffer instance, @n
- * else @c null if the method is not successful
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_FORMAT The cached data cannot be converted to the ByteBuffer message.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @exception E_SYSTEM A system error has occurred.
- */
- Tizen::Base::ByteBuffer* GetCachedByteBufferMessageN(void);
-
private:
_NfcSystemAdapter(void);
_NfcSystemAdapter(const _NfcSystemAdapter& value);