
/* ----------------------------------------------------------------------------
 * Implements
 */
#include "UDS_Services_Common.h"

/* ----------------------------------------------------------------------------
 * Uses
 */
#include "ModelsInterfaces/CommonMacros.h"
//#include "Platform_Types.h"
#include "DiagnosticR/ProjectCfg.h"
#include "Std_Types.h"
#include "DiagnosticR/Comp_ISO_15765_3/Iso15765_3.h"
#include "UDS_Services_Common.h"
#include "UDS_CoreServices_CB.h"
//#include "ficoNVM.h"
//#include "GearShiftStrategy_If.h"
//#include "DriveModeSwitch_If.h"
//#include "PaddleStatus_If.h"
#include "smartee.h"
/* ----------------------------------------------------------------------------
 * Private defines
 */

#define DLC_DID_ECU_SN                  24U
#define DLC_DID_CD_VIN                  17U
#define DLC_DID_CD_MANFAC_SN            16U
#define DLC_DID_CD_APP_DATAID           3U
#define DLC_DID_CD_MANUF_ECUHWNUM       11U
#define DLC_DID_DTC_SETTING             12U
#define DLC_DID_MTOC	                17U
#define DLC_DID_SHEILD_AUTOPARK	        1U
#define DLC_DID_TRANSPORTATION_MODE	    1U
#define DLC_DID_REPROGRAMMING_COUNTER   2U
#define DLC_DID_REPROGRAMMING_DATE      4U
#define DLC_DID_APPSW_FINGER_PRINT      26U
#define DLC_DID_ECUMANUFACTURE_DATE     6U
#define DLC_DID_ECUINSTALLATION_DATE    6U
#define DLC_DID_DCID	                3U

#define DLC_GAC_DIAG_SPEC_VERSION       3U
#define DLC_GAC_HW_VERSION              16U
#define DLC_GAC_ECU_SW_VERSION          16U
#define DLC_GAC_SPARE_NUMBER            14U
#define DLC_SYSTEM_SUPPLIER_ID          6U
#define DLC_GAC_KIT_PART_NUMBER         14U
#define DLC_SYSTEM_NAME		            20U
#define DLC_UDS_PROTOL_VERSION          2U
#define DLC_BOOT_SW_VERSION             6U
#define DLC_REPAIR_SHOP_CODE            16U
#define DLC_BOOT_SW_ID             		3U


/* ----------------------------------------------------------------------------
 * Private types
 */
typedef struct{
	UI_8 gac_diagnostic_version[DLC_GAC_DIAG_SPEC_VERSION];
	UI_8 gac_hardware_version[DLC_GAC_HW_VERSION];
	UI_8 gac_spare_number[DLC_GAC_SPARE_NUMBER];
	UI_8 system_supplier_id[DLC_SYSTEM_SUPPLIER_ID];
	UI_8 gac_kit_assembly_part_number[DLC_GAC_KIT_PART_NUMBER];
	UI_8 system_name[DLC_SYSTEM_NAME];
	UI_8 uds_protol_version[DLC_UDS_PROTOL_VERSION];
	UI_8 boot_version[DLC_BOOT_SW_VERSION];
}t_logical_did;

/* ----------------------------------------------------------------------------
 * Private macros
 */

/* ----------------------------------------------------------------------------
 * Forward declarations
 */

/* ----------------------------------------------------------------------------
 * Private variables
 */
const UI_8 NVM_DID_CD_VIN[DLC_DID_CD_VIN] = GAC_VIN_DEFAULT_VALUE;
const UI_8 NVM_Reprogramming_Date_App[DLC_DID_REPROGRAMMING_DATE] = {0x20,0x24,0x08,0x19};
const UI_8 NVM_DID_CD_SUPPLIER_ID[DLC_SYSTEM_SUPPLIER_ID] = {'2','4','0','8','1','9'};
const UI_8 NVM_Repair_Shop_Code[DLC_REPAIR_SHOP_CODE] = GAC_ECU_REPAIR_SHOP_CODE;
const UI_8 NVM_DID_CD_HW_VERSION[DLC_GAC_HW_VERSION] = {'H','W','0','6',0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20};
static uint8 RAM_DID_CD_VIN[DLC_DID_CD_VIN];
static uint8 RAM_DID_CD_REPROGRAMMING_DATE[DLC_DID_REPROGRAMMING_DATE];
static uint8 RAM_DID_CD_SUPPLIER_ID[DLC_SYSTEM_SUPPLIER_ID];
static uint8 RAM_DID_REPAIR_SHOP_CODE[DLC_REPAIR_SHOP_CODE];
static uint8 RAM_DID_CD_HW_VERSION[DLC_GAC_HW_VERSION];
  #if 0
#pragma ghs startdata
#pragma ghs section rodata=".nvm_sn"
const UI_8 NVM_DID_CD_ECU_SN[DLC_DID_ECU_SN] = GAC_ECU_SN_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_sheild_auto_park"
const UI_8 NVM_DID_CD_SHEILD_AutoPark[DLC_DID_SHEILD_AUTOPARK] = {0x0};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_vin"
const UI_8 NVM_DID_CD_VIN[DLC_DID_CD_VIN] = GAC_VIN_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_manfac_sn"
const UI_8 NVM_DID_CD_MANFAC_SN[DLC_DID_CD_MANFAC_SN] = GAC_MANFAC_SN_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

//<0610
#pragma ghs startdata
#pragma ghs section rodata=".nvm_boot_id"
const UI_8 NVM_DID_CD_BOOT_ID[DLC_BOOT_SW_ID] = GAC_BOOT_ID_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_ecusw_version"
const UI_8 NVM_DID_CD_ECUSW_VERSION[DLC_GAC_ECU_SW_VERSION] = GAC_ECUSW_VERSION_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata



//0610>

#pragma ghs startdata
#pragma ghs section rodata=".nvm_app_dataid"
const UI_8 NVM_DID_CD_APP_DATAID[DLC_DID_CD_APP_DATAID] = GAC_APP_DATAID_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_vehiclemanuf_ecuhwnum_sn"
const UI_8 NVM_DID_CD_MANUF_ECUHWNUM[DLC_DID_CD_MANUF_ECUHWNUM] = GAC_MANUF_ECUHWNUM_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_dtc_setting"
const UI_8 NVM_DID_CD_DTC_SETTING[DLC_DID_DTC_SETTING] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_transportation_mode"
const UI_8 NVM_DID_CD_TRANSPORTATION_MODEG[DLC_DID_TRANSPORTATION_MODE]= {0x0};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_mtoc"
const UI_8 NVM_DID_CD_MTOC[DLC_DID_MTOC]= GAC_MTOC_DEFAULT_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_faa_flag"
const UI_8 NVM_Faa_Flag = 0x0;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_reprogramming_counter"
const UI_8 NVM_Reprogramming_Counter[DLC_DID_REPROGRAMMING_COUNTER] = {0x0};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_reprogramming_attempt_counter"
const UI_8 NVM_Reprogramming_Attempt_Counter[DLC_DID_REPROGRAMMING_COUNTER] = {0x0};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_reprogramming_date"
const UI_8 NVM_Reprogramming_Date[DLC_DID_REPROGRAMMING_DATE] = {3,1,0,5,2,1};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_reprogramming_date_app"
const UI_8 NVM_Reprogramming_Date_App[DLC_DID_REPROGRAMMING_DATE] = {3,1,0,5,2,1};
#pragma ghs section data=default
#pragma ghs enddata


#pragma ghs startdata
#pragma ghs section rodata=".nvm_ecumanufacture_date"
const UI_8 NVM_Ecumanufacture_Date[DLC_DID_ECUMANUFACTURE_DATE] = {3,1,0,5,2,1};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_ecuinstallation_date"
const UI_8 NVM_Ecuinstallation_Date[DLC_DID_ECUINSTALLATION_DATE] = {3,1,0,5,2,1};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_bootsw_version"
const UI_8 NVM_DID_CD_BOOTSW_VERSION[DLC_BOOT_SW_VERSION] = {'0','A','0','0','0','1'};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_hw_version"
const UI_8 NVM_DID_CD_HW_VERSION[DLC_GAC_HW_VERSION] = {0x41,0x30,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20};
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_supplier_id"
const UI_8 NVM_DID_CD_SUPPLIER_ID[DLC_SYSTEM_SUPPLIER_ID] = GAC_APP_SUPPLIER_ID;
#pragma ghs section data=default
#pragma ghs enddata


#pragma ghs startdata
#pragma ghs section rodata=".nvm_app_finger_print"
const UI_8 NVM_App_SW_Finger_Print[DLC_DID_APPSW_FINGER_PRINT] = GAC_APP_SW_FINGER_INFO;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_app_finger_print_app"
const UI_8 NVM_App_SW_Finger_Print_App[DLC_DID_APPSW_FINGER_PRINT] = GAC_APP_SW_FINGER_INFO;
#pragma ghs section data=default
#pragma ghs enddata


#pragma ghs startdata
#pragma ghs section rodata=".nvm_manufactory_mode"
const UI_8 NVM_Manufactory_Mode = 0xFF;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_logical_did"
const t_logical_did nvm_logical_id;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_dcid"
const uint8 nvm_dcid[DLC_DID_DCID] = GAC_DCID_VALUE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_drive_mode"
const UI_8 NVM_Drive_Mode = 0x0;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_paddle_active"
const UI_8 NVM_Paddle_Configure = 0xAA;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_drive_mode_storage"
const UI_8 NVM_Drive_Storage = 0x39;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_repair_shop_code"
const UI_8 NVM_Repair_Shop_Code[DLC_REPAIR_SHOP_CODE] = GAC_ECU_REPAIR_SHOP_CODE;
#pragma ghs section data=default
#pragma ghs enddata

#pragma ghs startdata
#pragma ghs section rodata=".nvm_last_position"
const UI_8 NVM_Last_Pos_Req = 1;
#pragma ghs section data=default
#pragma ghs enddata

static uint8 RAM_DID_ECU_SN[DLC_DID_ECU_SN];
static uint8 RAM_DID_CD_VIN[DLC_DID_CD_VIN];
static uint8 RAM_DID_CD_MANFAC_SN[DLC_DID_CD_MANFAC_SN];
static uint8 RAM_DID_CD_APP_DATAID[DLC_DID_CD_APP_DATAID];
static uint8 RAM_DID_CD_MANUF_ECUHWNUM[DLC_DID_CD_MANUF_ECUHWNUM];
static uint8 RAM_DID_CD_DTC_SETTING[DLC_DID_DTC_SETTING];
static uint8 RAM_DID_CD_TRANSPORTATION_MODEG[DLC_DID_TRANSPORTATION_MODE];
static uint8 RAM_DID_CD_MTOC[DLC_DID_MTOC];
static uint8 RAM_DID_CD_REPROGRAMMING_COUNTER[DLC_DID_REPROGRAMMING_COUNTER];
static uint8 RAM_DID_CD_REPROGRAMMING_ATTEMPT_COUNTER[DLC_DID_REPROGRAMMING_COUNTER];

static uint8 RAM_DID_CD_ECUMANUFACTURE_DATE[DLC_DID_ECUMANUFACTURE_DATE];
static uint8 RAM_DID_CD_ECUINSTALLATION_DATE[DLC_DID_ECUINSTALLATION_DATE];
//<0610
static uint8 RAM_DID_CD_BOOT_ID[DLC_BOOT_SW_ID];
static uint8 RAM_DID_CD_ECUSW_VERSION[DLC_GAC_ECU_SW_VERSION];
static uint8 RAM_DID_CD_BOOTSW_VERSION[DLC_BOOT_SW_VERSION];



//0610>
static uint8 RAM_DID_CD_APPSW_FINGER_PRINT[DLC_DID_APPSW_FINGER_PRINT];
static uint8 RAM_DRIVE_MODE;
static uint8 RAM_PADDLE_CONFIGURE;
static uint8 RAM_EOL_CONFIGURE;

static t_logical_did RAM_LOGICAL_DID;
static uint8 RAM_DCID[DLC_DID_DCID];

static uint8 RAM_LAST_POSITION = 0;
static uint8 RAM_ATP = 0;
static uint8 RAM_FAA_FLAG = 0;
static uint8 RAM_Manufactory_Mode = 0;
#endif
/* ----------------------------------------------------------------------------
 * Public variables
 */

/* ----------------------------------------------------------------------------
 * Public functions
 */
void UDS_DID_initNVM(void)
{	
	
	memcpy(RAM_DID_CD_VIN, NVM_DID_CD_VIN, DLC_DID_CD_VIN);
	memcpy(RAM_DID_CD_REPROGRAMMING_DATE, NVM_Reprogramming_Date_App,DLC_DID_REPROGRAMMING_DATE);
	memcpy(RAM_DID_CD_SUPPLIER_ID, NVM_DID_CD_SUPPLIER_ID,DLC_SYSTEM_SUPPLIER_ID);
	memcpy(RAM_DID_REPAIR_SHOP_CODE,NVM_Repair_Shop_Code,sizeof(NVM_Repair_Shop_Code));
	memcpy(RAM_DID_CD_HW_VERSION, NVM_DID_CD_HW_VERSION,DLC_GAC_HW_VERSION);
}
//static void onWriteFinished(BOOL ret)
//{
	/* Do Nothing */
//}
t_UDS_ERR Get_DID_ECU_SN(uint8 *data)
{
	//memcpy(data, RAM_DID_ECU_SN, sizeof(RAM_DID_ECU_SN));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_ECU_SN(uint8 *data)
{
	//memcpy(RAM_DID_ECU_SN, data, sizeof(RAM_DID_ECU_SN));
	//ficoNVM_Write_Serial_Number(RAM_DID_ECU_SN, onWriteFinished);

    return TRUE;
}

t_UDS_ERR Get_DID_CD_SYSID_VIN(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_VIN, sizeof(RAM_DID_CD_VIN));
    SmartEE_Read(0x500, data, 17);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_CD_VIN(uint8 *data)
{
	//memcpy(RAM_DID_CD_VIN, data, sizeof(RAM_DID_CD_VIN));
	//ficoNVM_Write_VIN(RAM_DID_CD_VIN, onWriteFinished);
    SmartEE_Write(0x500, data, 17);
    return TRUE;
}

t_UDS_ERR Get_DID_TouchSen1_BaseLine(uint8 *data)
{
    memcpy(data,&g16_DiagTouchPressSenRes[0][0],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen2_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][1],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen3_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][2],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen4_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][3],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen5_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][4],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen6_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][5],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen7_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][6],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen8_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][7],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen9_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][8],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen10_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][9],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen11_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][10],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen12_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][11],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen13_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][12],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen14_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][13],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen15_BaseLine(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[0][14],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen1_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][0],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen2_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][1],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen3_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][2],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen4_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][3],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen5_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][4],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen6_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][5],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen7_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][6],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen8_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][7],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen9_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][8],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen10_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][9],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen11_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][10],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen12_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][11],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen13_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][12],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen14_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][13],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_TouchSen15_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[1][14],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_PressSen_Baseline(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[2][0],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_PressSen_Signal(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[2][1],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Pre_Value(uint8 *data)
{
	memcpy(data,&g16_DiagTouchPressSenRes[2][2],2);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Reprogramming_Date(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_REPROGRAMMING_DATE, sizeof(RAM_DID_CD_REPROGRAMMING_DATE));
    SmartEE_Read(0x517, data, 4);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_Reprogramming_Date(uint8 *data)
{
	
	//memcpy(RAM_DID_CD_REPROGRAMMING_DATE, data, sizeof(RAM_DID_CD_REPROGRAMMING_DATE));
	//ficoNVM_Write_REPROGRAME_DATE(RAM_DID_CD_REPROGRAMMING_DATE, onWriteFinished);
   SmartEE_Write(0x517, data, 4);
    return TRUE;
}


t_UDS_ERR Set_DID_CD_APP_SW_FINGERPRINT(uint8 *data)
{
	//memcpy(RAM_DID_CD_APPSW_FINGER_PRINT, data, sizeof(RAM_DID_CD_APPSW_FINGER_PRINT));
	//ficoNVM_Write_App_FigrPriApp(RAM_DID_CD_APPSW_FINGER_PRINT, onWriteFinished);

    return TRUE;
}

t_UDS_ERR Get_DID_CD_SYSID_MANFAC_SN(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_MANFAC_SN, sizeof(RAM_DID_CD_MANFAC_SN));

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_CD_MANFAC_SN(uint8 *data)
{
	//memcpy(RAM_DID_CD_MANFAC_SN, data, sizeof(RAM_DID_CD_MANFAC_SN));
	//ficoNVM_Write_MANFAC_SN(RAM_DID_CD_MANFAC_SN, onWriteFinished);

    return TRUE;
}

t_UDS_ERR Get_DID_CD_SYSID_APP_DATAID(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_APP_DATAID, sizeof(RAM_DID_CD_APP_DATAID));

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_CD_APP_DATAID(uint8 *data)
{
	//memcpy(RAM_DID_CD_APP_DATAID, data, sizeof(RAM_DID_CD_APP_DATAID));
	//ficoNVM_Write_APP_DATAID(RAM_DID_CD_APP_DATAID, onWriteFinished);

    return TRUE;
}

t_UDS_ERR Get_DID_CD_SYSID_MANUF_ECUHWNUM(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_MANUF_ECUHWNUM, sizeof(RAM_DID_CD_MANUF_ECUHWNUM));

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_CD_MANUF_ECUHWNUM(uint8 *data)
{
	//memcpy(RAM_DID_CD_MANUF_ECUHWNUM, data, sizeof(RAM_DID_CD_MANUF_ECUHWNUM));
	//ficoNVM_Write_MANUF_ECUHWNUM(RAM_DID_CD_MANUF_ECUHWNUM, onWriteFinished);

    return TRUE;
}

t_UDS_ERR Get_DID_Dtc_Setting(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_DTC_SETTING, sizeof(RAM_DID_CD_DTC_SETTING));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Set_DID_Dtc_Setting(uint8 *data)
{
	//memcpy(RAM_DID_CD_DTC_SETTING, data, sizeof(RAM_DID_CD_DTC_SETTING));
	//ficoNVM_Write_Dtc_Setting_Flag(RAM_DID_CD_DTC_SETTING, onWriteFinished);

    return TRUE;
}


t_UDS_ERR Set_DID_Shield_Atp(uint8 *data)
{
	if(data[0] <= 1)
	{
//		shield_atp = data[0];
//		ficoNVM_Write_Shield_ATP_Flag(&shield_atp, onWriteFinished);
	}else{
		return FALSE;
	}
    return TRUE;
}

t_UDS_ERR Set_DID_Repair_Shop_Code(uint8 *data)
{
	//memcpy(RAM_DID_REPAIR_SHOP_CODE,data,sizeof(RAM_DID_REPAIR_SHOP_CODE));
	//ficoNVM_Write_Repair_Shop_Code_Flag(RAM_DID_REPAIR_SHOP_CODE, onWriteFinished);
    SmartEE_Write(0x51B, data, 16);
    return TRUE;
}

t_UDS_ERR Get_DID_Reprogramming_Counter(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_REPROGRAMMING_COUNTER, sizeof(RAM_DID_CD_REPROGRAMMING_COUNTER));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Reprogramming_Attempt_Counter(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_REPROGRAMMING_ATTEMPT_COUNTER, sizeof(RAM_DID_CD_REPROGRAMMING_ATTEMPT_COUNTER));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_EcuManufacture_Date(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_ECUMANUFACTURE_DATE, sizeof(RAM_DID_CD_ECUMANUFACTURE_DATE));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_EcuInstallation_Date(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_ECUINSTALLATION_DATE, sizeof(RAM_DID_CD_ECUINSTALLATION_DATE));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_App_Sw_Finger_Print(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_APPSW_FINGER_PRINT, sizeof(RAM_DID_CD_APPSW_FINGER_PRINT));
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Gac_Hw_Version(uint8 *data)
{
    memcpy(data, RAM_DID_CD_HW_VERSION,DLC_GAC_HW_VERSION);

    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Gac_Ecusw_Version(uint8 *data)
{
    UI_8 sw_num[DLC_GAC_ECU_SW_VERSION] = GAC_ECUSW_VERSION_DEFAULT_VALUE;
    memcpy(data,sw_num,DLC_GAC_ECU_SW_VERSION);
    return ISO15765_3_POSITIVE_RESPONSE;
}


t_UDS_ERR Get_DID_Gac_Spare_Number(uint8 *data)
{
	data[0] = 'A';
	data[1] = 'B';
	data[2] = 'C';
	data[3] = 'D';
	data[4] = 'E';
	data[5] = 'F';
	data[6] = '0';
	data[7] = '1';
	data[8] = '2';
	data[9] = '3';
	data[10] = '4';
	data[11] = '5';
	data[12] = '6';
	data[13] = '7';
	data[14] = '8';
	data[15] = '9';
	data[16] = 'A';
	data[17] = 'B';
	data[18] = 'C';
	data[19] = 'D';
	data[20] = 'E';
//	memcpy(data, RAM_LOGICAL_DID.gac_spare_number,DLC_GAC_SPARE_NUMBER);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_System_Supplier_Id(uint8 *data)
{
    memcpy(data, RAM_DID_CD_SUPPLIER_ID,DLC_SYSTEM_SUPPLIER_ID);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Gac_Kit_Part_Number(uint8 *data)
{
	data[0] = 'A';
	data[1] = 'K';
	data[2] = 'C';
	data[3] = 'G';
	data[4] = '-';
	data[5] = '0';
	data[6] = '0';
	data[7] = '7';
	data[8] = 'X';
	data[9] = '-';
	data[10] = 'A';
	data[11] = '1';
	data[12] = ' ';
	data[13] = ' ';
	//	memcpy(data, RAM_LOGICAL_DID.gac_kit_assembly_part_number,DLC_GAC_KIT_PART_NUMBER);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_System_Name(uint8 *data)
{
	//memcpy(data, RAM_LOGICAL_DID.system_name,DLC_SYSTEM_NAME);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Uds_Protol_Version(uint8 *data)
{
	//memcpy(data, RAM_LOGICAL_DID.uds_protol_version,DLC_UDS_PROTOL_VERSION);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Boot_Version(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_BOOTSW_VERSION,DLC_BOOT_SW_VERSION);
    return ISO15765_3_POSITIVE_RESPONSE;
}
t_UDS_ERR Get_DID_Boot_ID(uint8 *data)
{
	//memcpy(data, RAM_DID_CD_BOOT_ID,sizeof(RAM_DID_CD_BOOT_ID));
    return ISO15765_3_POSITIVE_RESPONSE;
}


t_UDS_ERR Get_DID_DCID(uint8 *data)
{
	//memcpy(data, RAM_DCID,DLC_DID_DCID);
    return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_Shield_Atp(uint8 *data)
{
//	data[0] = shield_atp;
	return ISO15765_3_POSITIVE_RESPONSE;
}

t_UDS_ERR Get_DID_GAC_Repair_Shop_Id(uint8 *data)
{
	//memcpy(data, RAM_DID_REPAIR_SHOP_CODE,DLC_REPAIR_SHOP_CODE);
    SmartEE_Read(0x51B, data, 16);
	return ISO15765_3_POSITIVE_RESPONSE;
}


//t_UDS_ERR Set_DID_CD_Drive_Mode_Configure(uint8 *data)
//{
//	EOL_config = *((st_eol_config *)data);
//    paddle_active = EOL_config.paddle_config;
//
//	ficoNVM_Write_Drive_Mode_Configure((uint8*)(&EOL_config), onFinishedDriveConfig);
//
//    return TRUE;
//}

//uint8 GetLastPosition(void)
//{
	//return RAM_LAST_POSITION;
//}

//uint8* GetNvmDtcSetting(void)
//{
	//return RAM_DID_CD_DTC_SETTING;
//}

/* ----------------------------------------------------------------------------
 * Private functions
 */

