コード例 #1
0
ファイル: PushData.cs プロジェクト: neoayi/IoTSharp
 public PushData(ILogger <PushData> logger, IServiceScopeFactory scopeFactor
                 , IOptions <AppSettings> options, IMsgQueue queue
                 )
 {
     _mcsetting = options.Value.MqttClient;
     _logger    = logger;
     scope      = scopeFactor.CreateScope();
     _queue     = queue;
 }
コード例 #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;
 }
コード例 #3
0
ファイル: MQTTServerHandler.cs プロジェクト: neoayi/IoTSharp
 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;
 }
コード例 #4
0
ファイル: CoAPResource.cs プロジェクト: neoayi/IoTSharp
 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.");
 }
コード例 #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));
        }
コード例 #6
0
 public DbReceiver(ILog _log, IMsgQueue <byte[]> _msg)
 {
     msg = _msg;
 }
コード例 #7
0
 public ClientSocket(ILog _log, IMsgQueue <Msg> _msg, IWebSocket _socket)
 {
     msg    = _msg;
     socket = _socket;
 }
コード例 #8
0
 public HostSocket(ILog _log, IMsgQueue <Msg> _msg, IWebSocketConnection _socket)
 {
     msg    = _msg;
     socket = _socket;
 }
コード例 #9
0
ファイル: CoAPService.cs プロジェクト: neoayi/IoTSharp
 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)));
 }