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 23*2fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24*2fca4dadSMilanka Ringwald * GMBH 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 38fe5a6c4eSMilanka Ringwald /** 3990f75057SMilanka Ringwald * @title Bluetooth Power Control 40af3c1ffeSMatthias Ringwald * 4190f75057SMilanka Ringwald * The Bluetooth Hardware Control API allows HCI to manage Bluetooth chipsets via direct hardware controls. 42af3c1ffeSMatthias Ringwald * 43af3c1ffeSMatthias Ringwald */ 44af3c1ffeSMatthias Ringwald 4580e33422SMatthias Ringwald #ifndef BTSTACK_CONTROL_H 4680e33422SMatthias 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 6090f75057SMilanka Ringwald /* API_START */ 6190f75057SMilanka Ringwald 62af3c1ffeSMatthias Ringwald typedef struct { 63d0b87befSMatthias Ringwald void (*init) (const void *config); 64d0b87befSMatthias Ringwald int (*on) (void); // <-- turn BT module on and configure 65d0b87befSMatthias Ringwald int (*off) (void); // <-- turn BT module off 66d0b87befSMatthias Ringwald int (*sleep)(void); // <-- put BT module to sleep - only to be called after ON 67d0b87befSMatthias Ringwald int (*wake) (void); // <-- wake BT module from sleep - only to be called after SLEEP 68af3c1ffeSMatthias Ringwald void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event)); 69fb55bd0aSMatthias Ringwald } btstack_control_t; 70af3c1ffeSMatthias Ringwald 7190f75057SMilanka Ringwald /* API_END */ 7290f75057SMilanka Ringwald 73af3c1ffeSMatthias Ringwald #if defined __cplusplus 74af3c1ffeSMatthias Ringwald } 75af3c1ffeSMatthias Ringwald #endif 76af3c1ffeSMatthias Ringwald 7780e33422SMatthias Ringwald #endif // BTSTACK_CONTROL_H 78