/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#ifndef _BMS_MODULE_EVENT_H_
#define _BMS_MODULE_EVENT_H_

/**
 * @brief Application module event
 * @defgroup app_module_event Application module event
 * @{
 */
 #include<zephyr.h>
#include <device.h>
#include<devicetree.h>
#include <drivers/gpio.h>

#include <app_event_manager.h>
#include <app_event_manager_profiler_tracer.h>

#ifdef __cplusplus
extern "C" {
#endif
//*********

//************************************************************
/** @brief Bms event types submitted by Application module. */

enum bms_module_event_type {
        BMS_PIN_SUCCESS,
        BMS_PIN_FAIL,
        BMS_DETACHED,
	BMS_ATTACHED,
        BMS_DATA_READY,       
	BMS_DATA_ERROR
};

/** @brief Data types that the bms module requests samples for in
 *	   @ref bms_module_event_type APP_EVT_DATA_GET.
 */
struct bms_module_data_type {
       int bms_id;
       unsigned char bms_buf[39];
};

/** @brief Bms module event. */
struct bms_module_event {
	struct app_event_header header;
	enum bms_module_event_type type;	
        
        union {
		struct bms_module_data_type bmsdata;
		/* Module ID, used when acknowledging shutdown requests. */
		int err;
	} data;
};

/** Register bms module events as an event type with the event manager. */
APP_EVENT_TYPE_DECLARE(bms_module_event);

#ifdef __cplusplus
}
#endif

/**
 * @}
 */

#endif /* _APP_MODULE_EVENT_H_ */
