diff --git a/Common/OpenSim.Framework/LLSDHelpers.cs b/Common/OpenSim.Framework/LLSDHelpers.cs index 5b734837af..3b044a3e82 100644 --- a/Common/OpenSim.Framework/LLSDHelpers.cs +++ b/Common/OpenSim.Framework/LLSDHelpers.cs @@ -99,6 +99,31 @@ namespace OpenSim.Framework } } + [LLSDType("MAP")] + public class LLSDMapLayerResponse + { + public LLSDMapRequest AgentData = new LLSDMapRequest(); + public LLSDArray LayerData = new LLSDArray(); + + public LLSDMapLayerResponse() + { + + } + } + + [LLSDType("MAP")] + public class LLSDCapsDetails + { + public string MapLayer = ""; + public string NewFileAgentInventory = ""; + //public string EventQueueGet = ""; + + public LLSDCapsDetails() + { + + } + } + [LLSDType("MAP")] public class LLSDMapLayer { @@ -108,10 +133,9 @@ namespace OpenSim.Framework public int Bottom = 0; public LLUUID ImageID = LLUUID.Zero; - public LLSDArray TestArray = new LLSDArray(); public LLSDMapLayer() { - + } } @@ -137,6 +161,7 @@ namespace OpenSim.Framework } } + [LLSDType("MAP")] public class LLSDTest { @@ -153,12 +178,11 @@ namespace OpenSim.Framework [AttributeUsage(AttributeTargets.Class)] public class LLSDType : Attribute { - private string myHandler; - + private string myType; public LLSDType(string type) { - myHandler = type; + myType = type; } @@ -166,7 +190,7 @@ namespace OpenSim.Framework { get { - return myHandler; + return myType; } } } diff --git a/Common/OpenSim.Servers/BaseHttpServer.cs b/Common/OpenSim.Servers/BaseHttpServer.cs index 86339c1d4f..e55e33c2f5 100644 --- a/Common/OpenSim.Servers/BaseHttpServer.cs +++ b/Common/OpenSim.Servers/BaseHttpServer.cs @@ -75,7 +75,7 @@ namespace OpenSim.Servers public bool AddRestHandler(string method, string path, RestMethod handler) { - Console.WriteLine("adding new REST handler for path " + path); + //Console.WriteLine("adding new REST handler for path " + path); string methodKey = String.Format("{0}: {1}", method, path); if (!this.m_restHandlers.ContainsKey(methodKey)) diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs index 319e0275c8..27d4828e23 100644 --- a/OpenSim/OpenSim.Region/Caps.cs +++ b/OpenSim/OpenSim.Region/Caps.cs @@ -63,10 +63,9 @@ namespace OpenSim.Region /// public string CapsRequest(string request, string path, string param) { - Console.WriteLine("Caps Request " + request); - string result = ""; - result += this.GetCapabilities(); - result += ""; + // Console.WriteLine("Caps Request " + request); + string result = ""; + result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); return result; } @@ -74,15 +73,19 @@ namespace OpenSim.Region /// /// /// - protected string GetCapabilities() + protected LLSDCapsDetails GetCapabilities() { - string capURLS = ""; - + /* string capURLS = ""; capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; //capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; - return capURLS; + return capURLS;*/ + + LLSDCapsDetails caps = new LLSDCapsDetails(); + caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; + caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; + return caps; } /// @@ -99,9 +102,12 @@ namespace OpenSim.Region LLSDMapRequest mapReq = new LLSDMapRequest(); LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); - string res = "AgentDataFlags0LayerData"; - res += this.BuildLLSDMapLayerResponse(); - res += ""; + LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); + + //Console.WriteLine(" Maplayer response is " + res); + return res; } @@ -109,24 +115,14 @@ namespace OpenSim.Region /// /// /// - protected string BuildLLSDMapLayerResponse() + protected LLSDMapLayer BuildLLSDMapLayerResponse() { - string res = ""; - int left; - int right; - int top; - int bottom; - LLUUID image = null; + LLSDMapLayer mapLayer = new LLSDMapLayer(); + mapLayer.Right = 5000; + mapLayer.Top = 5000; + mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); - left = 0; - bottom = 0; - top = 5000; - right = 5000; - image = new LLUUID("00000000-0000-0000-9999-000000000006"); - - res += "Left" + left + "Bottom" + bottom + "Top" + top + "Right" + right + "ImageID" + image.ToStringHyphenated() + ""; - - return res; + return mapLayer; } public string ProcessEventQueue(string request, string path, string param) @@ -191,7 +187,7 @@ namespace OpenSim.Region AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; - Console.WriteLine("uploader url is " + uploaderURL); + //Console.WriteLine("uploader url is " + uploaderURL); res += ""; res += "uploader" + uploaderURL + ""; //res += "successtrue"; @@ -244,7 +240,7 @@ namespace OpenSim.Region res += "statecomplete"; res += ""; - Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); + // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); if (OnUpLoad != null) {