Example #1
0
 public DebugServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity)
 {
     _connection = connection;
     _seq = seq;
     _identity = identity;
     _bootTime = DateTime.Now;
 }
        public StatusTextServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity, StatusTextLoggerConfig config)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (seq == null)
            {
                throw new ArgumentNullException(nameof(seq));
            }
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _connection = connection;
            _seq        = seq;
            _identity   = identity;
            _config     = config;

            _logger.Debug($"Create status logger for [sys:{identity.SystemId}, com:{identity.ComponenId}] with send rate:{config.MaxSendRateHz} Hz, buffer size: {config.MaxQueueSize}");

            Observable.Timer(TimeSpan.FromSeconds(1.0 / _config.MaxSendRateHz),
                             TimeSpan.FromSeconds(1.0 / _config.MaxSendRateHz)).Subscribe(TrySend, _disposeCancel.Token);
        }
Example #3
0
 public CommandLongServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity)
 {
     _connection = connection;
     _seq        = seq;
     _identity   = identity;
     connection
     .Where(_ => _.MessageId == CommandLongPacket.PacketMessageId)
     .Cast <CommandLongPacket>()
     .Where(_ => _.Payload.TargetComponent == identity.ComponentId && _.Payload.TargetSystem == identity.SystemId)
     .ObserveOn(TaskPoolScheduler.Default)
     .Subscribe(OnRequest, _disposeCancel.Token);
 }
 public V2ExtensionServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity)
 {
     _connection = connection;
     _seq        = seq;
     _identity   = identity;
     connection
     .Where(_ => _.MessageId == V2ExtensionPacket.PacketMessageId)
     .Cast <V2ExtensionPacket>().Where(_ =>
                                       (_.Payload.TargetSystem == 0 || _.Payload.TargetSystem == _identity.SystemId) &&
                                       (_.Payload.TargetComponent == 0 || _.Payload.TargetComponent == _identity.ComponenId))
     .Subscribe(_onData, _disposeCancel.Token);
 }
Example #5
0
        public LoggingServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq,
                             MavlinkServerIdentity identity)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (seq == null)
            {
                throw new ArgumentNullException(nameof(seq));
            }

            _connection = connection;
            _seq        = seq;
            _identity   = identity;
        }
Example #6
0
 public MavlinkPacketTransponder(IMavlinkV2Connection connection, MavlinkServerIdentity identityConfig, IPacketSequenceCalculator seq)
 {
     if (connection == null)
     {
         throw new ArgumentNullException(nameof(connection));
     }
     if (identityConfig == null)
     {
         throw new ArgumentNullException(nameof(identityConfig));
     }
     if (seq == null)
     {
         throw new ArgumentNullException(nameof(seq));
     }
     _connection     = connection;
     _identityConfig = identityConfig;
     _seq            = seq;
     _payloadContent = new byte[new TPacket().Payload.GetMaxByteSize() + 1];
     _payloadSize    = new TPacket().Payload.GetMaxByteSize();
 }
Example #7
0
 public MavlinkServerBase(IMavlinkV2Connection connection, MavlinkServerIdentity identity, IPacketSequenceCalculator sequenceCalculator = null, bool disposeConnection = true)
 {
     _seq       = sequenceCalculator ?? new PacketSequenceCalculator();
     _heartbeat = new MavlinkHeartbeatServer(connection, _seq, identity, new MavlinkHeartbeatServerConfig
     {
         HeartbeatRateMs = 1000
     });
     _statusText = new StatusTextServer(connection, _seq, identity, new StatusTextLoggerConfig
     {
         MaxQueueSize  = 100,
         MaxSendRateHz = 10
     });
     _commandLong        = new CommandLongServer(connection, _seq, identity);
     _debug              = new DebugServer(connection, _seq, identity);
     _logging            = new LoggingServer(connection, _seq, identity);
     _v2Extension        = new V2ExtensionServer(connection, _seq, identity);
     _params             = new MavlinkParamsServer(connection, _seq, identity);
     MavlinkV2Connection = connection;
     _identity           = identity;
     _disposeConnection  = disposeConnection;
 }
Example #8
0
 public MavlinkParamsServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity)
     : base(connection, seq, identity)
 {
     Subscribe <ParamRequestListPacket, ParamRequestListPayload>(OnRequestList);
 }
 protected MavlinkMicroserviceBase(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity)
 {
     _connection = connection ?? throw new ArgumentNullException(nameof(connection));
     _seq        = seq ?? throw new ArgumentNullException(nameof(seq));
     _identity   = identity ?? throw new ArgumentNullException(nameof(identity));
 }
Example #10
0
 public MavlinkHeartbeatServer(IMavlinkV2Connection connection, IPacketSequenceCalculator seq, MavlinkServerIdentity identity, MavlinkHeartbeatServerConfig config)
 {
     _config      = config;
     _transponder = new MavlinkPacketTransponder <HeartbeatPacket, HeartbeatPayload>(connection, identity, seq);
 }