Exemplo n.º 1
0
 public PushData(ILogger <PushData> logger, IServiceScopeFactory scopeFactor
                 , IOptions <AppSettings> options, IMsgQueue queue
                 )
 {
     _mcsetting = options.Value.MqttClient;
     _logger    = logger;
     scope      = scopeFactor.CreateScope();
     _queue     = queue;
 }
Exemplo n.º 2
0
 public PushData(ILogger <PushData> logger, IServiceScopeFactory scopeFactor
                 , IOptions <AppSettings> options, IMsgQueue queue, IStorage storage
                 )
 {
     _appSettings = options.Value;
     _logger      = logger;
     scope        = scopeFactor.CreateScope();
     _queue       = queue;
     _storage     = storage;
 }
Exemplo n.º 3
0
 public MQTTServerHandler(ILogger <MQTTServerHandler> logger, IServiceScopeFactory scopeFactor, IMqttServerEx serverEx
                          , IOptions <AppSettings> options, IMsgQueue queue
                          )
 {
     _mcsetting = options.Value.MqttClient;
     _logger    = logger;
     scope      = scopeFactor.CreateScope();
     _dbContext = scope.ServiceProvider.GetRequiredService <ApplicationDbContext>();
     _serverEx  = serverEx;
     _queue     = queue;
 }
Exemplo n.º 4
0
 public CoApResource(string name, ApplicationDbContext dbContext, ILogger logger, IMsgQueue queue)
     : base(name)
 {
     Attributes.Title = name;
     _res             = (CoApRes)Enum.Parse(typeof(CoApRes), name);
     _dbContext       = dbContext;
     foreach (Int32 item in _supported)
     {
         Attributes.AddContentType(item);
     }
     _logger = logger;
     _queue  = queue;
     _logger.LogInformation($"CoApResource {name} is created.");
 }
Exemplo n.º 5
0
        private void DoSend(string msg)
        {
            int i = 0;
            IMsgQueue <IActor> item = fQueue.TryDequeue().Result;

            while (item.Result && (i < KSize))
            {
                item.Data.SendMessage("Bop");
                item = fQueue.TryDequeue().Result;
                Console.WriteLine("receive " + i.ToString(CultureInfo.InvariantCulture));
                i++;
            }
            Console.WriteLine("end " + i.ToString(CultureInfo.InvariantCulture));
        }
Exemplo n.º 6
0
 public DbReceiver(ILog _log, IMsgQueue <byte[]> _msg)
 {
     msg = _msg;
 }
Exemplo n.º 7
0
 public ClientSocket(ILog _log, IMsgQueue <Msg> _msg, IWebSocket _socket)
 {
     msg    = _msg;
     socket = _socket;
 }
Exemplo n.º 8
0
 public HostSocket(ILog _log, IMsgQueue <Msg> _msg, IWebSocketConnection _socket)
 {
     msg    = _msg;
     socket = _socket;
 }
Exemplo n.º 9
0
 public CoAPService(ILogger <CoAPService> logger, IServiceScopeFactory scopeFactor, IOptions <AppSettings> options, IMsgQueue queue)
 {
     _settings     = options.Value;
     server        = new CoapServer(_settings.CoapServer);
     _logger       = logger;
     _serviceScope = scopeFactor.CreateScope();
     _dbContext    = _serviceScope.ServiceProvider.GetRequiredService <ApplicationDbContext>();
     Enum.GetNames(typeof(CoApRes)).ToList().ForEach(n => server.Add(new CoApResource(n, _serviceScope.ServiceProvider.GetRequiredService <ApplicationDbContext>(), _logger, queue)));
 }