public override int EncodeFragmentData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; if (frameIndex == 0) { currentIndex = EncodeUtil.Encode(ref InteractionName, packetBytes, currentIndex, 20); currentIndex = EncodeUtil.Encode(ref SourceParticipantId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref SourceObjectId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref TargetParticipantId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref TargetObjectId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ExtensionDialect, packetBytes, currentIndex, 4); currentIndex = EncodeUtil.Encode(ref ExtensionDialectMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ExtensionDialectMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref extensionLength, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ExtensionData, 0, packetBytes, currentIndex, FragmentDataSize(frameIndex) - InternalDataPrefixSize); } else { currentIndex = EncodeUtil.Encode(ref ExtensionData, frameIndex * MxpConstants.MaxFrameDataSize - TotalDataPrefixSize, packetBytes, currentIndex, FragmentDataSize(frameIndex)); } return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; // Response Fragment currentIndex = EncodeUtil.Encode(ref RequestMessageId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref FailureCode, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ParticipantId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref AvatarId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleName, packetBytes, currentIndex, 40); currentIndex = EncodeUtil.Encode(ref BubbleAssetCacheUrl, packetBytes, currentIndex, 50); currentIndex = EncodeUtil.Encode(ref BubbleRange, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubblePerceptionRange, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleRealTime, packetBytes, currentIndex); // Program Fragment currentIndex = EncodeUtil.Encode(ref ProgramName, packetBytes, currentIndex, 25); currentIndex = EncodeUtil.Encode(ref ProgramMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProgramMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolSourceRevision, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref ChallengeRequestBytes, packetBytes, currentIndex, 64); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref ListType, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref ParticipantId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ParticipantIdentityType, packetBytes, currentIndex, 20); currentIndex = EncodeUtil.Encode(ref ParticipantIdentity, packetBytes, currentIndex, 219); return(currentIndex); }
public static void EncodePacketHeader(Packet packet) { int currentIndex = 0; currentIndex = EncodeUtil.Encode(ref packet.SessionId, packet.PacketBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref packet.PacketId, packet.PacketBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref packet.FirstSendTime, packet.PacketBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref packet.Quaranteed, packet.PacketBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref packet.ResendCount, packet.PacketBytes, currentIndex); packet.DataStartIndex = currentIndex; }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; // Response Fragment currentIndex = EncodeUtil.Encode(ref RequestMessageId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref FailureCode, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; for (int i = 0; i < packetIdCount; i++) { currentIndex = EncodeUtil.Encode(ref packetIds[i], packetBytes, currentIndex); } //FramesEncoded++; return(currentIndex); }
public override int EncodeFragmentData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; if (frameIndex == 0) { currentIndex = EncodeUtil.Encode(ref ObjectId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ObjectIndex, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref TypeId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ParentObjectId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ObjectName, packetBytes, currentIndex, 20); currentIndex = EncodeUtil.Encode(ref TypeName, packetBytes, currentIndex, 20); currentIndex = EncodeUtil.Encode(ref OwnerId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Location.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Location.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Location.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Velocity.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Velocity.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Velocity.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Acceleration.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Acceleration.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Acceleration.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.W, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularVelocity.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularVelocity.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularVelocity.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularVelocity.W, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularAcceleration.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularAcceleration.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularAcceleration.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(AngularAcceleration.W, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BoundingSphereRadius, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref Mass, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ExtensionDialect, packetBytes, currentIndex, 4); currentIndex = EncodeUtil.Encode(ref ExtensionDialectMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ExtensionDialectMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref extensionLength, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ExtensionData, 0, packetBytes, currentIndex, FragmentDataSize(frameIndex) - InternalDataPrefixSize); } else { currentIndex = EncodeUtil.Encode(ref ExtensionData, frameIndex * MxpConstants.MaxFrameDataSize - TotalDataPrefixSize, packetBytes, currentIndex, FragmentDataSize(frameIndex)); } return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; if (frameIndex == 0) { // Response Fragment currentIndex = EncodeUtil.Encode(ref SourceBubbleId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref TargetBubbleId, packetBytes, currentIndex); } currentIndex = ObjectFragment.EncodeFragmentData(frameIndex, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref ObjectIndex, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Location.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Location.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Location.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(Orientation.W, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref TargetBubbleId, packetBytes, currentIndex); currentIndex = SourceBubbleFragment.EncodeFragmentData(packetBytes, currentIndex); // Program Fragment currentIndex = EncodeUtil.Encode(ref ProgramName, packetBytes, currentIndex, 25); currentIndex = EncodeUtil.Encode(ref ProgramMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProgramMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolSourceRevision, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFragmentData(byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref BubbleId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleName, packetBytes, currentIndex, 40); currentIndex = EncodeUtil.Encode(ref BubbleAssetCacheUrl, packetBytes, currentIndex, 51); currentIndex = EncodeUtil.Encode(ref OwnerId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleAddress, packetBytes, currentIndex, 40); currentIndex = EncodeUtil.Encode(ref BubblePort, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(BubbleCenter.X, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(BubbleCenter.Y, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(BubbleCenter.Z, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleRange, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubblePerceptionRange, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleRealTime, packetBytes, currentIndex); return(currentIndex); }
/// <summary> /// Encodes one message frame to packet bytes. /// </summary> /// <param name="session"> /// A session the message belongs to. <see cref="Session"/> /// </param> /// <param name="packetBytes"> /// A byte array containing packet bytes. <see cref="System.Byte"/> /// </param> /// <param name="startIndex"> /// The start index in packet byte array. <see cref="System.Int32"/> /// </param> /// <param name="frameQuaranteed"> /// Output parameter which is true if frame is quaranteed. <see cref="System.Boolean"/> /// </param> /// <returns> /// Start index of next frame in packet byte array. <see cref="System.Int32"/> /// </returns> public static int EncodeFrame(Session session, byte[] packetBytes, int startIndex, ref bool frameQuaranteed) { MessageEntry messageEntry = session.GetPartialOutboundMessage(); if (messageEntry == null) { return(startIndex); } Message message = messageEntry.Message; frameQuaranteed = message.Quaranteed; int currentIndex = startIndex; UInt16 frameCount = message.FrameCount; byte frameSize = message.FrameDataSize(messageEntry.FramesCompleted); currentIndex = EncodeUtil.Encode(ref message.TypeCode, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref message.MessageId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref frameCount, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref messageEntry.FramesCompleted, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref frameSize, packetBytes, currentIndex); try { currentIndex = message.EncodeFrameData(messageEntry.FramesCompleted, packetBytes, currentIndex); messageEntry.FramesCompleted++; } catch (Exception e) { LogUtil.Error("Error sending message: " + e.ToString()); session.CompleteOutboundMessage(messageEntry); } if (messageEntry.FramesCompleted == message.FrameCount) { session.CompleteOutboundMessage(messageEntry); } return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; // TODO this does not work as there are additional parameters /*if (FrameCount != ObjectFragment.FrameCount) * { * FrameCount = ObjectFragment.FrameCount; * }*/ if (frameIndex == 0) { // Response Fragment currentIndex = EncodeUtil.Encode(ref RequestMessageId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref FailureCode, packetBytes, currentIndex); } currentIndex = ObjectFragment.EncodeFragmentData(frameIndex, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }
public override int EncodeFrameData(int frameIndex, byte[] packetBytes, int startIndex) { int currentIndex = startIndex; currentIndex = EncodeUtil.Encode(ref BubbleId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref AvatarId, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref BubbleName, packetBytes, currentIndex, 40); currentIndex = EncodeUtil.Encode(ref LocationName, packetBytes, currentIndex, 28); currentIndex = EncodeUtil.Encode(ref ParticipantIdentifier, packetBytes, currentIndex, 32); currentIndex = EncodeUtil.Encode(ref ParticipantSecret, packetBytes, currentIndex, 32); currentIndex = EncodeUtil.Encode(ref ParticipantRealTime, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref IdentityProviderUrl, packetBytes, currentIndex, 50); // Program Fragment currentIndex = EncodeUtil.Encode(ref ProgramName, packetBytes, currentIndex, 25); currentIndex = EncodeUtil.Encode(ref ProgramMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProgramMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolMajorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolMinorVersion, packetBytes, currentIndex); currentIndex = EncodeUtil.Encode(ref ProtocolSourceRevision, packetBytes, currentIndex); //FramesEncoded++; return(currentIndex); }