/* This file was generated by plugin 'Nordic Semiconductor nRF5x v.1.2.2' (BDS version 1.1.3135.0) */

#ifndef BLE_BUTTON_TEST_SERVICE_H__
#define BLE_BUTTON_TEST_SERVICE_H__

#include <stdint.h>
#include <stdbool.h>
#include "ble.h"
#include "ble_srv_common.h"
#include "app_util_bds.h"



/**@brief Button test service event type. */
typedef enum
{ 
    BLE_BUTTON_TEST_SERVICE_BUTTON_TEST_SERVICE_NEW_CHARACTERISTIC_EVT_NOTIFICATION_ENABLED,  /**< Button test service new characteristic value notification enabled event. */
    BLE_BUTTON_TEST_SERVICE_BUTTON_TEST_SERVICE_NEW_CHARACTERISTIC_EVT_NOTIFICATION_DISABLED, /**< Button test service new characteristic value notification disabled event. */
    BLE_BUTTON_TEST_SERVICE_BUTTON_TEST_SERVICE_NEW_CHARACTERISTIC_EVT_WRITE, /**< Button test service new characteristic write event. */
} ble_button_test_service_evt_type_t;

// Forward declaration of the ble_button_test_service_t type.
typedef struct ble_button_test_service_s ble_button_test_service_t;








/**@brief Button test service new characteristic structure. */
typedef struct
{
    uint8_t button_field;
} ble_button_test_service_button_test_service_new_characteristic_t;

/**@brief Button test service Service event. */
typedef struct
{
    ble_button_test_service_evt_type_t evt_type;    /**< Type of event. */
    union {
        uint16_t cccd_value; /**< Holds decoded data in Notify and Indicate event handler. */
        ble_button_test_service_button_test_service_new_characteristic_t button_test_service_new_characteristic; /**< Holds decoded data in Write event handler. */
    } params;
} ble_button_test_service_evt_t;

/**@brief Button test service Service event handler type. */
typedef void (*ble_button_test_service_evt_handler_t) (ble_button_test_service_t * p_button_test_service, ble_button_test_service_evt_t * p_evt);

/**@brief Button test service Service init structure. This contains all options and data needed for initialization of the service */
typedef struct
{
    ble_button_test_service_evt_handler_t     evt_handler; /**< Event handler to be called for handling events in the Button test service Service. */
    ble_button_test_service_button_test_service_new_characteristic_t ble_button_test_service_button_test_service_new_characteristic_initial_value; /**< If not NULL, initial value of the Button test service new characteristic characteristic. */ 
} ble_button_test_service_init_t;

/**@brief Button test service Service structure. This contains various status information for the service.*/
struct ble_button_test_service_s
{
    ble_button_test_service_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Button test service Service. */
    uint16_t service_handle; /**< Handle of Button test service Service (as provided by the BLE stack). */
    ble_gatts_char_handles_t button_test_service_new_characteristic_handles; /**< Handles related to the Button test service new characteristic characteristic. */
    uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */
};

/**@brief Function for initializing the Button test service.
 *
 * @param[out]  p_button_test_service       Button test service Service structure. This structure will have to be supplied by
 *                          the application. It will be initialized by this function, and will later
 *                          be used to identify this particular service instance.
 * @param[in]   p_button_test_service_init  Information needed to initialize the service.
 *
 * @return      NRF_SUCCESS on successful initialization of service, otherwise an error code.
 */
uint32_t ble_button_test_service_init(ble_button_test_service_t * p_button_test_service, const ble_button_test_service_init_t * p_button_test_service_init);

/**@brief Function for handling the Application's BLE Stack events.*/
void ble_button_test_service_on_ble_evt(ble_button_test_service_t * p_button_test_service, ble_evt_t * p_ble_evt);

/**@brief Function for setting the Button test service new characteristic.
 *
 * @details Sets a new value of the Button test service new characteristic characteristic. The new value will be sent
 *          to the client the next time the client reads the Button test service new characteristic characteristic.
 *          This function is only generated if the characteristic's Read property is not 'Excluded'.
 *
 * @param[in]   p_button_test_service                 Button test service Service structure.
 * @param[in]   p_button_test_service_new_characteristic  New Button test service new characteristic.
 *
 * @return      NRF_SUCCESS on success, otherwise an error code.
 */
uint32_t ble_button_test_service_button_test_service_new_characteristic_set(ble_button_test_service_t * p_button_test_service, ble_button_test_service_button_test_service_new_characteristic_t * p_button_test_service_new_characteristic);

#endif //_BLE_BUTTON_TEST_SERVICE_H__
