nfc_uri_rec.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. #ifndef NFC_URI_REC_H__
  13. #define NFC_URI_REC_H__
  14. /**@file
  15. *
  16. * @defgroup nfc_uri_rec URI records
  17. * @{
  18. * @ingroup nfc_uri_msg
  19. *
  20. * @brief Generation of NFC NDEF URI record descriptions.
  21. *
  22. */
  23. #include "nfc_ndef_record.h"
  24. /**
  25. * @enum nfc_uri_id_t
  26. * @brief URI identifier codes according to "URI Record Type Definition"
  27. * (denotation "NFCForum-TS-RTD_URI_1.0" published on 2006-07-24) chapter 3.2.2.
  28. */
  29. typedef enum
  30. {
  31. NFC_URI_NONE = 0x00, /**< No prepending is done. */
  32. NFC_URI_HTTP_WWW = 0x01, /**< "http://www." */
  33. NFC_URI_HTTPS_WWW = 0x02, /**< "https://www." */
  34. NFC_URI_HTTP = 0x03, /**< "http:" */
  35. NFC_URI_HTTPS = 0x04, /**< "https:" */
  36. NFC_URI_TEL = 0x05, /**< "tel:" */
  37. NFC_URI_MAILTO = 0x06, /**< "mailto:" */
  38. NFC_URI_FTP_ANONYMOUS = 0x07, /**< "ftp://anonymous:anonymous@" */
  39. NFC_URI_FTP_FTP = 0x08, /**< "ftp://ftp." */
  40. NFC_URI_FTPS = 0x09, /**< "ftps://" */
  41. NFC_URI_SFTP = 0x0A, /**< "sftp://" */
  42. NFC_URI_SMB = 0x0B, /**< "smb://" */
  43. NFC_URI_NFS = 0x0C, /**< "nfs://" */
  44. NFC_URI_FTP = 0x0D, /**< "ftp://" */
  45. NFC_URI_DAV = 0x0E, /**< "dav://" */
  46. NFC_URI_NEWS = 0x0F, /**< "news:" */
  47. NFC_URI_TELNET = 0x10, /**< "telnet://" */
  48. NFC_URI_IMAP = 0x11, /**< "imap:" */
  49. NFC_URI_RTSP = 0x12, /**< "rtsp://" */
  50. NFC_URI_URN = 0x13, /**< "urn:" */
  51. NFC_URI_POP = 0x14, /**< "pop:" */
  52. NFC_URI_SIP = 0x15, /**< "sip:" */
  53. NFC_URI_SIPS = 0x16, /**< "sips:" */
  54. NFC_URI_TFTP = 0x17, /**< "tftp:" */
  55. NFC_URI_BTSPP = 0x18, /**< "btspp://" */
  56. NFC_URI_BTL2CAP = 0x19, /**< "btl2cap://" */
  57. NFC_URI_BTGOEP = 0x1A, /**< "btgoep://" */
  58. NFC_URI_TCPOBEX = 0x1B, /**< "tcpobex://" */
  59. NFC_URI_IRDAOBEX = 0x1C, /**< "irdaobex://" */
  60. NFC_URI_FILE = 0x1D, /**< "file://" */
  61. NFC_URI_URN_EPC_ID = 0x1E, /**< "urn:epc:id:" */
  62. NFC_URI_URN_EPC_TAG = 0x1F, /**< "urn:epc:tag:" */
  63. NFC_URI_URN_EPC_PAT = 0x20, /**< "urn:epc:pat:" */
  64. NFC_URI_URN_EPC_RAW = 0x21, /**< "urn:epc:raw:" */
  65. NFC_URI_URN_EPC = 0x22, /**< "urn:epc:" */
  66. NFC_URI_URN_NFC = 0x23, /**< "urn:nfc:" */
  67. NFC_URI_RFU = 0xFF /**< No prepending is done. Reserved for future use. */
  68. } nfc_uri_id_t;
  69. /** @brief Function for generating a description of a URI record.
  70. *
  71. * This function declares and initializes a static instance of an NFC NDEF record description
  72. * of a URI record.
  73. *
  74. * @note The record payload data (@p uri_id_code, @p p_uri_data, and @p
  75. * uri_data_len) should be declared as static. If it is declared as
  76. * automatic, the NDEF message encoding (see @ref nfc_uri_msg_encode)
  77. * must be done in the same variable scope.
  78. *
  79. * @param[in] uri_id_code URI identifier code that defines the protocol field of the URI.
  80. * @param[in] p_uri_data Pointer to the URI string.
  81. * The string should not contain the protocol field if the protocol
  82. * was specified in @p uri_id_code.
  83. * @param[in] uri_data_len Length of the URI string.
  84. *
  85. * @return Pointer to the description of the record.
  86. */
  87. nfc_ndef_record_desc_t * nfc_uri_rec_declare( nfc_uri_id_t uri_id_code,
  88. uint8_t const * const p_uri_data,
  89. uint8_t uri_data_len);
  90. /** @} */
  91. #endif // NFC_URI_REC_H__