Hello nuno,
There is an error on the .NET declaration of the function SetSchedule. The Problem is the marshaling of the array that contains the schedule slots.
For C#, please change this definition In the PLinApi.cs file:
Code: Select all
[DllImport("plinapi.dll", EntryPoint = "LIN_SetSchedule")]
public static extern TLINError SetSchedule(
HLINCLIENT hClient,
HLINHW hHw,
int iScheduleNumber,
[MarshalAs(UnmanagedType.LPArray)]
[In, Out] TLINScheduleSlot pSchedule,
int iSlotCount);
for this other:
Code: Select all
[DllImport("plinapi.dll", EntryPoint = "LIN_SetSchedule")]
public static extern TLINError SetSchedule(
HLINCLIENT hClient,
HLINHW hHw,
int iScheduleNumber,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)]
[In, Out]TLINScheduleSlot[] pSchedule,
int iSlotCount);
That should solve the problem. You have now to change your code in order to give an array of slots to the function:
Code: Select all
Peak.Lin.TLINScheduleSlot[] t;
t = new Peak.Lin.TLINScheduleSlot[10];
t[0].Delay = 10;
t[0].Type = Peak.Lin.TLINSlotType.sltUnconditional;
t[0].FrameId = new Byte[8];
t[0].FrameId[0] = (byte)0x0b;
Peak.Lin.PLinApi.SetSchedule(m_hClient, m_hHw, 0, t, 10);
Peak.Lin.PLinApi.StartSchedule(m_hClient, m_hHw, 0);
Now your code should work. Thank you for reporting this.