Skip to content
Permalink
Browse files

[ifm] Fixes & persistent app (#231)

* [ifm] Fixes related to CameraSettingsControl.

* readonly params: backgrounddistance & integrationtimemode

* keep using existing MetriCam App & add exposure ratio property (only works in moderate exposure mode)

* fix header offsets for newest ifm firmware & change ip address property to be more consistent with other camera implementations

* all properties other than IP immutable when not connected & fix IP property desc

* set parameters in connect impl only when creating a new application

* throw exceptions when accessing properties when not connected

Co-authored-by: sisiplac <simon.placht@metrilus.de>
  • Loading branch information
jangernert and sisiplac committed Feb 19, 2020
1 parent 49ccd81 commit 40c7d71fb111e0de8f70454656fc630acd345cb3

Large diffs are not rendered by default.

@@ -0,0 +1,76 @@
using System;
using System.ComponentModel;
using System.Reflection;

namespace MetriCam2.Cameras
{
/// <summary>
/// ifm O3D3xx Trigger Modes
/// </summary>
public enum O3D3xxTriggerMode
{
FreeRun = 1,
ProcessInterface = 2,
PositiveEdge = 3,
NegatigeEdge = 4,
PositiveAndNegativeEdge = 5,
}

public enum O3D3xxIntegrationMode
{
[Description("low")]
SingleIntegrationTime = 0,
[Description("moderate")]
TwoIntegrationTimes = 1,
[Description("high")]
ThreeIntegrationTimes = 2,
}

public enum NonAmbiguityRange
{
[Description("lessthan5m")]
LessThan5 = 0,
[Description("upto30m")]
UpTo30 = 1,
[Description("morethan30m")]
MoreThan30 = 2,
}

public static class EnumUtils
{
public static string GetDescription(this Enum value)
{
Type type = value.GetType();
string name = Enum.GetName(type, value);
if (name != null)
{
FieldInfo field = type.GetField(name);
if (field != null)
{
DescriptionAttribute attr =
Attribute.GetCustomAttribute(field,
typeof(DescriptionAttribute)) as DescriptionAttribute;
if (attr != null)
{
return attr.Description;
}
}
}
return null;
}

public static object GetEnum(Type type, string description)
{
Array allValues = Enum.GetValues(type);
foreach (Enum value in allValues)
{
if(description == GetDescription(value))
{
return Enum.Parse(type, value.ToString());
}
}

return null;
}
}
}

This file was deleted.

@@ -0,0 +1,17 @@
// Copyright (c) Metrilus GmbH
// MetriCam 2 is licensed under the MIT license. See License.txt for full license text.

using System;

namespace MetriCam2.Exceptions
{
public class NotConnectedException : MetriCam2Exception
{
public NotConnectedException(string message)
: base(message)
{ }
public NotConnectedException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}

Some generated files are not rendered by default. Learn more.

@@ -6,7 +6,7 @@
<Value Profile="(Default)">Distance</Value>
</Setting>
<Setting Name="PreConnectParameters" Type="System.String" Scope="User">
<Value Profile="(Default)">IPAddress=192.168.1.159;Port=554;Username=admin;Password=MetriX123;</Value>
<Value Profile="(Default)">CameraIP=192.168.1.78</Value>
</Setting>
<Setting Name="MinDepthToDisplay" Type="System.Single" Scope="User">
<Value Profile="(Default)">0</Value>
@@ -15,10 +15,10 @@
<Value Profile="(Default)">3</Value>
</Setting>
<Setting Name="CameraDLLPath" Type="System.String" Scope="User">
<Value Profile="(Default)">MetriCam2.Cameras.Hikvision.dll</Value>
<Value Profile="(Default)">MetriCam2.Cameras.ifm.dll</Value>
</Setting>
<Setting Name="CameraName" Type="System.String" Scope="User">
<Value Profile="(Default)">MetriCam2.Cameras.Hikvision</Value>
<Value Profile="(Default)">MetriCam2.Cameras.O3D3xx</Value>
</Setting>
</Settings>
</SettingsFile>
@@ -51,7 +51,7 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BetaCameras\Hikvision\Hikvision.csproj" />
<ProjectReference Include="..\..\BetaCameras\ifm\ifm.csproj" />
<ProjectReference Include="..\..\MetriCam2\MetriCam2.csproj" />
<ProjectReference Include="..\..\MetriCam2.Controls\MetriCam2.Controls.csproj" />
</ItemGroup>
@@ -11,7 +11,7 @@
<value>Distance</value>
</setting>
<setting name="PreConnectParameters" serializeAs="String">
<value>IPAddress=192.168.1.159;Port=554;Username=admin;Password=MetriX123;</value>
<value>CameraIP=192.168.1.78</value>
</setting>
<setting name="MinDepthToDisplay" serializeAs="String">
<value>0</value>
@@ -20,10 +20,10 @@
<value>3</value>
</setting>
<setting name="CameraDLLPath" serializeAs="String">
<value>MetriCam2.Cameras.Hikvision.dll</value>
<value>MetriCam2.Cameras.ifm.dll</value>
</setting>
<setting name="CameraName" serializeAs="String">
<value>MetriCam2.Cameras.Hikvision</value>
<value>MetriCam2.Cameras.O3D3xx</value>
</setting>
</MetriCam2.Samples.SimpleViewer.Properties.Settings>
</userSettings>

0 comments on commit 40c7d71

Please sign in to comment.
You can’t perform that action at this time.