/*==================================================================================================

FILE INFORMATION HEADER

USED IN PROJECT:			S1003065-01 PPS-TX/S1003067-01 PPS-RX software application
ITEM TYPE:					Source Code
ITEM NAME:					xlru_message_mng.h
ITEM DESCRIPTION:			This file contains the definitions of messages
TARGET:						ATSAM4LC8B / ATSAM4LS8B
DOC REFERENCES:				SWDS1003065-01/SWDS1003065-01
PROGRAMMER NAME(S):			A.Chessa, L.Vallongo
COPYRIGHT:					LEONARDO-FINMECCANICA S.p.A
REVISION HISTORY:
- 01.00: first release

====================================================================================================
© Copyright LEONARDO S.p.A.. All rights reserved
Any right of industrial and intellectual property on this document,
and of technical Know-how herein contained, belongs to
LEONARDO S.p.A. and/or third parties.
According to the law, it is forbidden to disclose, reproduce or however
use this document and any data herein contained for any use without
previous written authorization by LEONARDO S.p.A.
==================================================================================================*/

#ifndef XLRU_MESSAGE_MNG_H_
#define XLRU_MESSAGE_MNG_H_

#include "xlru_lcu.h"
#include "xlru_pps.h"
#include "xlru_psm.h"

typedef struct
{
	char full_message[BUFFER_DIM];	//full message analized
	char checksum[2];				//only part of checksum
	int	pos_checksum;				//position where start checksum
	char payload[BUFFER_DIM];		//message without checksum
	bool valid;						//0 not valid, 1 valid
	char device;					//0 no device, 1 psm, 2 pps, 3 lcu
} xlru_message_received_t;


char*  xlru_send_lcu_set_message(void);
char*  xlru_send_pps_set_message(void);
char*  xlru_send_psm_set_message(void);

char*  xlru_send_lcu_get_message(void);

char*  xlru_send_lcu_test_status_message(void);
char*  xlru_send_pps_test_status_message(void);

char*  xlru_send_lcu_reset_eti_message(void);
char*  xlru_send_lcu_active_download_message(void);
char*  xlru_send_lcu_sw_status_message(void);

char* xlru_send_lcu_override_set_value_message(lcu_override_param_id_t _param_id,int _value);
char* xlru_send_lcu_override_get_value_message(lcu_override_param_id_t _param_id);
char* xlru_send_lcu_override_get_factory_message(lcu_override_param_id_t _param_id);
char* xlru_send_lcu_override_set_to_factory_message(lcu_override_param_id_t _param_id);

void set_correct_last_error(char* msg, int device);

int  xlru_check_message(xlru_message_received_t *mess);




#endif /* XLRU_MESSAGE_MNG_H_ */
