id: satellites_telemetry_parser
label: Telemetry Parser
category: '[Satellites]/Data sinks'

parameters:
-   id: definition
    label: Telemetry Definition
    dtype: string
-   id: output
    label: Output
    dtype: enum
    default: 'stdout'
    options: ['stdout', 'file']
    option_labels: [Standard output (stdout), File]
    hide: ${ 'part' if output == 'file' else 'none' }
-   id: file
    label: File
    dtype: file_save
    hide: ${ 'all' if output == 'stdout' else 'none' }
-   id: options
    label: Command line options
    dtype: string
    default: '""'
    hide: part

inputs:
-   domain: message
    id: in

templates:
    imports: import satellites.components.datasinks
    make: |
        % if context.get('output')() == 'stdout':
        satellites.components.datasinks.telemetry_parser(${definition}, options=${options})
        % else:
        satellites.components.datasinks.telemetry_parser(${definition}, file = ${file}, options=${options})
        % endif

documentation: |-
    Parses telemetry frames according to a construct telemetry definition

    The parser prints the output to the standard output or a file

    Input:
        PDUs containing telemetry frames

    Parameters:
        Telemetry Definition: the telemetry definition to use for parsing, which must be an object of satellites.telemetry supporting the parse() method
        Output: selects standard output or file as output destination
        File: selects the path of the output file
        Command line options: options to pass down to the block, following the syntax of the gr_satellites command line tool

file_format: 1
