xref: /btstack/src/btstack_control.h (revision fb55bd0accfa8c0bd43a8057575bc2b762a5b3bd)
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 /*
39*fb55bd0aSMatthias Ringwald  *  btstack_control.h
40af3c1ffeSMatthias Ringwald  *
41*fb55bd0aSMatthias Ringwald  *  BTstack Bluetooth Hardware Control API -- allows HCI to manage Bluetooth chipsets via direct hardware controls
42af3c1ffeSMatthias Ringwald  *
43af3c1ffeSMatthias Ringwald  */
44af3c1ffeSMatthias Ringwald 
45*fb55bd0aSMatthias Ringwald #ifndef __BTSTACK_CONTROL_H
46*fb55bd0aSMatthias 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 {
61*fb55bd0aSMatthias Ringwald     int          (*on)   (const void *config);  // <-- turn BT module on and configure
62*fb55bd0aSMatthias Ringwald     int          (*off)  (const void *config);  // <-- turn BT module off
63*fb55bd0aSMatthias Ringwald     int          (*sleep)(const void *config);  // <-- put BT module to sleep    - only to be called after ON
64*fb55bd0aSMatthias Ringwald     int          (*wake) (const void *config);  // <-- wake BT module from sleep - only to be called after SLEEP
65af3c1ffeSMatthias Ringwald     void         (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
66*fb55bd0aSMatthias Ringwald } btstack_control_t;
67af3c1ffeSMatthias Ringwald 
68af3c1ffeSMatthias Ringwald #if defined __cplusplus
69af3c1ffeSMatthias Ringwald }
70af3c1ffeSMatthias Ringwald #endif
71af3c1ffeSMatthias Ringwald 
72*fb55bd0aSMatthias Ringwald #endif // __BTSTACK_CONTROL_H
73