-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
18 changed files
with
391 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
RDMSharp/ParameterWrapper/Catalogue/Generic/ASCIIParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class ASCIIParameterWrapper : AbstractGenericParameterWrapper<string, string> | ||
{ | ||
public ASCIIParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
|
||
protected override string getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToString(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(string value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override string setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToString(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(string value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
RDMSharp/ParameterWrapper/Catalogue/Generic/AbstractGenericParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.ComponentModel; | ||
|
||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public abstract class AbstractGenericParameterWrapper<TGet, TSet> : AbstractRDMParameterWrapper<Empty, TGet, TSet, Empty>, IRDMGetParameterWrapperWithEmptyGetRequest | ||
{ | ||
private readonly RDMParameterDescription parameterDescription; | ||
public AbstractGenericParameterWrapper(in RDMParameterDescription parameterDescription) : base((ERDM_Parameter)parameterDescription.ParameterId) | ||
{ | ||
this.parameterDescription = parameterDescription; | ||
} | ||
public sealed override string Name => this.parameterDescription.Description; | ||
public sealed override string Description => null; | ||
public Type GetResponseType => typeof(TGet); | ||
|
||
public sealed override ERDM_CommandClass CommandClass => this.parameterDescription.CommandClass; | ||
|
||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
protected sealed override byte[] getRequestValueToParameterData(Empty value) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
protected sealed override Empty getRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
protected sealed override Empty setResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
protected sealed override byte[] setResponseValueToParameterData(Empty value) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public RDMMessage BuildGetRequestMessage() | ||
{ | ||
return this.buildGetRequestMessage(); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
RDMSharp/ParameterWrapper/Catalogue/Generic/NotDefinedParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class NotDefinedParameterWrapper : AbstractGenericParameterWrapper<byte[], byte[]> | ||
{ | ||
public NotDefinedParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
protected override byte[] getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return parameterData; | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(byte[] value) | ||
{ | ||
return value; | ||
} | ||
|
||
protected override byte[] setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return parameterData; | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(byte[] value) | ||
{ | ||
return value; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
RDMSharp/ParameterWrapper/Catalogue/Generic/SignedByteParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class SignedByteParameterWrapper : AbstractGenericParameterWrapper<sbyte, sbyte> | ||
{ | ||
public SignedByteParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
protected override sbyte getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToSByte(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(sbyte value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override sbyte setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToSByte(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(sbyte value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
RDMSharp/ParameterWrapper/Catalogue/Generic/SignedDWordParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class SignedDWordParameterWrapper : AbstractGenericParameterWrapper<int, int> | ||
{ | ||
public SignedDWordParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
|
||
protected override int getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToInt(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(int value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override int setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToInt(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(int value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
RDMSharp/ParameterWrapper/Catalogue/Generic/SignedWordParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class SignedWordParameterWrapper : AbstractGenericParameterWrapper<short, short> | ||
{ | ||
public SignedWordParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
|
||
protected override short getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToShort(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(short value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override short setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToShort(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(short value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
RDMSharp/ParameterWrapper/Catalogue/Generic/UnsignedByteParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class UnsignedByteParameterWrapper : AbstractGenericParameterWrapper<byte, byte>, IRDMGetParameterWrapperWithEmptyGetRequest | ||
{ | ||
public UnsignedByteParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
protected override byte getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToByte(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(byte value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override byte setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToByte(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(byte value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
RDMSharp/ParameterWrapper/Catalogue/Generic/UnsignedDWordParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class UnsignedDWordParameterWrapper : AbstractGenericParameterWrapper<uint, uint> | ||
{ | ||
public UnsignedDWordParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
protected override uint getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToUInt(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(uint value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override uint setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToUInt(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(uint value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
RDMSharp/ParameterWrapper/Catalogue/Generic/UnsignedWordParameterWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace RDMSharp.ParameterWrapper.Generic | ||
{ | ||
public sealed class UnsignedWordParameterWrapper : AbstractGenericParameterWrapper<ushort, ushort> | ||
{ | ||
public UnsignedWordParameterWrapper(in RDMParameterDescription parameterDescription) : base(parameterDescription) | ||
{ | ||
} | ||
|
||
|
||
protected override ushort getResponseParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToUShort(ref parameterData); | ||
} | ||
|
||
protected override byte[] getResponseValueToParameterData(ushort value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
|
||
protected override ushort setRequestParameterDataToValue(byte[] parameterData) | ||
{ | ||
return Tools.DataToUShort(ref parameterData); | ||
} | ||
|
||
protected override byte[] setRequestValueToParameterData(ushort value) | ||
{ | ||
return Tools.ValueToData(value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.