Introduced the CJMS11 camera component and its factory in TbfComponents. Added implementation for the CJMS11 camera class, along with unit tests to validate its functionality and integration. This enhances existing camera support in the system.
75 lines
1.8 KiB
C#
75 lines
1.8 KiB
C#
///
|
|
/// Copyright (c) 2017 Sensus Metering Systems
|
|
///
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Xml.Serialization;
|
|
using Common;
|
|
using TBF.Rig.Generic;
|
|
using TBF.Resources;
|
|
|
|
namespace TBF.Rig.Network.Camera.CJMS11
|
|
{
|
|
public enum TestImagesMode
|
|
{
|
|
None,
|
|
SaveFirstImages,
|
|
SaveLastImages,
|
|
LoadImages,
|
|
Count,
|
|
Invalid,
|
|
}
|
|
|
|
public class CameraCfg : ComponentCfgBase, IChildComponentCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CameraCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new CameraCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public int HardwareAddress;
|
|
public bool DisplayTerminal;
|
|
|
|
[XmlIgnore]
|
|
public TestImagesMode TestImagesMode;
|
|
|
|
[XmlIgnore]
|
|
public int TestImagesCount;
|
|
|
|
public string IPAddressCJMS;
|
|
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
CameraCfg() { }
|
|
|
|
public CameraCfg(string name, IComponentFactory factory)
|
|
: this()
|
|
{
|
|
Name = name;
|
|
Factory = factory;
|
|
ParentName = "Network.Adapter";
|
|
HardwareAddress = 1;
|
|
TestImagesMode = TestImagesMode.None;
|
|
TestImagesCount = 3000;
|
|
DebugLevel = DebugMode.AutoDetect;
|
|
IPAddressCJMS = "192.168.1.100";
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, s/n={1}, Terminal={2}, TestImagesMode={3}, TestImagesCount={4}, Parent={5}, IPAddressCJMS={6}",
|
|
Name,
|
|
HardwareAddress,
|
|
DisplayTerminal ? Strings.yes : Strings.no,
|
|
TestImagesMode,
|
|
TestImagesCount,
|
|
ParentName,
|
|
IPAddressCJMS);
|
|
}
|
|
}
|
|
}
|