yamcs / yamcs

A framework for mission control
https://yamcs.org
GNU Affero General Public License v3.0
194 stars 82 forks source link

Enumerated system parameters do not have metadata when queried from MDB #739

Closed merose closed 9 months ago

merose commented 1 year ago

Some system parameters are of enumerated type, but retrieving the parameter definition does not retrieve the enumeration values as it does for other enumerated types. One example is the cop1Status.state parameter associated with a sub-data-link that can perform COP-1 processing.

Clients that want to provide pick lists or dropdowns for enumerated values, in search or when choosing client-side styling of displayed parameters based on value, for example, cannot populate such lists without the list of possible enumerated values.

Example:

$ curl 'http://localhost:8090/yamcs/api/mdb/vper/parameters/yamcs/yamcs1/localhost1-FCLTU.vc1/cop1Status'
{
  "name": "cop1Status",
  "qualifiedName": "/yamcs/yamcs1/localhost1-FCLTU.vc1/cop1Status",
  "shortDescription": "Status of the COP1 protocol",
  "type": {
    "engType": "aggregate",
    "member": [{
      "name": "cop1Active",
      "type": {
        "engType": "boolean"
      }
    }, {
      "name": "state",
      "type": {
        "engType": "enumeration"
      }
    }, {
      "name": "waitQueueNumTC",
      "type": {
        "engType": "integer"
      }
    }, {
      "name": "sentQueueNumFrames",
      "type": {
        "engType": "integer"
      }
    }, {
      "name": "vS",
      "type": {
        "engType": "integer"
      }
    }, {
      "name": "nnR",
      "type": {
        "engType": "integer"
      }
    }]
  },
  "dataSource": "SYSTEM",
  "path": ["state"]
}$

For an enumerated parameter defined within the XTCE, however, the enumeration labels are supplied:

$ curl 'http://localhost:8090/yamcs/api/mdb/vper/parameters/ViperRover/CfeEventServicesCPU1/logMode'
{
  "name": "logMode",
  "qualifiedName": "/ViperRover/CfeEventServicesCPU1/logMode",
  "shortDescription": "Local event logging mode (overwrite/discard)",
  "type": {
    "engType": "enumeration",
    "dataEncoding": {
      "type": "INTEGER",
      "littleEndian": false,
      "sizeInBits": 8,
      "encoding": "UNSIGNED"
    },
    "enumValue": [{
      "value": "0",
      "label": "EVS_P_LOG_OVERWRITE",
      "description": "Log Overwrite"
    }, {
      "value": "1",
      "label": "EVS_P_LOG_DISCARD",
      "description": "Log Discard"
    }]
  },
  "dataSource": "TELEMETERED",
  "usedBy": {
    "container": [{
      "name": "EVS_HousekeepingTlm",
      "qualifiedName": "/ViperRover/CfeEventServicesCPU1/EVS_HousekeepingTlm"
    }]
  }
}$
fqqb commented 9 months ago

Closing. This was addressed by commit 54e782dd, available since v5.8.5

{
  "name": "cop1Status",
  "qualifiedName": "/yamcs/yamcs1/UDP_CUSTOM_CLTU_OUT.vc0/cop1Status",
  "shortDescription": "Status of the COP1 protocol",
  "type": {
    "engType": "aggregate",
    "member": [{
      "name": "cop1Active",
      "type": {
        "engType": "boolean",
        "zeroStringValue": "False",
        "oneStringValue": "True",
        "name": "boolean",
        "qualifiedName": "/yamcs/boolean"
      }
    }, {
      "name": "state",
      "type": {
        "engType": "enumeration",
        "enumValue": [{
          "value": "0",
          "label": "ACTIVE"
        }, {
          "value": "1",
          "label": "RETRANSMIT_WITHOUT_WAIT"
        }, {
          "value": "2",
          "label": "RETRANSMIT_WITH_WAIT"
        }, {
          "value": "3",
          "label": "INITIALIZING_WITHOUT_BC"
        }, {
          "value": "4",
          "label": "INITIALIZING_WITH_BC"
        }, {
          "value": "5",
          "label": "UNINITIALIZED"
        }, {
          "value": "6",
          "label": "SUSPENDED"
        }],
        "name": "org_yamcs_protobuf_Cop1State",
        "qualifiedName": "/yamcs/org_yamcs_protobuf_Cop1State"
      }
    }, {
      "name": "waitQueueNumTC",
      "type": {
        "engType": "integer",
        "signed": false,
        "name": "uint32",
        "qualifiedName": "/yamcs/uint32"
      }
    }, {
      "name": "sentQueueNumFrames",
      "type": {
        "engType": "integer",
        "signed": false,
        "name": "uint32",
        "qualifiedName": "/yamcs/uint32"
      }
    }, {
      "name": "vS",
      "type": {
        "engType": "integer",
        "signed": false,
        "name": "uint32",
        "qualifiedName": "/yamcs/uint32"
      }
    }, {
      "name": "nnR",
      "type": {
        "engType": "integer",
        "signed": false,
        "name": "uint32",
        "qualifiedName": "/yamcs/uint32"
      }
    }],
    "name": "Cop1Status",
    "qualifiedName": "/yamcs/yamcs1/Cop1Status"
  },
  "dataSource": "SYSTEM"
}