diff --git a/DoxyGen/Doxyfile b/DoxyGen/Doxyfile index 6a000ae..ae7a013 100644 --- a/DoxyGen/Doxyfile +++ b/DoxyGen/Doxyfile @@ -61,7 +61,7 @@ PROJECT_BRIEF = # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = //intranet/home/Afbeeldingen/PasserVR/Logos/Logo3NameRight100.png +PROJECT_LOGO = //intranet/home/Afbeeldingen/PasserVR/Logos/PasserLife/PasserLifeLogoLeft_300.png # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is diff --git a/Messages/DestroyMsg.cs b/Messages/DestroyMsg.cs index e5d0a8e..660c142 100644 --- a/Messages/DestroyMsg.cs +++ b/Messages/DestroyMsg.cs @@ -1,6 +1,3 @@ -using System.IO; -using System.Threading.Tasks; - namespace Passer.RoboidControl { /// diff --git a/Messages/InvestigateMsg.cs b/Messages/InvestigateMsg.cs index 43a6d60..d822fec 100644 --- a/Messages/InvestigateMsg.cs +++ b/Messages/InvestigateMsg.cs @@ -1,6 +1,3 @@ -using System.IO; -using System.Threading.Tasks; - namespace Passer.RoboidControl { /// @@ -44,28 +41,6 @@ namespace Passer.RoboidControl { buffer[ix++] = this.thingId; return ix; } - // public override void Deserialize(byte[] buffer) { - // uint ix = 0; - // this.networkId = buffer[ix++]; - // this.thingId = buffer[ix++]; - // } - - //public static bool Send(Participant client, CoreThing thing) { - // InvestigateMsg msg = new(thing.networkId, thing.id); - // return SendMsg(client, msg); - //} - // public static async Task Receive(Stream dataStream, Participant client, byte packetSize) { - // if (packetSize != length) - // return false; - - // byte[] buffer = await Receive(dataStream, packetSize); - // InvestigateMsg msg = new InvestigateMsg(buffer); - // //UnityEngine.Debug.Log($"Receive investigate [{msg.networkId}/{msg.thingId}]"); - - // client.messageQueue.Enqueue(msg); - // return true; - - // } } } \ No newline at end of file diff --git a/Messages/Messages.cs b/Messages/Messages.cs index 078c8b2..d75e62b 100644 --- a/Messages/Messages.cs +++ b/Messages/Messages.cs @@ -1,6 +1,3 @@ -using System.Threading.Tasks; -using System.IO; - namespace Passer.RoboidControl { /// @@ -23,34 +20,6 @@ namespace Passer.RoboidControl { /// The buffer to serilize into /// The length of the message in the buffer public virtual byte Serialize(ref byte[] buffer) { return 0; } - - //public virtual void Deserialize(byte[] buffer) { } - - // public bool SendTo(Participant client) { - // Serialize(ref client.buffer); - // return client.SendBuffer(client.buffer.Length); - // } - - // public static bool SendMsg(Participant client, IMessage msg) { - // msg.Serialize(ref client.buffer); - // return client.SendBuffer(client.buffer.Length); - // } - - // public static bool PublishMsg(Participant client, IMessage msg) { - // msg.Serialize(ref client.buffer); - // return client.PublishBuffer(client.buffer.Length); - // } - - // public static async Task Receive(Stream dataStream, byte packetSize) { - // byte[] buffer = new byte[packetSize - 1]; // without msgId - // int byteCount = dataStream.Read(buffer, 0, packetSize - 1); - // while (byteCount < packetSize - 1) { - // // not all bytes have been read, wait and try again - // await Task.Delay(1); - // byteCount += dataStream.Read(buffer, byteCount, packetSize - 1 - byteCount); - // } - // return buffer; - // } } } diff --git a/ModelUrlMsg.cs b/Messages/ModelUrlMsg.cs similarity index 54% rename from ModelUrlMsg.cs rename to Messages/ModelUrlMsg.cs index 8f82e47..01b6527 100644 --- a/ModelUrlMsg.cs +++ b/Messages/ModelUrlMsg.cs @@ -1,22 +1,52 @@ namespace Passer.RoboidControl { + /// + /// Message for communicating the URL for a model of the thing + /// public class ModelUrlMsg : IMessage { + /// + /// The message ID + /// public const byte Id = 0x90; // (144) Model URL + /// + /// The length of the message without th URL itself + /// public const byte length = 4; + /// + /// The network ID of the thing + /// public byte networkId; + /// + /// The ID of the thing + /// public byte thingId; + /// + /// The URL of the model + /// public string url = null; + /// + /// Create a new message for sending + /// + /// The network ID of the thing + /// The thing for which to send the model URL public ModelUrlMsg(byte networkId, Thing thing) { this.networkId = networkId; this.thingId = thing.id; this.url = thing.modelUrl; } - public ModelUrlMsg(byte networkId, byte thingId, string url, float scale = 1) { + /// + /// Create a new message for sending + /// + /// The network ID of the thing + /// The ID of the thing + /// The URL to send + public ModelUrlMsg(byte networkId, byte thingId, string url) { this.networkId = networkId; this.thingId = thingId; this.url = url; } + /// @copydoc Passer::RoboidControl::IMessage::IMessage(byte[] buffer) public ModelUrlMsg(byte[] buffer) { byte ix = 1; this.networkId = buffer[ix++]; @@ -26,6 +56,7 @@ namespace Passer.RoboidControl { url = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, strlen); } + /// @copydoc Passer::RoboidControl::IMessage::Serialize public override byte Serialize(ref byte[] buffer) { if (this.url == null) return 0; diff --git a/Messages/NameMsg.cs b/Messages/NameMsg.cs index 6193c37..57de3aa 100644 --- a/Messages/NameMsg.cs +++ b/Messages/NameMsg.cs @@ -9,7 +9,7 @@ namespace Passer.RoboidControl { /// public const byte Id = 0x91; // 145 /// - /// The length of the message + /// The length of the message without the name string /// public const byte length = 4; /// diff --git a/Messages/ParticipantMsg.cs b/Messages/ParticipantMsg.cs index 5f83a4e..6ba3228 100644 --- a/Messages/ParticipantMsg.cs +++ b/Messages/ParticipantMsg.cs @@ -3,6 +3,8 @@ namespace Passer.RoboidControl { /// /// A participant messages notifies other participants of its presence /// + /// When received by another participant, it can be followed by a NetworkIdMsg + /// to announce that participant to this client such that it can join privately public class ParticipantMsg : IMessage { /// /// The message ID @@ -20,7 +22,7 @@ namespace Passer.RoboidControl { /// /// Create a new message for sending /// - /// + /// The network ID known by the participant public ParticipantMsg(byte networkId) { this.networkId = networkId; } diff --git a/Messages/PoseMsg.cs b/Messages/PoseMsg.cs index e31953e..a43b40d 100644 --- a/Messages/PoseMsg.cs +++ b/Messages/PoseMsg.cs @@ -1,5 +1,3 @@ -using System.IO; -using System.Threading.Tasks; using Passer.LinearAlgebra; namespace Passer.RoboidControl { @@ -27,7 +25,7 @@ namespace Passer.RoboidControl { public byte thingId; /// - /// bitpattern stating which pose components are available + /// Bit pattern stating which pose components are available /// public byte poseType; /// @@ -60,7 +58,7 @@ namespace Passer.RoboidControl { /// public Spherical linearVelocity = Spherical.zero; /// - /// The angular veloicty of the thing in local space + /// The angular velocity of the thing in local space /// public Spherical angularVelocity = Spherical.zero; @@ -105,59 +103,7 @@ namespace Passer.RoboidControl { LowLevelMessages.SendSpherical(buffer, ref ix, this.angularVelocity); return ix; } - // public override void Deserialize(byte[] buffer) { - // byte ix = 0; - // this.networkId = buffer[ix++]; - // this.thingId = buffer[ix++]; - // this.poseType = buffer[ix++]; - // if ((poseType & Pose_Position) != 0) - // this.position = LowLevelMessages.ReceiveSpherical(buffer, ref ix); - // if ((poseType & Pose_Orientation) != 0) - // this.orientation = LowLevelMessages.ReceiveSwingTwist(buffer, ref ix); - // if ((poseType & Pose_LinearVelocity) != 0) - // this.linearVelocity = LowLevelMessages.ReceiveSpherical(buffer, ref ix); - // if ((poseType & Pose_AngularVelocity) != 0) - // this.angularVelocity = LowLevelMessages.ReceiveSpherical(buffer, ref ix); - // } - - // public static bool Send(Participant client, byte thingId, Spherical position, SwingTwist orientation) { - // PoseMsg msg = new PoseMsg(client.networkId, thingId, position, orientation); - // return SendMsg(client, msg); - // } - // public static async Task Receive(Stream dataStream, Participant client, byte packetSize) { - // byte[] buffer = await Receive(dataStream, packetSize); - // PoseMsg msg = new PoseMsg(buffer); - - // // Do no process poses with nwid == 0 (== local) - // if (msg.networkId == 0) - // return true; - - // client.messageQueue.Enqueue(msg); - // return true; - // } - - // public static bool SendTo(Participant participant, Thing thing) { - // if (participant == null || thing == null) - // return false; - - // byte ix = 0; - // participant.buffer[ix++] = PoseMsg.Id; - // participant.buffer[ix++] = participant.networkId; - // participant.buffer[ix++] = thing.id; - // participant.buffer[ix++] = thing.poseUpdated; - - // if ((thing.poseUpdated & Pose_Position) != 0 && thing.position != null) - // LowLevelMessages.SendSpherical(participant.buffer, ref ix, thing.position); - // if ((thing.poseUpdated & Pose_Orientation) != 0 && thing.orientation != null) - // LowLevelMessages.SendQuat32(participant.buffer, ref ix, thing.orientation); - // if ((thing.poseUpdated & Pose_LinearVelocity) != 0 && thing.linearVelocity != null) - // LowLevelMessages.SendSpherical(participant.buffer, ref ix, thing.linearVelocity); - // if ((thing.poseUpdated & Pose_AngularVelocity) != 0 && thing.angularVelocity != null) - // LowLevelMessages.SendSpherical(participant.buffer, ref ix, thing.angularVelocity); - - // return participant.SendBuffer(ix); - // } } } \ No newline at end of file diff --git a/Messages/TextMsg.cs b/Messages/TextMsg.cs index 7d353e6..c2dcf16 100644 --- a/Messages/TextMsg.cs +++ b/Messages/TextMsg.cs @@ -1,10 +1,7 @@ -using System.IO; -using System.Threading.Tasks; - namespace Passer.RoboidControl { /// - /// Message for sending generic text. + /// Message for sending generic text /// public class TextMsg : IMessage { /// @@ -43,19 +40,6 @@ namespace Passer.RoboidControl { buffer[ix++] = (byte)this.text[textIx]; return ix; } - // public override void Deserialize(byte[] buffer) { - // uint ix = 0; - // uint strlen = buffer[ix++]; - // this.text = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, (int)strlen); - // } - - // public static async Task Receive(Stream dataStream, Participant client, byte packetSize) { - // byte[] buffer = await Receive(dataStream, packetSize); - // TextMsg msg = new TextMsg(buffer); - - // client.messageQueue.Enqueue(msg); - // return true; - // } } } \ No newline at end of file diff --git a/RemoteParticipant.cs b/RemoteParticipant.cs index 3f2bc02..64b9fb4 100644 --- a/RemoteParticipant.cs +++ b/RemoteParticipant.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Passer.RoboidControl { /// - /// A reference to a participant, possible on a remote location + /// A reference to a participant, possibly on a remote location /// public class RemoteParticipant { /// @@ -28,7 +28,7 @@ namespace Passer.RoboidControl { /// /// Create a new remote participant /// - /// The ip address of the participant + /// The IP address of the participant /// The UDP port of the participant public RemoteParticipant(string ipAddress, int port) { this.ipAddress = ipAddress; @@ -43,7 +43,7 @@ namespace Passer.RoboidControl { /// /// Get a thing with the given ids /// - /// The networkId of the thing + /// The network ID of the thing /// The ID of the thing /// The thing when it is found, null in other cases. public Thing Get(byte networkId, byte thingId) { diff --git a/Thing.cs b/Thing.cs index 8730e7e..95dc1b1 100644 --- a/Thing.cs +++ b/Thing.cs @@ -12,6 +12,28 @@ namespace Passer.RoboidControl { #region Types + #endregion Types + + #region Properties + + public delegate void ChangeHandler(); + public delegate void SphericalHandler(Spherical v); + public delegate void ThingHandler(Thing t); + + /// + /// The participant to which this thing belongs + /// + public RemoteParticipant participant; + + /// + /// The network ID of this thing. + /// + public byte networkId; + /// + /// The ID of this thing + /// + public byte id; + /// /// Predefined thing types /// @@ -37,27 +59,6 @@ namespace Passer.RoboidControl { /// public byte type; - #endregion Types - - #region Properties - - /// - /// The participant to which this thing belongs - /// - public RemoteParticipant participant; - - public delegate void ChangeHandler(); - public delegate void SphericalHandler(Spherical v); - - /// - /// The network ID of this thing. - /// - public byte networkId; - /// - /// The ID of this thing - /// - public byte id; - /// /// Event which is triggered when the parent changes /// @@ -96,7 +97,7 @@ namespace Passer.RoboidControl { /// /// Remove the given thing as a child of this thing /// - /// + /// The child to remove public void RemoveChild(Thing child) { children.Remove(child); } @@ -271,7 +272,6 @@ namespace Passer.RoboidControl { #endregion Update - public delegate void ThingHandler(Thing t); /// /// Event triggered when a new thing has been created ///