Exemplo n.º 1
0
 private static void ProcessParameterSet(CollarFile file, ArgosFile argos, DateTime first, DateTime last,
                                         IEnumerable<ArgosTransmission> transmissions,
                                         GetTelonicsParametersForArgosDatesResult parameters)
 {
     LogGeneralMessage(String.Format("    Start processing collar {0}/{1}", parameters.CollarManufacturer,
                                     parameters.CollarId));
     var start = parameters.StartDate ?? DateTime.MinValue;
     if (start < first)
         start = first;
     var end = parameters.EndDate ?? DateTime.MaxValue;
     if (last < end)
         end = last;
     var processor = GetProcessor(file, parameters);
     var transmissionSubset = transmissions.Where(t => start <= t.DateTime && t.DateTime <= end);
     var lines = processor.ProcessTransmissions(transmissionSubset, argos);
     var data = Encoding.UTF8.GetBytes(String.Join(Environment.NewLine, lines) + Environment.NewLine);
     var filename = Path.GetFileNameWithoutExtension(file.FileName) + "_" + parameters.CollarId + ".csv";
     var fileLoader = new FileLoader(filename, data)
         {
             Project = file.Project,
             Owner = file.ProjectInvestigator,
             Collar = new Collar {CollarManufacturer = parameters.CollarManufacturer,
                                  CollarId = parameters.CollarId},
             Status = file.Status,
             ParentFileId = file.FileId,
             ArgosDeploymentId = parameters.DeploymentId,
             CollarParameterId = parameters.ParameterId,
             AllowDuplicates = true
         };
     fileLoader.Load();
     var message =
         String.Format(
             "    Successfully added Argos {0} transmissions from {1:g} to {2:g} to Collar {3}/{4}",
             parameters.PlatformId, start, end,
             parameters.CollarManufacturer, parameters.CollarId);
     LogGeneralMessage(message);
 }
Exemplo n.º 2
0
 // ReSharper disable once UnusedParameter.Local
 private static IProcessor GetGps8000Processor(GetTelonicsParametersForArgosDatesResult parameters)
 {
     //if (parameters.Format != 'A' || parameters.Contents == null)
     //    throw new InvalidOperationException("Invalid parameter file format or contents for Gen4 processor");
     return new Gps8000Processor();
 }
Exemplo n.º 3
0
 private static IProcessor GetProcessor(CollarFile file, GetTelonicsParametersForArgosDatesResult parameters)
 {
     switch (file.Format)
     {
         case 'E':
         case 'F':
             switch (parameters.CollarModel)
             {
                 case "Gen3":
                     return GetGen3Processor(parameters);
                 case "Gen4":
                     return GetGen4Processor(parameters);
                 case "GPS8000":
                     return GetGps8000Processor(parameters);
                 default:
                     throw new InvalidOperationException("Unsupported collar model '" + parameters.CollarModel +
                                                         "'. (supported models are Gen3, and Gen4)");
             }
         case 'G':
             return new DebevekProcessor();
         default:
             throw new InvalidOperationException("Unsupported CollarFile Format '" + file.Format +
                                                 "'. (supported formats are E,F,G)");
     }
 }
Exemplo n.º 4
0
 private static IProcessor GetGen3Processor(GetTelonicsParametersForArgosDatesResult parameters)
 {
     if (parameters.Gen3Period == null)
         throw new InvalidOperationException("Unknown period for Gen3 collar");
     if (parameters.Format == 'B')
         throw new InvalidOperationException(
             "GPS Fixes for Gen3 collars with PTT parameter files (*.ppf) must be processed with Telonics ADC-T03.");
     return new Gen3Processor(TimeSpan.FromMinutes(parameters.Gen3Period.Value));
 }