Skip to content

Commit

Permalink
Notifications improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
gurux01 committed Dec 5, 2017
1 parent 57a4ddc commit b3f9dae
Show file tree
Hide file tree
Showing 12 changed files with 383 additions and 308 deletions.
33 changes: 29 additions & 4 deletions Development/DevicePropertiesForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions Development/DevicePropertiesForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
//
//
//
// Version: $Revision: 9716 $,
// $Date: 2017-11-21 09:19:16 +0200 (ti, 21 marras 2017) $
// $Author: gurux01 $
// Version: $Revision: 9745 $,
// $Date: 2017-12-04 13:42:46 +0200 (ma, 04 joulu 2017) $
// $Author: kurumi $
//
// Copyright (c) Gurux Ltd
//
Expand Down Expand Up @@ -278,11 +278,11 @@ public DevicePropertiesForm(GXManufacturerCollection manufacturers, GXDLMSDevice
{
if (SelectedMedia == null || SelectedMedia.GetType() != type)
{
this.MediasCB.Items.Add(a.CreateInstance(type.ToString()));
MediasCB.Items.Add(a.CreateInstance(type.ToString()));
}
else
{
this.MediasCB.Items.Add(SelectedMedia);
MediasCB.Items.Add(SelectedMedia);
}
}
}
Expand Down Expand Up @@ -327,6 +327,7 @@ public DevicePropertiesForm(GXManufacturerCollection manufacturers, GXDLMSDevice
WindowSizeTXTb.Text = Device.WindowSizeTX.ToString();
WindowSizeRXTb.Text = Device.WindowSizeRX.ToString();
InactivityTimeoutTb.Text = Device.InactivityTimeout.ToString();
MaxPduTb.Text = Device.PduSize.ToString();
}
catch (Exception Ex)
{
Expand Down Expand Up @@ -620,6 +621,8 @@ private void OKBtn_Click(object sender, EventArgs e)
Device.WindowSizeTX = byte.Parse(WindowSizeTXTb.Text);
Device.WindowSizeRX = byte.Parse(WindowSizeRXTb.Text);
Device.InactivityTimeout = int.Parse(InactivityTimeoutTb.Text);
Device.PduSize = UInt16.Parse(MaxPduTb.Text);

Device.Name = name;
Device.Media = SelectedMedia;
Device.Manufacturer = man.Identification;
Expand Down Expand Up @@ -916,6 +919,7 @@ private void ManufacturerCB_SelectedIndexChanged(object sender, EventArgs e)
if (Device.Name == null)
{
type = man.GetActiveServer().HDLCAddress;
Device.UseWrapper = man.UseIEC47;
}
foreach (GXServerAddress it in ((GXManufacturer)ManufacturerCB.SelectedItem).ServerSettings)
{
Expand Down
14 changes: 10 additions & 4 deletions Development/GXDLMSCommunicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//
//
//
// Version: $Revision: 9719 $,
// $Date: 2017-11-21 14:15:51 +0200 (ti, 21 marras 2017) $
// $Author: gurux01 $
// Version: $Revision: 9745 $,
// $Date: 2017-12-04 13:42:46 +0200 (ma, 04 joulu 2017) $
// $Author: kurumi $
//
// Copyright (c) Gurux Ltd
//
Expand Down Expand Up @@ -561,7 +561,7 @@ public void UpdateManufactureSettings(string id)
}

//If network media is used check is manufacturer supporting IEC 62056-47
if (!parent.UseRemoteSerial && this.media is GXNet && manufacturer.UseIEC47)
if (parent.UseWrapper && !parent.UseRemoteSerial && this.media is GXNet)
{
client.InterfaceType = InterfaceType.WRAPPER;
}
Expand Down Expand Up @@ -688,6 +688,12 @@ public void InitializeConnection()
{
GXReplyData reply = new GXReplyData();
byte[] data;
client.Limits.WindowSizeRX = parent.WindowSizeRX;
client.Limits.WindowSizeTX = parent.WindowSizeTX;
client.Limits.MaxInfoRX = parent.MaxInfoRX;
client.Limits.MaxInfoTX = parent.MaxInfoTX;
client.MaxReceivePDUSize = parent.PduSize;

data = SNRMRequest();
if (data != null)
{
Expand Down
103 changes: 41 additions & 62 deletions Development/GXDLMSDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//
//
//
// Version: $Revision: 9730 $,
// $Date: 2017-11-24 12:14:34 +0200 (pe, 24 marras 2017) $
// $Author: gurux01 $
// Version: $Revision: 9745 $,
// $Date: 2017-12-04 13:42:46 +0200 (ma, 04 joulu 2017) $
// $Author: kurumi $
//
// Copyright (c) Gurux Ltd
//
Expand All @@ -33,7 +33,6 @@

using System;
using System.Collections.Generic;
using System.Text;
using Gurux.Serial;
using System.Windows.Forms;
using Gurux.DLMS;
Expand Down Expand Up @@ -72,7 +71,7 @@ void UpdateStatus(DeviceState state)
}

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public DeviceState Status
{
get
Expand All @@ -82,27 +81,27 @@ public DeviceState Status
}

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
GXDLMSObjectCollection m_Objects;

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public ProgressEventHandler OnProgress;

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public StatusEventHandler OnStatusChanged;

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public MessageTraceEventHandler OnTrace;

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
System.Timers.Timer KeepAlive;

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
GXDLMSCommunicator communicator;

public void KeepAliveStart()
Expand Down Expand Up @@ -331,16 +330,11 @@ public bool UseWrapper
/// <remarks>
/// DefaultValue is 128. Minimum value is 32 and max value is 128.
/// </remarks>
[DefaultValue(128)]
public UInt16 MaxInfoTX
{
get
{
return communicator.client.Limits.MaxInfoTX;
}
set
{
communicator.client.Limits.MaxInfoTX = value;
}
get;
set;
}

/// <summary>
Expand All @@ -349,16 +343,11 @@ public UInt16 MaxInfoTX
/// <remarks>
/// DefaultValue is 128. Minimum value is 32 and max value is 128.
/// </remarks>
[DefaultValue(128)]
public UInt16 MaxInfoRX
{
get
{
return communicator.client.Limits.MaxInfoRX;
}
set
{
communicator.client.Limits.MaxInfoRX = value;
}
get;
set;
}

/// <summary>
Expand All @@ -369,15 +358,8 @@ public UInt16 MaxInfoRX
/// </remarks>
public byte WindowSizeTX
{
get
{
return communicator.client.Limits.WindowSizeTX;
}
set
{
communicator.client.Limits.WindowSizeTX = value;
}

get;
set;
}

/// <summary>
Expand All @@ -388,14 +370,21 @@ public byte WindowSizeTX
/// </remarks>
public byte WindowSizeRX
{
get
{
return communicator.client.Limits.WindowSizeRX;
}
set
{
communicator.client.Limits.WindowSizeRX = value;
}
get;
set;
}


/// <summary>
/// Proposed maximum size of PDU.
/// </summary>
/// <remarks>
/// DefaultValue is 1.
[DefaultValue(0xFFFF)]
public UInt16 PduSize
{
get;
set;
}


Expand Down Expand Up @@ -483,7 +472,7 @@ public GXDLMSCommunicator Comm
}

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public Gurux.DLMS.ManufacturerSettings.GXObisCodeCollection ObisCodes
{
get
Expand All @@ -498,15 +487,15 @@ public Gurux.DLMS.ManufacturerSettings.GXObisCodeCollection ObisCodes


[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public IGXManufacturerExtension Extension
{
get;
internal set;
}

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public Gurux.Common.IGXMedia Media
{
get
Expand All @@ -520,7 +509,7 @@ public Gurux.Common.IGXMedia Media
}

[Browsable(false)]
[System.Xml.Serialization.XmlIgnore()]
[XmlIgnore()]
public GXManufacturerCollection Manufacturers
{
get;
Expand All @@ -547,19 +536,6 @@ public HDLCAddressType HDLCAddressing
set;
}


/// <summary>
/// Is wrapper used.
/// </summary>
[Browsable(false)]
public bool UseIEC47
{
get
{
return Manufacturers.FindByIdentification(this.Manufacturer).UseIEC47;
}
}

/// <summary>
/// Constructor.
/// </summary>
Expand All @@ -580,6 +556,9 @@ public GXDLMSDevice(Gurux.Common.IGXMedia media)
m_Status = DeviceState.Initialized;
WaitTime = 5;
InactivityTimeout = 120;
WindowSizeRX = WindowSizeTX = 1;
MaxInfoRX = MaxInfoTX = 128;
PduSize = 0xFFFF;
}

/// <summary>
Expand Down Expand Up @@ -905,7 +884,7 @@ private void KeepAlive_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
NotifyProgress(this, "Keep Alive", 0, 1);
NotifyProgress(this, "Keep Alive", 0, 1);
communicator.KeepAlive();
}
catch (Exception Ex)
Expand Down
4 changes: 2 additions & 2 deletions Development/GXDLMSDirector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
<Reference Include="Gurux.DLMS, Version=8.5.1711.2403, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Gurux.DLMS.8.5.1711.2403\lib\portable-win+net35\Gurux.DLMS.dll</HintPath>
</Reference>
<Reference Include="Gurux.DLMS.UI, Version=8.5.1711.2801, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Gurux.DLMS.UI.8.5.1711.2801\lib\portable-win+net35\Gurux.DLMS.UI.dll</HintPath>
<Reference Include="Gurux.DLMS.UI, Version=8.5.1712.505, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Gurux.DLMS.UI.8.5.1712.505\lib\portable-win+net35\Gurux.DLMS.UI.dll</HintPath>
</Reference>
<Reference Include="Gurux.Net, Version=8.1.1711.2301, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Gurux.Net.8.1.1711.2301\lib\portable-win+net40\Gurux.Net.dll</HintPath>
Expand Down
Loading

0 comments on commit b3f9dae

Please sign in to comment.