public ApiController( LatestDataProvider latestDataProvider, GatewayConfiguration gatewayConfiguration, AprsConfig aprsConfig ) { _latestDataProvider = latestDataProvider; _gatewayConfiguration = gatewayConfiguration; _aprsConfig = aprsConfig; }
public Listener() : base(new ClientSettings() { EndPoint = new DnsEndPoint( AprsConfig.GetConfig().Uri, AprsConfig.GetConfig().Port), Listening = false, Splitter = "\r\n", Timeout = 1020000, // 17 minutes afaik, ReconnectOnDisconnect = true }) { // Set the callbacks before starting the client ConnectEvent += OnConnect; ReceiveEvent += OnReceive; Start(); }
public void Start() { if (_Socket != null) { Stop(); } _Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); var state = new StateObject { WorkSocket = _Socket }; _Socket.Connect(AprsConfig.GetConfig().URI, AprsConfig.GetConfig().Port); // Begin receiving the data from the remote device. _Socket.BeginReceive(state.Buffer, 0, StateObject.BUFFER_SIZE, 0, new AsyncCallback(ReceiveCallback), state); _Socket.Send(Encoding.ASCII.GetBytes(string.Format("user {0} pass {1} vers experimenting 0.1 filter {2}\n", AprsConfig.GetConfig().Callsign, AprsConfig.GetConfig().Password, AprsConfig.GetConfig().Filter))); }
/// <summary> /// Configures all services & providers that are based on the appsettings.json /// </summary> /// <param name="services">The systems' IServiceCollection</param> private void ConfigureConfigBasedServices(IServiceCollection services) { var gatewayConfiguration = new GatewayConfiguration(); Configuration.GetSection("GatewayOptions").Bind(gatewayConfiguration); services.AddSingleton(gatewayConfiguration); var aprsConfig = new AprsConfig(); Configuration.GetSection("AprsConfig").Bind(aprsConfig); services.AddSingleton(aprsConfig); services.AddSingleton(_ => { var provider = new AircraftProvider(aprsConfig); provider.Initialize().GetAwaiter().GetResult(); return(provider); }); }
public AircraftProvider(AprsConfig aprsConfig) { _aprsConfig = aprsConfig; _aircraftList = new Dictionary <string, Aircraft>(); }
public StreamProvider(AprsConfig aprsConfig) { _aprsConfig = aprsConfig; Stream = CreateStream(); }
private void OnConnect() { Send( $"user {AprsConfig.GetConfig().Callsign} pass {AprsConfig.GetConfig().Password} vers experimenting 0.1 filter {AprsConfig.GetConfig().Filter}\n"); }