xref: /btstack/src/btstack_control.h (revision 80e33422a96c028b3a9c308fc4b9b874712dafb4)
1af3c1ffeSMatthias Ringwald /*
2af3c1ffeSMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
3af3c1ffeSMatthias Ringwald  *
4af3c1ffeSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5af3c1ffeSMatthias Ringwald  * modification, are permitted provided that the following conditions
6af3c1ffeSMatthias Ringwald  * are met:
7af3c1ffeSMatthias Ringwald  *
8af3c1ffeSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9af3c1ffeSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10af3c1ffeSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11af3c1ffeSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12af3c1ffeSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13af3c1ffeSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14af3c1ffeSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15af3c1ffeSMatthias Ringwald  *    from this software without specific prior written permission.
16af3c1ffeSMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17af3c1ffeSMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18af3c1ffeSMatthias Ringwald  *    monetary gain.
19af3c1ffeSMatthias Ringwald  *
20af3c1ffeSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21af3c1ffeSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22af3c1ffeSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23af3c1ffeSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24af3c1ffeSMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25af3c1ffeSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26af3c1ffeSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27af3c1ffeSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28af3c1ffeSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29af3c1ffeSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30af3c1ffeSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31af3c1ffeSMatthias Ringwald  * SUCH DAMAGE.
32af3c1ffeSMatthias Ringwald  *
33af3c1ffeSMatthias Ringwald  * Please inquire about commercial licensing options at
34af3c1ffeSMatthias Ringwald  * [email protected]
35af3c1ffeSMatthias Ringwald  *
36af3c1ffeSMatthias Ringwald  */
37af3c1ffeSMatthias Ringwald 
38af3c1ffeSMatthias Ringwald /*
39fb55bd0aSMatthias Ringwald  *  btstack_control.h
40af3c1ffeSMatthias Ringwald  *
41fb55bd0aSMatthias Ringwald  *  BTstack Bluetooth Hardware Control API -- allows HCI to manage Bluetooth chipsets via direct hardware controls
42af3c1ffeSMatthias Ringwald  *
43af3c1ffeSMatthias Ringwald  */
44af3c1ffeSMatthias Ringwald 
45*80e33422SMatthias Ringwald #ifndef BTSTACK_CONTROL_H
46*80e33422SMatthias Ringwald #define BTSTACK_CONTROL_H
47af3c1ffeSMatthias Ringwald 
48af3c1ffeSMatthias Ringwald #include <stdint.h>
49eb886013SMatthias Ringwald #include "btstack_util.h"
50af3c1ffeSMatthias Ringwald 
51af3c1ffeSMatthias Ringwald #if defined __cplusplus
52af3c1ffeSMatthias Ringwald extern "C" {
53af3c1ffeSMatthias Ringwald #endif
54af3c1ffeSMatthias Ringwald 
55af3c1ffeSMatthias Ringwald typedef enum {
56af3c1ffeSMatthias Ringwald     POWER_WILL_SLEEP = 1,
57af3c1ffeSMatthias Ringwald     POWER_WILL_WAKE_UP
58af3c1ffeSMatthias Ringwald } POWER_NOTIFICATION_t;
59af3c1ffeSMatthias Ringwald 
60af3c1ffeSMatthias Ringwald typedef struct {
61d0b87befSMatthias Ringwald 	void (*init) (const void *config);
62d0b87befSMatthias Ringwald     int  (*on)   (void);  // <-- turn BT module on and configure
63d0b87befSMatthias Ringwald     int  (*off)  (void);  // <-- turn BT module off
64d0b87befSMatthias Ringwald     int  (*sleep)(void);  // <-- put BT module to sleep    - only to be called after ON
65d0b87befSMatthias Ringwald     int  (*wake) (void);  // <-- wake BT module from sleep - only to be called after SLEEP
66af3c1ffeSMatthias Ringwald     void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
67fb55bd0aSMatthias Ringwald } btstack_control_t;
68af3c1ffeSMatthias Ringwald 
69af3c1ffeSMatthias Ringwald #if defined __cplusplus
70af3c1ffeSMatthias Ringwald }
71af3c1ffeSMatthias Ringwald #endif
72af3c1ffeSMatthias Ringwald 
73*80e33422SMatthias Ringwald #endif // BTSTACK_CONTROL_H
74