うおーるぼっとを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

Committer:
jksoft
Date:
Mon Jun 10 16:01:50 2013 +0000
Revision:
0:fccb789424fc
1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:fccb789424fc 1 /*
jksoft 0:fccb789424fc 2 * Copyright (C) 2009-2012 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 * 4. Any redistribution, use, or modification is done solely for
jksoft 0:fccb789424fc 17 * personal benefit and not for any commercial purpose or for
jksoft 0:fccb789424fc 18 * monetary gain.
jksoft 0:fccb789424fc 19 *
jksoft 0:fccb789424fc 20 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
jksoft 0:fccb789424fc 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
jksoft 0:fccb789424fc 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
jksoft 0:fccb789424fc 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
jksoft 0:fccb789424fc 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
jksoft 0:fccb789424fc 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
jksoft 0:fccb789424fc 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
jksoft 0:fccb789424fc 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
jksoft 0:fccb789424fc 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
jksoft 0:fccb789424fc 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
jksoft 0:fccb789424fc 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
jksoft 0:fccb789424fc 31 * SUCH DAMAGE.
jksoft 0:fccb789424fc 32 *
jksoft 0:fccb789424fc 33 * Please inquire about commercial licensing options at btstack@ringwald.ch
jksoft 0:fccb789424fc 34 *
jksoft 0:fccb789424fc 35 */
jksoft 0:fccb789424fc 36 #pragma once
jksoft 0:fccb789424fc 37
jksoft 0:fccb789424fc 38 #include <stdint.h>
jksoft 0:fccb789424fc 39 #include <btstack/linked_list.h>
jksoft 0:fccb789424fc 40
jksoft 0:fccb789424fc 41 #include "config.h"
jksoft 0:fccb789424fc 42
jksoft 0:fccb789424fc 43 typedef enum {
jksoft 0:fccb789424fc 44 SDP_ErrorResponse = 1,
jksoft 0:fccb789424fc 45 SDP_ServiceSearchRequest,
jksoft 0:fccb789424fc 46 SDP_ServiceSearchResponse,
jksoft 0:fccb789424fc 47 SDP_ServiceAttributeRequest,
jksoft 0:fccb789424fc 48 SDP_ServiceAttributeResponse,
jksoft 0:fccb789424fc 49 SDP_ServiceSearchAttributeRequest,
jksoft 0:fccb789424fc 50 SDP_ServiceSearchAttributeResponse
jksoft 0:fccb789424fc 51 } SDP_PDU_ID_t;
jksoft 0:fccb789424fc 52
jksoft 0:fccb789424fc 53 // service record
jksoft 0:fccb789424fc 54 // -- uses user_data field for actual
jksoft 0:fccb789424fc 55 typedef struct {
jksoft 0:fccb789424fc 56 // linked list - assert: first field
jksoft 0:fccb789424fc 57 linked_item_t item;
jksoft 0:fccb789424fc 58
jksoft 0:fccb789424fc 59 // client connection
jksoft 0:fccb789424fc 60 void * connection;
jksoft 0:fccb789424fc 61
jksoft 0:fccb789424fc 62 // data is contained in same memory
jksoft 0:fccb789424fc 63 uint32_t service_record_handle;
jksoft 0:fccb789424fc 64 uint8_t service_record[0];
jksoft 0:fccb789424fc 65 } service_record_item_t;
jksoft 0:fccb789424fc 66
jksoft 0:fccb789424fc 67
jksoft 0:fccb789424fc 68 void sdp_init(void);
jksoft 0:fccb789424fc 69
jksoft 0:fccb789424fc 70 void sdp_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type,
jksoft 0:fccb789424fc 71 uint16_t channel, uint8_t *packet, uint16_t size));
jksoft 0:fccb789424fc 72
jksoft 0:fccb789424fc 73 #ifdef EMBEDDED
jksoft 0:fccb789424fc 74 // register service record internally - the normal version creates a copy of the record
jksoft 0:fccb789424fc 75 // pre: AttributeIDs are in ascending order => ServiceRecordHandle is first attribute if present
jksoft 0:fccb789424fc 76 // @returns ServiceRecordHandle or 0 if registration failed
jksoft 0:fccb789424fc 77 uint32_t sdp_register_service_internal(void *connection, service_record_item_t * record_item);
jksoft 0:fccb789424fc 78 #else
jksoft 0:fccb789424fc 79 // register service record internally - this special version doesn't copy the record, it cannot be freeed
jksoft 0:fccb789424fc 80 // pre: AttributeIDs are in ascending order
jksoft 0:fccb789424fc 81 // pre: ServiceRecordHandle is first attribute and valid
jksoft 0:fccb789424fc 82 // pre: record
jksoft 0:fccb789424fc 83 // @returns ServiceRecordHandle or 0 if registration failed
jksoft 0:fccb789424fc 84 uint32_t sdp_register_service_internal(void *connection, uint8_t * service_record);
jksoft 0:fccb789424fc 85 #endif
jksoft 0:fccb789424fc 86
jksoft 0:fccb789424fc 87 // unregister service record internally
jksoft 0:fccb789424fc 88 void sdp_unregister_service_internal(void *connection, uint32_t service_record_handle);
jksoft 0:fccb789424fc 89
jksoft 0:fccb789424fc 90 //
jksoft 0:fccb789424fc 91 void sdp_unregister_services_for_connection(void *connection);
jksoft 0:fccb789424fc 92
jksoft 0:fccb789424fc 93 //
jksoft 0:fccb789424fc 94 int sdp_handle_service_search_request(uint8_t * packet, uint16_t remote_mtu);
jksoft 0:fccb789424fc 95 int sdp_handle_service_attribute_request(uint8_t * packet, uint16_t remote_mtu);
jksoft 0:fccb789424fc 96 int sdp_handle_service_search_attribute_request(uint8_t * packet, uint16_t remote_mtu);