#ifndef BLE_LBS_H__
#define BLE_LBS_H__

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

#define LBS_UUID_BASE        {	0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, \
								0x00, 0x80, \
								0x00, 0x10, \
								0x00, 0x00, \
								0x00, 0x00, 0x00, 0x00}
#define MPUS_UUID_SERVICE     0xffe0	//mpu6050 = 0x1526
#define MPUS_UUID_MPU_CHAR    0xffe4	//mpu6050 = 0x1527

// Forward declaration of the ble_lbs_t type. 
typedef struct ble_mpus_s ble_mpus_t;

typedef void (*ble_lbs_led_write_handler_t) (ble_mpus_t * p_lbs, uint8_t new_state);
															
typedef struct
{
    ble_lbs_led_write_handler_t led_write_handler; /**< Event handler to be called when the LED Characteristic is written. */
} ble_mpus_init_t;

/**@brief mpu9250 Service structure. This structure contains various status information for the service. */
struct ble_mpus_s
{
	uint16_t                    service_handle;      /**< Handle of MPU9250 Service (as provided by the BLE stack). */
	//ble_gatts_char_handles_t    led_char_handles;    /**< Handles related to the LED Characteristic. */
	ble_gatts_char_handles_t    mpu_char_handles;    /**< Handles related to the mpu Characteristic. */
	uint8_t                     uuid_type;           /**< UUID type for the LED Button Service. */
	uint16_t                    conn_handle;         /**< Handle of the current connection (as provided by the BLE stack). BLE_CONN_HANDLE_INVALID if not in a connection. */
	//ble_lbs_led_write_handler_t led_write_handler;   /**< Event handler to be called when the LED Characteristic is written. */
};															
															
uint32_t ble_mpus_init(ble_mpus_t * p_mpus, const ble_mpus_init_t * p_mpus_init);
uint16_t ble_mpu9250_on_data_read(ble_mpus_t * p_mpus, int16_t *pAVal, int16_t *pGVal, int16_t *pMVal, int16_t *pTVal);

void ble_mpus_on_ble_evt(ble_mpus_t * p_lbs, ble_evt_t * p_ble_evt);

#endif
