public IActionResult FecDecodePost(DecodeViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.Error = "Input errors";
                return(View(viewModel));
            }

            var fecResult = FecHelpers.DecodePayload(viewModel.HexPayloadOriginal, viewModel.PreambleLength, viewModel.VirtualFillLength, viewModel.DualBasis);

            if (fecResult.Success)
            {
                viewModel.PayloadUncorrected   = fecResult.PayloadUncorrected;
                viewModel.BlockUncorrected     = fecResult.BlockUncorrected;
                viewModel.PayloadCorrected     = fecResult.PayloadCorrected;
                viewModel.BlockCorrected       = fecResult.BlockCorrected;
                viewModel.ErrorsCorrectedCount = fecResult.ErrorsCorrectedCount;
            }
            else
            {
                viewModel.Error = fecResult.Error;
                return(View(viewModel));
            }

            return(View(viewModel));
        }
        private async Task <TelemetryRow> GetTelemetryRowForDemodedData(ObservationEntry observationEntry, ObservationEntry.DemodDataEntry demodedData)
        {
            HttpContent httpContents = await satnogsNetworkApi.GetObservationData(observationEntry.Id, demodedData.ResourceName);

            byte[] data = await httpContents.ReadAsByteArrayAsync();

            var fecResult     = FecHelpers.DecodePayload(data, 16, 0, false);
            var beaconDecoded = BeaconDecoder.DecodeBeacon(fecResult.PayloadCorrected ?? fecResult.PayloadUncorrected);

            return(new TelemetryRow()
            {
                Observation = observationEntry,
                DemodData = demodedData,
                FecDecodeResult = fecResult,
                Acrux1Beacon = beaconDecoded
            });
        }
Beispiel #3
0
        public IActionResult DecodePost(DecodeViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            // Preamble length is 16 because beacons have an Ax25 frame in the first 16 bytes which does not participate
            // in the FEC block.
            //
            var fecResult     = FecHelpers.DecodePayload(viewModel.HexPayloadOriginal, 16, 0, false);
            var beaconDecoded = BeaconDecoder.DecodeBeacon(fecResult.PayloadCorrected ?? fecResult.PayloadUncorrected);

            viewModel.FecDecodeResult = fecResult;
            viewModel.Acrux1Beacon    = beaconDecoded;

            return(View(viewModel));
        }