diff --git a/Client/Client.csproj b/Client/Client.csproj index c73e0d1..b664ee3 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -1,8 +1,12 @@ - + Exe netcoreapp3.1 + + + + diff --git a/Message/Message.cs b/Message/Message.cs new file mode 100644 index 0000000..3f580fb --- /dev/null +++ b/Message/Message.cs @@ -0,0 +1,63 @@ +using Newtonsoft.Json; +using System; + +namespace Message +{ + /// + /// Message class to handle traffic between clients and server + /// + public class Message + { + /// + /// identifier for the message + /// + public Identifier Identifier + { + get;set; + } + + /// + /// payload of the message, the actual text + /// + public string Payload + { + get;set; + } + + /// + /// constructs a new message with the given parameters + /// + /// the identifier + /// the payload + public Message(Identifier identifier, string payload) + { + this.Identifier = identifier; + this.Payload = payload; + } + + /// + /// serializes this object to a JSON string + /// + /// a JSON representation of this object + public string Serialize() + { + return JsonConvert.SerializeObject(this); + } + + /// + /// deserializes a JSON string into a new Message object + /// + /// the JSON string to deserialize + /// a new Message object from the JSON string + public static Message Deserialize(string json) + { + return (Message)JsonConvert.DeserializeObject(json); + } + } + + public enum Identifier + { + LOGIN, + CHAT, + } +} diff --git a/Message/Message.csproj b/Message/Message.csproj new file mode 100644 index 0000000..0eaee1b --- /dev/null +++ b/Message/Message.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.1 + + + + + + + diff --git a/ProftaakRH/BLEHandler.cs b/ProftaakRH/BLEHandler.cs index da2d90a..9df61d8 100644 --- a/ProftaakRH/BLEHandler.cs +++ b/ProftaakRH/BLEHandler.cs @@ -24,7 +24,6 @@ namespace Hardware public BLEHandler(IDataConverter dataConverter) { this.dataConverter = dataConverter; - bool running = false; } /// diff --git a/ProftaakRH/ProftaakRH.sln b/ProftaakRH/ProftaakRH.sln index 4ea030c..069a13b 100644 --- a/ProftaakRH/ProftaakRH.sln +++ b/ProftaakRH/ProftaakRH.sln @@ -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 diff --git a/Server/Server.csproj b/Server/Server.csproj index c73e0d1..4c98a00 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -5,4 +5,8 @@ netcoreapp3.1 + + + +