/*
 *
 * Copyright (C) 2020-2022 Qing.zhou
 *
 *
 */

#ifndef __UDS_SERVICETYPE_H__
#define __UDS_SERVICETYPE_H__
/* -------------------------------- Includes -------------------------------- */
/* external head files */
//#include "Global.h"
#include "Std_Types.h"
/* internal head files */



/* -------------------------------- Defines --------------------------------- */

/* -------------------------------- Macros ---------------------------------- */

/* ------------------------------- Data Types ------------------------------- */
typedef uint8 t_UDS_ERR;
typedef uint8 t_UDS_Session;

#ifndef uint8_t 
typedef  unsigned char uint8_t;
#endif

#ifndef uint16_t 
typedef  unsigned short uint16_t;
#endif

typedef struct{
    t_UDS_ERR        (*ImplReturn)(uint8 * buf_data_rx);                /*return control to ECU implement*/
    t_UDS_ERR        (*ImplDefault)(uint8 * buf_data_rx);               /*reset to default implement*/
    t_UDS_ERR        (*ImplFreeze)(uint8 * buf_data_rx);                /*freeze current state implement*/
    t_UDS_ERR        (*ImplControl)(uint8 * buf_data_rx);               /*Short term adjustment  implement*/
}t_UDSIOcontrolParameter;

typedef struct{
    t_UDS_ERR        (*ImplStart)(void);                                /*start routine implement*/
    t_UDS_ERR        (*ImplStop)(void);                                 /*stop routine implement*/
    t_UDS_ERR        (*ImplReq)(void);                                  /*request resuolt routine implement*/
}t_UDSRoutineControlParameter;

typedef struct {
    uint16_t                    did;
    uint16_t                    size;                                   /* size is the control status record without io control type */
    t_UDS_Session               allowed_session;
    uint8                       security;                               /*Security access level of each did*/
    t_UDSIOcontrolParameter     func_impl;
} t_UDSIOControlSubCommands;

typedef struct {
    uint16_t                        did;
    uint16_t                        size;                                /* size is the */
    t_UDS_Session                   allowed_session;
    uint8                           security;                            /*Security access level of each did*/
    t_UDSRoutineControlParameter    func_impl;
} t_UDSRoutineControlCommands;

typedef struct {
    uint16_t        did;
    uint16_t        size;
    t_UDS_Session   allowed_session;
    t_UDS_ERR       (*Getter)(uint8 * buf_data_rx);
} t_UDSReadDidSubCommands;

typedef struct {
    uint16          did;
    uint16          size;
    t_UDS_Session   allowed_session;
    uint8           security;                                            /*Security access level of each did*/
    t_UDS_ERR       (*Setter)(uint8 * buf_data_rx);

} t_UDSWriteDiDSubCommandsReference;

/* ---------------------------- Global Variables ---------------------------- */

/* -------------------------- Function declaration -------------------------- */

#endif /* __UDS_SERVICETYPE_H */
