You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.9 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace USB2XXX
{
class LIN_UDS
{
//LIN UDS地址定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct LIN_UDS_ADDR
{
public Byte ReqID; //请求报文ID。
public Byte ResID; //应答报文ID。
public Byte NAD; //节点地址0x7F为广播地址
public Byte CheckType; //0-标准1-增强
public Byte STmin; //连续帧时间间隔,单位为毫秒
};
//函数返回错误代码定义
public const Int32 LIN_UDS_OK = 0;
public const Int32 LIN_UDS_TRAN_USB = -98;
public const Int32 LIN_UDS_TRAN_CAN = -99;
public const Int32 LIN_UDS_TIMEOUT_A = -100;
public const Int32 LIN_UDS_TIMEOUT_Bs = -101;
public const Int32 LIN_UDS_TIMEOUT_Cr = -102;
public const Int32 LIN_UDS_WRONG_SN = -103;
public const Int32 LIN_UDS_INVALID_FS = -104;
public const Int32 LIN_UDS_UNEXP_PDU = -105;
public const Int32 LIN_UDS_WFT_OVRN = -106;
public const Int32 LIN_UDS_BUFFER_OVFLW = -107;
public const Int32 LIN_UDS_ERROR = -108;
//LIN UDS相关函数定义
[DllImport("USB2XXX.dll")]
public static extern Int32 LIN_UDS_Request(Int32 DevHandle,Byte LINIndex,ref LIN_UDS_ADDR pUDSAddr,Byte[] pReqData,Int32 DataLen);
[DllImport("USB2XXX.dll")]
public static extern Int32 LIN_UDS_Response(Int32 DevHandle,Byte LINIndex,ref LIN_UDS_ADDR pUDSAddr,Byte[] pResData,Int32 TimeOutMs);
[DllImport("USB2XXX.dll")]
public static extern Int32 LIN_UDS_GetMsgFromUDSBuffer(Int32 DevHandle,Byte LINIndex,IntPtr pCanGetMsg,Int32 BufferSize);
}
}