Hello,
"TLINClientParam" enumeration has "clpOnReceiveEventHandle" for setting handle for the receive event.
However, It is not used in the samples inside PLinAPI. Also, it is not documented in the GetClientParam and SetClientParam functions. Supported client parameters are documented for GetClientParam and SetClientParam. "clpOnReceiveEventHandle" is not included.
So, my question: "clpOnReceiveEventHandle" really supported by SetClientParam function?
Thanks,
Murat
Does TLINClientParam.clpOnReceiveEventHandle really work?
-
- Posts: 14
- Joined: Wed 29. Jun 2016, 14:07
Re: Does TLINClientParam.clpOnReceiveEventHandle really work?
Hello Murat,
it seems as this parameter, clpOnReceiveEventHandle , as well as clpOnPluginEventHandle were forgotten to be included in the documentation of LIN_GetCleintParam and LIN_SetClientParam. I nevertheless can confirm, that these parameters are supported by both functions (and class methods).
The samples use the timer approach, so that the use of those parameter was not needed. Here is an example on how to set and get the parameter in C#:
PLinApi.SetClientParam
PLinApi.GetClientParam
You need to use a thread to wait for the event signalization, when a message is received
I hope this helps you. Thanks for bringing this to our attention.
it seems as this parameter, clpOnReceiveEventHandle , as well as clpOnPluginEventHandle were forgotten to be included in the documentation of LIN_GetCleintParam and LIN_SetClientParam. I nevertheless can confirm, that these parameters are supported by both functions (and class methods).
The samples use the timer approach, so that the use of those parameter was not needed. Here is an example on how to set and get the parameter in C#:
PLinApi.SetClientParam
Code: Select all
// Member variable definition
System.Threading.AutoResetEvent m_Event;
...
// Member variable initialization
m_Event = new System.Threading.AutoResetEvent(false);
...
// Configuring reception event
...
int buffer = m_Event.SafeWaitHandle.DangerousGetHandle().ToInt32();
if (Peak.Lin.PLinApi.SetClientParam(m_hClient, Peak.Lin.TLINClientParam.clpOnReceiveEventHandle, buffer) == Peak.Lin.TLINError.errOK)
MessageBox.Show("Handle was Configured: " + buffer.ToString());
else
MessageBox.Show("Error configuring event handle ");
...
Code: Select all
// Retrieving reception event
int buffer;
if (Peak.Lin.PLinApi.GetClientParam(m_hClient, Peak.Lin.TLINClientParam.clpOnReceiveEventHandle, out buffer, 4) == Peak.Lin.TLINError.errOK)
MessageBox.Show("Configured handle: " + buffer.ToString());
else
MessageBox.Show("Error retrieving event handle ");
Code: Select all
System.Threading.Thread m_Thread;
...
m_Thread = new System.Threading.Thread(DoRead);
m_Thread.IsBackground = true;
m_Thread.Start();
...
private void DoRead()
{
while (true)
{
if(m_Event.WaitOne(50))
ReadMessages();
}
}
Best regards,
Keneth
Keneth
-
- Posts: 14
- Joined: Wed 29. Jun 2016, 14:07
Re: Does TLINClientParam.clpOnReceiveEventHandle really work?
Thank you Keneth for quick and perfect response.
Re: Does TLINClientParam.clpOnReceiveEventHandle really work?
you are welcome. Closed.
Best regards,
Keneth
Keneth