185a677ecSMatthias Ringwald /* 285a677ecSMatthias Ringwald * Copyright (C) 2014 BlueKitchen GmbH 385a677ecSMatthias Ringwald * 485a677ecSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 585a677ecSMatthias Ringwald * modification, are permitted provided that the following conditions 685a677ecSMatthias Ringwald * are met: 785a677ecSMatthias Ringwald * 885a677ecSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 985a677ecSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 1085a677ecSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 1185a677ecSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 1285a677ecSMatthias Ringwald * documentation and/or other materials provided with the distribution. 1385a677ecSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 1485a677ecSMatthias Ringwald * contributors may be used to endorse or promote products derived 1585a677ecSMatthias Ringwald * from this software without specific prior written permission. 1685a677ecSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 1785a677ecSMatthias Ringwald * personal benefit and not for any commercial purpose or for 1885a677ecSMatthias Ringwald * monetary gain. 1985a677ecSMatthias Ringwald * 2085a677ecSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 2185a677ecSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2285a677ecSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 2385a677ecSMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 2485a677ecSMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2585a677ecSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2685a677ecSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 2785a677ecSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2885a677ecSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2985a677ecSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 3085a677ecSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3185a677ecSMatthias Ringwald * SUCH DAMAGE. 3285a677ecSMatthias Ringwald * 3385a677ecSMatthias Ringwald * Please inquire about commercial licensing options at 3485a677ecSMatthias Ringwald * [email protected] 3585a677ecSMatthias Ringwald * 3685a677ecSMatthias Ringwald */ 3780e33422SMatthias Ringwald #ifndef BATTERY_SERVICE_SERVER_H 3880e33422SMatthias Ringwald #define BATTERY_SERVICE_SERVER_H 3985a677ecSMatthias Ringwald 4085a677ecSMatthias Ringwald #include <stdint.h> 4185a677ecSMatthias Ringwald 4285a677ecSMatthias Ringwald #if defined __cplusplus 4385a677ecSMatthias Ringwald extern "C" { 4485a677ecSMatthias Ringwald #endif 4585a677ecSMatthias Ringwald 4685a677ecSMatthias Ringwald /** 47*1ea30d1bSMilanka Ringwald * @text The Battery Service allows to query your device's battery level in a standardized way. 48*1ea30d1bSMilanka Ringwald * 49*1ea30d1bSMilanka Ringwald * To use with your application, add `#import <batery_service.gatt>` to your .gatt file. 50*1ea30d1bSMilanka Ringwald * After adding it to your .gatt file, you call *battery_service_server_init(value)* with the 51*1ea30d1bSMilanka Ringwald * current value of your battery. The valid range for the battery level is 0-100. 52*1ea30d1bSMilanka Ringwald * 53*1ea30d1bSMilanka Ringwald * If the battery level changes, you can call *battery_service_server_set_battery_value(value)*. 54*1ea30d1bSMilanka Ringwald * The service supports sending Notifications if the client enables them. 5585a677ecSMatthias Ringwald */ 5685a677ecSMatthias Ringwald 5785a677ecSMatthias Ringwald /* API_START */ 5885a677ecSMatthias Ringwald 5985a677ecSMatthias Ringwald /** 6085a677ecSMatthias Ringwald * @brief Init Battery Service Server with ATT DB 6185a677ecSMatthias Ringwald * @param battery_value in range 0-100 6285a677ecSMatthias Ringwald */ 6385a677ecSMatthias Ringwald void battery_service_server_init(uint8_t battery_value); 6485a677ecSMatthias Ringwald 6585a677ecSMatthias Ringwald /** 6685a677ecSMatthias Ringwald * @brief Update battery value 6785a677ecSMatthias Ringwald * @note triggers notifications if subscribed 6885a677ecSMatthias Ringwald * @param battery_value in range 0-100 6985a677ecSMatthias Ringwald */ 7085a677ecSMatthias Ringwald void battery_service_server_set_battery_value(uint8_t battery_value); 7185a677ecSMatthias Ringwald 7285a677ecSMatthias Ringwald /* API_END */ 7385a677ecSMatthias Ringwald 7485a677ecSMatthias Ringwald #if defined __cplusplus 7585a677ecSMatthias Ringwald } 7685a677ecSMatthias Ringwald #endif 7785a677ecSMatthias Ringwald 7885a677ecSMatthias Ringwald #endif 7985a677ecSMatthias Ringwald 80