示例#1
0
        private static void AddDefaultServices(
            IServiceCollection collection,
            IDroneServerEnviroment enviroment,
            IConfiguration configuration)
        {
            if (collection is null)
            {
                throw new ArgumentNullException(nameof(collection));
            }
            if (enviroment is null)
            {
                throw new ArgumentNullException(nameof(enviroment));
            }
            if (configuration is null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            collection.AddSettingsWithDB(configuration);
            collection.AddDroneContexts(enviroment);
            collection.AddLoopWorkers();
            collection.AddMovement();
            collection.AddPidRegulators();
            collection.AddGlobalExceptionCatching();
            collection.AddStabilization();
        }
 public static IServiceCollection AddDroneContexts(this IServiceCollection collection, IDroneServerEnviroment enviroment)
 {
     collection.TryAddSingleton <IDroneServerContext, DroneServerContext>();
     collection.TryAddSingleton(enviroment);
     return(collection);
 }
示例#3
0
 public GenericDroneServerHostBuilder(IHostBuilder builder)
 {
     _builder   = builder ?? throw new ArgumentNullException(nameof(builder));
     Enviroment = new DroneServerEnviroment();
 }
示例#4
0
 public DroneServerContext(IMovementSource movementSource, IDroneServerEnviroment enviroment, IServiceProvider provider)
 {
     MovementSource = movementSource ?? throw new ArgumentNullException(nameof(movementSource));
     Enviroment     = enviroment ?? throw new ArgumentNullException(nameof(enviroment));
     Provider       = provider ?? throw new ArgumentNullException(nameof(provider));
 }