States structure

The following section will explain the structure of a state.

Defining states

In Touch Portal there are states which can be used by IF statement and with Events. With your plugin you can add states to Touch Portal. You can define a state as part of a action category. Events can link to the id of the states to be able to act on changes of those states.

  "desc":"Fruit Kind description",
  "valueChoices": [
Attribute Type Mandatory From version Description
id Text yes 1.0 This is the id of the state. It is used to identify the states within Touch Portal. This id needs to be unique across plugins. This means that if you give it the id "1" there is a big chance that it will be a duplicate. Touch Portal may reject it or when the other state is updated, yours will be as well with wrong data. Best practise is to create a unique prefix for all your states like in our case; tp_sid_fruit.
type Text yes 1.0 This is the type of state. Currently we only support the type "choice". A choice state is a state where you specify a limited amount of state values the state can be.
2.0 From this version we also support the type "text". This type can be used for smart conversion as well.

"#FF115599" can be interpreted by the plug-in visuals action as a color. The format needs to be this or it will not be seen as a color and will not be converted.

A base64 representation of an image will also be allowed for specific actions such as the plug-in visuals action. This will read the base64 string representation and convert it to an image and show it on the button. We suggest to keep these as small as possible. Images used like this on a button are not stored and only exist temporary. This allows for a performant updating process. Allow for multiple updates per second depending on the computer used, the device used and the quality of the network.

The base64 string should only hold the base64 data. The meta data should be stripped. The format has to be a PNG. It has to be a squared image.
desc Text yes 1.0 This text describes the state and is used in the IF statement to let the user see what state it is changing. We recommend to make this text work in the flow of the inline nature of the IF statement within Touch Portal. This is also the title that is used in list where you can use this state value for logic execution.
default Text Yes 1.0 This is the value the state will have if it is not set already but is looked up.
valueChoices Collection Optional 1.0 Specify the collection of values that can be used to choose from. These can also be dynamically changed if you use the dynamic actions.

As you can see, you can use the values if you add {$value$} in the text of the execution command.