うおーるぼっとをiPhoneでコントロールするプログラムです。 iPhoneとはBTLEで接続しています。

Dependencies:   FatFileSystem HighSpeedAnalogIn TB6612FNG2 mbed

Committer:
jksoft
Date:
Fri May 10 11:48:07 2013 +0000
Revision:
0:373bcb197dc8
?????????

Who changed what in which revision?

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