Skip to content

Commit 45296e8

Browse files
authored
Merge pull request #244 from lzaslav/develop
Address missed changes and crash in Visualizer
2 parents b7e3b32 + 1bc4477 commit 45296e8

File tree

4 files changed

+54
-10
lines changed

4 files changed

+54
-10
lines changed

ISOv4Plugin/Mappers/DeviceMapper.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,10 @@ public interface IDeviceMapper
3333
public class DeviceMapper : BaseMapper, IDeviceMapper
3434
{
3535
DeviceElementMapper _deviceElementMapper;
36-
private readonly IManufacturer _manufacturer;
3736

3837
public DeviceMapper(TaskDataMapper taskDataMapper) : base(taskDataMapper, "DVC")
3938
{
4039
_deviceElementMapper = new DeviceElementMapper(taskDataMapper);
41-
42-
_manufacturer = ManufacturerFactory.GetManufacturer(taskDataMapper);
4340
}
4441

4542
#region Export

ISOv4Plugin/Mappers/TaskDataMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ public ApplicationDataModel.ADM.ApplicationDataModel Import(ISO11783_TaskData ta
507507
}
508508
}
509509

510-
var manufacturer = ManufacturerFactory.GetManufacturer(this);
511-
manufacturer?.PostProcessModel(AdaptDataModel, DeviceElementHierarchies);
510+
var manufacturer = ManufacturerFactory.GetManufacturer(this);
511+
manufacturer?.PostProcessModel(AdaptDataModel, DeviceElementHierarchies);
512512

513513
return AdaptDataModel;
514514
}

ISOv4Plugin/ObjectModel/DeviceElementHierarchy.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
2121
{
2222
public class DeviceElementHierarchies
2323
{
24-
private readonly IManufacturer _manufacturer;
25-
2624
public DeviceElementHierarchies(IEnumerable<ISODevice> devices,
2725
RepresentationMapper representationMapper,
2826
bool mergeBins,
@@ -35,6 +33,8 @@ public DeviceElementHierarchies(IEnumerable<ISODevice> devices,
3533
//Track any device element geometries not logged as a DPT
3634
Dictionary<string, List<string>> missingGeometryDefinitions = new Dictionary<string, List<string>>();
3735

36+
var manufacturer = ManufacturerFactory.GetManufacturer(taskDataMapper);
37+
3838
foreach (ISODevice device in devices)
3939
{
4040
ISODeviceElement rootDeviceElement = device.DeviceElements.SingleOrDefault(det => det.DeviceElementType == ISODeviceElementType.Device);
@@ -44,7 +44,7 @@ public DeviceElementHierarchies(IEnumerable<ISODevice> devices,
4444
hierarchyElement.HandleBinDeviceElements();
4545
Items.Add(device.DeviceId, hierarchyElement);
4646

47-
_manufacturer?.ProcessDeviceElementHierarchy(hierarchyElement, missingGeometryDefinitions);
47+
manufacturer?.ProcessDeviceElementHierarchy(hierarchyElement, missingGeometryDefinitions);
4848
}
4949
}
5050

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using AgGateway.ADAPT.ApplicationDataModel.Equipment;
34
using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
@@ -6,11 +7,57 @@
67

78
namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
89
{
9-
internal class ISOOperationData : OperationData
10+
internal class ISOOperationData : OperationData, IConvertible
1011
{
1112
/// <summary>
1213
/// An internal list of DeviceElementUses that are may be updated during import; not exposed on the public interface.
1314
/// </summary>
1415
internal List<DeviceElementUse> DeviceElementUses { get; set; } = new List<DeviceElementUse>();
16+
17+
#region IConvertible impelementation
18+
public TypeCode GetTypeCode()
19+
{
20+
return TypeCode.Object;
21+
}
22+
23+
public bool ToBoolean(IFormatProvider provider) => throw new NotImplementedException();
24+
25+
public byte ToByte(IFormatProvider provider) => throw new NotImplementedException();
26+
27+
public char ToChar(IFormatProvider provider) => throw new NotImplementedException();
28+
29+
public DateTime ToDateTime(IFormatProvider provider) => throw new NotImplementedException();
30+
31+
public decimal ToDecimal(IFormatProvider provider) => throw new NotImplementedException();
32+
33+
public double ToDouble(IFormatProvider provider) => throw new NotImplementedException();
34+
35+
public short ToInt16(IFormatProvider provider) => throw new NotImplementedException();
36+
37+
public int ToInt32(IFormatProvider provider) => throw new NotImplementedException();
38+
39+
public long ToInt64(IFormatProvider provider) => throw new NotImplementedException();
40+
41+
public sbyte ToSByte(IFormatProvider provider) => throw new NotImplementedException();
42+
43+
public float ToSingle(IFormatProvider provider) => throw new NotImplementedException();
44+
45+
public string ToString(IFormatProvider provider) => throw new NotImplementedException();
46+
47+
public object ToType(Type conversionType, IFormatProvider provider)
48+
{
49+
if (conversionType == typeof(ISOOperationData) || conversionType == typeof(OperationData))
50+
{
51+
return this;
52+
}
53+
throw new NotImplementedException();
54+
}
55+
56+
public ushort ToUInt16(IFormatProvider provider) => throw new NotImplementedException();
57+
58+
public uint ToUInt32(IFormatProvider provider) => throw new NotImplementedException();
59+
60+
public ulong ToUInt64(IFormatProvider provider) => throw new NotImplementedException();
61+
#endregion
1562
}
16-
}
63+
}

0 commit comments

Comments
 (0)