This is an example of STANAG 4609 Telemetry Extractor SDK usage for STANAG Telemetry Extraction from the 4609 compliant file. This code snippet demonstrates how to open a file and receive decoded telemetry packets. STANAG 4609 Telemetry Extractor SDK allows metadata extraction from STANAG files (TS) and RAW binary files.
- Note
- RAW binary files MUST have ".bin" or ".dat" extension.
To perform this task, we'll use StanagTelemetryExtractor instance. For more details on the interfaces please see StTelemetryExtractor.IStanagTelemetryExtractor
- Create Telemetry Extractor instance.
StanagTelemetryExtractor extractor = new StanagTelemetryExtractor();
- Setup events.
extractor.MetadataPidDetectionCompleteEvent += new MetadataPidDetectionCompleteHandler(extractor_MetadataPidDetectionCompleteEvent);
extractor.PacketReadyEvent +=
new StTelemetryExtractor.PacketReadyHandler(extractor_ExtractorPacketReadyEvent);
extractor.SegmentProcessingEvent += new SegmentProcessingHandler(extractor_SegmentProcessingEvent);
extractor.ExtractorErrorEvent +=
new StTelemetryExtractor.ExtractorErrorHandler(extractor_ExtractorErrorEvent);
extractor.ExtractorMessageEvent +=
new StTelemetryExtractor.ExtractorMessageHandler(extractor_ExtractorMessageEvent);
extractor.ExtractorCompleteEvent +=
new StTelemetryExtractor.ExtractorCompleteHandler(extractor_ExtractorCompleteEvent);
- Initialize Extractor.
extractor.ValidateChecksum = true;
extractor.AddFile(@"StanagFile1.ts", null);
extractor.AddFile(@"StanagFile2.ts", null);
extractor.AddFile(@"RawTelemetryFile1.bin", null);
extractor.AddFile(@"RawTelemetryFile2.dat", null);
Now, the ExtractorPacketReadyEvent will be fired every time new packet is decoded. The event also provides an approximate byte offset from the beginning of the file.
static void extractor_ExtractorPacketReadyEvent(List<EG601Item> pckt, Int64 offset)
{
Console.Write("Packet {0} klvs\t received\t ", pckt.Count);
Console.Write("Time {0}. Offset {1}\n", pckt[0].ConvertedValueStr, offset);
}
The event will contain a list of decoded KLV metadata packets, as shown below:
Figure 1. Decoded packet.
For the complete sample source please see Sample Code - Klv Metadata extraction