/* *****************************************************************************
 * BEGIN: Banner
 *-----------------------------------------------------------------------------
 *                                 ETAS GmbH
 *                      D-70469 Stuttgart, Borsigstr. 14
 *-----------------------------------------------------------------------------
 *    Administrative Information (automatically filled in by ISOLAR)         
 *-----------------------------------------------------------------------------
 * Name: Code-Frame generation feature
 * Description:
 * Version: 7.0
 *-----------------------------------------------------------------------------
 * END: Banner
 ******************************************************************************

 * Project : RTA-BSW Starter Kit
 * Component: /CAN_System/Pkg_Ecu/TestComponent/Test
 * Runnable : All Runnables in SwComponent
 *****************************************************************************
 * Tool Version: ISOLAR-A V 8.0
 * Author: NIC1ANA
 * Date : Tue Oct 13 16:06:49 2015
 ****************************************************************************/

#include "Rte_Com_SWC.h"
#include "CanNm_Priv.h"

/*PROTECTED REGION ID(FileHeaderUserDefinedIncludes :RE_Test) ENABLED START */
/* Start of user defined includes  - Do not remove this comment */
/* End of user defined includes - Do not remove this comment */
/*PROTECTED REGION END */

/*PROTECTED REGION ID(FileHeaderUserDefinedConstants :RE_Test) ENABLED START */
/* Start of user defined constant definitions - Do not remove this comment */
/* End of user defined constant definitions - Do not remove this comment */
/*PROTECTED REGION END */

/*PROTECTED REGION ID(FileHeaderUserDefinedVariables :RE_Test) ENABLED START */
/* Start of user variable defintions - Do not remove this comment  */
/* End of user variable defintions - Do not remove this comment  */
/*PROTECTED REGION END */
#define Com_SWC_START_SEC_CODE
#include "Com_SWC_MemMap.h"

volatile uint8 BMS_SG_BatteryIdentifier;
volatile uint8 BMS_SG_BatteryStatus;
volatile uint16 BMS_SG_CapacityMeasure;
volatile uint32 BMS_SG_Counter;
volatile uint16 BMS_SG_CurrentMeasure;
volatile uint8 BMS_SG_EngineCoolantTemp;
volatile uint8 BMS_SG_EngineFuelTemp;
volatile uint32 BMS_SG_EngineSpeed;
volatile uint8 BMS_SG_EngineTorque;
volatile uint8 BMS_SG_StateOfCharge;
volatile uint8 BMS_SG_StateOfHealth;
volatile uint16 BMS_SG_Status;
volatile uint8 BMS_SG_VehicleSpeed;
volatile uint16 BMS_SG_VoltageMeasure;

extern VAR(CanNm_RamType, CANNM_VAR) CanNm_RamData_s[CANNM_NUMBER_OF_CHANNELS];


volatile uint8 SleepStatus;

FUNC (void, Test_CODE) RE_Com_SWC // return value & FctID
(
		void
)
{
	uint8 TST_TestNumber;

	P2VAR(CanNm_RamType,AUTOMATIC,NM_APPL_DATA) NetworkRamDataPtr;
	NetworkRamDataPtr = &CanNm_RamData_s[0];

	// direct link to NM module only for AUTOMATION TESTING purpose!!! not allowed in normal situation
	SleepStatus = NetworkRamDataPtr->stRemoteSleepInd;



	/* Local Data Declaration */

	/*PROTECTED REGION ID(UserVariables :RE_Com_SWC) ENABLED START */
	/* Start of user variable defintions - Do not remove this comment  */
	/* End of user variable defintions - Do not remove this comment  */
	/*PROTECTED REGION END */
//	Std_ReturnType retValue = RTE_E_OK;
	/*  -------------------------------------- Data Read -----------------------------------------  */
	BMS_SG_BatteryIdentifier = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_BatteryIdentifier_Rx_BMS_SG_BatteryIdentifier_Rx();
	BMS_SG_BatteryStatus = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_BatteryStatus_Rx_BMS_SG_BatteryStatus_Rx();
	BMS_SG_CapacityMeasure = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_CapacityMeasure_Rx_BMS_SG_CapacityMeasure_Rx();
	BMS_SG_Counter = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_Counter_Rx_BMS_SG_Counter_Rx();
	BMS_SG_CurrentMeasure = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_CurrentMeasure_Rx_BMS_SG_CurrentMeasure_Rx();
	BMS_SG_EngineCoolantTemp = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_EngineCoolantTemp_Rx_BMS_SG_EngineCoolantTemp_Rx();
	BMS_SG_EngineFuelTemp = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_EngineFuelTemp_Rx_BMS_SG_EngineFuelTemp_Rx();
	BMS_SG_EngineSpeed = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_EngineSpeed_Rx_BMS_SG_EngineSpeed_Rx();
	BMS_SG_EngineTorque = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_EngineTorque_Rx_BMS_SG_EngineTorque_Rx();
	BMS_SG_StateOfCharge = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_StateOfCharge_Rx_BMS_SG_StateOfCharge_Rx();
	BMS_SG_StateOfHealth = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_StateOfHealth_Rx_BMS_SG_StateOfHealth_Rx();
	BMS_SG_Status = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_Status_Rx_BMS_SG_Status_Rx();
	BMS_SG_VehicleSpeed = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_VehicleSpeed_Rx_BMS_SG_VehicleSpeed_Rx();
	BMS_SG_VoltageMeasure = Rte_IRead_RE_Com_SWC_RPort_BMS_SG_VoltageMeasure_Rx_BMS_SG_VoltageMeasure_Rx();

	TST_TestNumber = Rte_IRead_RE_Com_SWC_RPort_TST_TestNumber_TST_TestNumber();

//	SwcTest_MPDU_RX_FRAME_MULT0 = Rte_IRead_RE_Test_RPort_MPDU_RX_FRAME_MULT0_uint8();
//	SwcTest_MPDU_RX_FRAME_MULT1 = Rte_IRead_RE_Test_RPort_MPDU_RX_FRAME_MULT1_uint8();
//	SwcTest_MPDU_RX_FRAME_STAT = Rte_IRead_RE_Test_RPort_MPDU_RX_FRAME_STAT_uint8();

	/*  -------------------------------------- Server Call Point  --------------------------------  */

	/*  -------------------------------------- CDATA ---------------------------------------------  */


	/*  -------------------------------------- Data Write ----------------------------------------  */

	Rte_Write_PPort_TestRequested_uint8_Impl(TST_TestNumber);
	Rte_Write_PPort_BMS_SG_BatteryIdentifier_Tx_BMS_SG_BatteryIdentifier_Tx(BMS_SG_BatteryIdentifier);
	Rte_Write_PPort_BMS_SG_BatteryStatus_Tx_BMS_SG_BatteryStatus_Tx(BMS_SG_BatteryStatus);
	Rte_Write_PPort_BMS_SG_CapacityMeasure_Tx_BMS_SG_CapacityMeasure_Tx(BMS_SG_CapacityMeasure);
	Rte_Write_PPort_BMS_SG_Counter_Tx_BMS_SG_Counter_Tx(BMS_SG_Counter);
	Rte_Write_PPort_BMS_SG_CurrentMeasure_Tx_BMS_SG_CurrentMeasure_Tx(BMS_SG_CurrentMeasure);
	Rte_Write_PPort_BMS_SG_EngineCoolantTemp_Tx_BMS_SG_EngineCoolantTemp_Tx(BMS_SG_EngineCoolantTemp);
	Rte_Write_PPort_BMS_SG_EngineFuelTemp_Tx_BMS_SG_EngineFuelTemp_Tx(BMS_SG_EngineFuelTemp);
	Rte_Write_PPort_BMS_SG_EngineSpeed_Tx_BMS_SG_EngineSpeed_Tx(BMS_SG_EngineSpeed);
	Rte_Write_PPort_BMS_SG_EngineTorque_Tx_BMS_SG_EngineTorque_Tx(BMS_SG_EngineTorque);
	Rte_Write_PPort_BMS_SG_StateOfCharge_Tx_BMS_SG_StateOfCharge_Tx(BMS_SG_StateOfCharge);
	Rte_Write_PPort_BMS_SG_StateOfHealth_Tx_BMS_SG_StateOfHealth_Tx(BMS_SG_StateOfHealth);
	Rte_Write_PPort_BMS_SG_Status_Tx_BMS_SG_Status_Tx(BMS_SG_Status);
	Rte_Write_PPort_BMS_SG_VehicleSpeed_Tx_BMS_SG_VehicleSpeed_Tx(BMS_SG_VehicleSpeed);
	Rte_Write_PPort_BMS_SG_VoltageMeasure_Tx_BMS_SG_VoltageMeasure_Tx(BMS_SG_VoltageMeasure);

	Rte_Write_PPort_CanNm_TestResult_CanNm_TestResult(SleepStatus);
	/*  -------------------------------------- Trigger Interface ---------------------------------  */

	/*  -------------------------------------- Mode Management -----------------------------------  */

	/*  -------------------------------------- Port Handling -------------------------------------  */

	/*  -------------------------------------- Exclusive Area ------------------------------------  */

	/*  -------------------------------------- Multiple Instantiation ----------------------------  */

	/*PROTECTED REGION ID(User Logic :RE_Test) ENABLED START */
	/* Start of user code - Do not remove this comment */



	/* End of user code - Do not remove this comment */
	/*PROTECTED REGION END */

}

#define Com_SWC_START_SEC_CODE
#include "Com_SWC_MemMap.h"
