#if !defined (CAN_SM_H)
#define CAN_SM_H
/***********************************************************/
#include "CanSM_Cfg.h"
#include "CanIf_Cfg.h"
#include "CanIf.h"
#include "CanTp.h"
#include "CanTrcv.h"
/***********************************************************/
typedef CanIf_ControllerErrorType  CanSM_BusErrorStatusType;
typedef unsigned char              CanSM_BattModeType;
typedef CanIf_ControllerModeType   Can_ControllerModeType;
typedef CanIf_CanDlcType           Can_CanDlcType;
typedef CanIf_CanDataType          Can_CanDataType;
typedef CanIf_CanIdType            Can_CanIdType;
typedef CanIf_HwHandleType         Can_HwHandleType;
typedef CanIf_ControllerErrorType  Can_ErrorStatusType;

typedef enum
{
	COMM_NO_COMMUNICATION = 0u,
	COMM_SILENT_COMMUNICATION,
	COMM_FULL_COMMUNICATION

}CanSM_CommuniocationStatusType;

typedef enum
{
	BUS_TRAFFIC_OFFLINE = 0u,
	BUS_TRAFFIC_TXONLINE,
	BUS_TRAFFIC_RXONLINE,
	BUS_TRAFFIC_ONLINE

}CanSM_BusTrafficType;

typedef struct
{
  	CanSM_BorTimerType              eCanSm_BorTimer;           	
  	CanSM_BusErrorStatusType        eCanSM_BusErrorStatus;
  	
  	CanSM_BattModeType              eCanSM_NewBattMode;
  	CanSM_BattModeType              eCanSM_OldBattMode;
  	
  	CanSM_CommuniocationStatusType  eCanSm_RequestedNewComMode;
  	CanSM_CommuniocationStatusType  eCanSm_RequestedOldComMode;
  	
  	CanSM_BusTrafficType            eCanSM_ComTraffic;
  	CanSM_BusTrafficType            eCanSM_NMTraffic;
  	ComUint8                        eCanSM_IsInit;

}CanSM_LocalClusterDataType;
extern CanSM_LocalClusterDataType  TsCanSM_h_LocalClusterData;
#define GET_CANSM_LOCAL_DATA(field)       (TsCanSM_h_LocalClusterData.field) 
#define SET_CANSM_LOCAL_DATA(field,data)  (TsCanSM_h_LocalClusterData.field = data) 

/***********************************************************/
extern void CanSM_MainFunction(void);
extern void InitCanSM_Parameter(void);
extern void DeInitCanSM_Parameter(void);
extern void ReInitCanSM_Parameter(void);

extern void GetCanSM_ControllerBusoffStatus(CanSM_BusErrorStatusType *LeCanSM_u_BusoffStatus);
extern void SetCanSM_BusoffEvent(CanSM_BusErrorStatusType LeCanSM_u_BusoffEvent);

extern void GetCanSM_ComTrafficStatus(CanSM_BusTrafficType *LeCanSM_e_DataPtr);
extern void GetCanSM_NMTrafficStatus(CanSM_BusTrafficType *LeCanSM_e_DataPtr);
/***********************************************************/


#endif

