mirror of
https://gitee.com/muyuchl/nrf51_2in13_epd.git
synced 2025-12-16 10:48:12 +08:00
copy project from century 2in6 esl project
This commit is contained in:
125
COMPONENTS/nfc/ndef/uri/nfc_uri_msg.c
Normal file
125
COMPONENTS/nfc/ndef/uri/nfc_uri_msg.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "nfc_uri_msg.h"
|
||||
|
||||
/** @brief Function for generating a description of an NFC NDEF URI message.
|
||||
*
|
||||
* This function declares and initializes a static instance of an NFC NDEF message description
|
||||
* and NFC NDEF records descriptions.
|
||||
*
|
||||
* @param[in] uri_id_code URI identifier code that defines the protocol field of the URI.
|
||||
* @param[in] p_uri_data Pointer to the URI string.
|
||||
* This string should not contain the protocol field if the protocol
|
||||
* was specified in @p uri_id_code
|
||||
* @param[in] uri_data_len Length of the URI string.
|
||||
* @param[out] pp_uri_msg_desc Pointer to pointer to the NDEF message description.
|
||||
*
|
||||
* @retval NRF_SUCCESS If the description was successfully created.
|
||||
* @retval NRF_ERROR_INVALID_PARAM If the URI string was invalid (equal to NULL).
|
||||
*/
|
||||
static ret_code_t nfc_uri_msg_declare( nfc_uri_id_t uri_id_code,
|
||||
uint8_t const * const p_uri_data,
|
||||
uint8_t uri_data_len,
|
||||
nfc_ndef_msg_desc_t ** pp_uri_msg_desc)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
nfc_ndef_record_desc_t * p_uri_rec;
|
||||
|
||||
/* Create NFC NDEF message description, capacity - 1 record */
|
||||
NFC_NDEF_MSG_DEF(nfc_uri_msg, 1);
|
||||
|
||||
/* The message description is static, therefore */
|
||||
/* you must clear the message (needed for supporting multiple calls) */
|
||||
nfc_ndef_msg_clear(&NFC_NDEF_MSG(nfc_uri_msg));
|
||||
|
||||
if (p_uri_data != NULL)
|
||||
{
|
||||
/* Create NFC NDEF URI Record description */
|
||||
p_uri_rec = nfc_uri_rec_declare(uri_id_code,
|
||||
p_uri_data,
|
||||
uri_data_len);
|
||||
|
||||
/* Add URI record as lone record to message */
|
||||
err_code = nfc_ndef_msg_record_add(&NFC_NDEF_MSG(nfc_uri_msg), p_uri_rec);
|
||||
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NRF_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
*pp_uri_msg_desc = &NFC_NDEF_MSG(nfc_uri_msg);
|
||||
|
||||
return NRF_SUCCESS;
|
||||
}
|
||||
|
||||
ret_code_t nfc_uri_msg_encode( nfc_uri_id_t uri_id_code,
|
||||
uint8_t const * const p_uri_data,
|
||||
uint8_t uri_data_len,
|
||||
uint8_t * p_buf,
|
||||
uint32_t * p_len)
|
||||
{
|
||||
ret_code_t err_code;
|
||||
nfc_ndef_msg_desc_t * p_uri_msg_desc;
|
||||
|
||||
/* Create NFC NDEF message description with URI record */
|
||||
err_code = nfc_uri_msg_declare( uri_id_code,
|
||||
p_uri_data,
|
||||
uri_data_len,
|
||||
&p_uri_msg_desc);
|
||||
|
||||
if (err_code != NRF_SUCCESS)
|
||||
{
|
||||
return err_code;
|
||||
}
|
||||
|
||||
/* Encode whole message into buffer */
|
||||
err_code = nfc_ndef_msg_encode(p_uri_msg_desc,
|
||||
p_buf,
|
||||
p_len);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
96
COMPONENTS/nfc/ndef/uri/nfc_uri_msg.h
Normal file
96
COMPONENTS/nfc/ndef/uri/nfc_uri_msg.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NFC_URI_MSG_H__
|
||||
#define NFC_URI_MSG_H__
|
||||
|
||||
/**@file
|
||||
*
|
||||
* @defgroup nfc_uri_msg URI messages
|
||||
* @{
|
||||
* @ingroup nfc_ndef_messages
|
||||
*
|
||||
* @brief Generation of NFC NDEF messages with a URI record.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nfc_ndef_msg.h"
|
||||
#include "nfc_uri_rec.h"
|
||||
#include "nrf_error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief Function for encoding an NFC NDEF URI message.
|
||||
*
|
||||
* This function encodes an NFC NDEF message into a buffer.
|
||||
*
|
||||
* @param[in] uri_id_code URI identifier code that defines the protocol field of the URI.
|
||||
* @param[in] p_uri_data Pointer to the URI string.
|
||||
* The string should not contain the protocol field if the protocol
|
||||
* was specified in @p uri_id_code.
|
||||
* @param[in] uri_data_len Length of the URI string.
|
||||
* @param[out] p_buf Pointer to the buffer for the message.
|
||||
* @param[in,out] p_len Size of the available memory for the message as input.
|
||||
* Size of the generated message as output.
|
||||
*
|
||||
* @retval NRF_SUCCESS If the description was successfully created.
|
||||
* @retval NRF_ERROR_INVALID_PARAM If the URI string was invalid (equal to NULL).
|
||||
* @retval NRF_ERROR_NO_MEM If the predicted message size is bigger than the provided
|
||||
* buffer space.
|
||||
* @retval Other Other codes might be returned depending on
|
||||
* the function @ref nfc_ndef_msg_encode.
|
||||
*/
|
||||
ret_code_t nfc_uri_msg_encode( nfc_uri_id_t uri_id_code,
|
||||
uint8_t const * const p_uri_data,
|
||||
uint8_t uri_data_len,
|
||||
uint8_t * p_buf,
|
||||
uint32_t * p_len);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NFC_URI_MSG_H__
|
||||
115
COMPONENTS/nfc/ndef/uri/nfc_uri_rec.c
Normal file
115
COMPONENTS/nfc/ndef/uri/nfc_uri_rec.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "nfc_uri_rec.h"
|
||||
#include "nrf_error.h"
|
||||
|
||||
/**
|
||||
* @brief Type of description of the payload of a URI record.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
nfc_uri_id_t uri_id_code; ///< URI identifier code.
|
||||
uint8_t const * p_uri_data; ///< Pointer to a URI string.
|
||||
uint8_t uri_data_len; ///< Length of the URI string.
|
||||
} uri_payload_desc_t;
|
||||
|
||||
/**
|
||||
* @brief Function for constructing the payload for a URI record.
|
||||
*
|
||||
* This function encodes the payload according to the URI record definition. It implements an API
|
||||
* compatible with @ref p_payload_constructor_t.
|
||||
*
|
||||
* @param[in] p_input Pointer to the description of the payload.
|
||||
* @param[out] p_buff Pointer to payload destination. If NULL, function will
|
||||
* calculate the expected size of the URI record payload.
|
||||
*
|
||||
* @param[in,out] p_len Size of available memory to write as input. Size of generated
|
||||
* payload as output.
|
||||
*
|
||||
* @retval NRF_SUCCESS If the payload was encoded successfully.
|
||||
* @retval NRF_ERROR_NO_MEM If the predicted payload size is bigger than the provided buffer space.
|
||||
*/
|
||||
static ret_code_t nfc_uri_payload_constructor( uri_payload_desc_t * p_input,
|
||||
uint8_t * p_buff,
|
||||
uint32_t * p_len)
|
||||
{
|
||||
if (p_buff != NULL)
|
||||
{
|
||||
/* Verify if there is enough available memory */
|
||||
if (p_input->uri_data_len >= *p_len)
|
||||
{
|
||||
return NRF_ERROR_NO_MEM;
|
||||
}
|
||||
|
||||
/* Copy descriptor content into the buffer */
|
||||
*(p_buff++) = p_input->uri_id_code;
|
||||
memcpy(p_buff, p_input->p_uri_data, p_input->uri_data_len );
|
||||
}
|
||||
|
||||
*p_len = p_input->uri_data_len + 1;
|
||||
|
||||
return NRF_SUCCESS;
|
||||
}
|
||||
|
||||
nfc_ndef_record_desc_t * nfc_uri_rec_declare( nfc_uri_id_t uri_id_code,
|
||||
uint8_t const * const p_uri_data,
|
||||
uint8_t uri_data_len)
|
||||
{
|
||||
static uri_payload_desc_t uri_payload_desc;
|
||||
static const uint8_t static_uri_type = 'U';
|
||||
|
||||
NFC_NDEF_GENERIC_RECORD_DESC_DEF( uri_rec,
|
||||
TNF_WELL_KNOWN, // tnf <- well-known
|
||||
NULL,
|
||||
0, // no id
|
||||
&static_uri_type,
|
||||
1, // type size 1B
|
||||
nfc_uri_payload_constructor,
|
||||
&uri_payload_desc);
|
||||
|
||||
uri_payload_desc.uri_id_code = uri_id_code;
|
||||
uri_payload_desc.p_uri_data = p_uri_data;
|
||||
uri_payload_desc.uri_data_len = uri_data_len;
|
||||
|
||||
return &NFC_NDEF_GENERIC_RECORD_DESC( uri_rec);
|
||||
}
|
||||
|
||||
133
COMPONENTS/nfc/ndef/uri/nfc_uri_rec.h
Normal file
133
COMPONENTS/nfc/ndef/uri/nfc_uri_rec.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NFC_URI_REC_H__
|
||||
#define NFC_URI_REC_H__
|
||||
|
||||
/**@file
|
||||
*
|
||||
* @defgroup nfc_uri_rec URI records
|
||||
* @{
|
||||
* @ingroup nfc_uri_msg
|
||||
*
|
||||
* @brief Generation of NFC NDEF URI record descriptions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nfc_ndef_record.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @enum nfc_uri_id_t
|
||||
* @brief URI identifier codes according to "URI Record Type Definition"
|
||||
* (denotation "NFCForum-TS-RTD_URI_1.0" published on 2006-07-24) chapter 3.2.2.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NFC_URI_NONE = 0x00, /**< No prepending is done. */
|
||||
NFC_URI_HTTP_WWW = 0x01, /**< "http://www." */
|
||||
NFC_URI_HTTPS_WWW = 0x02, /**< "https://www." */
|
||||
NFC_URI_HTTP = 0x03, /**< "http:" */
|
||||
NFC_URI_HTTPS = 0x04, /**< "https:" */
|
||||
NFC_URI_TEL = 0x05, /**< "tel:" */
|
||||
NFC_URI_MAILTO = 0x06, /**< "mailto:" */
|
||||
NFC_URI_FTP_ANONYMOUS = 0x07, /**< "ftp://anonymous:anonymous@" */
|
||||
NFC_URI_FTP_FTP = 0x08, /**< "ftp://ftp." */
|
||||
NFC_URI_FTPS = 0x09, /**< "ftps://" */
|
||||
NFC_URI_SFTP = 0x0A, /**< "sftp://" */
|
||||
NFC_URI_SMB = 0x0B, /**< "smb://" */
|
||||
NFC_URI_NFS = 0x0C, /**< "nfs://" */
|
||||
NFC_URI_FTP = 0x0D, /**< "ftp://" */
|
||||
NFC_URI_DAV = 0x0E, /**< "dav://" */
|
||||
NFC_URI_NEWS = 0x0F, /**< "news:" */
|
||||
NFC_URI_TELNET = 0x10, /**< "telnet://" */
|
||||
NFC_URI_IMAP = 0x11, /**< "imap:" */
|
||||
NFC_URI_RTSP = 0x12, /**< "rtsp://" */
|
||||
NFC_URI_URN = 0x13, /**< "urn:" */
|
||||
NFC_URI_POP = 0x14, /**< "pop:" */
|
||||
NFC_URI_SIP = 0x15, /**< "sip:" */
|
||||
NFC_URI_SIPS = 0x16, /**< "sips:" */
|
||||
NFC_URI_TFTP = 0x17, /**< "tftp:" */
|
||||
NFC_URI_BTSPP = 0x18, /**< "btspp://" */
|
||||
NFC_URI_BTL2CAP = 0x19, /**< "btl2cap://" */
|
||||
NFC_URI_BTGOEP = 0x1A, /**< "btgoep://" */
|
||||
NFC_URI_TCPOBEX = 0x1B, /**< "tcpobex://" */
|
||||
NFC_URI_IRDAOBEX = 0x1C, /**< "irdaobex://" */
|
||||
NFC_URI_FILE = 0x1D, /**< "file://" */
|
||||
NFC_URI_URN_EPC_ID = 0x1E, /**< "urn:epc:id:" */
|
||||
NFC_URI_URN_EPC_TAG = 0x1F, /**< "urn:epc:tag:" */
|
||||
NFC_URI_URN_EPC_PAT = 0x20, /**< "urn:epc:pat:" */
|
||||
NFC_URI_URN_EPC_RAW = 0x21, /**< "urn:epc:raw:" */
|
||||
NFC_URI_URN_EPC = 0x22, /**< "urn:epc:" */
|
||||
NFC_URI_URN_NFC = 0x23, /**< "urn:nfc:" */
|
||||
NFC_URI_RFU = 0xFF /**< No prepending is done. Reserved for future use. */
|
||||
} nfc_uri_id_t;
|
||||
|
||||
/** @brief Function for generating a description of a URI record.
|
||||
*
|
||||
* This function declares and initializes a static instance of an NFC NDEF record description
|
||||
* of a URI record.
|
||||
*
|
||||
* @note The record payload data (@p uri_id_code, @p p_uri_data, and @p
|
||||
* uri_data_len) should be declared as static. If it is declared as
|
||||
* automatic, the NDEF message encoding (see @ref nfc_uri_msg_encode)
|
||||
* must be done in the same variable scope.
|
||||
*
|
||||
* @param[in] uri_id_code URI identifier code that defines the protocol field of the URI.
|
||||
* @param[in] p_uri_data Pointer to the URI string.
|
||||
* The string should not contain the protocol field if the protocol
|
||||
* was specified in @p uri_id_code.
|
||||
* @param[in] uri_data_len Length of the URI string.
|
||||
*
|
||||
* @return Pointer to the description of the record.
|
||||
*/
|
||||
nfc_ndef_record_desc_t * nfc_uri_rec_declare( nfc_uri_id_t uri_id_code,
|
||||
uint8_t const * const p_uri_data,
|
||||
uint8_t uri_data_len);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NFC_URI_REC_H__
|
||||
Reference in New Issue
Block a user