public HubService(IHubContext <DeviceHub> hubContext, ACommunicationProtocol communicationProtocol) { HubContext = hubContext; CommunicationProtocol = communicationProtocol; CommunicationProtocol.SetSendStatusDelegate(SendStatus); CommunicationProtocol.SetSendAvailableCommandsDelegate(SendAvailableCommands); CommunicationProtocol.SetSendImageDelegate(SendImage); CommunicationProtocol.SetSendPdfDelegate(SendPdf); }
public static Task RunWebHostBuilder(string[] args, string publicKey, ACommunicationProtocol communicationProtocol) { return(WebHost.CreateDefaultBuilder(args) .ConfigureServices(configureServices => { configureServices.AddSingleton(provider => { RSA rsa = RSA.Create(); rsa.FromXmlString(publicKey); return new RsaSecurityKey(rsa); }); configureServices.AddSingleton(communicationProtocol); }) .UseStartup <Startup>() .UseUrls("http://localhost:3001") .Build() .RunAsync()); }
public DeviceHub(HubService hubService, ACommunicationProtocol communicationProtocol) { HubService = hubService; CommunicationProtocol = communicationProtocol; }