コード例 #1
0
 public HubService(IHubContext <DeviceHub> hubContext, ACommunicationProtocol communicationProtocol)
 {
     HubContext            = hubContext;
     CommunicationProtocol = communicationProtocol;
     CommunicationProtocol.SetSendStatusDelegate(SendStatus);
     CommunicationProtocol.SetSendAvailableCommandsDelegate(SendAvailableCommands);
     CommunicationProtocol.SetSendImageDelegate(SendImage);
     CommunicationProtocol.SetSendPdfDelegate(SendPdf);
 }
コード例 #2
0
 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());
 }
コード例 #3
0
 public DeviceHub(HubService hubService, ACommunicationProtocol communicationProtocol)
 {
     HubService            = hubService;
     CommunicationProtocol = communicationProtocol;
 }