UDS_14Service_Filter.c 2.25 KB
Newer Older
罗洪旭's avatar
罗洪旭 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
#include "UDS_14Service_Filter.h"

/**
  *14服务是否支持功能寻址
  *功能寻址下屏蔽该负反馈
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC11(void)
{
    uint8_t NRC = positiveResponse;
    return NRC;
}

/**
  *14服务会话是否支持验证
  *功能寻址下屏蔽该负反馈
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC7F(void)
{
    uint8_t NRC = positiveResponse;
    return NRC;
}

/**
  *14服务解锁等级验证
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC33(void)
{
    uint8_t NRC = positiveResponse;
    return NRC;
}

/**
  *14服务最小长度验证
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC13_MinLengthCheck(void)
{
    uint8_t NRC = positiveResponse;
    if ( DiagMSG.msgDLC < 3u )
    {
        NRC = incorrectMessageLength;
        UDS_Service_Response(0x14u, NEGATIVE_RSP, DIAG_ID_Tx, 1u, ( uint8_t * )&NRC);
    }
    else
    {
        NRC = positiveResponse;
    }
    return NRC;
}

/**
  *14服务超出请求范围验证
  *功能寻址下屏蔽该负反馈
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC31(void)
{
    uint8_t NRC = positiveResponse;
    if ( DiagMSG.msgData.S14Detail.Parameter == 0xFFFFFFu )
    {
        NRC = positiveResponse;
    }
    else
    {
        NRC = requestOutOfRange;
        if ( DiagMSG.msgID == DIAG_ID_Rx_PHY )
        {
            UDS_Service_Response(0x14u, NEGATIVE_RSP, DIAG_ID_Tx, 1u, ( uint8_t * )&NRC);
        }
    }
    return NRC;
}

/**
  *14服务总长度长度验证
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC13_TotalLengthCheck(void)
{
    uint8_t NRC = positiveResponse;
    if ( DiagMSG.msgDLC != 3u )
    {
        NRC = incorrectMessageLength;
        UDS_Service_Response(0x14u, NEGATIVE_RSP, DIAG_ID_Tx, 1u, ( uint8_t * )&NRC);
    }
    else
    {
        NRC = positiveResponse;
    }
    return NRC;
}

/**
  *14服务条件验证
  *@return 负反馈编号
  */
uint8_t UDS_14Service_NRC22(void)
{
    uint8_t NRC = positiveResponse;
    if ( getSpeed( ) >= 3u )
    {
        NRC = conditionsNotCorrect;
        UDS_Service_Response(0x14u, NEGATIVE_RSP, DIAG_ID_Tx, 1u, ( uint8_t * )&NRC);
    }
    else if ( getESpeed( ) > 400u )
    {
        NRC = conditionsNotCorrect;
        UDS_Service_Response(0x14u, NEGATIVE_RSP, DIAG_ID_Tx, 1u, ( uint8_t * )&NRC);
    }
    else
    {
        NRC = positiveResponse;
    }
    return NRC;
}