Module scpi::tree

source ·
Expand description

A SCPI command tree consisting of command nodes and handlers.

Se chapter 6 of SCPI standard for guidelines for header and command tree guidelines.

§Example

Take the following command tree.

*COM
:TODO
:TODO?
:BRANch
    :CHILd <args>
    [:DEFault?] <args>

This would be written like below. Note that a node handles both the query and event form of commands and it’s up to the handler to reject a query on an event only node or vice-versa.

use scpi::tree::{prelude::*, command::Todo};
const ROOT: Node<MyDevice> = Branch {
    name: b"",
    default: false,
    sub: &[
        Leaf {
            name: b"*COM",
            default: false,
            handler: &Todo,
        },
        Leaf {
            name: b"TODO",
            default: false,
            handler: &Todo,//Handles both TODO and TODO?
        },
        Branch {
            name: b"BRANch",
            default: false,
            sub: &[
                // Default leaves must be first!
                Leaf {
                    name: b"DEFault",
                    default: true,
                    handler: &Todo,
                },
                Leaf {
                    name: b"CHILd",
                    default: false,
                    handler: &Todo,
                },
            ],
        },
    ],
};

Modules§

  • Command trait and helper functions.
  • Everything needed when creating command trees or command handlers

Enums§

  • A SCPI command node These nodes are structured as a command tree where each node represent a SCPI header mnemonic.