3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this  
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in  
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting  
  17   documentation, and that the name of the author not be used in  
  18   advertising or publicity pertaining to distribution of the  
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  33  *  Header file for SDPServices.c. 
  36 #ifndef _SDPSERVICES_H_ 
  37 #define _SDPSERVICES_H_ 
  40                 #include "ServiceDiscoveryProtocol.h" 
  43                 /** Size of a full 128 bit UUID, in bytes. */ 
  44                 #define UUID_SIZE_BYTES                         16 
  46                 /** First 80 bits common to all standardized Bluetooth services. */ 
  47                 #define BASE_80BIT_UUID                         0x0000, 0x0010, 0x0080, {0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB} 
  49                 #define RFCOMM_UUID                             {SWAPENDIAN_32(0x00000003), BASE_80BIT_UUID} 
  50                 #define L2CAP_UUID                              {SWAPENDIAN_32(0x00000100), BASE_80BIT_UUID} 
  51                 #define SP_CLASS_UUID                           {SWAPENDIAN_32(0x00001101), BASE_80BIT_UUID} 
  52                 #define PUBLICBROWSEGROUP_CLASS_UUID            {SWAPENDIAN_32(0x00001002), BASE_80BIT_UUID} 
  54                 #define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE    0x0000 
  55                 #define SDP_ATTRIBUTE_ID_SERVICECLASSIDS        0x0001 
  56                 #define SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST 0x0004 
  57                 #define SDP_ATTRIBUTE_ID_BROWSEGROUPLIST        0x0005 
  58                 #define SDP_ATTRIBUTE_ID_LANGUAGEBASEATTROFFSET 0x0006 
  59                 #define SDP_ATTRIBUTE_ID_SERVICENAME            0x0100 
  60                 #define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION     0x0101 
  62                 /** Swaps the byte ordering of a 16-bit value at compile time. Do not use this macro for swapping byte orderings 
  63                  *  of dynamic values computed at runtime -- use SwapEndian_16() instead. 
  65                  *  \param[in]  x  16-bit value whose byte ordering is to be swapped 
  67                  *  \return Input value with the byte ordering reversed 
  69                 #define SWAPENDIAN_16(x)                        ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) 
  71                 /** Swaps the byte ordering of a 32-bit value at compile time. Do not use this macro for swapping byte orderings 
  72                  *  of dynamic values computed at runtime -- use SwapEndian_32() instead. 
  74                  *  \param[in]  x  32-bit value whose byte ordering is to be swapped 
  76                  *  \return Input value with the byte ordering reversed 
  78                 #define SWAPENDIAN_32(x)                        ((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \ 
  79                                                                  (((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL)) 
  81                 /** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */ 
  82                 #define SERVICE_ATTRIBUTE_TABLE_TERMINATOR      {.Data = NULL} 
  85                 /** Type define for a UUID value structure. This struct can be used to hold full 128-bit UUIDs. */ 
  88                         uint32_t A
; /**< Bits 0-31 of the UUID. */ 
  89                         uint16_t B
; /**< Bits 32-47 of the UUID. */ 
  90                         uint16_t C
; /**< Bits 48-63 of the UUID. */ 
  91                         uint16_t D
; /**< Bits 64-79 of the UUID. */ 
  92                         uint8_t  E
[6]; /**< Bits 80-128 of the UUID. */ 
  95                 /** Structure for the association of attribute ID values to an attribute value in FLASH. A table of these 
  96                  *  structures can then be built up for each supported UUID service within the device. 
  98                  *  \note This table must be terminated with a \ref SERVICE_ATTRIBUTE_TABLE_TERMINATOR element. 
 102                         uint16_t    AttributeID
; /**< Attribute ID of the table element which the UUID service supports */ 
 103                         const void* Data
; /**< Pointer to the attribute data, located in PROGMEM memory space */ 
 104                 } ServiceAttributeTable_t
; 
 106                 /** Structure for a list of Data Elements containing 8-bit integers, for service attributes requiring such lists. */ 
 109                         uint8_t Header
; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_8Bit) */ 
 110                         uint8_t Value
; /**< Value to store in the list Data Element */ 
 113                 /** Structure for a list of Data Elements containing 16-bit integers, for service attributes requiring such lists. */ 
 116                         uint8_t  Header
; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit) */ 
 117                         uint16_t Value
; /**< Value to store in the list Data Element */ 
 120                 /** Structure for a list of Data Elements containing 32-bit integers, for service attributes requiring such lists. */ 
 123                         uint8_t  Header
; /**< Data Element header, should be (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_32Bit) */ 
 124                         uint32_t Value
; /**< Value to store in the list Data Element */ 
 127                 /** Structure for a list of Data Elements containing UUIDs, for service attributes requiring UUID lists. */ 
 130                         uint8_t Header
; /**< Data Element header, should be (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit) */ 
 131                         UUID_t  UUID
; /**< UUID to store in the list Data Element */ 
 134                 /** Structure for a list of Data Elements Sequences containing UUID Data Elements, for service attributes requiring 
 139                         uint8_t     Header
; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */ 
 140                         uint8_t     Size
; /**< Size of the inner Data Element sequence */ 
 144                                 ItemUUID_t UUID
; /**< UUID to store in the protocol list Data Element sequence */ 
 148                 /** Structure for a list of Data Elements containing language encodings, including the language ID, Encoding ID and 
 149                  *  Attribute base offset. 
 153                         Item16Bit_t LanguageID
; /**< Language ID for the current language */ 
 154                         Item16Bit_t EncodingID
; /**< Encoding used for the current language */ 
 155                         Item16Bit_t OffsetID
; /**< Attribute offset added to all strings using this language within the service */ 
 156                 } ItemLangEncoding_t
; 
 158         /* External Variables: */ 
 159                 extern const ServiceAttributeTable_t SerialPort_Attribute_Table
[];