diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-01-03 01:57:58 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-01-03 01:57:58 +0200 |
| commit | 63b2a192ba12f8239668b6818db4ad02db68dbbc (patch) | |
| tree | c9c1de011b38fbff94ce87ac2771667b9a3e773d /Software/Visual_Studio/Tango.PMR | |
| parent | f917366c405a4308b4b60e30eb1bd0dcf880532c (diff) | |
| download | Tango-63b2a192ba12f8239668b6818db4ad02db68dbbc.tar.gz Tango-63b2a192ba12f8239668b6818db4ad02db68dbbc.zip | |
Implemented abstraction of message encoding/decoding by adding another layer of "Encoders" to Transporters.
Diffstat (limited to 'Software/Visual_Studio/Tango.PMR')
| -rw-r--r-- | Software/Visual_Studio/Tango.PMR/ITangoMessage.cs | 34 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 1 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.PMR/TangoMessage.cs | 10 |
3 files changed, 40 insertions, 5 deletions
diff --git a/Software/Visual_Studio/Tango.PMR/ITangoMessage.cs b/Software/Visual_Studio/Tango.PMR/ITangoMessage.cs new file mode 100644 index 000000000..90b33a6bb --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ITangoMessage.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Common; + +namespace Tango.PMR +{ + public interface ITangoMessage + { + /// <summary> + /// Gets the container that will encapsulate the actual PMR message. + /// </summary> + MessageContainer Container { get; } + + /// <summary> + /// Gets or sets the PMR message type. + /// </summary> + MessageType Type { get; set; } + + /// <summary> + /// Serializes the Tango message to byte array. + /// </summary> + /// <returns></returns> + byte[] ToBytes(); + + /// <summary> + /// Serializes the Tango message to byte array representing a serialized JSON object of this Tango message. + /// </summary> + /// <returns></returns> + byte[] ToJsonBytes(); + } +} diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 7226685ea..e3846da7a 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -55,6 +55,7 @@ <Compile Include="Integration\ExternalClientLoginResponse.cs" /> <Compile Include="Integration\OverrideDataBaseRequest.cs" /> <Compile Include="Integration\OverrideDataBaseResponse.cs" /> + <Compile Include="ITangoMessage.cs" /> <Compile Include="MessageFactory.cs" /> <Compile Include="NativePMR.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/Software/Visual_Studio/Tango.PMR/TangoMessage.cs b/Software/Visual_Studio/Tango.PMR/TangoMessage.cs index 4819ac509..c99fc0dfb 100644 --- a/Software/Visual_Studio/Tango.PMR/TangoMessage.cs +++ b/Software/Visual_Studio/Tango.PMR/TangoMessage.cs @@ -13,10 +13,10 @@ namespace Tango.PMR /// Represents a wrapper class for PRM messages. /// </summary> /// <typeparam name="T"></typeparam> - public class TangoMessage<T> where T : IMessage<T> + public class TangoMessage<T> : ITangoMessage where T : IMessage<T> { /// <summary> - /// Gets the container. + /// Gets the container that will encapsulate the actual PMR message. /// </summary> public MessageContainer Container { get; } @@ -26,7 +26,7 @@ namespace Tango.PMR public T Message { get; set; } /// <summary> - /// Gets or sets the message type. + /// Gets or sets the PMR message type. /// </summary> public MessageType Type { get; set; } @@ -46,7 +46,7 @@ namespace Tango.PMR } /// <summary> - /// Generates a new <see cref="MessageContainer"/> containing the message of type <see cref="T"/> and returns a byte array. + /// Serializes the Tango message to byte array. /// </summary> /// <returns></returns> public byte[] ToBytes() @@ -61,7 +61,7 @@ namespace Tango.PMR } /// <summary> - /// Generates a new <see cref="MessageContainer"/> containing the message of type <see cref="T"/> and returns a byte array. + /// Serializes the Tango message to byte array representing a serialized JSON object of this Tango message. /// </summary> /// <returns></returns> public byte[] ToJsonBytes() |
