Send a command - Metasys - LIT-12013522 - Software Application - Basic Services client library for .NET (and COM) - Metasys API - 4.2

Metasys REST Client for .NET and COM Developer Guide

Brand
Metasys
Product name
Basic Services client library for .NET (and COM)
Metasys API
Document type
API Reference Guide
Document number
LIT-12013522
Version
4.2
Revision date
2021-04-07
Language
English (United States)

When you send a command, send the number and types of arguments specified in the command object that you retrieved from the GetCommands method.

For an example, see the following .NET C# code:
Command adjust = commands.FindById("Adjust"); // Adjust
Command operatorOverride = commands.FindById("OperatorOverride"); // OperatorOverride
Command release = commands.FindById("Release"); // Release 
Console.WriteLine(release);
/*                     
  {
    "Title": "Release",
    "TitleEnumerationKey": "commandIdEnumSet.releaseCommand",
    "CommandId": "Release",
    "Items": [
      {
        "Title": "oneOf",
        "Type": "enum",
        "EnumerationValues": [
          {
            "Title": "Present Value",
            "TitleEnumerationKey": "attributeEnumSet.presentValue"
          }
        ],
        "Minimum": 1.0,
        "Maximum": 1.0
      },
      {
        "Title": "oneOf",
        "Type": "enum",
        "EnumerationValues": [
          {
            "Title": "0 (No Priority)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityNone"
          },
          {
            "Title": "1 (Manual Life Safety)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityManualEmergency"
          },
          {
            "Title": "2 (Auto Life Safety)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityFireApplications"
          },
          {
            "Title": "3 (Application)",
            "TitleEnumerationKey": "writePriorityEnumSet.priority3"
          },
          {
            "Title": "4 (Application)",
            "TitleEnumerationKey": "writePriorityEnumSet.priority4"
          },
          {
            "Title": "5 (Critical Equipment)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityCriticalEquipment"
          },
          {
            "Title": "6 (Minimum On Off)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityMinimumOnOff"
          },
          {
            "Title": "7 (Heavy Equip Delay)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityHeavyEquipDelay"
          },
          {
            "Title": "8 (Operator Override)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityOperatorOverride"
          },
          {
            "Title": "9 (Application)",
            "TitleEnumerationKey": "writePriorityEnumSet.priority9"
          },
          {
            "Title": "10 (Application)",
            "TitleEnumerationKey": "writePriorityEnumSet.priority10"
          },
          {
            "Title": "11 (Demand Limiting)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityDemandLimiting"
          },
          {
            "Title": "12 (Application)",
            "TitleEnumerationKey": "writePriorityEnumSet.priority12"
          },
          {
            "Title": "13 (Load Rolling)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityLoadRolling"
          },
          {
            "Title": "14 (Application)",
            "TitleEnumerationKey": "writePriorityEnumSet.priority14"
          },
          {
            "Title": "15 (Scheduling)",
            "TitleEnumerationKey": "writePriorityEnumSet.prioritySchedulingOst"
          },
          {
            "Title": "16 (Default)",
            "TitleEnumerationKey": "writePriorityEnumSet.priorityDefault"
          }
        ],
        "Minimum": 1.0,
        "Maximum": 1.0
      }
    ]
  }
*/               
var list1 = new List<object> { 70 };
client.SendCommand(objectId, adjust.CommandId, list1);
var list2 = new List<object> { 75 };
client.SendCommand(objectId, operatorOverride.CommandId, list2);
var list3 = new List<object> { "attributeEnumSet.presentValue", "writePriorityEnumSet.priorityNone" };
client.SendCommand(objectId, release.CommandId, list3);
Note: You must use the titleEnumerationKey for the values, and not title. The title is the user friendly translated value that describes the enumeration. For more information on titleEnumerationKey, see previous results.
Table 1. Send commands .NET signature
Library method name SendCommand
Description Send a command to the Metasys server.
Method signature void SendCommand(Guid id, string command, IEnumerable<object> values = null);
Method input parameters
  • id: object GUID to receive the command.
  • command: name of the command, for example, adjust or operatorOverride.
  • values: list of objects that specify the values used with the specified command.
Return value None