xref: /btstack/src/ble/gatt-service/battery_service_server.h (revision 85a677ece041b067ddfcfed9310ca6ca27fff07b)
1*85a677ecSMatthias Ringwald /*
2*85a677ecSMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
3*85a677ecSMatthias Ringwald  *
4*85a677ecSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*85a677ecSMatthias Ringwald  * modification, are permitted provided that the following conditions
6*85a677ecSMatthias Ringwald  * are met:
7*85a677ecSMatthias Ringwald  *
8*85a677ecSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*85a677ecSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*85a677ecSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*85a677ecSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*85a677ecSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*85a677ecSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*85a677ecSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*85a677ecSMatthias Ringwald  *    from this software without specific prior written permission.
16*85a677ecSMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*85a677ecSMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*85a677ecSMatthias Ringwald  *    monetary gain.
19*85a677ecSMatthias Ringwald  *
20*85a677ecSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*85a677ecSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*85a677ecSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*85a677ecSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24*85a677ecSMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*85a677ecSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*85a677ecSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*85a677ecSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*85a677ecSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*85a677ecSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*85a677ecSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*85a677ecSMatthias Ringwald  * SUCH DAMAGE.
32*85a677ecSMatthias Ringwald  *
33*85a677ecSMatthias Ringwald  * Please inquire about commercial licensing options at
34*85a677ecSMatthias Ringwald  * [email protected]
35*85a677ecSMatthias Ringwald  *
36*85a677ecSMatthias Ringwald  */
37*85a677ecSMatthias Ringwald #ifndef __BATTERY_SERVICE_SERVER_H
38*85a677ecSMatthias Ringwald #define __BATTERY_SERVICE_SERVER_H
39*85a677ecSMatthias Ringwald 
40*85a677ecSMatthias Ringwald #include <stdint.h>
41*85a677ecSMatthias Ringwald 
42*85a677ecSMatthias Ringwald #if defined __cplusplus
43*85a677ecSMatthias Ringwald extern "C" {
44*85a677ecSMatthias Ringwald #endif
45*85a677ecSMatthias Ringwald 
46*85a677ecSMatthias Ringwald /**
47*85a677ecSMatthias Ringwald  * Implementation of the GATT Battery Service Server
48*85a677ecSMatthias Ringwald  * To use with your application, add '#import <battery_service.gatt' to your .gatt file
49*85a677ecSMatthias Ringwald  */
50*85a677ecSMatthias Ringwald 
51*85a677ecSMatthias Ringwald /* API_START */
52*85a677ecSMatthias Ringwald 
53*85a677ecSMatthias Ringwald /**
54*85a677ecSMatthias Ringwald  * @brief Init Battery Service Server with ATT DB
55*85a677ecSMatthias Ringwald  * @param battery_value in range 0-100
56*85a677ecSMatthias Ringwald  */
57*85a677ecSMatthias Ringwald void battery_service_server_init(uint8_t battery_value);
58*85a677ecSMatthias Ringwald 
59*85a677ecSMatthias Ringwald /**
60*85a677ecSMatthias Ringwald  * @brief Update battery value
61*85a677ecSMatthias Ringwald  * @note triggers notifications if subscribed
62*85a677ecSMatthias Ringwald  * @param battery_value in range 0-100
63*85a677ecSMatthias Ringwald  */
64*85a677ecSMatthias Ringwald void battery_service_server_set_battery_value(uint8_t battery_value);
65*85a677ecSMatthias Ringwald 
66*85a677ecSMatthias Ringwald /* API_END */
67*85a677ecSMatthias Ringwald 
68*85a677ecSMatthias Ringwald #if defined __cplusplus
69*85a677ecSMatthias Ringwald }
70*85a677ecSMatthias Ringwald #endif
71*85a677ecSMatthias Ringwald 
72*85a677ecSMatthias Ringwald #endif
73*85a677ecSMatthias Ringwald 
74