mbed base bard check program for BlueTooth USB dongle module (3 switches, 6 leds, I2C LCD, A/D)
Fork of BTstack by
BTstack/btstack/sdp_util.h@3:7b7d1273e2d5, 2016-10-17 (annotated)
- Committer:
- tamaki
- Date:
- Mon Oct 17 00:25:18 2016 +0000
- Revision:
- 3:7b7d1273e2d5
- Parent:
- 0:1ed23ab1345f
mbed base bard check program
; for BlueTooth USB dongle module
; (3 switches, 6 leds, I2C LCD, A/D)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:1ed23ab1345f | 1 | /* |
va009039 | 0:1ed23ab1345f | 2 | * Copyright (C) 2010 by Matthias Ringwald |
va009039 | 0:1ed23ab1345f | 3 | * |
va009039 | 0:1ed23ab1345f | 4 | * Redistribution and use in source and binary forms, with or without |
va009039 | 0:1ed23ab1345f | 5 | * modification, are permitted provided that the following conditions |
va009039 | 0:1ed23ab1345f | 6 | * are met: |
va009039 | 0:1ed23ab1345f | 7 | * |
va009039 | 0:1ed23ab1345f | 8 | * 1. Redistributions of source code must retain the above copyright |
va009039 | 0:1ed23ab1345f | 9 | * notice, this list of conditions and the following disclaimer. |
va009039 | 0:1ed23ab1345f | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
va009039 | 0:1ed23ab1345f | 11 | * notice, this list of conditions and the following disclaimer in the |
va009039 | 0:1ed23ab1345f | 12 | * documentation and/or other materials provided with the distribution. |
va009039 | 0:1ed23ab1345f | 13 | * 3. Neither the name of the copyright holders nor the names of |
va009039 | 0:1ed23ab1345f | 14 | * contributors may be used to endorse or promote products derived |
va009039 | 0:1ed23ab1345f | 15 | * from this software without specific prior written permission. |
va009039 | 0:1ed23ab1345f | 16 | * |
va009039 | 0:1ed23ab1345f | 17 | * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS |
va009039 | 0:1ed23ab1345f | 18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
va009039 | 0:1ed23ab1345f | 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
va009039 | 0:1ed23ab1345f | 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS |
va009039 | 0:1ed23ab1345f | 21 | * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
va009039 | 0:1ed23ab1345f | 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
va009039 | 0:1ed23ab1345f | 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
va009039 | 0:1ed23ab1345f | 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
va009039 | 0:1ed23ab1345f | 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
va009039 | 0:1ed23ab1345f | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
va009039 | 0:1ed23ab1345f | 27 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
va009039 | 0:1ed23ab1345f | 28 | * SUCH DAMAGE. |
va009039 | 0:1ed23ab1345f | 29 | * |
va009039 | 0:1ed23ab1345f | 30 | */ |
va009039 | 0:1ed23ab1345f | 31 | |
va009039 | 0:1ed23ab1345f | 32 | /* |
va009039 | 0:1ed23ab1345f | 33 | * sdp_util.h |
va009039 | 0:1ed23ab1345f | 34 | */ |
va009039 | 0:1ed23ab1345f | 35 | |
va009039 | 0:1ed23ab1345f | 36 | #pragma once |
va009039 | 0:1ed23ab1345f | 37 | |
va009039 | 0:1ed23ab1345f | 38 | #include <stdint.h> |
va009039 | 0:1ed23ab1345f | 39 | |
va009039 | 0:1ed23ab1345f | 40 | #if defined __cplusplus |
va009039 | 0:1ed23ab1345f | 41 | extern "C" { |
va009039 | 0:1ed23ab1345f | 42 | #endif |
va009039 | 0:1ed23ab1345f | 43 | |
va009039 | 0:1ed23ab1345f | 44 | typedef enum { |
va009039 | 0:1ed23ab1345f | 45 | DE_NIL = 0, |
va009039 | 0:1ed23ab1345f | 46 | DE_UINT, |
va009039 | 0:1ed23ab1345f | 47 | DE_INT, |
va009039 | 0:1ed23ab1345f | 48 | DE_UUID, |
va009039 | 0:1ed23ab1345f | 49 | DE_STRING, |
va009039 | 0:1ed23ab1345f | 50 | DE_BOOL, |
va009039 | 0:1ed23ab1345f | 51 | DE_DES, |
va009039 | 0:1ed23ab1345f | 52 | DE_DEA, |
va009039 | 0:1ed23ab1345f | 53 | DE_URL |
va009039 | 0:1ed23ab1345f | 54 | } de_type_t; |
va009039 | 0:1ed23ab1345f | 55 | |
va009039 | 0:1ed23ab1345f | 56 | typedef enum { |
va009039 | 0:1ed23ab1345f | 57 | DE_SIZE_8 = 0, |
va009039 | 0:1ed23ab1345f | 58 | DE_SIZE_16, |
va009039 | 0:1ed23ab1345f | 59 | DE_SIZE_32, |
va009039 | 0:1ed23ab1345f | 60 | DE_SIZE_64, |
va009039 | 0:1ed23ab1345f | 61 | DE_SIZE_128, |
va009039 | 0:1ed23ab1345f | 62 | DE_SIZE_VAR_8, |
va009039 | 0:1ed23ab1345f | 63 | DE_SIZE_VAR_16, |
va009039 | 0:1ed23ab1345f | 64 | DE_SIZE_VAR_32 |
va009039 | 0:1ed23ab1345f | 65 | } de_size_t; |
va009039 | 0:1ed23ab1345f | 66 | |
va009039 | 0:1ed23ab1345f | 67 | // UNIVERSAL ATTRIBUTE DEFINITIONS |
va009039 | 0:1ed23ab1345f | 68 | #define SDP_ServiceRecordHandle 0x0000 |
va009039 | 0:1ed23ab1345f | 69 | #define SDP_ServiceClassIDList 0x0001 |
va009039 | 0:1ed23ab1345f | 70 | #define SDP_ServiceRecordState 0x0002 |
va009039 | 0:1ed23ab1345f | 71 | #define SDP_ServiceID 0x0003 |
va009039 | 0:1ed23ab1345f | 72 | #define SDP_ProtocolDescriptorList 0x0004 |
va009039 | 0:1ed23ab1345f | 73 | #define SDP_BrowseGroupList 0x0005 |
va009039 | 0:1ed23ab1345f | 74 | #define SDP_LanguageBaseAttributeIDList 0x0006 |
va009039 | 0:1ed23ab1345f | 75 | #define SDP_ServiceInfoTimeToLive 0x0007 |
va009039 | 0:1ed23ab1345f | 76 | #define SDP_ServiceAvailability 0x0008 |
va009039 | 0:1ed23ab1345f | 77 | #define SDP_BluetoothProfileDescriptorList 0x0009 |
va009039 | 0:1ed23ab1345f | 78 | #define SDP_DocumentationURL 0x000a |
va009039 | 0:1ed23ab1345f | 79 | #define SDP_ClientExecutableURL 0x000b |
va009039 | 0:1ed23ab1345f | 80 | #define SDP_IconURL 0x000c |
va009039 | 0:1ed23ab1345f | 81 | #define SDP_AdditionalProtocolDescriptorList 0x000d |
va009039 | 0:1ed23ab1345f | 82 | #define SDP_SupportedFormatsList 0x0303 |
va009039 | 0:1ed23ab1345f | 83 | |
va009039 | 0:1ed23ab1345f | 84 | // SERVICE CLASSES |
va009039 | 0:1ed23ab1345f | 85 | #define SDP_OBEXObjectPush 0x1105 |
va009039 | 0:1ed23ab1345f | 86 | #define SDP_OBEXFileTransfer 0x1106 |
va009039 | 0:1ed23ab1345f | 87 | #define SDP_PublicBrowseGroup 0x1002 |
va009039 | 0:1ed23ab1345f | 88 | |
va009039 | 0:1ed23ab1345f | 89 | // PROTOCOLS |
va009039 | 0:1ed23ab1345f | 90 | #define SDP_SDPProtocol 0x0001 |
va009039 | 0:1ed23ab1345f | 91 | #define SDP_UDPProtocol 0x0002 |
va009039 | 0:1ed23ab1345f | 92 | #define SDP_RFCOMMProtocol 0x0003 |
va009039 | 0:1ed23ab1345f | 93 | #define SDP_OBEXProtocol 0x0008 |
va009039 | 0:1ed23ab1345f | 94 | #define SDP_L2CAPProtocol 0x0100 |
va009039 | 0:1ed23ab1345f | 95 | |
va009039 | 0:1ed23ab1345f | 96 | // OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList |
va009039 | 0:1ed23ab1345f | 97 | #define SDP_Offest_ServiceName 0x0000 |
va009039 | 0:1ed23ab1345f | 98 | #define SDP_Offest_ServiceDescription 0x0001 |
va009039 | 0:1ed23ab1345f | 99 | #define SDP_Offest_ProviderName 0x0002 |
va009039 | 0:1ed23ab1345f | 100 | |
va009039 | 0:1ed23ab1345f | 101 | // OBEX |
va009039 | 0:1ed23ab1345f | 102 | #define SDP_vCard_2_1 0x01 |
va009039 | 0:1ed23ab1345f | 103 | #define SDP_vCard_3_0 0x02 |
va009039 | 0:1ed23ab1345f | 104 | #define SDP_vCal_1_0 0x03 |
va009039 | 0:1ed23ab1345f | 105 | #define SDP_iCal_2_0 0x04 |
va009039 | 0:1ed23ab1345f | 106 | #define SDP_vNote 0x05 |
va009039 | 0:1ed23ab1345f | 107 | #define SDP_vMessage 0x06 |
va009039 | 0:1ed23ab1345f | 108 | #define SDP_OBEXFileTypeAny 0xFF |
va009039 | 0:1ed23ab1345f | 109 | |
va009039 | 0:1ed23ab1345f | 110 | // MARK: DateElement |
va009039 | 0:1ed23ab1345f | 111 | void de_dump_data_element(uint8_t * record); |
va009039 | 0:1ed23ab1345f | 112 | int de_get_len(uint8_t *header); |
va009039 | 0:1ed23ab1345f | 113 | de_size_t de_get_size_type(uint8_t *header); |
va009039 | 0:1ed23ab1345f | 114 | de_type_t de_get_element_type(uint8_t *header); |
va009039 | 0:1ed23ab1345f | 115 | int de_get_header_size(uint8_t * header); |
va009039 | 0:1ed23ab1345f | 116 | void de_create_sequence(uint8_t *header); |
va009039 | 0:1ed23ab1345f | 117 | void de_store_descriptor_with_len(uint8_t * header, de_type_t type, de_size_t size, uint32_t len); |
va009039 | 0:1ed23ab1345f | 118 | uint8_t * de_push_sequence(uint8_t *header); |
va009039 | 0:1ed23ab1345f | 119 | void de_pop_sequence(uint8_t * parent, uint8_t * child); |
va009039 | 0:1ed23ab1345f | 120 | void de_add_number(uint8_t *seq, de_type_t type, de_size_t size, uint32_t value); |
va009039 | 0:1ed23ab1345f | 121 | void de_add_data( uint8_t *seq, de_type_t type, uint16_t size, uint8_t *data); |
va009039 | 0:1ed23ab1345f | 122 | |
va009039 | 0:1ed23ab1345f | 123 | int de_get_data_size(uint8_t * header); |
va009039 | 0:1ed23ab1345f | 124 | void de_add_uuid128(uint8_t * seq, uint8_t * uuid); |
va009039 | 0:1ed23ab1345f | 125 | |
va009039 | 0:1ed23ab1345f | 126 | // MARK: SDP |
va009039 | 0:1ed23ab1345f | 127 | uint16_t sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint8_t *buffer); |
va009039 | 0:1ed23ab1345f | 128 | uint8_t * sdp_get_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID); |
va009039 | 0:1ed23ab1345f | 129 | uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID, uint32_t value); |
va009039 | 0:1ed23ab1345f | 130 | int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern); |
va009039 | 0:1ed23ab1345f | 131 | int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList); |
va009039 | 0:1ed23ab1345f | 132 | int sdp_filter_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint16_t *usedBytes, uint8_t *buffer); |
va009039 | 0:1ed23ab1345f | 133 | |
va009039 | 0:1ed23ab1345f | 134 | void sdp_create_spp_service(uint8_t *service, int service_id, const char *name); |
va009039 | 0:1ed23ab1345f | 135 | |
va009039 | 0:1ed23ab1345f | 136 | #if defined __cplusplus |
va009039 | 0:1ed23ab1345f | 137 | } |
va009039 | 0:1ed23ab1345f | 138 | #endif |