BLE demo for mbed Ported RunningElectronics's SBDBT firmware for BLE. It can communicate with iOS

Dependencies:   FatFileSystem mbed

Fork of BTstack by Norimasa Okamoto

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bt_control.h Source File

bt_control.h

00001 /*
00002  * Copyright (C) 2009-2012 by Matthias Ringwald
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the copyright holders nor the names of
00014  *    contributors may be used to endorse or promote products derived
00015  *    from this software without specific prior written permission.
00016  * 4. Any redistribution, use, or modification is done solely for
00017  *    personal benefit and not for any commercial purpose or for
00018  *    monetary gain.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
00024  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * Please inquire about commercial licensing options at btstack@ringwald.ch
00034  *
00035  */
00036 
00037 /*
00038  *  bt_control.h
00039  *
00040  *  BT Control API -- allows BT Daemon to initialize and control differnt hardware
00041  *
00042  *  Created by Matthias Ringwald on 5/19/09.
00043  *
00044  */
00045 
00046 #pragma once
00047 
00048 #include <stdint.h>
00049 
00050 typedef enum {
00051     POWER_WILL_SLEEP = 1,
00052     POWER_WILL_WAKE_UP
00053 } POWER_NOTIFICATION_t;
00054 
00055 typedef struct {
00056     int          (*on)   (void *config);  // <-- turn BT module on and configure
00057     int          (*off)  (void *config);  // <-- turn BT module off
00058     int          (*sleep)(void *config);  // <-- put BT module to sleep    - only to be called after ON
00059     int          (*wake) (void *config);  // <-- wake BT module from sleep - only to be called after SLEEP
00060     int          (*valid)(void *config);  // <-- test if hardware can be supported
00061     const char * (*name) (void *config);  // <-- return hardware name
00062 
00063     /** support for UART baud rate changes - cmd has to be stored in hci_cmd_buffer
00064      * @return have command
00065      */
00066     int          (*baudrate_cmd)(void * config, uint32_t baudrate, uint8_t *hci_cmd_buffer); 
00067     
00068     /** support custom init sequences after RESET command - cmd has to be stored in hci_cmd_buffer
00069       * @return have command
00070       */
00071     int          (*next_cmd)(void *config, uint8_t * hci_cmd_buffer); 
00072 
00073     void         (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
00074 
00075     void         (*hw_error)(void); 
00076 } bt_control_t;