BLE demo for mbed Ported RunningElectronics's SBDBT firmware for BLE. It can communicate with iOS
Dependencies: FatFileSystem mbed
Fork of BTstack by
sdp_util.h
00001 /* 00002 * Copyright (C) 2010 by Matthias Ringwald 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. Neither the name of the copyright holders nor the names of 00014 * contributors may be used to endorse or promote products derived 00015 * from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS 00018 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00019 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00020 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 00021 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00022 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00023 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00024 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00025 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00026 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00027 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00028 * SUCH DAMAGE. 00029 * 00030 */ 00031 00032 /* 00033 * sdp_util.h 00034 */ 00035 00036 #pragma once 00037 00038 #include <stdint.h> 00039 00040 #if defined __cplusplus 00041 extern "C" { 00042 #endif 00043 00044 typedef enum { 00045 DE_NIL = 0, 00046 DE_UINT, 00047 DE_INT, 00048 DE_UUID, 00049 DE_STRING, 00050 DE_BOOL, 00051 DE_DES, 00052 DE_DEA, 00053 DE_URL 00054 } de_type_t; 00055 00056 typedef enum { 00057 DE_SIZE_8 = 0, 00058 DE_SIZE_16, 00059 DE_SIZE_32, 00060 DE_SIZE_64, 00061 DE_SIZE_128, 00062 DE_SIZE_VAR_8, 00063 DE_SIZE_VAR_16, 00064 DE_SIZE_VAR_32 00065 } de_size_t; 00066 00067 // UNIVERSAL ATTRIBUTE DEFINITIONS 00068 #define SDP_ServiceRecordHandle 0x0000 00069 #define SDP_ServiceClassIDList 0x0001 00070 #define SDP_ServiceRecordState 0x0002 00071 #define SDP_ServiceID 0x0003 00072 #define SDP_ProtocolDescriptorList 0x0004 00073 #define SDP_BrowseGroupList 0x0005 00074 #define SDP_LanguageBaseAttributeIDList 0x0006 00075 #define SDP_ServiceInfoTimeToLive 0x0007 00076 #define SDP_ServiceAvailability 0x0008 00077 #define SDP_BluetoothProfileDescriptorList 0x0009 00078 #define SDP_DocumentationURL 0x000a 00079 #define SDP_ClientExecutableURL 0x000b 00080 #define SDP_IconURL 0x000c 00081 #define SDP_AdditionalProtocolDescriptorList 0x000d 00082 #define SDP_SupportedFormatsList 0x0303 00083 00084 // SERVICE CLASSES 00085 #define SDP_OBEXObjectPush 0x1105 00086 #define SDP_OBEXFileTransfer 0x1106 00087 #define SDP_PublicBrowseGroup 0x1002 00088 00089 // PROTOCOLS 00090 #define SDP_SDPProtocol 0x0001 00091 #define SDP_UDPProtocol 0x0002 00092 #define SDP_RFCOMMProtocol 0x0003 00093 #define SDP_OBEXProtocol 0x0008 00094 #define SDP_L2CAPProtocol 0x0100 00095 00096 // OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList 00097 #define SDP_Offest_ServiceName 0x0000 00098 #define SDP_Offest_ServiceDescription 0x0001 00099 #define SDP_Offest_ProviderName 0x0002 00100 00101 // OBEX 00102 #define SDP_vCard_2_1 0x01 00103 #define SDP_vCard_3_0 0x02 00104 #define SDP_vCal_1_0 0x03 00105 #define SDP_iCal_2_0 0x04 00106 #define SDP_vNote 0x05 00107 #define SDP_vMessage 0x06 00108 #define SDP_OBEXFileTypeAny 0xFF 00109 00110 // MARK: DateElement 00111 void de_dump_data_element(uint8_t * record); 00112 int de_get_len(uint8_t *header); 00113 de_size_t de_get_size_type(uint8_t *header); 00114 de_type_t de_get_element_type(uint8_t *header); 00115 int de_get_header_size(uint8_t * header); 00116 void de_create_sequence(uint8_t *header); 00117 void de_store_descriptor_with_len(uint8_t * header, de_type_t type, de_size_t size, uint32_t len); 00118 uint8_t * de_push_sequence(uint8_t *header); 00119 void de_pop_sequence(uint8_t * parent, uint8_t * child); 00120 void de_add_number(uint8_t *seq, de_type_t type, de_size_t size, uint32_t value); 00121 void de_add_data( uint8_t *seq, de_type_t type, uint16_t size, uint8_t *data); 00122 00123 int de_get_data_size(uint8_t * header); 00124 void de_add_uuid128(uint8_t * seq, uint8_t * uuid); 00125 00126 // MARK: SDP 00127 uint16_t sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint8_t *buffer); 00128 uint8_t * sdp_get_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID); 00129 uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID, uint32_t value); 00130 int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern); 00131 int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList); 00132 int sdp_filter_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint16_t *usedBytes, uint8_t *buffer); 00133 00134 void sdp_create_spp_service(uint8_t *service, int service_id, const char *name); 00135 00136 #if defined __cplusplus 00137 } 00138 #endif
Generated on Thu Jul 14 2022 15:03:49 by 1.7.2