public void Setup() { Log.LogManager.Level = Log.LogLevel.Fatal; _root = new Resource(String.Empty); Resource sensors = new Resource("sensors"); Resource temp = new Resource("temp"); Resource light = new Resource("light"); _root.Add(sensors); sensors.Add(light); sensors.Add(temp); sensors.Attributes.Title = "Sensor Index"; temp.Attributes.AddResourceType("temperature-c"); temp.Attributes.AddInterfaceDescription("sensor"); temp.Attributes.Add("foo"); temp.Attributes.Add("bar", "one"); temp.Attributes.Add("bar", "two"); light.Attributes.AddResourceType("light-lux"); light.Attributes.AddInterfaceDescription("sensor"); }
public Resource Add(Resource child) { lock (this) { Add((IResource)child); } return this; }
/// <summary> /// Constructs a new CoAP Exchange object representing /// the specified exchange and resource. /// </summary> internal CoapExchange(Exchange exchange, Resource resource) { _exchange = exchange; _resource = resource; }
private void CreateServer() { CoAPEndPoint endpoint = new CoAPEndPoint(0); _resource = new TestResource(NAME_1, PAYLOAD); _server = new CoapServer(); _server .Add(new Resource(RES_A) .Add(new Resource(RES_AA) .Add(_resource .Add(new TestResource(CHILD, CHILD_PAYLOAD))))); _server.AddEndPoint(endpoint); _server.Start(); _serverPort = ((System.Net.IPEndPoint)endpoint.LocalEndPoint).Port; }
private void CreateServer() { CoAPEndPoint endpoint = new CoAPEndPoint(0); _resource = new StorageResource(TARGET, CONTENT_1); _server = new CoapServer(); _server.Add(_resource); _server.AddEndPoint(endpoint); _server.Start(); _serverPort = ((System.Net.IPEndPoint)endpoint.LocalEndPoint).Port; }