- fixed problem in data set creation for C# API

pull/6/head
Michael Zillgith 11 years ago
parent 9f3854fbfb
commit ca9cff0c90

@ -127,10 +127,10 @@ namespace IEC61850
static extern void IedConnection_installConnectionClosedHandler (IntPtr self, InternalConnectionClosedHandler handler, IntPtr parameter);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr IedConnection_readDataSetValues (IntPtr self, out int error, string dataSetReference, IntPtr dataSet);
static extern IntPtr IedConnection_readDataSetValues (IntPtr self, out int error, [MarshalAs(UnmanagedType.LPStr)] string dataSetReference, IntPtr dataSet);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr IedConnection_createDataSet (IntPtr self, out int error, string dataSetReference, IntPtr dataSet);
static extern IntPtr IedConnection_createDataSet (IntPtr self, out int error, [MarshalAs(UnmanagedType.LPStr)] string dataSetReference, IntPtr dataSet);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void IedConnection_deleteDataSet (IntPtr self, out int error, string dataSetReference);
@ -861,7 +861,7 @@ namespace IEC61850
IntPtr linkedList = LinkedList_create ();
foreach (string dataSetElement in dataSetElements) {
IntPtr handle = System.Runtime.InteropServices.Marshal.StringToHGlobalAuto (dataSetElement);
IntPtr handle = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi (dataSetElement);
LinkedList_add (linkedList, handle);
}

@ -12,12 +12,13 @@ namespace datasets
{
IedConnection con = new IedConnection ();
string hostname;
if (args.Length > 0)
hostname = args[0];
else
hostname = "localhost";
string hostname;
if (args.Length > 0)
hostname = args[0];
else
hostname = "10.0.2.2";
//hostname = "localhost";
Console.WriteLine("Connect to " + hostname);
@ -36,13 +37,13 @@ namespace datasets
List<string> dataSetElements = new List<string>();
dataSetElements.Add("IEDM1CPUBHKW/DRCS1.ModOnConn.stVal[ST]");
dataSetElements.Add("IEDM1CPUBHKW/DRCS1.ModOnConn.t[ST]");
dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn1.mag.f[MX]");
dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn2.mag.f[MX]");
con.CreateDataSet("IEDM1CPUBHKW/LLN0.ds1", dataSetElements);
con.CreateDataSet("simpleIOGenericIO/LLN0.ds1", dataSetElements);
// get the directory of the data set
List<string> dataSetDirectory = con.GetDataSetDirectory("IEDM1CPUBHKW/LLN0.ds1");
List<string> dataSetDirectory = con.GetDataSetDirectory("simpleIOGenericIO/LLN0.ds1");
foreach (string entry in dataSetDirectory)
{
@ -50,7 +51,7 @@ namespace datasets
}
// read the values of the newly created data set
DataSet dataSet = con.ReadDataSetValues("IEDM1CPUBHKW/LLN0.ds1", null);
DataSet dataSet = con.ReadDataSetValues("simpleIOGenericIO/LLN0.ds1", null);
MmsValue dataSetValues = dataSet.GetValues();
@ -62,7 +63,7 @@ namespace datasets
// delete the data set
con.DeleteDataSet("IEDM1CPUBHKW/LLN0.ds1");
con.DeleteDataSet("simpleIOGenericIO/LLN0.ds1");
con.Abort();
}

@ -45,7 +45,8 @@ namespace reporting
if (args.Length > 0)
hostname = args [0];
else
hostname = "localhost";
//hostname = "localhost";
hostname = "172.23.44.10";
Console.WriteLine ("Connect to " + hostname);

@ -111,8 +111,6 @@ public class DataModelValue {
public void updateEnumOrdValue(TypeDeclarations typeDecls)
{
if (enumType != null) {
System.out.println("Lookup enum type " + enumType);
SclType sclType = typeDecls.lookupType(enumType);

@ -46,32 +46,6 @@ public class EnumerationType extends SclType {
static List<EnumerationType> getDefaultEnumTypes() {
LinkedList<EnumerationType> defaultTypes = new LinkedList<EnumerationType>();
// EnumerationType type = new EnumerationType("Tcmd");
// type.addEnumValue(new EnumerationValue("stop", 0));
// type.addEnumValue(new EnumerationValue("lower", 1));
// type.addEnumValue(new EnumerationValue("higher", 2));
// type.addEnumValue(new EnumerationValue("reserved", 3));
//
// defaultTypes.add(type);
/*
<EnumType id="Dbpos">
<EnumVal ord="0">intermediate-state</EnumVal>
<EnumVal ord="1">off</EnumVal>
<EnumVal ord="2">on</EnumVal>
<EnumVal ord="3">bad-state</EnumVal>
</EnumType>
*/
// type = new EnumerationType("Dbpos");
// type.addEnumValue(new EnumerationValue("intermediate-state", 0));
// type.addEnumValue(new EnumerationValue("intermediate", 0)); /* for compatibility with older SCL files */
// type.addEnumValue(new EnumerationValue("off", 1));
// type.addEnumValue(new EnumerationValue("on", 2));
// type.addEnumValue(new EnumerationValue("bad-state", 3));
//
// defaultTypes.add(type);
return defaultTypes;
}

@ -287,9 +287,9 @@ public class DynamicModelGenerator {
if (value == null) {
value = dataAttribute.getDefinition().getValue();
// if (value != null)
// if (value.getValue() == null)
// value.updateEnumOrdValue(ied.getTypeDeclarations());
if (value != null)
if (value.getValue() == null)
value.updateEnumOrdValue(ied.getTypeDeclarations());
}
if (value != null) {

Loading…
Cancel
Save