うおーるぼっとをWiiリモコンでコントロールする新しいプログラムです。 以前のものより、Wiiリモコンが早く繋がる様になりました。 It is a program which controls A with the Wii remote. ※ A Bluetooth dongle and a Wii remote control are needed.
Dependencies: USBHost mbed FATFileSystem mbed-rtos
btstack/btstack.h@0:fccb789424fc, 2013-06-10 (annotated)
- Committer:
- jksoft
- Date:
- Mon Jun 10 16:01:50 2013 +0000
- Revision:
- 0:fccb789424fc
1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:fccb789424fc | 1 | /* |
jksoft | 0:fccb789424fc | 2 | * Copyright (C) 2009 by Matthias Ringwald |
jksoft | 0:fccb789424fc | 3 | * |
jksoft | 0:fccb789424fc | 4 | * Redistribution and use in source and binary forms, with or without |
jksoft | 0:fccb789424fc | 5 | * modification, are permitted provided that the following conditions |
jksoft | 0:fccb789424fc | 6 | * are met: |
jksoft | 0:fccb789424fc | 7 | * |
jksoft | 0:fccb789424fc | 8 | * 1. Redistributions of source code must retain the above copyright |
jksoft | 0:fccb789424fc | 9 | * notice, this list of conditions and the following disclaimer. |
jksoft | 0:fccb789424fc | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
jksoft | 0:fccb789424fc | 11 | * notice, this list of conditions and the following disclaimer in the |
jksoft | 0:fccb789424fc | 12 | * documentation and/or other materials provided with the distribution. |
jksoft | 0:fccb789424fc | 13 | * 3. Neither the name of the copyright holders nor the names of |
jksoft | 0:fccb789424fc | 14 | * contributors may be used to endorse or promote products derived |
jksoft | 0:fccb789424fc | 15 | * from this software without specific prior written permission. |
jksoft | 0:fccb789424fc | 16 | * |
jksoft | 0:fccb789424fc | 17 | * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS |
jksoft | 0:fccb789424fc | 18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
jksoft | 0:fccb789424fc | 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
jksoft | 0:fccb789424fc | 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS |
jksoft | 0:fccb789424fc | 21 | * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
jksoft | 0:fccb789424fc | 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
jksoft | 0:fccb789424fc | 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
jksoft | 0:fccb789424fc | 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
jksoft | 0:fccb789424fc | 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
jksoft | 0:fccb789424fc | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
jksoft | 0:fccb789424fc | 27 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
jksoft | 0:fccb789424fc | 28 | * SUCH DAMAGE. |
jksoft | 0:fccb789424fc | 29 | * |
jksoft | 0:fccb789424fc | 30 | */ |
jksoft | 0:fccb789424fc | 31 | |
jksoft | 0:fccb789424fc | 32 | /* |
jksoft | 0:fccb789424fc | 33 | * btstack.h |
jksoft | 0:fccb789424fc | 34 | * |
jksoft | 0:fccb789424fc | 35 | * Created by Matthias Ringwald on 7/1/09. |
jksoft | 0:fccb789424fc | 36 | * |
jksoft | 0:fccb789424fc | 37 | * BTstack client API |
jksoft | 0:fccb789424fc | 38 | * |
jksoft | 0:fccb789424fc | 39 | */ |
jksoft | 0:fccb789424fc | 40 | |
jksoft | 0:fccb789424fc | 41 | #pragma once |
jksoft | 0:fccb789424fc | 42 | |
jksoft | 0:fccb789424fc | 43 | #include <btstack/hci_cmds.h> |
jksoft | 0:fccb789424fc | 44 | #include <btstack/run_loop.h> |
jksoft | 0:fccb789424fc | 45 | #include <btstack/utils.h> |
jksoft | 0:fccb789424fc | 46 | |
jksoft | 0:fccb789424fc | 47 | #include <stdint.h> |
jksoft | 0:fccb789424fc | 48 | |
jksoft | 0:fccb789424fc | 49 | #if defined __cplusplus |
jksoft | 0:fccb789424fc | 50 | extern "C" { |
jksoft | 0:fccb789424fc | 51 | #endif |
jksoft | 0:fccb789424fc | 52 | |
jksoft | 0:fccb789424fc | 53 | // Default TCP port for BTstack daemon |
jksoft | 0:fccb789424fc | 54 | #define BTSTACK_PORT 13333 |
jksoft | 0:fccb789424fc | 55 | |
jksoft | 0:fccb789424fc | 56 | // UNIX domain socket for BTstack */ |
jksoft | 0:fccb789424fc | 57 | #define BTSTACK_UNIX "/tmp/BTstack" |
jksoft | 0:fccb789424fc | 58 | |
jksoft | 0:fccb789424fc | 59 | // packet handler |
jksoft | 0:fccb789424fc | 60 | typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); |
jksoft | 0:fccb789424fc | 61 | |
jksoft | 0:fccb789424fc | 62 | // optional: if called before bt_open, TCP socket is used instead of local unix socket |
jksoft | 0:fccb789424fc | 63 | // note: address is not copied and must be valid during bt_open |
jksoft | 0:fccb789424fc | 64 | void bt_use_tcp(const char * address, uint16_t port); |
jksoft | 0:fccb789424fc | 65 | |
jksoft | 0:fccb789424fc | 66 | // init BTstack library |
jksoft | 0:fccb789424fc | 67 | int bt_open(void); |
jksoft | 0:fccb789424fc | 68 | |
jksoft | 0:fccb789424fc | 69 | // stop using BTstack library |
jksoft | 0:fccb789424fc | 70 | int bt_close(void); |
jksoft | 0:fccb789424fc | 71 | |
jksoft | 0:fccb789424fc | 72 | // send hci cmd packet |
jksoft | 0:fccb789424fc | 73 | int bt_send_cmd(const hci_cmd_t *cmd, ...); |
jksoft | 0:fccb789424fc | 74 | |
jksoft | 0:fccb789424fc | 75 | // register packet handler -- channel only valid for l2cap and rfcomm packets |
jksoft | 0:fccb789424fc | 76 | // @returns old packet handler |
jksoft | 0:fccb789424fc | 77 | btstack_packet_handler_t bt_register_packet_handler(btstack_packet_handler_t handler); |
jksoft | 0:fccb789424fc | 78 | |
jksoft | 0:fccb789424fc | 79 | void bt_send_acl(uint8_t * data, uint16_t len); |
jksoft | 0:fccb789424fc | 80 | |
jksoft | 0:fccb789424fc | 81 | void bt_send_l2cap(uint16_t local_cid, uint8_t *data, uint16_t len); |
jksoft | 0:fccb789424fc | 82 | void bt_send_rfcomm(uint16_t rfcom_cid, uint8_t *data, uint16_t len); |
jksoft | 0:fccb789424fc | 83 | |
jksoft | 0:fccb789424fc | 84 | #if defined __cplusplus |
jksoft | 0:fccb789424fc | 85 | } |
jksoft | 0:fccb789424fc | 86 | #endif |