visualSTATE ControlCenter Documentation

ControlCenter is an application that can handle a set of commands and take appropriate action as opening application, or forwarning a request to an application. The ControlCenter must be started before any command is sent to it.
Normmally ControlCenter listens on port 8090.
ControlCenter puts no restrictions on who sends commands to it.

Creating a project with a new state machine

Launch a Designer to create a new project with a new system, a new topstate and a state machine below it. Normally a response will be given indicating sucess. But you may also get a response with some kind of error message.

Parameters

projectPath The full path to the project to create
projectName Name of the new project. The name must be a legal identifier in C.
projectGuid Optional guid to use for the new project. If left empty a new guid is automatically assigned to the project.
systemName Name of the new system. The name must be a legal identifier in C.
systemGuid Optional guid to use for the new system. If left empty a new guid is automatically assigned to the system.
topStatePath The full path to the topstate file to create
topStateName Name of the new topstate. The name must be a legal identifier in C.
topStateGuid Optional guid to use for the new topstate. If left empty a new guid is automatically assigned to the topstate.
stateMachineName Name of the new state machine. The name must be a legal identifier in C.
stateMachineGuid Optional guid to use for the new state. If left empty a new guid is automatically assigned to the state.

Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "createProjectAndStateMachine",
  "params": {
      "projectPath": "d:/slet/TestJSON/TestJSONProject.vsp",
      "projectName": "TestProject",
      "projectGuid": "1234-5678-9012",
      "systemName": "System0",
      "systemGuid": "1234-5678-9013",
      "topStatePath": "d:/slet/TestJSON/TestJSONProject.vsr",
      "topStateName": "Topstate1",
      "topStateGuid": "1234-5678-9014",
      "stateMachineName": "State1",
      "stateMachineGuid": "1234-5678-9015"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

Launching Designer

Launch a Designer with a given visualSTATE project. Set focus to a given item. Normally a response will be given indicating sucess. But you may also get a response with some kind of error message.

Parameters

projectPath The full path to the project to load
focusItemGuid Optional guid for the item to set focus to. If the guid is left empty the application will choose what to focus.

Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "launchDesigner",
  "params": {
      "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
      "focusItemGuid": "1985B3C4-74A3-42B5-B03E-941B13633A5C"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

Adding a state machine to an existing design

Launch a Designer with a given visualSTATE project. Then add a new state with a given name and guid to a given parent.

Parameters

projectPath The full path to the project to load and modify
parentGuid Guid for the parent to add a new state to.
newStateMachineName Optional name for the new state to add. If the name is left empty the application will choose a new name.
newStateMachineGuid Optional guid for the new item to add. If left empty a new guid is automatically assigned to the new state

Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "addStateMachine",
  "params": {
      "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
      "parentGuid": "1234-5678-9015",
      "newStateMachineName": "NewState",
      "newStateMachineGuid": "1234-5678-9016"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

Launch Scene Composer

Launch a Scene Composer with a given visualSTATE project. Set focus to a given state.
This notification will normally be initiated from the user choosing to launch Scene Composer for a given state from inside Designer.
Since this is a notification no reply is needed/expected.

Parameters

projectPath The full path to the project to load
guidToFocus Guid of a state to set focus to in Scene Composer.

Example

{
  "jsonrpc": "2.0",
  "method": "launchSceneComposer",
  "params": {
      "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
      "guidToFocus": "1234-5678-9015"
  }
}

Launching Validator

Launch a Validator with a given visualSTATE project. Set focus to a given item. Normally a response will be given indicating sucess. But you may also get a response with some kind of error message.

Parameters

projectPath The full path to the project to load
focusItemGuid Optional guid for the item to set focus to. If the guid is left empty the application will choose what to focus.

Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "launchValidator",
  "params": {
      "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
      "focusItemGuid": "1985B3C4-74A3-42B5-B03E-941B13633A5C"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

Disabling look ahead of guard values in Validator

For the Validator running with the given project, disable the looking forward for guards. Default, Validator will use settings from the workspace, the given project was saved in. The setting is normally under the user's control. Setting the value here, forces a value, and disables user's ability to change the value in the Validator session.

Parameters

projectPath The full path to the project to load
disable true or false to indicate whether to disable or not.

Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "disableLookAheadGuardCheck",
  "params": {
      "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
      "disable": true
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

Deducing an event in Validator

Deduce an event in a Validator with a given visualSTATE project. Set focus to a given item. Normally a response will be given indicating sucess. But you may also get a response with some kind of error message.
The command will reply with an indication of which actions were performed as a result of deducing the event. It may also in the middle send a request for an action function return value. See further down.

Parameters

projectPath The full path to the project to load
eventName Name of the event to deduce for the given model.
eventArguments Optional argument. If present, it must be an array of values.

Example

In this example a single action function call is performed with two arguments to the action function call.
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "deductEvent",
  "params": {
    "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
    "eventName": "SE_RESET"
  }
}
{
  "id": 2,
  "jsonrpc": "2.0",
  "result": {
    "actions": [
      {
        "action": {
          "actionArguments": [2,0],
          "actionName": "Action0"
        }
      }
    ]
  }
}

Example

In this example the Validator requests the value of an action function call before replying what actions were performed.
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "deductEvent",
  "params": {
    "projectPath": "d:/slet/JSONTestProject/JSONTestProject.vsp",
    "eventName": "Event4"
  }
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "getActionFunctionCallResult",
  "params": {
    "action": {
      "actionArguments": [2,0],
      "actionName": "Action3"
    }
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 7
}
{
  "id": 2,
  "jsonrpc": "2.0",
  "result": {
    "actions": [
      {
        "assignment": {
          "assignedTo": "External1",
          "assignedToIndex": null,
          "value": 7
        }
      },
      {
        "action": {
          "actionArguments": null,
          "actionName": "Action5"
        }
      },
      {
        "assignment": {
          "assignedTo": "ExternalArray",
          "assignedToIndex": 2,
          "value": 7
        }
      }
    ]
  }
}

Requesting an action function call return value from Validator

During a 'deductEvent' (see above) the Validator may need to get the return value for an action function call. If so, it will send out this command.
As a reply to the command the value for the action function call should be returned.

Parameters

actionName The name of the action function to get the return value for
actionArguments Optional array with arguments for the action function call asked for.

Example

For an example of this refer to 'deductEvent'.