public static OicHostBuilder UseCoapUdp(this OicHostBuilder builder) { return(builder.ConfigureServices(services => services .AddSingleton <ICoapTransportFactory, CoapUdpTransportFactory>() )); }
public static OicHostBuilder UseCoap(this OicHostBuilder builder, Action <OicCoapServerOptions> options) { return(builder.UseCoap().ConfigureServices(services => { services.Configure(options); })); }
static void Main(string[] args) { var config = new ConfigurationBuilder() .AddCommandLine(args) .Build(); var host = new OicHostBuilder() .UseConfiguration(config) .ConfigureLogging(logging => { logging .AddDebug() .AddConsole(); }) .UseCoap(options => { // TODO: Allow providing listening options from IOptions<OicCoapServer> options.Listen(new CoapUdpEndPoint(Coap.Port) { JoinMulticast = true }); // enable /.well-know/core options.UseCoreLink = true; }) .UseCoapUdp() .UseStartup <Startup>() .Build(); host.Run(); }
public static OicHostBuilder UseCoap(this OicHostBuilder builder) { return(builder.ConfigureServices(services => services .AddTransient <IConfigureOptions <OicCoapServerOptions>, OicCoapServerOptionsSetup>() .AddTransient <IOicContextFactory, OicCoapContextFactory>() .AddSingleton <IOicServer, OicCoapServer>() )); }