예제 #1
0
 /// <summary>
 /// The settings
 /// </summary>
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationController"/> class.
 /// </summary>
 /// <param name="applicationService">The application service.</param>
 /// <param name="mapper">The mapper.</param>
 /// <param name="settings">The settings.</param>
 public ApplicationController(IApplicationService applicationService,
                              IMapper mapper,
                              IDeviceConfigService deviceConfigService)
 {
     _applicationService  = applicationService;
     _mapper              = mapper;
     _deviceConfigService = deviceConfigService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VersionController"/> class.
 /// </summary>
 /// <param name="versionService">The version service.</param>
 /// <param name="apkService">The apk service.</param>
 /// <param name="mapper">The mapper.</param>
 public VersionController(IVersionService versionService,
                          IMapper mapper,
                          IBundleService bundleService,
                          IDeviceConfigService deviceConfigService)
 {
     _versionService      = versionService;
     _mapper              = mapper;
     _bundleService       = bundleService;
     _deviceConfigService = deviceConfigService;
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceController"/> class.
 /// </summary>
 /// <param name="deviceService">The device service.</param>
 /// <param name="versionService">The version service.</param>
 /// <param name="mapper">The mapper.</param>
 /// <param name="settings">The settings.</param>
 public DeviceController(IDeviceService deviceService,
                         IMapper mapper,
                         Settings settings,
                         IHttpContextAccessor httpContextAccessor,
                         IDeviceConfigService deviceConfigService)
 {
     _deviceService       = deviceService;
     _mapper              = mapper;
     _settings            = settings;
     _httpContextAccessor = httpContextAccessor;
     _deviceConfigService = deviceConfigService;
 }
예제 #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
                              IHostApplicationLifetime appLifetime,
                              IDeviceConfigService configService)
        {
            appLifetime.ApplicationStopping.Register(ApplicationShutdown);
            PrepareEnvironment(env);
            WebRootPath = env.WebRootPath;
            Settings.Instance.WebRootPath = env.WebRootPath;
            SetupScheduler();
            var config = configService.DeviceConfigs.IsCurrent().FirstOrDefault();

            if (config != null)
            {
                SetCurrentConfig(config);
            }

            app.UseExceptionHandler($"/{Business.Constants.ApiEndpoint.ERROR}");
            app.UseStaticFiles();
            app.UseRouting();
            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();
            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
                c.RoutePrefix = string.Empty;
                c.EnableValidator(null);
            });
            app.UseCors(builder =>
            {
                builder.AllowAnyHeader();
                builder.AllowAnyMethod();
                builder.AllowCredentials();
                builder.WithExposedHeaders(Microsoft.Net.Http.Headers.HeaderNames.ContentDisposition);
                //builder.AllowAnyOrigin();
                builder.SetIsOriginAllowed(origin =>
                {
                    return(true);
                });
            });
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
예제 #5
0
 public DeviceConfigController(IDeviceConfigService dcs)
 {
     this._dcs = dcs;
 }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="SpeedingThresholdsService"></param>
 /// <param name="injectConfig"></param>
 /// <param name="loggingService"></param>
 public DeviceConfigSpeedingThresholdController(IDeviceConfigService <DeviceConfigSpeedingThresholdsRequest, DeviceConfigSpeedingThresholdsDetails> speedingThresholdsService,
                                                IInjectConfig injectConfig, ILoggingService loggingService) : base(injectConfig.ResolveKeyed <DeviceConfigRequestToAttributeMaps>("DeviceConfigRequestToAttributeMaps"), loggingService)
 {
     base._loggingService.CreateLogger(typeof(DeviceConfigSpeedingThresholdController));
     this._speedingThresholdsService = speedingThresholdsService;
 }
예제 #7
0
 public DeviceConfigAssetSecurityController(IDeviceConfigService <DeviceConfigAssetSecurityRequest, DeviceConfigAssetSecurityDetails> assetSecurityService,
                                            IInjectConfig injectConfig, ILoggingService loggingService) : base(injectConfig.ResolveKeyed <DeviceConfigRequestToAttributeMaps>("DeviceConfigRequestToAttributeMaps"), loggingService)
 {
     base._loggingService.CreateLogger(typeof(DeviceConfigAssetSecurityController));
     this._assetSecurityService = assetSecurityService;
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigController"/> class.
 /// </summary>
 /// <param name="deviceService">The device service.</param>
 public ConfigController(IDeviceConfigService deviceConfigService,
                         Settings settings)
 {
     _deviceConfigService = deviceConfigService;
     _settings            = settings;
 }
예제 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="reportingScheduleService"></param>
 /// <param name="injectConfig"></param>
 /// <param name="loggingService"></param>
 public DeviceConfigMaintenanceModeController(IDeviceConfigService <DeviceConfigMaintenanceModeRequest, DeviceConfigMaintenanceModeDetails> MaintenanceModeService,
                                              IInjectConfig injectConfig, ILoggingService loggingService) : base(injectConfig.ResolveKeyed <DeviceConfigRequestToAttributeMaps>("DeviceConfigRequestToAttributeMaps"), loggingService)
 {
     base._loggingService.CreateLogger(typeof(DeviceConfigMaintenanceModeController));
     this._maintenanceModeService = MaintenanceModeService;
 }
예제 #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="FaultCodeReportingService"></param>
 /// <param name="injectConfig"></param>
 /// <param name="loggingService"></param>
 public DeviceConfigFaultCodeReportingController(IDeviceConfigService <DeviceConfigFaultCodeReportingRequest, DeviceConfigFaultCodeReportingDetails> faultCodeReportingService,
                                                 IInjectConfig injectConfig, ILoggingService loggingService) : base(injectConfig.ResolveKeyed <DeviceConfigRequestToAttributeMaps>("DeviceConfigRequestToAttributeMaps"), loggingService)
 {
     base._loggingService.CreateLogger(typeof(DeviceConfigFaultCodeReportingController));
     this._faultCodeReportingService = faultCodeReportingService;
 }
예제 #11
0
 public DeviceConfigParameterGroupsController(IDeviceConfigService <DeviceConfigParameterGroupRequest, ParameterGroupDetails> deviceConfigParamGroupService, DeviceConfigAttributeToRequestMaps attributeMap, ILoggingService loggingService) : base(attributeMap, loggingService)
 {
     this._deviceConfigParamGroupService = deviceConfigParamGroupService;
     this._loggingService = loggingService;
     this._loggingService.CreateLogger <DeviceConfigParameterGroupsController>();
 }
예제 #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="reportingScheduleService"></param>
 /// <param name="injectConfig"></param>
 /// <param name="loggingService"></param>
 public DeviceConfigMetersController(IDeviceConfigService <DeviceConfigMetersRequest, DeviceConfigMetersDetails> metersService,
                                     IInjectConfig injectConfig, ILoggingService loggingService) : base(injectConfig.ResolveKeyed <DeviceConfigRequestToAttributeMaps>("DeviceConfigRequestToAttributeMaps"), loggingService)
 {
     base._loggingService.CreateLogger(typeof(DeviceConfigMetersController));
     this._metersService = metersService;
 }