Merge branch 'develop' into client
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Message\Message.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
63
Message/Message.cs
Normal file
63
Message/Message.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace Message
|
||||
{
|
||||
/// <summary>
|
||||
/// Message class to handle traffic between clients and server
|
||||
/// </summary>
|
||||
public class Message
|
||||
{
|
||||
/// <summary>
|
||||
/// identifier for the message
|
||||
/// </summary>
|
||||
public Identifier Identifier
|
||||
{
|
||||
get;set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// payload of the message, the actual text
|
||||
/// </summary>
|
||||
public string Payload
|
||||
{
|
||||
get;set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructs a new message with the given parameters
|
||||
/// </summary>
|
||||
/// <param name="identifier">the identifier</param>
|
||||
/// <param name="payload">the payload</param>
|
||||
public Message(Identifier identifier, string payload)
|
||||
{
|
||||
this.Identifier = identifier;
|
||||
this.Payload = payload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// serializes this object to a JSON string
|
||||
/// </summary>
|
||||
/// <returns>a JSON representation of this object</returns>
|
||||
public string Serialize()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// deserializes a JSON string into a new Message object
|
||||
/// </summary>
|
||||
/// <param name="json">the JSON string to deserialize</param>
|
||||
/// <returns>a new <c>Message</c> object from the JSON string</returns>
|
||||
public static Message Deserialize(string json)
|
||||
{
|
||||
return (Message)JsonConvert.DeserializeObject(json);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Identifier
|
||||
{
|
||||
LOGIN,
|
||||
CHAT,
|
||||
}
|
||||
}
|
||||
12
Message/Message.csproj
Normal file
12
Message/Message.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -24,7 +24,6 @@ namespace Hardware
|
||||
public BLEHandler(IDataConverter dataConverter)
|
||||
{
|
||||
this.dataConverter = dataConverter;
|
||||
bool running = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "..\Server\Server.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "..\Client\Client.csproj", "{5759DD20-7A4F-4D8D-B986-A70A7818C112}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -33,6 +35,10 @@ Global
|
||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -5,4 +5,8 @@
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Message\Message.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user