Junichi Katsu / Mbed 2 deprecated BLEControl

Dependencies:   FatFileSystem TB6612FNG2 mbed

Committer:
mbed_Cookbook_SE
Date:
Mon Nov 30 09:32:15 2015 +0000
Revision:
0:de03cbbcd0ff
??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_Cookbook_SE 0:de03cbbcd0ff 1 /*
mbed_Cookbook_SE 0:de03cbbcd0ff 2 * Copyright (C) 2009-2012 by Matthias Ringwald
mbed_Cookbook_SE 0:de03cbbcd0ff 3 *
mbed_Cookbook_SE 0:de03cbbcd0ff 4 * Redistribution and use in source and binary forms, with or without
mbed_Cookbook_SE 0:de03cbbcd0ff 5 * modification, are permitted provided that the following conditions
mbed_Cookbook_SE 0:de03cbbcd0ff 6 * are met:
mbed_Cookbook_SE 0:de03cbbcd0ff 7 *
mbed_Cookbook_SE 0:de03cbbcd0ff 8 * 1. Redistributions of source code must retain the above copyright
mbed_Cookbook_SE 0:de03cbbcd0ff 9 * notice, this list of conditions and the following disclaimer.
mbed_Cookbook_SE 0:de03cbbcd0ff 10 * 2. Redistributions in binary form must reproduce the above copyright
mbed_Cookbook_SE 0:de03cbbcd0ff 11 * notice, this list of conditions and the following disclaimer in the
mbed_Cookbook_SE 0:de03cbbcd0ff 12 * documentation and/or other materials provided with the distribution.
mbed_Cookbook_SE 0:de03cbbcd0ff 13 * 3. Neither the name of the copyright holders nor the names of
mbed_Cookbook_SE 0:de03cbbcd0ff 14 * contributors may be used to endorse or promote products derived
mbed_Cookbook_SE 0:de03cbbcd0ff 15 * from this software without specific prior written permission.
mbed_Cookbook_SE 0:de03cbbcd0ff 16 * 4. Any redistribution, use, or modification is done solely for
mbed_Cookbook_SE 0:de03cbbcd0ff 17 * personal benefit and not for any commercial purpose or for
mbed_Cookbook_SE 0:de03cbbcd0ff 18 * monetary gain.
mbed_Cookbook_SE 0:de03cbbcd0ff 19 *
mbed_Cookbook_SE 0:de03cbbcd0ff 20 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
mbed_Cookbook_SE 0:de03cbbcd0ff 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
mbed_Cookbook_SE 0:de03cbbcd0ff 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
mbed_Cookbook_SE 0:de03cbbcd0ff 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
mbed_Cookbook_SE 0:de03cbbcd0ff 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
mbed_Cookbook_SE 0:de03cbbcd0ff 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
mbed_Cookbook_SE 0:de03cbbcd0ff 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
mbed_Cookbook_SE 0:de03cbbcd0ff 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
mbed_Cookbook_SE 0:de03cbbcd0ff 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_Cookbook_SE 0:de03cbbcd0ff 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
mbed_Cookbook_SE 0:de03cbbcd0ff 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
mbed_Cookbook_SE 0:de03cbbcd0ff 31 * SUCH DAMAGE.
mbed_Cookbook_SE 0:de03cbbcd0ff 32 *
mbed_Cookbook_SE 0:de03cbbcd0ff 33 * Please inquire about commercial licensing options at btstack@ringwald.ch
mbed_Cookbook_SE 0:de03cbbcd0ff 34 *
mbed_Cookbook_SE 0:de03cbbcd0ff 35 */
mbed_Cookbook_SE 0:de03cbbcd0ff 36
mbed_Cookbook_SE 0:de03cbbcd0ff 37 /**
mbed_Cookbook_SE 0:de03cbbcd0ff 38 * interface to provide link key and remote name storage
mbed_Cookbook_SE 0:de03cbbcd0ff 39 */
mbed_Cookbook_SE 0:de03cbbcd0ff 40
mbed_Cookbook_SE 0:de03cbbcd0ff 41 #pragma once
mbed_Cookbook_SE 0:de03cbbcd0ff 42
mbed_Cookbook_SE 0:de03cbbcd0ff 43 #include <btstack/utils.h>
mbed_Cookbook_SE 0:de03cbbcd0ff 44
mbed_Cookbook_SE 0:de03cbbcd0ff 45 typedef struct {
mbed_Cookbook_SE 0:de03cbbcd0ff 46
mbed_Cookbook_SE 0:de03cbbcd0ff 47 // management
mbed_Cookbook_SE 0:de03cbbcd0ff 48 void (*open)(void);
mbed_Cookbook_SE 0:de03cbbcd0ff 49 void (*close)(void);
mbed_Cookbook_SE 0:de03cbbcd0ff 50
mbed_Cookbook_SE 0:de03cbbcd0ff 51 // link key
mbed_Cookbook_SE 0:de03cbbcd0ff 52 int (*get_link_key)(bd_addr_t *bd_addr, link_key_t *link_key);
mbed_Cookbook_SE 0:de03cbbcd0ff 53 void (*put_link_key)(bd_addr_t *bd_addr, link_key_t *key);
mbed_Cookbook_SE 0:de03cbbcd0ff 54 void (*delete_link_key)(bd_addr_t *bd_addr);
mbed_Cookbook_SE 0:de03cbbcd0ff 55
mbed_Cookbook_SE 0:de03cbbcd0ff 56 // remote name
mbed_Cookbook_SE 0:de03cbbcd0ff 57 int (*get_name)(bd_addr_t *bd_addr, device_name_t *device_name);
mbed_Cookbook_SE 0:de03cbbcd0ff 58 void (*put_name)(bd_addr_t *bd_addr, device_name_t *device_name);
mbed_Cookbook_SE 0:de03cbbcd0ff 59 void (*delete_name)(bd_addr_t *bd_addr);
mbed_Cookbook_SE 0:de03cbbcd0ff 60
mbed_Cookbook_SE 0:de03cbbcd0ff 61 // persistent rfcomm channel
mbed_Cookbook_SE 0:de03cbbcd0ff 62 uint8_t (*persistent_rfcomm_channel)(char *servicename);
mbed_Cookbook_SE 0:de03cbbcd0ff 63
mbed_Cookbook_SE 0:de03cbbcd0ff 64 } remote_device_db_t;
mbed_Cookbook_SE 0:de03cbbcd0ff 65
mbed_Cookbook_SE 0:de03cbbcd0ff 66 extern remote_device_db_t remote_device_db_iphone;
mbed_Cookbook_SE 0:de03cbbcd0ff 67 extern const remote_device_db_t remote_device_db_memory;
mbed_Cookbook_SE 0:de03cbbcd0ff 68
mbed_Cookbook_SE 0:de03cbbcd0ff 69 // MARK: non-persisten implementation
mbed_Cookbook_SE 0:de03cbbcd0ff 70 #include <btstack/linked_list.h>
mbed_Cookbook_SE 0:de03cbbcd0ff 71 #define MAX_NAME_LEN 32
mbed_Cookbook_SE 0:de03cbbcd0ff 72 typedef struct {
mbed_Cookbook_SE 0:de03cbbcd0ff 73 // linked list - assert: first field
mbed_Cookbook_SE 0:de03cbbcd0ff 74 linked_item_t item;
mbed_Cookbook_SE 0:de03cbbcd0ff 75
mbed_Cookbook_SE 0:de03cbbcd0ff 76 bd_addr_t bd_addr;
mbed_Cookbook_SE 0:de03cbbcd0ff 77 } db_mem_device_t;
mbed_Cookbook_SE 0:de03cbbcd0ff 78
mbed_Cookbook_SE 0:de03cbbcd0ff 79 typedef struct {
mbed_Cookbook_SE 0:de03cbbcd0ff 80 db_mem_device_t device;
mbed_Cookbook_SE 0:de03cbbcd0ff 81 link_key_t link_key;
mbed_Cookbook_SE 0:de03cbbcd0ff 82 } db_mem_device_link_key_t;
mbed_Cookbook_SE 0:de03cbbcd0ff 83
mbed_Cookbook_SE 0:de03cbbcd0ff 84 typedef struct {
mbed_Cookbook_SE 0:de03cbbcd0ff 85 db_mem_device_t device;
mbed_Cookbook_SE 0:de03cbbcd0ff 86 char device_name[MAX_NAME_LEN];
mbed_Cookbook_SE 0:de03cbbcd0ff 87 } db_mem_device_name_t;
mbed_Cookbook_SE 0:de03cbbcd0ff 88
mbed_Cookbook_SE 0:de03cbbcd0ff 89 typedef struct {
mbed_Cookbook_SE 0:de03cbbcd0ff 90 // linked list - assert: first field
mbed_Cookbook_SE 0:de03cbbcd0ff 91 linked_item_t item;
mbed_Cookbook_SE 0:de03cbbcd0ff 92
mbed_Cookbook_SE 0:de03cbbcd0ff 93 char service_name[MAX_NAME_LEN];
mbed_Cookbook_SE 0:de03cbbcd0ff 94 uint8_t channel;
mbed_Cookbook_SE 0:de03cbbcd0ff 95 } db_mem_service_t;