Version: 4
restore

Contents

Introduction

On this page we will look at uploading instruction definitions into the system and organising them into sets.

Instruction Definitions

Uploading Instruction Definitions

Deleting Instruction Definitions

Instruction Sets

Instruction sets are containers that hold instruction definitions. Permissions are assigned to instruction sets and not to individual instructions.

Instruction sets can contain any number of instructions and cannot be nested.

Any given instruction definition can only be assigned to one instruction set or to no set at all at any particular time. This means an instruction definition cannot belong to multiple instruction sets at the same time, but doesn't have to belong to a set either.

If an instruction definition doesn't belong to an instruction set, you cannot issue instructions based on that instruction definition.

Adding an Instruction Set

To add an instruction set all you need is a name. This name needs to be unique and no two instruction sets can have the same name.

Direct Consumer API callC# code using Consumer SDK library

Making a POST request with following payload:

Payload sent to https://my.tachyon.server/Consumer/InstructionSets
{
  "Name": "Hardware questions"
}

will yield following response:

Return payload
{
    "Id": 1,
    "Name": "Hardware questions",
    "Description": null,
    "Icon": null
}

Use InstructionSets object inside the Tachyon connector instance.

Creating an Instruction Set
var payload = new Tachyon.SDK.Consumer.Models.Send.InstructionSet
{
    Name = "Hardware questions"
};

var response = connector.InstructionSets.Add(payload);

response.ReceivedObject object will contain the same data you can see in the JSON response on the left.

An instruction set can also have a description and an icon.

The icon can be supplied either directly as binary data inside the "Icon" parameter or as the same binary data encoded in a base64 string supplied in "IconInBase64" parameter.

UseIcon parameter is a flag indicating if an icon should be used.

If this flag is set to true, icon will be used in following way:

  • If Icon field (byte array) is supplied, it will be used as the icon.
  • If Icon isn't supplied and IconInBase64 is supplied, it will be used as the icon.
  • If both Icon and IconInBase64 are supplied, Icon will be used and IconInBase64 will be ignored.
  • If neither Icon or IconInBase64 were supplied, icon will not be used and if there already was an icon assigned to the instruction set, it will be removed.

If this flag is set to false, no changes will be made to the icon. Both Icon and IconInBase64 fields are ignored.


Now we will create an Instruction Set with a description and an icon.

Direct Consumer API callC# code using Consumer SDK library

Making a POST request with following payload:

Payload sent to https://my.tachyon.server/Consumer/InstructionSets
{
  "Name": "Hardware questions",
  "Description": "This is a description",
  "UseIcon": true,
  "Icon": [<binary data here>]
}

will create an instruction set that uses binary data inside Icon. In order to use binary data encoded as base64 string make POST request with following payload:

Payload sent to https://my.tachyon.server/Consumer/InstructionSets
{
  "Name": "Hardware questions",
  "Description": "This is a description",
  "UseIcon": true,
  "IconInBase64": "<binary data encoded as base64 here>"
}

Both POST calls will yield following response:

Return payload
{
    "Id": 1,
    "Name": "Hardware questions",
    "Description": "This is a description",
    "Icon": [<binary data here>]
}

because the icon is always returned in its binary form

Use InstructionSets object inside the Tachyon connector instance.

To create an instruction set that uses an icon supplied as a binary array you can use code below and supply the icon inside binaryData variable

Creating an Instruction Set
var payload = new Tachyon.SDK.Consumer.Models.Send.InstructionSet
{
    Name = "Hardware questions",
    Description = "This is a description",
    UseIcon = true,
    Icon = binaryData
};

var response = connector.InstructionSets.Add(payload);

To create an instruction set that uses an icon supplied as binary data encoded in a base64 string, you can use code below and supply the icon inside encodedData variable

Creating an Instruction Set
var payload = new Tachyon.SDK.Consumer.Models.Send.InstructionSet
{
    Name = "Hardware questions",
    Description = "This is a description",
    UseIcon = true,
    IconInBase64 = encodedData
};

var response = connector.InstructionSets.Add(payload);

In either case, response.ReceivedObject object will contain the same data you can see in the JSON response on the left.

Editing an Instruction Set

To edit an instruction set you will need its Id.

You can modify all properties of an instruction set, apart from the Id, and icon follows the same rules as were outlined in the paragraph above.

This means the payload will look almost the same as what we've used to create an instruction set, with the addition of Id, and we will be making PUT requests instead of POST.

Direct Consumer API callC# code using Consumer SDK library

Making a PUT request with following payload:

Payload sent to https://my.tachyon.server/Consumer/InstructionSets
{
  "Id": 1,
  "Name": "Hardware instructions"
}

will yield following response:

Return payload
{
    "Id": 1,
    "Name": "Hardware instructions",
    "Description": null,
    "Icon": null
}

providing the instruction set with the Id of 1 didn't have an icon.

Use InstructionSets object inside the Tachyon connector instance.

Creating an Instruction Set
var payload = new Tachyon.SDK.Consumer.Models.Send.InstructionSet
{
   Id = 1,
   Name = "Hardware instructions"
};

var response = connector.InstructionSets.Update(payload);

response.ReceivedObject object will contain the same data you can see in the JSON response on the left.

Deleting an Instruction Set

Getting Instruction Sets

Adding Instruction Definitions to an Instruction Set

Removing Instruction Definitions from an Instruction Set