Skip to content

Commit

Permalink
change the namespace name of each type in Smdn.Net.EchonetLite.Append…
Browse files Browse the repository at this point in the history
…ix to the new one
  • Loading branch information
smdn committed Mar 31, 2024
1 parent 6ef2b2f commit 1f6b640
Show file tree
Hide file tree
Showing 22 changed files with 55 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{
/// <summary>
/// クラスグループ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{
/// <summary>
/// クラス
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Linq;
using System.Text.Json;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{
internal class EchonetObject : IEchonetObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#endif
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
using System;

namespace EchoDotNetLite.Specifications;
namespace Smdn.Net.EchonetLite.Appendix;

internal static class JsonValidationUtils {
public static string ThrowIfValueIsNullOrEmpty(string? value, string paramName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{
internal sealed class PropertyMaster
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{
internal sealed class SingleByteHexStringJsonConverter : JsonConverter<byte>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite.Appendix
{
/// <summary>
/// ECHONETオブジェクト詳細マスタ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT
using System.Text.Json.Serialization;

namespace EchoDotNetLite.Specifications
namespace Smdn.Net.EchonetLite
{

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// SPDX-License-Identifier: MIT
using System.Collections.Generic;

namespace EchoDotNetLite.Specifications
using Smdn.Net.EchonetLite.Appendix;

namespace Smdn.Net.EchonetLite
{

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// SPDX-License-Identifier: MIT
using System.Collections.Generic;

namespace EchoDotNetLite.Specifications
using Smdn.Net.EchonetLite.Appendix;

namespace Smdn.Net.EchonetLite
{
/// <summary>
/// ECHONET Lite オブジェクト
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// SPDX-License-Identifier: MIT
using System.Collections.Generic;

namespace EchoDotNetLite.Specifications
using Smdn.Net.EchonetLite.Appendix;

namespace Smdn.Net.EchonetLite
{
/// <summary>
/// ECHONET Lite クラスグループ定義
Expand Down
14 changes: 8 additions & 6 deletions src/Smdn.Net.EchonetLite/EchoDotNetLite.Models/EchoNode.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// SPDX-FileCopyrightText: 2018 HiroyukiSakoh
// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
// SPDX-License-Identifier: MIT
using EchoDotNetLite.Specifications;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;

using Smdn.Net.EchonetLite;
using Smdn.Net.EchonetLite.Appendix;

namespace EchoDotNetLite.Models
{
/// <summary>
Expand Down Expand Up @@ -61,12 +63,12 @@ private void OnDevicesChanged(NotifyCollectionChangedEventArgs e)

internal static class SpecificationUtil
{
public static Specifications.EchoProperty? FindProperty(byte classGroupCode, byte classCode, byte epc)
public static EchoProperty? FindProperty(byte classGroupCode, byte classCode, byte epc)
{
var @class = FindClass(classGroupCode, classCode);
if (@class is not null)
{
Specifications.EchoProperty? property;
EchoProperty? property;
property = @class.AnnoProperties.FirstOrDefault(p => p.Code == epc);
if (property is not null)
{
Expand Down Expand Up @@ -125,16 +127,16 @@ public UnknownEchoObject(EchoClassGroup classGroup, EchoClass @class)
public IEnumerable<EchoProperty> AnnoProperties => Enumerable.Empty<EchoProperty>();
}

public static Specifications.IEchonetObject? FindClass(byte classGroupCode, byte classCode)
public static IEchonetObject? FindClass(byte classGroupCode, byte classCode)
{
var profileClass = Specifications.プロファイル.クラス一覧.FirstOrDefault(
var profileClass = プロファイル.クラス一覧.FirstOrDefault(
g => g.ClassGroup.ClassGroupCode == classGroupCode
&& g.Class.ClassCode == classCode);
if (profileClass != null)
{
return profileClass;
}
var deviceClass = Specifications.機器.クラス一覧.FirstOrDefault(
var deviceClass = 機器.クラス一覧.FirstOrDefault(
g => g.ClassGroup.ClassGroupCode == classGroupCode
&& g.Class.ClassCode == classCode);
if (deviceClass != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Linq;
using EchoDotNetLite.Specifications;

using Smdn.Net.EchonetLite;

namespace EchoDotNetLite.Models
{
Expand Down Expand Up @@ -108,7 +109,7 @@ internal void ResetProperties(IEnumerable<EchoPropertyInstance> props)
/// クラスグループコード、クラスグループ名
/// ECHONET機器オブジェクト詳細規定がある場合、詳細仕様
/// </summary>
public Specifications.IEchonetObject Spec { get; }
public IEchonetObject Spec { get; }
/// <summary>
/// インスタンスコード
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System;
using System.Buffers;

using Smdn.Net.EchonetLite.Appendix;

namespace EchoDotNetLite.Models
{

Expand All @@ -12,7 +14,7 @@ namespace EchoDotNetLite.Models
/// </summary>
public sealed class EchoPropertyInstance
{
internal static Specifications.EchoProperty GenerateUnknownProperty(byte epc)
internal static EchoProperty GenerateUnknownProperty(byte epc)
=> new
(
code: epc,
Expand Down Expand Up @@ -73,7 +75,7 @@ bool isPropertyGet
{
}

public EchoPropertyInstance(Specifications.EchoProperty spec)
public EchoPropertyInstance(EchoProperty spec)
: this
(
spec: spec,
Expand All @@ -86,7 +88,7 @@ public EchoPropertyInstance(Specifications.EchoProperty spec)

public EchoPropertyInstance
(
Specifications.EchoProperty spec,
EchoProperty spec,
bool isPropertyAnno,
bool isPropertySet,
bool isPropertyGet
Expand All @@ -102,7 +104,7 @@ bool isPropertyGet
/// EPC
/// ECHONET機器オブジェクト詳細規定がある場合、詳細仕様
/// </summary>
public Specifications.EchoProperty Spec { get; }
public EchoProperty Spec { get; }
/// <summary>
/// プロパティ値の読み出し・通知要求のサービスを処理する。
/// プロパティ値読み出し要求(0x62)、プロパティ値書き込み・読み出し要求(0x6E)、プロパティ値通知要求(0x63)の要求受付処理を実施する。
Expand Down
18 changes: 10 additions & 8 deletions src/Smdn.Net.EchonetLite/EchoDotNetLite/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
using System.Threading;
using System.Threading.Tasks;

using Smdn.Net.EchonetLite;

namespace EchoDotNetLite
{
public partial class EchoClient : IDisposable, IAsyncDisposable
Expand Down Expand Up @@ -108,7 +110,7 @@ public EchoClient
SelfNode = new EchoNode
(
address: nodeAddress ?? throw new ArgumentNullException(nameof(nodeAddress)),
nodeProfile: new EchoObjectInstance(Specifications.プロファイル.ノードプロファイル, 0x01)
nodeProfile: new EchoObjectInstance(プロファイル.ノードプロファイル, 0x01)
);
Nodes = new List<EchoNode>();
//自己消費用
Expand Down Expand Up @@ -250,8 +252,8 @@ private ushort GetNewTid()
SelfNode.NodeProfile//ノードプロファイルから
, null//一斉通知
, new EchoObjectInstance(new EOJ(
classGroupCode: Specifications.プロファイル.ノードプロファイル.ClassGroup.ClassGroupCode,
classCode: Specifications.プロファイル.ノードプロファイル.Class.ClassCode,
classGroupCode: プロファイル.ノードプロファイル.ClassGroup.ClassGroupCode,
classCode: プロファイル.ノードプロファイル.Class.ClassCode,
instanceCode: 0x01
))
, Enumerable.Repeat(property, 1)
Expand All @@ -276,8 +278,8 @@ private ushort GetNewTid()
(
new EchoPropertyInstance
(
Specifications.プロファイル.ノードプロファイル.ClassGroup.ClassGroupCode,
Specifications.プロファイル.ノードプロファイル.Class.ClassCode,
プロファイル.ノードプロファイル.ClassGroup.ClassGroupCode,
プロファイル.ノードプロファイル.Class.ClassCode,
0xD5//インスタンスリスト通知
),
1
Expand All @@ -287,8 +289,8 @@ private ushort GetNewTid()
SelfNode.NodeProfile//ノードプロファイルから
, null//一斉通知
, new EchoObjectInstance(new EOJ(
classGroupCode: Specifications.プロファイル.ノードプロファイル.ClassGroup.ClassGroupCode,
classCode: Specifications.プロファイル.ノードプロファイル.Class.ClassCode,
classGroupCode: プロファイル.ノードプロファイル.ClassGroup.ClassGroupCode,
classCode: プロファイル.ノードプロファイル.Class.ClassCode,
instanceCode: 0x01
))
, properties
Expand Down Expand Up @@ -1267,7 +1269,7 @@ private void HandleFrameReceived(object? sender, (IPAddress address, Frame frame
sourceNode = new EchoNode
(
address: value.address,
nodeProfile: new EchoObjectInstance(Specifications.プロファイル.ノードプロファイル, 0x01)
nodeProfile: new EchoObjectInstance(プロファイル.ノードプロファイル, 0x01)
);
Nodes.Add(sourceNode);
NodeJoined?.Invoke(this,sourceNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using NUnit.Framework;

namespace EchoDotNetLite.Specifications;
namespace Smdn.Net.EchonetLite.Appendix;

[TestFixture]
public class EchoClassGroupTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using NUnit.Framework;

namespace EchoDotNetLite.Specifications;
namespace Smdn.Net.EchonetLite.Appendix;

[TestFixture]
public class EchoClassTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using NUnit.Framework;

namespace EchoDotNetLite.Specifications;
namespace Smdn.Net.EchonetLite.Appendix;

[TestFixture]
public class EchoPropertyTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using NUnit.Framework;

namespace EchoDotNetLite.Specifications;
namespace Smdn.Net.EchonetLite;

[TestFixture]
public class ApplicationServiceTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

using NUnit.Framework;

namespace EchoDotNetLite.Specifications;
using Smdn.Net.EchonetLite.Appendix;

namespace Smdn.Net.EchonetLite;

[TestFixture]
public class 機器Tests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

using NUnit.Framework;

namespace EchoDotNetLite.Specifications;
using Smdn.Net.EchonetLite.Appendix;

namespace Smdn.Net.EchonetLite;

[TestFixture]
public class プロファイルTests {
Expand Down

0 comments on commit 1f6b640

Please sign in to comment.