SetISO15765RxParameters
Method - intrepidcs API
C/C++ declare -
VB declare - VB.NET declare - C#
declare - Parameters - Return
Values - Remarks - C/C++ example
- VB example - VB.NET example
- C# example
This method sets the parameters necessary to control the CAN ISO15765-2 network layer message reception.
void
_stdcall icsneoSetISO15765RxParameters(int hObject,Public Declare Sub icsneoSetISO15765RxParameters
Lib "icsneo40.dll" _
(ByVal hObject As Long, _
ByVal lNetwork As Long,_
ByVal lEnable As Long, _
ByRef pFF_CFMsgFilter As
spyFilterLong, _
ByRef pFlowCTxMsg As
icsSpyMessage, _
ByVal lCFTimeOutMs As Long, _
ByVal lFlowCBlockSize As
Long, _
ByVal lUsesExtendedAddressing As
Long, _
ByVal lUseHardwareIfPresent As
Long)
Visual Basic .NET Declare
Public
Declare Sub
icsneoSetISO15765RxParameters Lib
"icsneo40.dll" _
(ByVal
hObject As Integer,
_
ByVal iNetwork As
Integer, _
ByVal
iEnable As Integer, _
ByRef
pFF_CFMsgFilter As
spyFilterLong, _
ByRef
pFlowCTxMsg As
icsSpyMessage, _
ByVal
lCFTimeOutMs As Integer,
_
ByVal
lFlowCBlockSize As Integer,
ByVal
lUsesExtendedAddressing As
Integer, _
ByVal
lUseHardwareIfPresent As
Integer)
[DllImport("icsneo40.dll")]
hObject
[in] Specifies the driver object created by OpenNeoDevice.
lNetwork
[in] Specifies which CAN neoVI network used for setup
parameters. Can be one of the following values: NETID_HSCAN = 1, NETID_MSCAN =
2, NETID_SWCAN = 3, and NETID_LSFTCAN = 4.
lEnable
[in] If lEnable is 1 ISO15765 services are enabled for this
network. If zero they are disabled.
pFF_CFMsgFilter
[in] Specifies the filter used to identify both First Frame
and Consecutive Frame messages. Fill in the ArbID only in the filter. If
extended addressing is used, also fill in byte 1.
pFlowCTxMsg
[in] Specifies the message transmitted as the Flow Control
frame. This frame should be entirely filled in. This includes the FS
(FlowStatus), BS (BlockStatus), and STMin (separation time minimum) parameters.
The BS parameter should match what is supplied
in the lFlowCBlockSize argument.
lCFTimeOutMs
[in] Specifies how long to wait for CF (Consecutive Frames)
from the transmitter of the message sequence before aborting the transmission.
lFlowCBlockSize
[in] Indicates the interval at which the Flow control is sent
out. For example, if set to three, the FC frame will be transmitted every three
received CF frames. If set to zero, the only time the FC frame will be sent out
will be when it receives the FF (First Frame).
lUsesExtendedAddressing
[in] Indicates the the messaging uses extended or mixed addressing. In
this case, the first data byte includes address data and the N_PCI info (Network Protocol
Control Information) starts at the second byte.
lUseHardwareIfPresent
[in] Currently not supported.
None.
This function will setup the hardware to accept receive multi-frame messages as defined in ISO15765-2. A call to this function will reset the receive engine to monitor for first frame messages. The receive engine can be monitored by calling the GetISO15765Status method.
Examples
Dim stFilter As spyFilterLong
Dim stMsg As icsSpyMessage
'// filter
stFilter.Header = &H777
stFilter.HeaderMask = &HFFF
'// flow control frame
stMsg.ArbIDOrHeader = &H641
stMsg.NumberBytesData = 8
stMsg.StatusBitField = 2
stMsg.Data(1) = &H30 'flow control frame
stMsg.Data(2) = 3 'block size
stMsg.Data(3) = 0 'stmin =0
Call icsneoSetISO15765RxParameters(m_hObject, NETID_HSCAN, 1, stFilter, stMsg, 100, 0, 0, 0)
spyFilterLong FF_CFMSGFilter;
icsSpyMessage FlowCTxMsg;
//
reset the structures to zeromemset(&FF_CFMSGFilter,0,
sizeof(FF_CFMSGFilter));// setup the filter
FF_CFMSGFilter.Header = 0x7E8;
FF_CFMSGFilter.HeaderMask = 0xFFF;
FlowCTxMsg.StatusBitField=2;
FlowCTxMsg.NumberBytesData =8;
FlowCTxMsg.ArbIDOrHeader = 0x641;
FlowCTxMsg.Data[0] = 0x30;
// setup rx on HSCAN
with 100 ms timeout and 3 block size
SetISO15765RxParameters(hObject, NETID_HSCAN, true,&FF_CFMSGFilter,
&FlowCTxMsg,100 , 3,0,0);
C# Example
spyFilterLong stFilter;
icsSpyMessage stMsg;
//Check to see if the port is open
if(m_bPortOpen != true)
{
MessageBox.Show("Port is not open");
return;
}
//Set the
filter up
stFilter.Header = ConvertFromHex(txtFirstFrame.Text);
stFilter.HeaderMask = ConvertFromHex("FFF");
//Set the Flow Control Frame Properties
stMsg.ArbIDOrHeader = ConvertFromHex(txtFlowControl.Text);
stMsg.NumberBytesData = 8;
stMsg.StatusBitField = 2;
stMsg.Data1 = Convert.ToByte(ConvertFromHex("30")); //flow
control frame
stMsg.Data2 = 3; //block size
stMsg.Data3 = 0; //stmin =0
//Set the established parameters
icsNeoDll.icsneoSetISO15765RxParameters(m_hObject, 1, 1,out
stFilter, out stMsg,
100, 0, 0, 0);
Visual Basic .NET Example
Dim
stFilter As
spyFilterLong
Dim stMsg As
icsSpyMessage
'//Check to see if the port is open
If Not
m_bPortOpen Then
MsgBox("Port is not open.")
Exit
Sub
End If
'//Set the filter up
stFilter.Header = "&H" & txtFirstFrame.Text
stFilter.HeaderMask = &HFFF
'//Set the Flow Control Frame Properties
stMsg.ArbIDOrHeader = "&H" & txtFlowControl.Text
stMsg.NumberBytesData = 8
stMsg.StatusBitField = 2
stMsg.Data1 = &H30 'flow control frame
stMsg.Data2 = 3 'block size
stMsg.Data3 = 0 'stmin =0
'//Set the established parameters
Call
icsneoSetISO15765RxParameters(m_hObject, 1, 1, stFilter, stMsg, 100, 0, 0, 0)
intrepidcs API Documentation - (C) Copyright 2000-2012 Intrepid Control Systems, Inc. (www.intrepidcs.com) |
Last Updated : Wednesday, September 17, 2008