Beispiel #1
0
        //private async Task send_request(IRequest request, bool with_nonce = false)
        //{
        //if (with_nonce)
        //{
        //    var nonce_val = this.Nonce.GetNext();
        //    request.set_nonce(nonce_val);
        //    nonce_syncword = null;
        //}

        //var me = new MessageExchange(request, this.packetRadio, this.Pod);

        //var response = await me.GetPodResponse();
        //ProtocolHelper.response_parse(response, this.Pod);

        //if (with_nonce && nonce_syncword != null)
        //{
        //    Debug.WriteLine("Nonce resync requested");
        //    this.Nonce.Sync(request.sequence.Value);
        //    var nonce_val = this.Nonce.GetNext();
        //    request.set_nonce(nonce_val);
        //    nonce_syncword = null;
        //    radio_message_sequence = request.sequence.Value;
        //    response = await me.GetPodResponse();
        //    ProtocolHelper.response_parse(response, this.Pod);
        //    if (nonce_syncword != null)
        //    {
        //        this.Nonce.Reset();
        //        throw new PdmException("Nonce sync failed");
        //    }
        //}
        //}

        private async Task <PodCommandResult> UpdateStatusInternal(IMessageProgress progress, CancellationToken ct,
                                                                   StatusRequestType update_type = StatusRequestType.Standard)
        {
            var request = new ErosMessageBuilder().WithStatus(update_type).Build();

            return(await MessageHandler.PerformExchange(request, StandardParameters, progress, ct));
        }
Beispiel #2
0
 public override async Task UpdateStatus(IMessageProgress progress, CancellationToken ct,
                                         StatusRequestType update_type = StatusRequestType.Standard)
 {
     try
     {
         Debug.WriteLine($"Updating pod status, request type {update_type}");
         await this.UpdateStatusInternal(progress, ct, update_type);
     }
     catch (OmniCoreException) { throw; }
     catch (Exception e)
     {
         throw new PdmException("Unexpected error", e);
     }
 }
 public IMessageBuilder WithStatus(StatusRequestType statusRequestType = StatusRequestType.Standard)
 {
     return(WithPart(new ErosRequest(PartType.RequestStatus, new Bytes().Append((byte)statusRequestType))));
 }
Beispiel #4
0
 public StatusRequest(StatusRequestType statusRequestType = StatusRequestType.Standard)
 {
     base.Parts = new MessagePart[] { new MessagePart(true, false, 0x0e, new byte[] { (byte)statusRequestType }) };
 }
Beispiel #5
0
 public abstract Task UpdateStatus(IMessageProgress progress, CancellationToken ct, StatusRequestType requestType);