Пример #1
0
        public CaptureManager(IOnlineManager onlineManager)
        {
            this.onlineManager = onlineManager;

            table = new TableValues <byte, float>();
            table.ValueChanged    += TableOnValueChanged;
            table.PropertyChanged += TableOnPropertyChanged;

            onlineManager.FirmwareManager.OnOpenFirmware  += FirmwareManagerOnOpenFirmware;
            onlineManager.FirmwareManager.OnCloseFirmware += FirmwareManagerOnOpenFirmware;
            onlineManager.FirmwareManager.PropertyChanged += FirmwareManagerOnPropertyChanged;

            onlineManager.FirmwareManager.AutoCorrection += (sender, args) =>
            {
                if (!onlineManager.EnabledRamOnlineCorrection)
                {
                    return;
                }
                if (CapturedTable == null || CapturedTable.Address != args.Address)
                {
                    return;
                }

                CapturedTable.SetSource(args.Index, args.Source);
                args.Cancel = true;
            };

            SetEnabled();
        }
Пример #2
0
 public void Prepare(IoControlManager ioControlManager)
 {
     this.ioControlManager = ioControlManager;
     onlineManager         = ioControlManager.appHost.GetOnlineManager();
     onlineManager.OltProtocol.OnConnect    += OltProtocolOnConnectDisconnect;
     onlineManager.OltProtocol.OnDisconnect += OltProtocolOnConnectDisconnect;
 }
Пример #3
0
 public HomeController(
     ICurrent current,
     IPushService pushService,
     IOnlineManager onlineManager,
     ILogger <HomeController> logger,
     ITokenService tokenService,
     IDeviceService deviceService,
     ITypeFinder typeFinder,
     ITypeResolve typeResolve,
     IDbContext dbContext,
     DbContextFactory dbContextFactory,
     ICache cache,
     IBackgroundJobManager backgroundJobManager,
     IOptions <HangfireOptions> hangfireOption)
 {
     _current              = current;
     _tokenService         = tokenService;
     _deviceService        = deviceService;
     _typeFinder           = typeFinder;
     _typeResolve          = typeResolve;
     _dbContext            = dbContext;
     _dbContextFactory     = dbContextFactory;
     _cache                = cache;
     _backgroundJobManager = backgroundJobManager;
     _hangfireOptions      = hangfireOption.Value;
     _pushService          = pushService;
     _logger               = logger;
 }
Пример #4
0
 protected HubBase(ICurrent current, IOnlineManager onlineManager, ILogger <HubBase> logger, IOptions <SysOptions> sysOptions)
 {
     Current       = current;
     OnlineManager = onlineManager;
     Logger        = logger;
     SysOptions    = sysOptions?.Value;
 }
Пример #5
0
 public OltEditorManager(IApplicationHost applicationHost)
 {
     appHost        = applicationHost;
     onlineManager  = appHost.GetOnlineManager();
     oltEditorPanel = new OltEditorPanel();
     oltEditorPanel.Init(onlineManager);
     appHost.AddContent(oltEditorPanel, "Изменение калибровок online", null, Keys.None);
 }
Пример #6
0
 public DeviceController(IDeviceService deviceService, ICurrent current, IPushService pushService, IOnlineManager onlineManager, DbContextFactory DbContextFactory, IDbContext dbContext, ILogger <DeviceController> logger)
 {
     _current          = current;
     _deviceService    = deviceService;
     _pushService      = pushService;
     _onlineManager    = onlineManager;
     _dbContext        = dbContext;
     _DbContextFactory = DbContextFactory;
     _logger           = logger;
 }
Пример #7
0
 public PushService(ICurrent current, IOnlineManager onlineManager, ILogger <PushService> logger, ITokenService tokenService, IMediator mediator, IDeviceService deviceService, ITypeFinder typeFinder, ITypeResolve typeResolve, SignalrClient signalrClient, IOptions <SysOptions> options)
 {
     _tokenService  = tokenService;
     _mediator      = mediator;
     _deviceService = deviceService;
     _typeFinder    = typeFinder;
     _typeResolve   = typeResolve;
     _current       = current;
     _onlineManager = onlineManager;
     _logger        = logger;
     _signalrClient = signalrClient;
     _options       = options?.Value;
 }
Пример #8
0
 public SignalRRealTimeNotifier(
     IOnlineManager onlineManager,
     IHubContext <DeviceHub> deviceHubContext,
     ILogger <SignalRRealTimeNotifier> logger,
     IPackStore <HttpLog> logStore,
     IDeviceService deviceService)
 {
     _onlineManager    = onlineManager;
     _deviceHubContext = deviceHubContext;
     Logger            = logger;
     _logStore         = logStore;
     _deviceService    = deviceService;
 }
Пример #9
0
 public MonitorWorker(IPackStore <HttpLog> httpLogStore,
                      IPackStore <MonitorEvent> monitorService,
                      IPackStore <TimeData> monitorTimeDataManager,
                      ILogger <MonitorWorker> logger,
                      IOptions <MonitorOptions> settings,
                      IOnlineManager onlineManager)
 {
     _httpLogStore           = httpLogStore;
     _monitorService         = monitorService;
     _monitorTimeDataManager = monitorTimeDataManager;
     _logger        = logger;
     _settings      = settings;
     _onlineManager = onlineManager;
 }
Пример #10
0
 public HomeController(
     ICurrent current,
     IOnlineManager onlineManager,
     ILogger <HomeController> logger,
     ITokenService tokenService,
     IDeviceService deviceService,
     ITypeFinder typeFinder,
     ITypeResolve typeResolve,
     IDbContext dbContext,
     DbContextFactory dbContextFactory,
     ICache cache,
     IBackgroundJobManager backgroundJobManager)
 {
     _current              = current;
     _tokenService         = tokenService;
     _deviceService        = deviceService;
     _typeFinder           = typeFinder;
     _typeResolve          = typeResolve;
     _dbContext            = dbContext;
     _dbContextFactory     = dbContextFactory;
     _cache                = cache;
     _backgroundJobManager = backgroundJobManager;
 }
Пример #11
0
 public DeviceHub(ICurrent current, ICache cache, IDbContext dbContext, IDatabaseHelper databaseHelper, IDataContainer dataContainer, SignalrClient signalrClient, IOnlineManager onlineManager, ILogger <DeviceHub> logger, ITokenService tokenService, IDeviceService deviceService, ITypeFinder typeFinder, ITypeResolve typeResolve, IMediator mediator, IHttpContextAccessor httpContextAccessor, IPackStore <HttpLog> logStore, IPackStore <TimeData> monitorTimeDataManager, Tracer tracer, TracerFactory tracerFactor, IOptions <MonitorOptions> settings, DbContextFactory dbContextFactory, IOptions <SysOptions> sysOptions, IOptions <HangfireOptions> hangfireOption = null) : base(current, onlineManager, logger, sysOptions)
 {
     _tokenService           = tokenService;
     _deviceService          = deviceService;
     _typeFinder             = typeFinder;
     _typeResolve            = typeResolve;
     _mediator               = mediator;
     _httpContextAccessor    = httpContextAccessor;
     _logStore               = logStore;
     _monitorTimeDataManager = monitorTimeDataManager;
     _tracer           = tracer;//tracerFactor.GetTracer( "syinpo-signalr-tracer"+CommonHelper.NewSequentialGuid() );
     _tracerFactory    = tracerFactor;
     _settings         = settings;
     _hangfireOptions  = hangfireOption.Value;
     _dbContextFactory = dbContextFactory;
     _cache            = cache;
     _dbContext        = dbContext;
     _databaseHelper   = databaseHelper;
     _dataContainer    = dataContainer;
     _signalrClient    = signalrClient;
     _logger           = logger;
 }
Пример #12
0
        public ServerEntry(IOnlineManager manager, [NotNull] ServerInformation information, bool? forceIsLan = null)
                : base(manager, information.GetUniqueId(), true) {
            if (information == null) throw new ArgumentNullException(nameof(information));

            OriginalInformation = information;

            IsLan = forceIsLan ?? information.IsLan;

            Ip = information.Ip;
            Port = information.Port;
            PortC = information.PortC;
            PortT = information.PortT;

            Ping = null;
            SetSomeProperties(information);
        }
Пример #13
0
 public ServerEntry(IOnlineManager manager, string id, bool enabled) : base(manager, id, enabled) {
     IsUnavailable = true;
 }
Пример #14
0
 public static ServerEntry FromAddress(IOnlineManager manager, [NotNull] string address) {
     if (address == null) throw new ArgumentNullException(nameof(address));
     var information = KunosApiProvider.TryToGetInformationDirect(address);
     return information == null ? null : new ServerEntry(manager, information, true);
 }
Пример #15
0
        /// <summary>
        /// 加载各种配置
        /// </summary>
        public virtual void Setup()
        {
            var builder = new ContainerBuilder();

            //Redis连接池  管理全局信息
            builder.Register(c => ConnectionMultiplexer.Connect(ServerContainer.GetServerSetting().RedisHost))
            .As <ConnectionMultiplexer>()
            .SingleInstance();

            //在线管理
            builder.Register(c => new RedisOnlineManager <TOnlineRole>(c.Resolve <ConnectionMultiplexer>())
            {
                //Serializer = c.Resolve<IRedisSerializer>()
            }).As <IOnlineManager>()
            .SingleInstance();

            //builder.Register(c => new ProtoResponseConvert()).As<IResponseConvert>().SingleInstance();
            ////默认的包解析器
            builder.Register(c => new ProtocolPackage())
            .InstancePerDependency()
            .As <IProtocolPackage>();

            //默认消息广播
            builder.Register(c => new DefaultMessageBroadcast()).SingleInstance();

            builder.Register(c => new ProtobufService()).As <IProtoService>().SingleInstance();


            foreach (var responseConvert in typeof(IResponseConvert).Assembly.GetTypes().Where(item => typeof(IResponseConvert).IsAssignableFrom(item)))
            {
                if (responseConvert.IsInterface)
                {
                    continue;
                }

                var attrs = responseConvert.GetCustomAttributes(typeof(DisplayColumnAttribute), false);
                if (attrs.Any())
                {
                    var convertName = ((DisplayColumnAttribute)attrs[0]).DisplayColumn;
                    if (!string.IsNullOrEmpty(convertName))
                    {
                        builder.Register(c => Activator.CreateInstance(responseConvert))
                        .Keyed <IResponseConvert>(convertName.ToLower())
                        .SingleInstance();
                    }
                }
            }

            IocConfig(builder);
            ServerContainer.InitContainers(builder);

            ServerContainer.ServerIoc.Resolve <IProtoService>().Init(ServerContainer.GetEntityAssemblyList());

            RedisDataBaseExtension.RedisSerilazer = ServerContainer.ServerIoc.Resolve <IRedisSerializer>();

            ProtocolPackage = ServerContainer.ServerIoc.Resolve <IProtocolPackage>();
            OnlineManager   = ServerContainer.ServerIoc.Resolve <IOnlineManager>();

            //注册内置命令
            RegisterActions(typeof(ActorService <TActorService, TOnlineRole>).Assembly.GetTypes());
            //注册外置命令
            RegisterActions(GetActions());
        }
Пример #16
0
 public void Init(IOnlineManager onlineManager)
 {
     this.onlineManager = onlineManager;
     onlineManager.FirmwareManager.OnOpenFirmware  += FirmwareManagerOnOnOpenFirmware;
     onlineManager.FirmwareManager.OnCloseFirmware += FirmwareManagerOnOnCloseFirmware;
 }