Compare commits
8 Commits
869ab4bc21
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| add2bb0590 | |||
| 721d397671 | |||
| fd4caf028b | |||
| f33ba0127f | |||
| 5e28088303 | |||
| 44daa44b6d | |||
| c34aa59ed1 | |||
| 092429cec8 |
430
Database.cs
430
Database.cs
@@ -22,6 +22,7 @@ namespace FAtoPA
|
||||
CreateFSMTable();
|
||||
CreateModbusTable();
|
||||
CreateVXTable();
|
||||
CreateConditionTable();
|
||||
}
|
||||
|
||||
private bool CreateFSMTable()
|
||||
@@ -33,7 +34,7 @@ namespace FAtoPA
|
||||
{
|
||||
connection.Open();
|
||||
var createtablecmd = connection.CreateCommand();
|
||||
createtablecmd.CommandText = "CREATE TABLE IF NOT EXISTS FsmData (SIID TEXT PRIMARY KEY, Enable INTEGER, Description TEXT)";
|
||||
createtablecmd.CommandText = "CREATE TABLE IF NOT EXISTS FsmData (SIID TEXT PRIMARY KEY, Enable INTEGER, Label TEXT, Type TEXT)";
|
||||
createtablecmd.ExecuteNonQuery();
|
||||
Debug.WriteLine("CreateFSMTable success");
|
||||
return true;
|
||||
@@ -79,7 +80,8 @@ namespace FAtoPA
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
FSMData fsmData = new FSMData(reader.GetString(0), reader.GetBoolean(1), reader.GetString(2));
|
||||
|
||||
FSMData fsmData = new FSMData(reader.GetString(0), reader.GetBoolean(1), reader.GetString(2), reader.GetString(3));
|
||||
fsmDatas.Add(fsmData);
|
||||
}
|
||||
}
|
||||
@@ -97,10 +99,11 @@ namespace FAtoPA
|
||||
foreach (var item in data)
|
||||
{
|
||||
var insertCmd = connection.CreateCommand();
|
||||
insertCmd.CommandText = "INSERT INTO FsmData (SIID, Enable, Description) VALUES (@SIID, @Enable, @Description)";
|
||||
insertCmd.CommandText = "INSERT INTO FsmData (SIID, Enable, Label, Type) VALUES (@SIID, @Enable, @Label, @Type)";
|
||||
insertCmd.Parameters.AddWithValue("@SIID", item.SIID);
|
||||
insertCmd.Parameters.AddWithValue("@Enable", item.Enable);
|
||||
insertCmd.Parameters.AddWithValue("@Description", item.Description);
|
||||
insertCmd.Parameters.AddWithValue("@Label", item.Label);
|
||||
insertCmd.Parameters.AddWithValue("@Type", item.Type);
|
||||
try
|
||||
{
|
||||
int result = insertCmd.ExecuteNonQuery();
|
||||
@@ -123,6 +126,29 @@ namespace FAtoPA
|
||||
}
|
||||
}
|
||||
|
||||
public FSMData FSMDataHaveSIID(String SIID)
|
||||
{
|
||||
if (SIID!=null && SIID.Length > 0)
|
||||
{
|
||||
using (var conn = new SQLiteConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
var findCmd = conn.CreateCommand();
|
||||
findCmd.CommandText = "SELECT FROM FsmData WHERE SIID = @SIID";
|
||||
findCmd.Parameters.AddWithValue("@SIID", SIID);
|
||||
using (var reader = findCmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
FSMData result = new FSMData(reader.GetString(0), reader.GetBoolean(1), reader.GetString(2), reader.GetString(3));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool RemoveFSMDatabySIID(String SIID)
|
||||
{
|
||||
using (var conn = new SQLiteConnection(connectionString))
|
||||
@@ -144,7 +170,7 @@ namespace FAtoPA
|
||||
}
|
||||
}
|
||||
|
||||
private bool CreateModbusTable()
|
||||
private bool CreateModbusTable()
|
||||
{
|
||||
//Debug.WriteLine("About to execute CreateModbusTable");
|
||||
using (var connection = new SQLiteConnection(connectionString))
|
||||
@@ -222,6 +248,29 @@ namespace FAtoPA
|
||||
}
|
||||
}
|
||||
|
||||
public ModbusData ModbusDataHaveSIID(String SIID)
|
||||
{
|
||||
if (SIID != null && SIID.Length > 0)
|
||||
{
|
||||
using (var conn = new SQLiteConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
var findCmd = conn.CreateCommand();
|
||||
findCmd.CommandText = "SELECT FROM ModbusData WHERE SIID = @SIID";
|
||||
findCmd.Parameters.AddWithValue("@SIID", SIID);
|
||||
using (var reader = findCmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
ModbusData result = new ModbusData(reader.GetString(0),(ushort) reader.GetInt16(1), reader.GetString(2));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ModbusData> GetModbusDatas()
|
||||
{
|
||||
List<ModbusData> modbusDatas = new List<ModbusData>();
|
||||
@@ -235,7 +284,7 @@ namespace FAtoPA
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
ModbusData modbusdata = new ModbusData(reader.GetString(0), reader.GetFieldValue<UInt16>(1), reader.GetString(2));
|
||||
ModbusData modbusdata = new ModbusData(reader.GetString(0), (ushort) reader.GetInt16(1), reader.GetString(2));
|
||||
modbusDatas.Add(modbusdata);
|
||||
}
|
||||
}
|
||||
@@ -264,6 +313,27 @@ namespace FAtoPA
|
||||
}
|
||||
}
|
||||
|
||||
private bool CreateConditionTable()
|
||||
{
|
||||
using (var connection = new SQLiteConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
var conFMSCmd = connection.CreateCommand();
|
||||
conFMSCmd.CommandText = "CREATE TABLE IF NOT EXISTS ConditionTable (No INTEGER AUTO INCREMENT, Condition TEXT, PASStatus TEXT)";
|
||||
conFMSCmd.ExecuteNonQuery();
|
||||
Debug.WriteLine("CreateConditionTable success");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("Error CreateConditionTable, Exception : " + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CreateVXTable()
|
||||
{
|
||||
//Debug.WriteLine("About to execute CreateVXTable");
|
||||
@@ -306,6 +376,29 @@ namespace FAtoPA
|
||||
return false;
|
||||
}
|
||||
|
||||
public VXData VXDataHaveSIID(String SIID)
|
||||
{
|
||||
if (SIID != null && SIID.Length > 0)
|
||||
{
|
||||
using (var conn = new SQLiteConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
var findCmd = conn.CreateCommand();
|
||||
findCmd.CommandText = "SELECT FROM VxTable WHERE SIID = @SIID";
|
||||
findCmd.Parameters.AddWithValue("@SIID", SIID);
|
||||
using (var reader = findCmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
VXData result = new VXData(reader.GetString(0), reader.GetByte(1), reader.GetByte(2), reader.GetString(3));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<VXData> GetVXDatas()
|
||||
{
|
||||
List<VXData> vxDatas = new List<VXData>();
|
||||
@@ -319,7 +412,7 @@ namespace FAtoPA
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
VXData vxdata = new VXData(reader.GetString(0), reader.GetByte(1), reader.GetByte(2));
|
||||
VXData vxdata = new VXData(reader.GetString(0), reader.GetByte(1), reader.GetByte(2), reader.GetString(3));
|
||||
vxDatas.Add(vxdata);
|
||||
}
|
||||
}
|
||||
@@ -388,36 +481,89 @@ namespace FAtoPA
|
||||
|
||||
class FSMData : INotifyPropertyChanged
|
||||
{
|
||||
public String SIID { get; set; }
|
||||
public Boolean Enable { get; set; }
|
||||
public String Description { get; set; }
|
||||
public String Value { get; set; }
|
||||
public String LastUpdate { get; set; }
|
||||
public FSMData(String siid, Boolean enable, String description)
|
||||
private String _siid;
|
||||
public String SIID
|
||||
{
|
||||
get => _siid;
|
||||
set
|
||||
{
|
||||
if (_siid != value)
|
||||
{
|
||||
_siid = value;
|
||||
OnPropertyChanged(nameof(SIID));
|
||||
}
|
||||
}
|
||||
}
|
||||
private Boolean _enable;
|
||||
public Boolean Enable
|
||||
{
|
||||
get => _enable;
|
||||
set
|
||||
{
|
||||
if (_enable != value)
|
||||
{
|
||||
_enable = value;
|
||||
OnPropertyChanged(nameof(Enable));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _label;
|
||||
public String Label {
|
||||
get => _label;
|
||||
set {
|
||||
if (_label != value)
|
||||
{
|
||||
_label = value;
|
||||
OnPropertyChanged(nameof(Label));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _type;
|
||||
public String Type
|
||||
{
|
||||
get => _type;
|
||||
set
|
||||
{
|
||||
if (_type != value)
|
||||
{
|
||||
_type = value;
|
||||
OnPropertyChanged(nameof(Type));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _value;
|
||||
public String Value {
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
if (_value != value)
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged(nameof(Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _lastupdate;
|
||||
public String LastUpdate {
|
||||
get => _lastupdate;
|
||||
set {
|
||||
if (_lastupdate != value)
|
||||
{
|
||||
_lastupdate = value;
|
||||
OnPropertyChanged(nameof(LastUpdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
public FSMData(String siid, Boolean enable, String label, String type)
|
||||
{
|
||||
this.SIID = siid;
|
||||
this.Enable = enable;
|
||||
this.Description = description;
|
||||
this.Label = label;
|
||||
this.Type = type;
|
||||
this.Value = "";
|
||||
this.LastUpdate = "";
|
||||
}
|
||||
public FSMData(String siid)
|
||||
{
|
||||
this.SIID = siid;
|
||||
this.Enable = true;
|
||||
this.Description = "";
|
||||
this.Value = "";
|
||||
this.LastUpdate = "";
|
||||
}
|
||||
public FSMData(String siid, Boolean enable)
|
||||
{
|
||||
this.SIID = siid;
|
||||
this.Enable = enable;
|
||||
this.Description = "";
|
||||
this.LastUpdate = "";
|
||||
this.Value = "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
@@ -425,16 +571,77 @@ namespace FAtoPA
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ModbusData
|
||||
{
|
||||
public String SIID { get; set; }
|
||||
public UInt16 Register { get; set; }
|
||||
public String Description { get; set; }
|
||||
|
||||
public String Value { get; set; }
|
||||
public String LastUpdate { get; set; }
|
||||
class ModbusData : INotifyPropertyChanged
|
||||
{
|
||||
private String _siid;
|
||||
public String SIID
|
||||
{
|
||||
get => _siid;
|
||||
set
|
||||
{
|
||||
if (_siid != value)
|
||||
{
|
||||
_siid = value;
|
||||
OnPropertyChanged(nameof(SIID));
|
||||
}
|
||||
}
|
||||
}
|
||||
private UInt16 _register;
|
||||
public UInt16 Register
|
||||
{
|
||||
get => _register;
|
||||
set
|
||||
{
|
||||
if (_register != value)
|
||||
{
|
||||
_register = value;
|
||||
OnPropertyChanged(nameof(Register));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _description;
|
||||
public String Description
|
||||
{
|
||||
get => _description;
|
||||
set
|
||||
{
|
||||
if (_description != value)
|
||||
{
|
||||
_description = value;
|
||||
OnPropertyChanged(nameof(Description));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _value;
|
||||
public String Value
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
if (_value != value)
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged(nameof(Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _lastupdate;
|
||||
public String LastUpdate
|
||||
{
|
||||
get => _lastupdate;
|
||||
set
|
||||
{
|
||||
if (_lastupdate != value)
|
||||
{
|
||||
_lastupdate = value;
|
||||
OnPropertyChanged(nameof(LastUpdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
public ModbusData(String siid, UInt16 register, String description)
|
||||
{
|
||||
this.SIID = siid;
|
||||
@@ -451,22 +658,143 @@ namespace FAtoPA
|
||||
this.Value = "";
|
||||
this.LastUpdate = "";
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
class VXData
|
||||
class FSMConditionVX : INotifyPropertyChanged
|
||||
{
|
||||
public String SIID { get; set; }
|
||||
public Byte FrameID { get; set; }
|
||||
public Byte CIN { get; set; }
|
||||
public String Description { get; set; }
|
||||
public String Value { get; set; }
|
||||
public String LastUpdate { get; set; }
|
||||
private string _condition;
|
||||
public string Condition
|
||||
{
|
||||
get => _condition;
|
||||
set
|
||||
{
|
||||
if (_condition != value)
|
||||
{
|
||||
_condition = value;
|
||||
OnPropertyChanged(nameof(Condition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private short _status;
|
||||
public short Status
|
||||
{
|
||||
get { return _status; }
|
||||
set
|
||||
{
|
||||
if (_status != value)
|
||||
{
|
||||
_status = value;
|
||||
OnPropertyChanged(nameof(Status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FSMConditionVX(string condition,short status)
|
||||
{
|
||||
this._condition = condition;
|
||||
this._status = status;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
class VXData : INotifyPropertyChanged
|
||||
{
|
||||
private String _siid;
|
||||
public String SIID
|
||||
{
|
||||
get => _siid;
|
||||
set
|
||||
{
|
||||
if (_siid != value)
|
||||
{
|
||||
_siid = value;
|
||||
OnPropertyChanged(nameof(SIID));
|
||||
}
|
||||
}
|
||||
}
|
||||
private Byte _frameid;
|
||||
public Byte FrameID
|
||||
{
|
||||
get => _frameid;
|
||||
set
|
||||
{
|
||||
if (_frameid != value)
|
||||
{
|
||||
_frameid = value;
|
||||
OnPropertyChanged(nameof(FrameID));
|
||||
}
|
||||
}
|
||||
}
|
||||
private Byte _cin;
|
||||
public Byte CIN
|
||||
{
|
||||
get => _cin;
|
||||
set
|
||||
{
|
||||
if (_cin != value)
|
||||
{
|
||||
_cin = value;
|
||||
OnPropertyChanged(nameof(CIN));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _description;
|
||||
public String Description
|
||||
{
|
||||
get => _description;
|
||||
set
|
||||
{
|
||||
if (_description != value)
|
||||
{
|
||||
_description = value;
|
||||
OnPropertyChanged(nameof(Description));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _value;
|
||||
public String Value
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
if (_value != value)
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged(nameof(Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
private String _lastupdate;
|
||||
public String LastUpdate
|
||||
{
|
||||
get => _lastupdate;
|
||||
set
|
||||
{
|
||||
if (_lastupdate != value)
|
||||
{
|
||||
_lastupdate = value;
|
||||
OnPropertyChanged(nameof(LastUpdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
public VXData(String siid, Byte frameid, Byte cin, String Description)
|
||||
{
|
||||
this.SIID = siid;
|
||||
this.FrameID = frameid;
|
||||
this.CIN = cin;
|
||||
this.Description=Description;
|
||||
this.Description = Description;
|
||||
this.Value = "";
|
||||
this.LastUpdate = "";
|
||||
}
|
||||
@@ -475,9 +803,15 @@ namespace FAtoPA
|
||||
this.SIID = siid;
|
||||
this.FrameID = frameid;
|
||||
this.CIN = cin;
|
||||
this.Description = siid+" To "+ frameid + "." + cin;
|
||||
this.Description = siid + " To " + frameid + "." + cin;
|
||||
this.Value = "";
|
||||
this.LastUpdate = "";
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,21 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -170,7 +185,11 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="FSMModbusData.cs" />
|
||||
<Compile Include="VX3K.cs" />
|
||||
<Compile Include="InputBox.xaml.cs">
|
||||
<DependentUpon>InputBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -188,6 +207,10 @@
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="InputBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MappingData.cs" />
|
||||
@@ -219,6 +242,18 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
23
FSM.cs
23
FSM.cs
@@ -12,6 +12,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace FAtoPA
|
||||
{
|
||||
/// <summary>
|
||||
/// Class to handle Fire Alarm System Monitoring
|
||||
/// </summary>
|
||||
class FSM
|
||||
{
|
||||
public static bool Started = false;
|
||||
@@ -21,6 +24,11 @@ namespace FAtoPA
|
||||
public Dictionary<int, String> ItemTypeDictionary { get; }
|
||||
public Dictionary<String, NodeData> AvailableNodes { get; }
|
||||
private EventInterface _event;
|
||||
/// <summary>
|
||||
/// to count the incoming event, then update at _event;
|
||||
/// </summary>
|
||||
public static long eventcounter = 0;
|
||||
|
||||
public FSM(EventInterface callback)
|
||||
{
|
||||
_event = callback;
|
||||
@@ -75,6 +83,7 @@ namespace FAtoPA
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
eventcounter = 0;
|
||||
controller = FSIController.GetInstance();
|
||||
// internal Listeners
|
||||
controller.AddListener(new ConfigListener(ItemTypeDictionary, AvailableNodes, listenerlist));
|
||||
@@ -150,6 +159,7 @@ namespace FAtoPA
|
||||
public void SetItemType(ItemType devItemType)
|
||||
{
|
||||
//Debug.WriteLine($"Item type {devItemType.FunctionalType} ({devItemType.Description})");
|
||||
|
||||
if (type_dictionary != null)
|
||||
{
|
||||
int type = int.Parse(devItemType.FunctionalType.ToString());
|
||||
@@ -160,7 +170,10 @@ namespace FAtoPA
|
||||
}
|
||||
else Debug.WriteLine($"type_dictionary already have key={type}");
|
||||
}
|
||||
|
||||
FSM.eventcounter++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -191,7 +204,8 @@ namespace FAtoPA
|
||||
}
|
||||
else Debug.WriteLine($"node_data already have SIID={SIID}");
|
||||
}
|
||||
|
||||
FSM.eventcounter++;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -207,7 +221,8 @@ namespace FAtoPA
|
||||
if (node_data.ContainsKey(SIID)) node_data.Remove(SIID);
|
||||
|
||||
}
|
||||
|
||||
FSM.eventcounter++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +275,8 @@ namespace FAtoPA
|
||||
} else Debug.WriteLine($"node_data doesn't contain SIID {SIID}");
|
||||
|
||||
} else Debug.WriteLine("node_data is null");
|
||||
|
||||
|
||||
FSM.eventcounter++;
|
||||
|
||||
}
|
||||
|
||||
@@ -271,6 +287,7 @@ namespace FAtoPA
|
||||
public void SetMPNetTime(DateTime mpNetTime)
|
||||
{
|
||||
Debug.WriteLine($"Time is {mpNetTime}");
|
||||
FSM.eventcounter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
52
FSMModbusData.cs
Normal file
52
FSMModbusData.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FAtoPA.Net
|
||||
{
|
||||
internal class FSMModbusData : INotifyPropertyChanged
|
||||
{
|
||||
private string _logicalstate;
|
||||
public String LogicalState
|
||||
{
|
||||
get { return _logicalstate; }
|
||||
set
|
||||
{
|
||||
if (_logicalstate != value)
|
||||
{
|
||||
|
||||
_logicalstate = value;
|
||||
OnPropertyChanged(nameof(LogicalState));
|
||||
}
|
||||
}
|
||||
}
|
||||
private short _register;
|
||||
public short Register
|
||||
{
|
||||
get { return _register; }
|
||||
set
|
||||
{
|
||||
if (_register != value)
|
||||
{
|
||||
_register = value;
|
||||
OnPropertyChanged(nameof(Register));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FSMModbusData(String logicalstate, short register)
|
||||
{
|
||||
LogicalState = logicalstate;
|
||||
Register = register;
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
||||
43
InputBox.xaml
Normal file
43
InputBox.xaml
Normal file
@@ -0,0 +1,43 @@
|
||||
<Window x:Class="FAtoPA.Net.InputBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FAtoPA.Net"
|
||||
mc:Ignorable="d"
|
||||
Title="FSM To Modbus Register" Height="200" Width="250">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="Logical State :" VerticalContentAlignment="Center"/>
|
||||
<Border Grid.Column="1" BorderBrush="Black" BorderThickness="0" Margin="5">
|
||||
<Label x:Name="txtLogicalState" />
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="Modbus Register :" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="1" x:Name="cbModbusRegister" Margin="5" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Content="Cancel" Margin="5" Click="Cancel_Click"/>
|
||||
<Button Grid.Column="1" Content="OK" Margin="5" Click="OK_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
77
InputBox.xaml.cs
Normal file
77
InputBox.xaml.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace FAtoPA.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Window1.xaml
|
||||
/// </summary>
|
||||
public partial class InputBox : Window
|
||||
{
|
||||
private String _key;
|
||||
public String FsmState { get => _key; }
|
||||
private short _value;
|
||||
public short ModbusRegister { get => _value; }
|
||||
private List<short> ModbusRegisters;
|
||||
|
||||
|
||||
public InputBox(string key, short value)
|
||||
{
|
||||
_key = key;
|
||||
_value = value;
|
||||
ModbusRegisters = new List<short>();
|
||||
for (short i = 0; i < 10; i++)
|
||||
{
|
||||
ModbusRegisters.Add(i);
|
||||
}
|
||||
InitializeComponent();
|
||||
cbModbusRegister.ItemsSource = ModbusRegisters;
|
||||
|
||||
txtLogicalState.Content = key;
|
||||
cbModbusRegister.SelectedIndex = ModbusRegisters.IndexOf(value);
|
||||
|
||||
|
||||
DataContext = this;
|
||||
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (cbModbusRegister.SelectedIndex != -1)
|
||||
{
|
||||
var selected = cbModbusRegister.SelectedItem;
|
||||
if (selected != null)
|
||||
{
|
||||
short vv = (short)selected;
|
||||
if (vv!= _value)
|
||||
{
|
||||
_value = vv;
|
||||
this.DialogResult = true;
|
||||
} else { this.DialogResult = false; }
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
MessageBox.Show("Please select a Modbus Register");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
420
MainWindow.xaml
420
MainWindow.xaml
@@ -9,9 +9,91 @@
|
||||
Closing="Window_Closing"
|
||||
Title="MainWindow"
|
||||
MinWidth="800"
|
||||
MaxWidth="1024"
|
||||
MinHeight="480"
|
||||
WindowState="Maximized" >
|
||||
<Grid>
|
||||
MaxHeight="600"
|
||||
WindowState="Maximized"
|
||||
IsManipulationEnabled="True">
|
||||
|
||||
<Window.Resources>
|
||||
|
||||
<!-- Style for Rounded Buttons -->
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="15"
|
||||
|
||||
Padding="5"
|
||||
Margin="5">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- Trigger for MouseOver -->
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="LightGray" />
|
||||
</Trigger>
|
||||
<!-- Trigger for Pressed -->
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="Gray" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="DarkGray" />
|
||||
</Trigger>
|
||||
<!-- Trigger for Disabled -->
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Opacity" Value="0.5" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Style for TabItem with Rounded Top Corners -->
|
||||
<Style TargetType="TabItem">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabItem">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="1 1 1 0"
|
||||
CornerRadius="10,10,0,0"
|
||||
Padding="12"
|
||||
Margin="2 2 0 0">
|
||||
<ContentPresenter
|
||||
x:Name="HeaderContent"
|
||||
ContentSource="Header"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- Trigger for Selected -->
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="LightBlue" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="DarkBlue" />
|
||||
</Trigger>
|
||||
<!-- Trigger for MouseOver -->
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="LightGray" />
|
||||
</Trigger>
|
||||
<Trigger Property="AreAnyTouchesCaptured" Value="True">
|
||||
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid IsManipulationEnabled="True">
|
||||
<DockPanel>
|
||||
<StatusBar DockPanel.Dock="Bottom" Height="30">
|
||||
<StatusBar.ItemsPanel>
|
||||
@@ -27,30 +109,29 @@
|
||||
</ItemsPanelTemplate>
|
||||
</StatusBar.ItemsPanel>
|
||||
<StatusBarItem Grid.Column="0" HorizontalContentAlignment="Center" BorderBrush="Black" BorderThickness="1">
|
||||
<TextBlock x:Name="firealarmstatusbar" Text="Fire Alarm Status" />
|
||||
<TextBlock x:Name="firealarmstatusbar" Text="Fire Alarm Status" Margin="5 0"/>
|
||||
</StatusBarItem>
|
||||
|
||||
<StatusBarItem Grid.Column="1" HorizontalContentAlignment="Center" BorderBrush="Black" BorderThickness="1">
|
||||
<TextBlock x:Name="modbusstatusbar" Text="Modbus Status" />
|
||||
<TextBlock x:Name="modbusstatusbar" Text="Modbus Status" Margin="5 0"/>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem Grid.Column="2" HorizontalContentAlignment="Center" BorderBrush="Black" BorderThickness="1">
|
||||
<TextBlock x:Name="vxstatusbar" Text="VX-3000 Status" />
|
||||
<TextBlock x:Name="vxstatusbar" Text="VX-3000 Status" Margin="5 0"/>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem Grid.Column="3" HorizontalContentAlignment="Center" BorderBrush="Black" BorderThickness="1">
|
||||
<TextBlock x:Name="datetimebar" Text="Date and Time" />
|
||||
<TextBlock x:Name="datetimebar" Text="Date and Time" Margin="5 0"/>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
<TabControl>
|
||||
<TabItem Header="Fire Alarm">
|
||||
<TabControl x:Name="mainTab" SelectionChanged="mainTab_SelectionChanged" IsManipulationEnabled="True">
|
||||
<TabItem Header="Fire Alarm" TouchDown="TabItem_TouchDown">
|
||||
<DockPanel>
|
||||
<Grid DockPanel.Dock="Top" Height="75">
|
||||
<Grid DockPanel.Dock="Top" Height="70">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="500"/>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="430"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Margin="5,5,5,5" x:Name="btnStartStopFSM" Content="Start FSM Connection" Grid.Column="0" Click="btnStartStopFSM_Click" />
|
||||
<Grid Grid.Column="1">
|
||||
<Button Margin="5" Padding="5,0" x:Name="btnStartStopFSM" Content="Start FSM Connection" Grid.Column="0" Click="btnStartStopFSM_Click" TouchEnter="btnStartStopFSM_TouchEnter" />
|
||||
<Grid Grid.Column="1" Margin="0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -58,7 +139,7 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid Visibility="Hidden" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -66,7 +147,7 @@
|
||||
<Label Content="NetGroup" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0"/>
|
||||
<ComboBox x:Name="netGroupNumber" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="1" Margin="5,0,5,5" ItemsSource="{Binding NetGroupList, IsAsync=True}" SelectedIndex="0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid Visibility="Hidden" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -74,7 +155,7 @@
|
||||
<Label Content="NetNode" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0"/>
|
||||
<ComboBox x:Name="netNodeNumber" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="1" Margin="5,0,5,5" ItemsSource="{Binding NetNodeList, IsAsync=True}" SelectedIndex="0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2">
|
||||
<Grid Visibility="Hidden" Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -82,7 +163,7 @@
|
||||
<Label Content="SI Type" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0"/>
|
||||
<ComboBox x:Name="siType" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="1" Margin="5,0,5,5" ItemsSource="{Binding SIType, IsAsync=True}" SelectedIndex="0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="3">
|
||||
<Grid Visibility="Hidden" Grid.Column="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -90,7 +171,7 @@
|
||||
<Label Content="SI Number" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0"/>
|
||||
<ComboBox x:Name="siNumber" Text="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="1" Margin="5,0,5,5" ItemsSource="{Binding SINumberList, IsAsync=True}" SelectedIndex="0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="4">
|
||||
<Grid Visibility="Hidden" Grid.Column="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -99,86 +180,119 @@
|
||||
<ComboBox x:Name="siSub" Text="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="1" Margin="5,0,5,5" ItemsSource="{Binding SISubList, IsAsync=True}" SelectedIndex="0"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2">
|
||||
<Grid Grid.Column="2" Margin="0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Margin="5" x:Name="btnAddSIID" Content="Manual Add To Table" Click="btnAddSIID_Click"/>
|
||||
<Button Grid.Column="1" Margin="5" x:Name="btnDelSIID" Content="Remove From Table" Click="btnDelSIID_Click"/>
|
||||
<Button Grid.Column="2" Margin="5" x:Name="btnClearSIID" Content="Clear Table" Click="btnClearSIID_Click"/>
|
||||
<Button Grid.Column="0" Margin="5,0" Padding="5,0" x:Name="btnDelSIID" Content="Remove From Table" Click="btnDelSIID_Click"/>
|
||||
<Button Grid.Column="1" Margin="5,0" Padding="5,0" x:Name="btnClearSIID" Content="Clear Table" Click="btnClearSIID_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<DockPanel DockPanel.Dock="Left" Width="300">
|
||||
<Label Content="Detected SIID" DockPanel.Dock="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<Grid DockPanel.Dock="Bottom" Height="50">
|
||||
<Label Content="Detected SIID" Margin="5,0" DockPanel.Dock="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" HorizontalAlignment="Left"/>
|
||||
<Grid DockPanel.Dock="Bottom" Height="50" Margin="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Count : 0" Margin="5,0" Grid.Column="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="DetectedSIIDCount"/>
|
||||
<Button Content="Add Selected to Table" Margin="5,0" Grid.Column="1" HorizontalAlignment="Stretch" Click="AddSelectedSIID" />
|
||||
<Button Content="Add Selected to Table" Margin="5,0" Padding="5,0" Grid.Column="1" HorizontalAlignment="Stretch" Click="AddSelectedSIID" />
|
||||
</Grid>
|
||||
|
||||
<ListBox x:Name="DetectedSIID" />
|
||||
<ListBox x:Name="DetectedSIID" Margin="5"/>
|
||||
</DockPanel>
|
||||
<DataGrid MinRowHeight="50" x:Name="FSMTable" AutoGenerateColumns="True" AutoGeneratingColumn="FSMTable_AutoGeneratingColumn" />
|
||||
|
||||
<DockPanel >
|
||||
<Label Content="FSM Status" DockPanel.Dock="Top" FontWeight="Bold" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left"/>
|
||||
<DataGrid Margin="5" MinRowHeight="50" x:Name="FSMTable" AutoGenerateColumns="True" AutoGeneratingColumn="FSMTable_AutoGeneratingColumn" ColumnWidth="*" />
|
||||
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Modbus">
|
||||
<TabItem Header="Modbus" TouchDown="TabItem_TouchDown">
|
||||
<DockPanel>
|
||||
<Grid DockPanel.Dock="Top" Height="75">
|
||||
<Grid DockPanel.Dock="Top" Height="70">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="500"/>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="280"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Margin="5" x:Name="btnStartStopModbus" Content="Start Modbus Connection" Grid.Column="0" Click="btnStartStopModbus_Click"/>
|
||||
<Grid Grid.Column="1">
|
||||
<Button Margin="5" Padding="5,0" x:Name="btnStartStopModbus" Content="Start Modbus Connection" Grid.Column="0" Click="btnStartStopModbus_Click"/>
|
||||
<Grid Grid.Column="1" Margin="0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="75"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="6*"/>
|
||||
<ColumnDefinition Width="75"/>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="SIID" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="1" x:Name="ModbusSIIDComboBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5,0,5,0" ItemsSource="{Binding FSMSIID, IsAsync=True}" Grid.ColumnSpan="2" SelectedIndex="0"/>
|
||||
<Label Grid.Column="3" Content="Register" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="4" x:Name="ModbusRegister" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5,0,5,0" ItemsSource="{Binding ModbusRegisters, IsAsync=True}" SelectedIndex="0" />
|
||||
<ComboBox Grid.Column="1" x:Name="ModbusSIIDComboBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding FSMSIID, IsAsync=True}" SelectedIndex="0"/>
|
||||
<Label Grid.Column="2" Content="Register" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="3" x:Name="ModbusRegister" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding ModbusRegisters, IsAsync=True}" SelectedIndex="0" />
|
||||
</Grid>
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="3*"/>
|
||||
<RowDefinition Height="4*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Margin="5" x:Name="btnAddModbus" Content="Add To Table" Click="btnAddModbus_Click"/>
|
||||
<Button Grid.Column="1" Margin="5" x:Name="btnDelModbus" Content="Remove From Table" Click="btnDelModbus_Click"/>
|
||||
<Button Grid.Column="2" Margin="5" x:Name="btnClearModbus" Content="Clear Table" Click="btnClearModbus_Click"/>
|
||||
<Button Grid.Column="0" Margin="5,5,5,5" Padding="5,0" x:Name="btnAddModbus" Content="Add To Table" Click="btnAddModbus_Click" Grid.RowSpan="2"/>
|
||||
<Button Grid.Column="1" Margin="5,5,5,5" Padding="5,0" x:Name="btnDelModbus" Content="Remove From Table" Click="btnDelModbus_Click" Grid.RowSpan="2"/>
|
||||
<Button Grid.Column="2" Margin="5,5,5,5" Padding="5,0" x:Name="btnClearModbus" Content="Clear Table" Click="btnClearModbus_Click" Grid.RowSpan="2"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<DockPanel DockPanel.Dock="Left" Width="200">
|
||||
<Label Content="Connected Modbus Client" DockPanel.Dock="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<Label Content="Count : 0" DockPanel.Dock="Bottom" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="ConnectedModbusCount"/>
|
||||
<ListBox x:Name="ConnectedModbusClients" />
|
||||
<DockPanel DockPanel.Dock="Left" Width="300">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel Grid.Row="0">
|
||||
<Grid DockPanel.Dock="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="AUTO"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Margin="5,0,5,0" Content="Connected Modbus Client" Grid.Column="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" Height="26" VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||
<Label Margin="5,0" Content="Count : 0" Grid.Column="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" x:Name="ConnectedModbusCount"/>
|
||||
</Grid>
|
||||
|
||||
<ListBox x:Name="ConnectedModbusClients" Margin="5,0" />
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Row="1">
|
||||
<Label Content="FA Status to Register Definition" DockPanel.Dock="Top" HorizontalContentAlignment="Center" FontWeight="Bold" HorizontalAlignment="Left"/>
|
||||
<Grid DockPanel.Dock="Bottom" Height="60">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="SetFSMtoModbusTranslationTable" Grid.Column="0" Content="Set Value" Margin="5,5,5,0" Padding="5,0" Click="SetFSMtoModbusTranslationTable_Click" Height="50" VerticalAlignment="Top"/>
|
||||
<Button x:Name="ResetFSMtoModbusTranslationTable" Grid.Column="1" Content="Reset Default" Margin="5" Padding="5,0" Click="ResetFSMtoModbusTranslationTable_Click" Height="50"/>
|
||||
</Grid>
|
||||
<DataGrid x:Name="FSMtoModbusTranslationTable" MouseDoubleClick="FSMtoModbusTranslationTable_MouseDoubleClick" AutoGenerateColumns="True" Margin="5,0" ColumnWidth="*" AutoGeneratingColumn="FSMtoModbusTranslationTable_AutoGeneratingColumn" RowHeight="30"/>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
<DockPanel>
|
||||
<Label Content="Modbus Table" HorizontalAlignment="Left" DockPanel.Dock="Top" FontWeight="Bold"/>
|
||||
<DataGrid MinRowHeight="50" x:Name="ModbusTable" AutoGenerateColumns="True" AutoGeneratingColumn="ModbusTable_AutoGeneratingColumn" ColumnWidth="*"/>
|
||||
|
||||
</DockPanel>
|
||||
<DataGrid x:Name="ModbusTable" AutoGenerateColumns="True" AutoGeneratingColumn="ModbusTable_AutoGeneratingColumn" />
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="TOA VX-3000">
|
||||
<TabItem Header="TOA VX-3000" TouchDown="TabItem_TouchDown">
|
||||
<DockPanel>
|
||||
<Grid DockPanel.Dock="Top" Height="75">
|
||||
<Grid DockPanel.Dock="Top" Height="70">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="500"/>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="290"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Margin="5,5,5,5" x:Name="btnStartStopVX" Content="Start VX-3000 Connection" Grid.Column="0" Click="btnStartStopVX_Click" />
|
||||
<Grid Grid.Column="1">
|
||||
<Button Margin="5,5,5,5" x:Name="btnStartStopVX" Padding="5,0" Content="Start VX-3000 Connection" Grid.Column="0" Click="btnStartStopVX_Click" />
|
||||
<Grid Grid.Column="1" Margin="0,5,0,5" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -188,11 +302,11 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="SIID" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="1" x:Name="VXSIIDComboBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5,0" ItemsSource="{Binding FSMSIID, IsAsync=True}" SelectedIndex="0"/>
|
||||
<ComboBox Grid.Column="1" x:Name="VXSIIDComboBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding FSMSIID, IsAsync=True}" SelectedIndex="0"/>
|
||||
<Label Grid.Column="2" Content="Frame" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="3" x:Name="VXFrame" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5,0" ItemsSource="{Binding VX3KID, IsAsync=True}" SelectedIndex="0"/>
|
||||
<ComboBox Grid.Column="3" x:Name="VXFrame" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding VX3KID, IsAsync=True}" SelectedIndex="0"/>
|
||||
<Label Grid.Column="4" Content="C-IN" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Grid.Column="5" x:Name="VXCIN" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5,0" ItemsSource="{Binding VX3KCIN, IsAsync=True}" SelectedIndex="0" />
|
||||
<ComboBox Grid.Column="5" x:Name="VXCIN" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" ItemsSource="{Binding VX3KCIN, IsAsync=True}" SelectedIndex="0" />
|
||||
</Grid>
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -200,91 +314,121 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Margin="5" x:Name="btnAddVX" Content="Add To Table" Click="btnAddVX_Click"/>
|
||||
<Button Grid.Column="1" Margin="5" x:Name="btnDelVX" Content="Remove From Table" Click="btnDelVX_Click"/>
|
||||
<Button Grid.Column="2" Margin="5" x:Name="btnClearVX" Content="Clear Table" Click="btnClearVX_Click"/>
|
||||
<Button Grid.Column="0" Margin="5" x:Name="btnAddVX" Padding="5,0" Content="Add To Table" Click="btnAddVX_Click"/>
|
||||
<Button Grid.Column="1" Margin="5" x:Name="btnDelVX" Padding="5,0" Content="Remove From Table" Click="btnDelVX_Click"/>
|
||||
<Button Grid.Column="2" Margin="5" x:Name="btnClearVX" Padding="5,0" Content="Clear Table" Click="btnClearVX_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<DataGrid x:Name="VXTable" AutoGenerateColumns="True" AutoGeneratingColumn="VXTable_AutoGeneratingColumn" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel Grid.Column="1">
|
||||
<Label Content="TOA VX-3000" FontWeight="Bold" DockPanel.Dock="Top" HorizontalAlignment="Left"/>
|
||||
<DataGrid MinRowHeight="50" x:Name="VXTable" AutoGenerateColumns="True" AutoGeneratingColumn="VXTable_AutoGeneratingColumn"/>
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Column="0">
|
||||
<Label Content="FSM Condition" FontWeight="Bold" DockPanel.Dock="Top" HorizontalAlignment="Left"/>
|
||||
<Grid DockPanel.Dock="Bottom" Height="50">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="btnResetFSMCon" Content="Reset Table" Height="50" Click="btnResetFSMCon_Click" Grid.Column="0"/>
|
||||
<Button x:Name="btnSetFSMCon" Content="Set Table" Height="50" Click="btnSetFSMCon_Click" Grid.Column="1"/>
|
||||
</Grid>
|
||||
<DataGrid x:Name="ConditionTable" AutoGenerateColumns="True" AutoGeneratingColumn="ConditionTable_AutoGeneratingColumn" DockPanel.Dock="Top" ColumnWidth="*" RowHeight="30"/>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
|
||||
</TabItem>
|
||||
<TabItem Header="Settings">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<GroupBox Header="Fire Alarm Settings">
|
||||
<DockPanel>
|
||||
<Button x:Name="btnApplyFSMConfig" Content="Apply Config" Click="ApplyFSMConfig" DockPanel.Dock="Right" Margin="5"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="NetGroup" Width="150"/>
|
||||
<TextBox x:Name="FSMConfig_NetGroup" Text="1" MinWidth="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_NetGroup_PreviewTextInput" TextChanged="FSMConfig_NetGroup_TextChanged"/>
|
||||
<TabItem Header="Settings" TouchDown="TabItem_TouchDown">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsDeferredScrollingEnabled="True" ScrollViewer.PanningMode="Both" >
|
||||
|
||||
<StackPanel Orientation="Vertical" MinWidth="800" HorizontalAlignment="Stretch">
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
<TextBlock Text="Fire Alarm Settings" FontWeight="Bold" FontSize="20"/>
|
||||
</GroupBox.Header>
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="NetGroup" Width="250"/>
|
||||
<TextBox x:Name="FSMConfig_NetGroup" Text="1" Padding="5,0" MinWidth="30" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_NetGroup_PreviewTextInput" TextChanged="FSMConfig_NetGroup_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="NetNode" Width="250"/>
|
||||
<TextBox x:Name="FSMConfig_NetNode" Padding="5,0" Text="1" MinWidth="30" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_NetNode_PreviewTextInput" TextChanged="FSMConfig_NetNode_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="PNA" Width="250"/>
|
||||
<TextBox x:Name="FSMConfig_PNA" Padding="5,0" Text="1" MinWidth="30" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_PNA_PreviewTextInput" TextChanged="FSMConfig_PNA_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="Local IP Address" Width="250"/>
|
||||
<TextBox x:Name="FSMConfig_LocalIP" Padding="5,0" Text="0.0.0.0" MinWidth="75" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_LocalIP_PreviewTextInput" TextChanged="FSMConfig_LocalIP_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="Use Multicast" Width="250"/>
|
||||
<CheckBox x:Name="FSM_UseMulticast" Content="No" Width="500" Height="35" IsChecked="False" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="Multicast Address" Width="250"/>
|
||||
<TextBox x:Name="FSMConfig_MulticastAddress" Padding="5,0" Text="239.192.0.1" MinWidth="75" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_MulticastAddress_PreviewTextInput" TextChanged="FSMConfig_MulticastAddress_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Content="Multicast Port" Width="250"/>
|
||||
<TextBox x:Name="FSMConfig_MulticastPort" Padding="5,0" Text="25000" MinWidth="50" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_MulticastPort_PreviewTextInput" TextChanged="FSMConfig_MulticastPort_TextChanged"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="btnApplyFSMConfig" Content="Apply Config" Click="ApplyFSMConfig" DockPanel.Dock="Bottom" Margin="250,0" Padding="5,0" Width="500" Height="50" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="NetNode" Width="150"/>
|
||||
<TextBox x:Name="FSMConfig_NetNode" Text="1" MinWidth="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_NetNode_PreviewTextInput" TextChanged="FSMConfig_NetNode_TextChanged"/>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
<TextBlock Text="Modbus Setting" FontWeight="Bold" FontSize="20" HorizontalAlignment="Center"/>
|
||||
</GroupBox.Header>
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Width="250" Content="Listen Port"/>
|
||||
<TextBox x:Name="ModbusListenPort" Text="502" Padding="5,0" MinWidth="50" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="ModbusListenPort_PreviewTextInput" TextChanged="ModbusListenPort_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Width="250" Content="Device ID"/>
|
||||
<TextBox x:Name="ModbusDeviceID" Padding="5,0" Text="1" MinWidth="50" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="ModbusDeviceID_PreviewTextInput" TextChanged="ModbusDeviceID_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Width="250" Content="Max. Register"/>
|
||||
<TextBox x:Name="ModbusMaxRegister" Padding="5,0" Text="2000" MinWidth="50" Height="35" Width="500" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="ModbusMaxRegister_PreviewTextInput" TextChanged="ModbusMaxRegister_TextChanged"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="btnApplyModbusConfig" Content="Apply Config" Click="ApplyModbusConfig" DockPanel.Dock="Bottom" Margin="250,0" Padding="5,0" Width="500" Height="50" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="PNA" Width="150"/>
|
||||
<TextBox x:Name="FSMConfig_PNA" Text="1" MinWidth="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_PNA_PreviewTextInput" TextChanged="FSMConfig_PNA_TextChanged"/>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
<TextBlock Text="VX-3000" FontWeight="Bold" FontSize="20" DockPanel.Dock="Top" HorizontalAlignment="Center"/>
|
||||
</GroupBox.Header>
|
||||
<DockPanel Margin="-1,0,1,0">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Width="250" Content="VX-3000 IP" />
|
||||
<TextBox x:Name="VX3K_IP" Padding="5,0" Text="192.168.14.1" MinWidth="75" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="VX3K_IP_PreviewTextInput" TextChanged="VX3K_IP_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5">
|
||||
<Label Width="250" Content="VX-3000 Port" />
|
||||
<TextBox x:Name="VX3K_Port" Padding="5,0" Text="5000" MinWidth="50" Width="500" Height="35" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="VX3K_Port_PreviewTextInput" TextChanged="VX3K_Port_TextChanged" />
|
||||
</StackPanel>
|
||||
<Button x:Name="btnApplyVX3KConfig" Content="Apply Config" Margin="250,0" Padding="5,0" Click="ApplyVX3KConfig" DockPanel.Dock="Bottom" Width="500" Height="50" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Local IP Address" Width="150"/>
|
||||
<TextBox x:Name="FSMConfig_LocalIP" Text="0.0.0.0" MinWidth="75" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_LocalIP_PreviewTextInput" TextChanged="FSMConfig_LocalIP_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Use Multicast" Width="150"/>
|
||||
<CheckBox x:Name="FSM_UseMulticast" Content="No" IsChecked="False" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Multicast Address" Width="150"/>
|
||||
<TextBox x:Name="FSMConfig_MulticastAddress" Text="239.192.0.1" MinWidth="75" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_MulticastAddress_PreviewTextInput" TextChanged="FSMConfig_MulticastAddress_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Multicast Port" Width="150"/>
|
||||
<TextBox x:Name="FSMConfig_MulticastPort" Text="25000" MinWidth="50" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="FSMConfig_MulticastPort_PreviewTextInput" TextChanged="FSMConfig_MulticastPort_TextChanged"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
</GroupBox>
|
||||
<GroupBox Header="Modbus Setting">
|
||||
<DockPanel>
|
||||
<Button x:Name="btnApplyModbusConfig" Content="Apply Config" Click="ApplyModbusConfig" DockPanel.Dock="Right" Margin="5"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Width="150" Content="Listen Port"/>
|
||||
<TextBox x:Name="ModbusListenPort" Text="502" MinWidth="50" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="ModbusListenPort_PreviewTextInput" TextChanged="ModbusListenPort_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Width="150" Content="Device ID"/>
|
||||
<TextBox x:Name="ModbusDeviceID" Text="1" MinWidth="50" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="ModbusDeviceID_PreviewTextInput" TextChanged="ModbusDeviceID_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Width="150" Content="Max. Register"/>
|
||||
<TextBox x:Name="ModbusMaxRegister" Text="2000" MinWidth="50" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="ModbusMaxRegister_PreviewTextInput" TextChanged="ModbusMaxRegister_TextChanged"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="VX-3000">
|
||||
<DockPanel Margin="-1,0,1,0">
|
||||
<Button x:Name="btnApplyVX3KConfig" Content="Apply Config" Margin="5" Click="ApplyVX3KConfig" DockPanel.Dock="Right"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Width="150" Content="VX-3000 IP" />
|
||||
<TextBox x:Name="VX3K_IP" Text="192.168.14.1" MinWidth="75" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="VX3K_IP_PreviewTextInput" TextChanged="VX3K_IP_TextChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Width="150" Content="VX-3000 Port" />
|
||||
<TextBox x:Name="VX3K_Port" Text="5000" MinWidth="50" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewTextInput="VX3K_Port_PreviewTextInput" TextChanged="VX3K_Port_TextChanged" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -300,6 +300,7 @@ namespace FAtoPA
|
||||
CloseConnection(client);
|
||||
client = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -309,8 +310,13 @@ namespace FAtoPA
|
||||
|
||||
if (key != null && client != null)
|
||||
{
|
||||
ModbusClientRecord prev = null;
|
||||
if (_event!=null) _event.Log("ModbusSlave: New Connection from " + key);
|
||||
ModbusClientRecord prev = clientmap[key];
|
||||
if (clientmap.ContainsKey(key))
|
||||
{
|
||||
prev = clientmap[key];
|
||||
}
|
||||
|
||||
|
||||
if (prev != null)
|
||||
{
|
||||
@@ -354,9 +360,11 @@ namespace FAtoPA
|
||||
// 2 byte Register Count, index [10,11]
|
||||
byte[] cmd = new byte[12];
|
||||
try {
|
||||
int readcount = await stream.ReadAsync(new byte[12], 0, 12);
|
||||
int readcount = await stream.ReadAsync(cmd, 0, 12);
|
||||
|
||||
if (readcount >= 12)
|
||||
{
|
||||
|
||||
client.RXBytes += (uint)readcount;
|
||||
UInt16 transactionID = GetTransactionID(cmd);
|
||||
UInt16 protocolID = GetProtocolID(cmd);
|
||||
@@ -364,7 +372,7 @@ namespace FAtoPA
|
||||
Byte unitID = GetUnitID(cmd);
|
||||
Byte functionCode = GetFunctionCode(cmd);
|
||||
byte[] payload = GetModbusPayload(cmd);
|
||||
|
||||
|
||||
if (protocolID == 0 && length == payload.Length + 2 && unitID == 1)
|
||||
{
|
||||
if (functionCode == 3)
|
||||
@@ -482,7 +490,10 @@ namespace FAtoPA
|
||||
client.TXBytes += (uint)response.Length;
|
||||
client.TXResponse++;
|
||||
}
|
||||
if (_event != null) _event.TXRXStatusUpdate(client);
|
||||
}
|
||||
|
||||
else if (readcount == 0) break; // connection closed
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user