More work on OpenGrid.Framework.Communications

merge
MW 2007-05-31 14:22:14 +00:00
parent ee5bd67b82
commit a575bc38d6
6 changed files with 124 additions and 22 deletions

View File

@ -31,7 +31,7 @@ namespace OpenGrid.Framework.Communications
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
public virtual IRegionCommsHost RegisterRegion(RegionInfo regionInfo)
public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo)
{
return null;
}

View File

@ -12,28 +12,30 @@ namespace OpenGrid.Framework.Communications
public class TestLocalCommsManager : RegionServerCommsManager
{
protected Dictionary<uint , RegionInfo> regions = new Dictionary<uint,RegionInfo>();
protected Dictionary<uint, RegionCommsHostBase> regionHosts = new Dictionary<uint, RegionCommsHostBase>();
public TestLocalCommsManager()
{
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public override RegionInfo LoadRegionConfigFromGridServer(LLUUID regionID)
{
return null;
}
/// <summary>
///
/// </summary>
/// <param name="regionInfo"></param>
/// <returns></returns>
public override IRegionCommsHost RegisterRegion(RegionInfo regionInfo)
public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo)
{
if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
{
this.regions.Add((uint)regionInfo.RegionHandle, regionInfo);
RegionCommsHostBase regionHost = new RegionCommsHostBase();
this.regionHosts.Add((uint)regionInfo.RegionHandle, regionHost);
return regionHost;
}
//already in our list of regions so for now lets return null
return null;
}
@ -59,19 +61,30 @@ namespace OpenGrid.Framework.Communications
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="loginData"></param>
/// <returns></returns>
public override bool AvatarCrossingToRegion()
public bool AddNewSession(uint regionHandle, Login loginData)
{
return false;
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = loginData.Agent;
agent.firstname = loginData.First;
agent.lastname = loginData.Last;
agent.SessionID = loginData.Session;
agent.SecureSessionID = loginData.SecureSession;
agent.circuitcode = loginData.CircuitCode;
agent.BaseFolder = loginData.BaseFolder;
agent.InventoryFolder = loginData.InventoryFolder;
agent.startpos = new LLVector3(128, 128, 70);
if (this.regionHosts.ContainsKey((uint)regionHandle))
{
this.regionHosts[(uint)regionHandle].TriggerExpectUser(agent);
return true;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public override IList RequestMapBlocks()
{
return null;
// region not found
return false;
}
}
}

View File

@ -6,7 +6,7 @@ using OpenSim.Framework.Types;
namespace OpenSim.Framework
{
public delegate void ExpectUserDelegate();
public delegate void ExpectUserDelegate(AgentCircuitData agent);
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
public interface IRegionCommsHost

View File

@ -107,6 +107,7 @@
<Compile Include="LoginService.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RegionCommsHostBase.cs" />
<Compile Include="Remoting.cs">
<SubType>Code</SubType>
</Compile>

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
namespace OpenSim.Framework
{
public class RegionCommsHostBase :IRegionCommsHost
{
public event ExpectUserDelegate OnExpectUser;
public event GenericCall2 OnExpectChildAgent;
public event GenericCall2 OnAvatarCrossingIntoRegion;
public event UpdateNeighbours OnNeighboursUpdate;
/// <summary>
///
/// </summary>
/// <param name="agent"></param>
/// <returns></returns>
public virtual bool TriggerExpectUser(AgentCircuitData agent)
{
if(OnExpectUser != null)
{
OnExpectUser(agent);
return true;
}
return false;
}
}
}

View File

@ -36,6 +36,9 @@ namespace OpenSim
public event NewAvatar OnNewAvatar;
public event GenericCall6 OnRemoveAvatar;
/// <summary>
///
/// </summary>
public LLVector3 StartPos
{
get
@ -48,6 +51,9 @@ namespace OpenSim
}
}
/// <summary>
///
/// </summary>
public LLUUID AgentId
{
get
@ -56,6 +62,9 @@ namespace OpenSim
}
}
/// <summary>
///
/// </summary>
public string FirstName
{
get
@ -65,6 +74,9 @@ namespace OpenSim
}
/// <summary>
///
/// </summary>
public string LastName
{
get
@ -75,6 +87,10 @@ namespace OpenSim
#region World/Avatar to Client
/// <summary>
///
/// </summary>
/// <param name="regInfo"></param>
public void MoveAgentIntoRegion(RegionInfo regInfo)
{
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
@ -88,6 +104,15 @@ namespace OpenSim
OutPacket(mov);
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="type"></param>
/// <param name="fromPos"></param>
/// <param name="fromName"></param>
/// <param name="fromAgentID"></param>
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
System.Text.Encoding enc = System.Text.Encoding.ASCII;
@ -104,6 +129,10 @@ namespace OpenSim
this.OutPacket(reply);
}
/// <summary>
///
/// </summary>
/// <param name="wearables"></param>
public void SendWearables(AvatarWearable[] wearables)
{
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
@ -125,6 +154,12 @@ namespace OpenSim
this.OutPacket(aw);
}
/// <summary>
///
/// </summary>
/// <param name="agentID"></param>
/// <param name="visualParams"></param>
/// <param name="textureEntry"></param>
public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
{
AvatarAppearancePacket avp = new AvatarAppearancePacket();
@ -200,6 +235,10 @@ namespace OpenSim
}
}
/// <summary>
///
/// </summary>
/// <param name="regionInfo"></param>
public void SendRegionHandshake(RegionInfo regionInfo)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
@ -240,6 +279,15 @@ namespace OpenSim
OutPacket(handshake);
}
/// <summary>
///
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <param name="avatarID"></param>
/// <param name="avatarLocalID"></param>
/// <param name="Pos"></param>
public void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos)
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
@ -263,6 +311,10 @@ namespace OpenSim
}
/// <summary>
///
/// </summary>
/// <param name="objdata"></param>
protected void SetDefaultPacketValues(ref ObjectUpdatePacket.ObjectDataBlock objdata)
{
objdata.PSBlock = new byte[0];
@ -291,6 +343,10 @@ namespace OpenSim
objdata.ObjectData[64] = 189;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket()
{
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);