Skip to content

How to Use Prust Test

Selman Özleyen edited this page Mar 2, 2021 · 3 revisions

Usage

This has an interactive CLI interface right now. You can simply type

cargo run

Then you will see the list of ports connected.
Enter your device index from the list and you opened the CLI! You can get help by:

>> help
USAGE:
    tc [OPTIONS] [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    exec_func     Sends a request to execute a function defined
    help          Prints this message or the help of the given subcommand(s)
    new_report    Creates new housekeeping report structure
    one_shot      Sends a one shot request for the specified hk id

Monitoring TM responses

The packets sent to you by the device will be written to out.txt file by an another thread.

Running a function

To send a TC[8,1] function execute packet, enter the command for example.

>> exec_func set_led 0 0

Here the function name and a series of u8 numbers are given which are the arguments of that function. In this example, you will get a response like this;

The packet send:
[24, 42, 192, 0, 0, 25, 32, 8, 1, 0, 0, 115, 101, 116, 95, 108, 101, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0]
TM SUCCESS RESPONSE
TM pack:
SpacePacket {
    primary_header: PrimaryHeader {
        ver_no: 0,
        type_flag: false,
        sec_header_flag: true,
        apid: 42,
        seq_flags: (
            true,
            true,
        ),
        packet_name: 0,
        data_len: 14,
    },
    data: TmPacket {
        header: TmPacketHeader {
            pus_ver_no: 2,
            time_ref_status: 0,
            service_type: 1,
            message_subtype: 7,
            message_type_counter: 0,
            destination_id: 42,
            abs_time: 0,
        },
        user_data: TxUserData {
            packet_error_control: 0,
            data: ServiceSuccess {
                request_id: RequestId {
                    ver_no: 0,
                    packet_type: true,
                    sec_header_flag: true,
                    apid: 42,
                    seq_flags: (
                        true,
                        true,
                    ),
                    packet_seq_count: 0,
                },
            },
        },
    },
}
The packet recieved (in bytes):
[8, 42, 192, 0, 0, 14, 32, 1, 7, 0, 0, 0, 42, 0, 0, 24, 42, 192, 0, 0, 0]

Since n is 2 by default and only one response comes program will need to be terminated by an interrupt. The usage of this subcommand can be learned by `cargo run exec_func --help. For example, usage of this subcommand is like this;

>> exec_func 
Sends a request to execute a function defined

USAGE:
    client exec_func [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -a <args>             arguments of the function
    -f <func_name>        func_id of the function

Creating a housekeeping structure

Usage is as follows;

>> new_report 
Creates a new housekeeping report structure

USAGE:
    client new_report [ARGS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <hk_id>           housekeeping structure id
    <param_ids>...    parameters that will be reported in this structure

For example to create a structure with id 0 and parameter 0 you can type

>> new_report 0 0 

The count of the parameter ids can be increased but only one parameter is supported right now. The response should be similar to this;

The packet send:
[24, 42, 192, 0, 0, 11, 32, 3, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0]
TM SUCCESS RESPONSE
TM pack:
SpacePacket {
    primary_header: PrimaryHeader {
        ver_no: 0,
        type_flag: false,
        sec_header_flag: true,
        apid: 42,
        seq_flags: (
            true,
            true,
        ),
        packet_name: 0,
        data_len: 14,
    },
    data: TmPacket {
        header: TmPacketHeader {
            pus_ver_no: 2,
            time_ref_status: 0,
            service_type: 1,
            message_subtype: 7,
            message_type_counter: 0,
            destination_id: 42,
            abs_time: 0,
        },
        user_data: TxUserData {
            packet_error_control: 0,
            data: ServiceSuccess {
                request_id: RequestId {
                    ver_no: 0,
                    packet_type: true,
                    sec_header_flag: true,
                    apid: 42,
                    seq_flags: (
                        true,
                        true,
                    ),
                    packet_seq_count: 0,
                },
            },
        },
    },
}
The packet recieved (in bytes):
[8, 42, 192, 0, 0, 14, 32, 1, 7, 0, 0, 0, 42, 0, 0, 24, 42, 192, 0, 0, 0]

Sending a one shot request

After creating the report data structure to send a one shot request you can run >> one_shot 0. Output should be similar to this;

The packet send:
[24, 42, 192, 0, 0, 8, 32, 3, 27, 0, 0, 1, 0, 0, 0]
Tm One Shot Response
PERIPHERAL VALUE RECIEVED:0
TM pack:
SpacePacket {
    primary_header: PrimaryHeader {
        ver_no: 0,
        type_flag: false,
        sec_header_flag: true,
        apid: 42,
        seq_flags: (
            true,
            true,
        ),
        packet_name: 0,
        data_len: 13,
    },
    data: TmPacket {
        header: TmPacketHeader {
            pus_ver_no: 2,
            time_ref_status: 0,
            service_type: 3,
            message_subtype: 25,
            message_type_counter: 0,
            destination_id: 42,
            abs_time: 0,
        },
        user_data: TxUserData {
            packet_error_control: 0,
            data: Service3_25 {
                housekeeping_id: 0,
                parameter_value: [
                    0,
                    0,
                ],
            },
        },
    },
}
The packet recieved (in bytes):
[8, 42, 192, 0, 0, 13, 32, 3, 25, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0]
TM SUCCESS RESPONSE
TM pack:
SpacePacket {
    primary_header: PrimaryHeader {
        ver_no: 0,
        type_flag: false,
        sec_header_flag: true,
        apid: 42,
        seq_flags: (
            true,
            true,
        ),
        packet_name: 0,
        data_len: 14,
    },
    data: TmPacket {
        header: TmPacketHeader {
            pus_ver_no: 2,
            time_ref_status: 0,
            service_type: 1,
            message_subtype: 7,
            message_type_counter: 0,
            destination_id: 42,
            abs_time: 0,
        },
        user_data: TxUserData {
            packet_error_control: 0,
            data: ServiceSuccess {
                request_id: RequestId {
                    ver_no: 0,
                    packet_type: true,
                    sec_header_flag: true,
                    apid: 42,
                    seq_flags: (
                        true,
                        true,
                    ),
                    packet_seq_count: 0,
                },
            },
        },
    },
}
The packet recieved (in bytes):
[8, 42, 192, 0, 0, 14, 32, 1, 7, 0, 0, 0, 42, 0, 0, 24, 42, 192, 0, 0, 0]

Enabling/Disabling periodic reporting of a Housekeeping parameter

After creating a housekeeping parameter you can run

>> periodic_dis 0

or

>> periodic_en 0

Clone this wiki locally