- changed .net API IsoConnectionParameters class to reflect 16 byte session selectors.

pull/6/head
Michael Zillgith 10 years ago
parent 7a8bd5dabe
commit a178e50052

@ -50,6 +50,15 @@ namespace IEC61850
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)] public byte[] value;
}
[StructLayout(LayoutKind.Sequential)]
private struct NativeSSelector
{
public byte size;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=16)] public byte[] value;
}
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern void IsoConnectionParameters_destroy(IntPtr self);
@ -57,13 +66,13 @@ namespace IEC61850
private static extern void IsoConnectionParameters_setRemoteApTitle(IntPtr self, string apTitle, int aeQualifier);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern void IsoConnectionParameters_setRemoteAddresses(IntPtr self, UInt32 pSelector, UInt16 sSelector, NativeTSelector tSelector);
private static extern void IsoConnectionParameters_setRemoteAddresses(IntPtr self, UInt32 pSelector, NativeSSelector sSelector, NativeTSelector tSelector);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern void IsoConnectionParameters_setLocalApTitle(IntPtr self, string apTitle, int aeQualifier);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern void IsoConnectionParameters_setLocalAddresses(IntPtr self, UInt32 pSelector, UInt16 sSelector, NativeTSelector tSelector);
private static extern void IsoConnectionParameters_setLocalAddresses(IntPtr self, UInt32 pSelector, NativeSSelector sSelector, NativeTSelector tSelector);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern void IsoConnectionParameters_setAcseAuthenticationParameter(IntPtr self, IntPtr acseAuthParameter);
@ -123,7 +132,7 @@ namespace IEC61850
/// <param name='tSelector'>
/// ISO COTP transport layer address
/// </param>
public void SetRemoteAddresses (UInt32 pSelector, UInt16 sSelector, byte[] tSelector)
public void SetRemoteAddresses (UInt32 pSelector, byte[] sSelector, byte[] tSelector)
{
if (tSelector.Length > 4)
throw new ArgumentOutOfRangeException("tSelector", "maximum size (4) exceeded");
@ -135,7 +144,14 @@ namespace IEC61850
for (int i = 0; i < tSelector.Length; i++)
nativeTSelector.value[i] = tSelector[i];
IsoConnectionParameters_setRemoteAddresses(self, pSelector, sSelector, nativeTSelector);
NativeSSelector nativeSSelector;
nativeSSelector.size = (byte) sSelector.Length;
nativeSSelector.value = new byte[16];
for (int i = 0; i < sSelector.Length; i++)
nativeSSelector.value [i] = sSelector [i];
IsoConnectionParameters_setRemoteAddresses(self, pSelector, nativeSSelector, nativeTSelector);
}
/// <summary>
@ -164,7 +180,7 @@ namespace IEC61850
/// <param name='tSelector'>
/// ISO COTP transport layer address
/// </param>
public void SetLocalAddresses (UInt32 pSelector, UInt16 sSelector, byte[] tSelector)
public void SetLocalAddresses (UInt32 pSelector, byte[] sSelector, byte[] tSelector)
{
if (tSelector.Length > 4)
throw new ArgumentOutOfRangeException("tSelector", "maximum size (4) exceeded");
@ -176,7 +192,14 @@ namespace IEC61850
for (int i = 0; i < tSelector.Length; i++)
nativeTSelector.value[i] = tSelector[i];
IsoConnectionParameters_setLocalAddresses(self, pSelector, sSelector, nativeTSelector);
NativeSSelector nativeSSelector;
nativeSSelector.size = (byte) sSelector.Length;
nativeSSelector.value = new byte[16];
for (int i = 0; i < sSelector.Length; i++)
nativeSSelector.value [i] = sSelector [i];
IsoConnectionParameters_setLocalAddresses(self, pSelector, nativeSSelector, nativeTSelector);
}
/// <summary>

Loading…
Cancel
Save