Skip to content

Commit 489770c

Browse files
committed
Refactor JSON classes
1 parent bcd48c9 commit 489770c

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ An implementation of ZWave Plus using the 2024a public specification.
2222
#### Other Projects
2323
* Check out my other projects for [HomeKit](https://github.com/SmartHomeOS/HomeKitDotNet)
2424

25+
Support is always appreciated:<br/><a href="https://www.buymeacoffee.com/jdomnitz" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Pizza" style="height: 60px !important;width: 217px !important;" ></a>
26+
2527
Testers, Tickets, Feedback and PRs are welcome.

ZWaveDotNet/Entities/Controller.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using ZWaveDotNet.CommandClassReports;
2323
using ZWaveDotNet.CommandClassReports.Enums;
2424
using ZWaveDotNet.Entities.Enums;
25+
using ZWaveDotNet.Entities.JSON;
2526
using ZWaveDotNet.Enums;
2627
using ZWaveDotNet.Provisioning;
2728
using ZWaveDotNet.Security;

ZWaveDotNet/Entities/CommandClassJson.cs renamed to ZWaveDotNet/Entities/JSON/CommandClassJSON.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212

1313
using ZWaveDotNet.Enums;
1414

15-
namespace ZWaveDotNet.Entities
15+
namespace ZWaveDotNet.Entities.JSON
1616
{
17+
#pragma warning disable CS1591
1718
public class CommandClassJson
19+
1820
{
1921
public byte Version { get; set; }
2022
public CommandClass CommandClass { get; set; }
2123
public bool Secure { get; set; }
2224
}
25+
#pragma warning restore CS1591
2326
}

ZWaveDotNet/Entities/ControllerJSON.cs renamed to ZWaveDotNet/Entities/JSON/ControllerJSON.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
// You should have received a copy of the GNU Affero General Public License
1111
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1212

13-
namespace ZWaveDotNet.Entities
13+
namespace ZWaveDotNet.Entities.JSON
1414
{
15+
#pragma warning disable CS1591
1516
public class ControllerJSON
1617
{
1718
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
18-
public uint HomeID { get ; set; }
19+
public uint HomeID { get; set; }
1920
public ushort ID { get; set; }
2021
public byte DbVersion { get; set; }
2122
public NodeJSON[] Nodes { get; set; }
2223
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2324
}
25+
#pragma warning restore CS1591
2426
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@
1313
using ZWaveDotNet.CommandClasses.Enums;
1414
using ZWaveDotNet.SerialAPI.Messages;
1515

16-
namespace ZWaveDotNet.Entities
16+
namespace ZWaveDotNet.Entities.JSON
1717
{
18+
#pragma warning disable CS1591
1819
public class NodeJSON
1920
{
2021
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2122
public NodeProtocolInfo NodeProtocolInfo { get; set; }
2223
public bool Interviewed { get; set; }
2324
public ushort ID { get; set; }
24-
public CommandClassJson[] CommandClasses { get; set; }
25+
public CommandClassJson[] CommandClasses { get; set; }
2526
public SecurityKey[] GrantedKeys { get; set; }
2627
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2728
}
29+
#pragma warning restore CS1591
2830
}

ZWaveDotNet/Entities/Node.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using ZWaveDotNet.CommandClassReports;
2323
using ZWaveDotNet.CommandClassReports.Enums;
2424
using ZWaveDotNet.Entities.Enums;
25+
using ZWaveDotNet.Entities.JSON;
2526
using ZWaveDotNet.Enums;
2627
using ZWaveDotNet.Security;
2728
using ZWaveDotNet.SerialAPI;
@@ -34,21 +35,21 @@ namespace ZWaveDotNet.Entities
3435
{
3536
public class Node
3637
{
37-
protected enum InterviewState { None, Started, Complete };
38-
public const ushort BROADCAST_ID = 0xFFFF;
39-
public const ushort MULTICAST_ID = 0xFFFE;
40-
public const ushort UNINITIALIZED_ID = 0x0000;
38+
private enum InterviewState { None, Started, Complete };
39+
internal const ushort BROADCAST_ID = 0xFFFF;
40+
internal const ushort MULTICAST_ID = 0xFFFE;
41+
internal const ushort UNINITIALIZED_ID = 0x0000;
4142

4243
public event NodeEventHandler? InterviewComplete;
4344

4445
public readonly ushort ID;
45-
protected readonly Controller controller;
46-
protected readonly NodeProtocolInfo? nodeInfo;
47-
protected bool failed;
48-
protected InterviewState interviewed;
49-
50-
protected ConcurrentDictionary<CommandClass, CommandClassBase> commandClasses = new ConcurrentDictionary<CommandClass, CommandClassBase>();
51-
protected List<EndPoint> endPoints = new List<EndPoint>();
46+
private readonly Controller controller;
47+
private readonly NodeProtocolInfo? nodeInfo;
48+
private bool failed;
49+
private InterviewState interviewed;
50+
51+
private ConcurrentDictionary<CommandClass, CommandClassBase> commandClasses = new ConcurrentDictionary<CommandClass, CommandClassBase>();
52+
private List<EndPoint> endPoints = new List<EndPoint>();
5253

5354
public Controller Controller { get { return controller; } }
5455
public bool LongRange { get { return nodeInfo?.IsLongRange ?? false; } }

0 commit comments

Comments
 (0)