public IEndPoint AddEndPoint(string endpointName, EndPoint address, ICoapConfig config, Type[] layers) { MockChannel channel = new MockChannel(address, this); CoAPEndPoint endpoint = new CoAPEndPoint(channel, config); if (layers != null) { CoapStack stack = endpoint.Stack; foreach (IEntry <ILayer, INextLayer> e in stack.GetAll().ToArray()) { if (e.Name == "head" || e.Name == "tail") { continue; } if (!layers.Contains(e.Filter.GetType())) { stack.Remove(e.Filter); } } } ChannelsByEndpoint.Add(address, new List <MockChannel>() { channel }); return(endpoint); }
/// <summary> /// Instantiates a new endpoint with the /// specified channel and configuration. /// </summary> public CoAPEndPoint(IChannel channel, ICoapConfig config) { _config = config; _channel = channel; _matcher = new Matcher(config); _coapStack = new CoapStack(config); _channel.DataReceived += ReceiveData; }
public ProxyCommunicator(ICoapConfig config) { _coapStack = new CoapStack(config); _httpStack = new HttpStack(config.HttpPort); _coapStack.RegisterReceiver(this); _httpStack.RegisterReceiver(this); }
/// <summary> /// Instantiates a new endpoint with the /// specified channel and configuration. /// </summary> public CoAPEndPoint(IChannel channel, ICoapConfig config) { dataChannel = channel ?? throw new ArgumentNullException(nameof(channel)); Config = config; _matcher = new Matcher(config); _coapStack = new CoapStack(config); dataChannel.DataReceived += ReceiveData; EndpointSchema = new [] { "coap", "coap+udp" }; }
public CommonCommunicator(ICoapConfig config) { _coapStack = new CoapStack(config); LowerLayer = _coapStack; }