xref: /btstack/src/ble/gatt-service/battery_service_server.h (revision 80e33422a96c028b3a9c308fc4b9b874712dafb4)
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  */
37*80e33422SMatthias Ringwald #ifndef BATTERY_SERVICE_SERVER_H
38*80e33422SMatthias 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 /**
4785a677ecSMatthias Ringwald  * Implementation of the GATT Battery Service Server
4885a677ecSMatthias Ringwald  * To use with your application, add '#import <battery_service.gatt' to your .gatt file
4985a677ecSMatthias Ringwald  */
5085a677ecSMatthias Ringwald 
5185a677ecSMatthias Ringwald /* API_START */
5285a677ecSMatthias Ringwald 
5385a677ecSMatthias Ringwald /**
5485a677ecSMatthias Ringwald  * @brief Init Battery Service Server with ATT DB
5585a677ecSMatthias Ringwald  * @param battery_value in range 0-100
5685a677ecSMatthias Ringwald  */
5785a677ecSMatthias Ringwald void battery_service_server_init(uint8_t battery_value);
5885a677ecSMatthias Ringwald 
5985a677ecSMatthias Ringwald /**
6085a677ecSMatthias Ringwald  * @brief Update battery value
6185a677ecSMatthias Ringwald  * @note triggers notifications if subscribed
6285a677ecSMatthias Ringwald  * @param battery_value in range 0-100
6385a677ecSMatthias Ringwald  */
6485a677ecSMatthias Ringwald void battery_service_server_set_battery_value(uint8_t battery_value);
6585a677ecSMatthias Ringwald 
6685a677ecSMatthias Ringwald /* API_END */
6785a677ecSMatthias Ringwald 
6885a677ecSMatthias Ringwald #if defined __cplusplus
6985a677ecSMatthias Ringwald }
7085a677ecSMatthias Ringwald #endif
7185a677ecSMatthias Ringwald 
7285a677ecSMatthias Ringwald #endif
7385a677ecSMatthias Ringwald 
74