Technical topic: MSC streamer

From TASTE
Jump to: navigation, search

Introduction

The MSC streamer is part of SpaceCreator. It is used to create and visualize a MSC chart. Start command is:

$ spacecreator.AppImage --mscstreaming

It then listens on port 34622. The port can be changes using the -p commandline option.

All interaction is done using it's WebSocket interface.


WebSocket API

Documentation can be found here as well: SpaceCreator source

Every Command is send using JSON data.

JSON structure:

{
    "CommandType": "command",
    "Parameters": {
        "parameter1": "value",
        "parameter2": "value",
        "parameter3": "value",
       ...
    }
}

Adding a new instance

This is for adding a new instance. By default added at the right end of the chart.

"CommandType": "Instance",
"Parameters": {
    "name": "value", // Instance's Name, command fails if Chart already has Instance with this name, optional
    "kind": "value", // Instance's Kind, optional - MSC uses the name if no kind is set
    "pos": "value",  // Instance's X position in pixel. Default is '-1' which means append at the right. optional
}

Stop an instance

This is for stopping an exxisting instance.

"CommandType": "StopInstance",
"Parameters": {
    "name": "value", // Name of the instance  to stop
}

Adding a new message

This is for adding a message between instances. Or for adding a create message.

"CommandType": "Message",
"Parameters": {
    "name": "value", // Message's Name, optional
    "srcName": "value", // Source Instance's Name, command fails if Chart doesn't have Instance with this name
    "dstName": "value", // Target Instance's Name, command fails if Chart doesn't have Instance with this name
    "MessageType": "value",  // Sets if this is a normal message, or a message that creates an instance. Possible values: {Message, Create}, optional
    "Async": "value" // If set, this message is asynchronous. So it will be drawn non horizontal. Two commands need to be used. One when sending/starting the message. And one when receiving/stoping it. Possible values: {sent, received}, optional
}

Adding a new timer

This is for adding timer events.

"CommandType": "Timer",
"Parameters": {
    "name": "value", // Timer's Name, optional
    "instanceName": "value", // Linked Instance's Name, command fails if Chart doesn't have Instance with this name, mandatory
    "TimerType": "value" // Sets the type of event. Possible values are{Start, Stop, Timeout}
}

Adding a new action

This is for adding an action.

"CommandType": "Action",
"Parameters": {
    "name": "value", // Action's Name, optional
    "instanceName": "value" // Linked Instance's Name, command fails if Chart doesn't have Instance with this name, mandatory
}

Adding a new condition

This is for adding a condition.

"CommandType": "Condition",
"Parameters": {
    "name": "value", // Condition's Name, optional
    "instanceName": "value", // Linked Instance's Name, command fails if Chart doesn't have Instance with this name, mandatory
    "share": "value" // If true, the condition is a shared one, which mean it applies to all instances. Possible values {True, False=default} optional
}

Adding a new message declaration

All messages should have a message declaration. Described in message.

"CommandType": "MessageDeclaration",
"Parameters": {
    "names": "value", // Names of the message declaration separated by commas ","
    "typeRefList": "value" // String representation of the (ASN.1)types of each parameters, separated by commas ","
}

Undo last command

"CommandType": "Undo"

Redo the last reverted command last command

"CommandType": "Redo"

Save the current data

Save the current chart to a file.

"CommandType": "Save",
"Parameters": {
    "fileName": "value", // name of the file to save to
    "asn1File": "value" // name of the file that is having the asn data. This is the file name only. So not including a thepath. The file is expected to be in the same directory as the msc file. This parameter is optional
}