- #define SDP_ATTRIBUTE_NAME 0x0000
- #define SDP_ATTRIBUTE_DESCRIPTION 0x0001
- #define SDP_ATTRIBUTE_PROVIDER 0x0002
- #define SDP_ATTRIBUTE_AVAILABILITY 0x0008
-
- #define SDP_DATATYPE_NIL (0x00 << 3)
- #define SDP_DATATYPE_UNSIGNED_INT (0x01 << 3)
- #define SDP_DATATYPE_SIGNED_INT (0x02 << 3)
- #define SDP_DATATYPE_UUID (0x03 << 3)
- #define SDP_DATATYPE_TEXT (0x04 << 3)
- #define SDP_DATATYPE_BOOLEAN (0x05 << 3)
- #define SDP_DATATYPE_ELEMENT_SEQUENCE (0x06 << 3)
- #define SDP_DATATYPE_ELEMENT_ALTERNATIVE (0x07 << 3)
- #define SDP_DATATYPE_URL (0x08 << 3)
-
- #define BASE_96BIT_UUID 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00
-
- #define SERVICE_ATTRIBUTE_TEXT(name, string) SERVICE_ATTRIBUTE_LEN8(name, SDP_DATATYPE_TEXT, sizeof(string), string)
- #define SERVICE_ATTRIBUTE_LEN8(name, type, size, ...) const ServiceAttributeData8Bit_t name PROGMEM = \
- {.Header = (type | 5), .Size = size, .Data = __VA_ARGS__}
- #define SERVICE_ATTRIBUTE_LEN16(name, type, size, ...) const ServiceAttributeData16Bit_t name PROGMEM = \
- {.Header = (type | 5), .Size = size, .Data = __VA_ARGS__}
- #define SERVICE_ATTRIBUTE_LEN32(name, type, size, ...) const ServiceAttributeData32Bit_t name PROGMEM = \
- {.Header = (type | 5), .Size = size, .Data = __VA_ARGS__}
- #define SERVICE_ATTRIBUTE_TABLE_TERMINATOR {.AttributeData = NULL}
+ /** Convenience macro - read a pointer out of PROGMEM space.
+ *
+ * \param[in] x Address of the pointer to read
+ *
+ * \return Pointer retrieved from PROGMEM space
+ */
+ #define pgm_read_ptr(x) (void*)pgm_read_word(x)
+
+ /* Enums: */
+ /** Data sizes for SDP Data Element headers, to indicate the size of the data contained in the element. When creating
+ * a Data Element, a value from this enum should be ORed with a value from the \ref ServiceDiscovery_DataTypes_t enum.
+ */
+ enum ServiceDiscovery_DataSizes_t
+ {
+ SDP_DATASIZE_8Bit = 0, /**< Contained data is 8 bits in length. */
+ SDP_DATASIZE_16Bit = 1, /**< Contained data is 16 bits in length. */
+ SDP_DATASIZE_32Bit = 2, /**< Contained data is 32 bits in length. */
+ SDP_DATASIZE_64Bit = 3, /**< Contained data is 64 bits in length. */
+ SDP_DATASIZE_128Bit = 4, /**< Contained data is 128 bits in length. */
+ SDP_DATASIZE_Variable8Bit = 5, /**< Contained data is encoded in an 8 bit size integer following the header. */
+ SDP_DATASIZE_Variable16Bit = 6, /**< Contained data is encoded in an 16 bit size integer following the header. */
+ SDP_DATASIZE_Variable32Bit = 7, /**< Contained data is encoded in an 32 bit size integer following the header. */
+ };
+
+ /** Data types for SDP Data Element headers, to indicate the type of data contained in the element. When creating
+ * a Data Element, a value from this enum should be ORed with a value from the \ref ServiceDiscovery_DataSizes_t enum.
+ */
+ enum ServiceDiscovery_DataTypes_t
+ {
+ SDP_DATATYPE_Nill = (0 << 3), /**< Indicates the container data is a Nill (null) type. */
+ SDP_DATATYPE_UnsignedInt = (1 << 3), /**< Indicates the container data is an unsigned integer. */
+ SDP_DATATYPE_SignedInt = (2 << 3), /**< Indicates the container data is a signed integer. */
+ SDP_DATATYPE_UUID = (3 << 3), /**< Indicates the container data is a UUID. */
+ SDP_DATATYPE_String = (4 << 3), /**< Indicates the container data is an ASCII string. */
+ SDP_DATATYPE_Boolean = (5 << 3), /**< Indicates the container data is a logical boolean. */
+ SDP_DATATYPE_Sequence = (6 << 3), /**< Indicates the container data is a sequence of containers. */
+ SDP_DATATYPE_Alternative = (7 << 3), /**< Indicates the container data is a sequence of alternative containers. */
+ SDP_DATATYPE_URL = (8 << 3), /**< Indicates the container data is a URL. */
+ };