BTstack for Nucleo F401RE/FRDM-KL46Z example program

Dependencies:   F401RE-USBHost mbed

The usage is the same as KL46Z-BTstack_example.
使い方はKL46Z-BTstack_exampleと同じです。
/media/uploads/va009039/f401re-btstack.jpg

Committer:
va009039
Date:
Mon Jun 09 09:03:25 2014 +0000
Revision:
0:a05a07cd6fdf
first commit

Who changed what in which revision?

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