From 8d18d58c19aa4443aaf7e9df7e81eb4e141b9774 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 2 Jul 2024 21:26:03 +0000 Subject: [PATCH] updates for autogenerated aravis db/pvi --- ADAravis/ADAravis.ibek.support.yaml | 98 ++++- ...i.device.yaml => ADAravis.pvi.device.yaml} | 2 +- ADGenICam/ADGenICam.pvi.device.yaml | 2 +- schemas/ibek.support.schema.json | 349 +++++++++++------- 4 files changed, 307 insertions(+), 144 deletions(-) rename ADAravis/{arvFeature.pvi.device.yaml => ADAravis.pvi.device.yaml} (99%) diff --git a/ADAravis/ADAravis.ibek.support.yaml b/ADAravis/ADAravis.ibek.support.yaml index a09a878..929a821 100644 --- a/ADAravis/ADAravis.ibek.support.yaml +++ b/ADAravis/ADAravis.ibek.support.yaml @@ -7,6 +7,11 @@ entity_models: description: |- Creates an aravisCamera camera areaDetector driver parameters: + ID: + type: str + description: |- + Cam ip address, hostname, MAC address, or ID -, (e.g. Prosilica-02-2166A-06844) + P: type: str description: |- @@ -22,11 +27,6 @@ entity_models: description: |- Port name for the camera - ID: - type: str - description: |- - Cam ip address, hostname, MAC address, or ID -, (e.g. Prosilica-02-2166A-06844) - BUFFERS: type: int description: |- @@ -51,23 +51,68 @@ entity_models: Asyn Port address, default 0 default: 0 + CLASS: + type: enum + description: |- + Camera class for custom commands + values: + Basler-a2A2600-20gmBAS: + Basler-scA1400-30gm: + Basler-scA1300-32gm: + Basler-scA640-70gm: + Basler-acA640-90gm: + Basler-acA640-300gm: + Basler-acA1300-30gm: + Basler-acA1300-60gm: + Basler-acA1300-75gm: + Basler_piA640_210gm: + AVT_Manta_G319B: + AVT_Mako_G040B: + AVT_Manta_G2460C: + AVT_Mako_G125B: + AVT_Mako_G125C: + AVT_Prosilica_GC1280M: + AVT_Mako_1_52: + AVT_Manta_G507B: + AVT_Manta_G145B: + AVT_Mako_G507B: + AVT_Mako_G507C: + AVT_Prosilica_GT5120: + AVT_Mako_G319C: + AVT_Manta_G419C: + AVT_Prosilica_GC1020C: + AVT_Prosilica_GC655C: + XIMEA_MC124CG-SY: + JAI_CM140_v2-2: + Prosilica_GC: + AVT_Manta_G125B: + AVT_Manta_G125C: + AVT_Manta_G040B: + AVT_Manta_G895B: + AVT_Mako_G158B: + AVT_Mako_G158C: + AVT_Manta_G235B: + AVT_Manta_G235C: + AVT_Manta_1_44: + AVT_Mako_G234C: + AVT_Mako_G234B: + AVT_Manta_G609B: + JAI_CM140: + AutoADGenICam: + # The AutoADGenICam value causes the start.sh to contact the camera and auto + # generate the DB file. The pvi.device file is always autogenerated + pre_init: - value: | - dbLoadRecords /tmp/genicam/genicam.template "P={{ P }},R={{ R }},PORT={{ PORT }}" # aravisConfig(const char *portName, const char *cameraName, size_t maxMemory, int priority, int stackSize) aravisConfig("{{PORT}}", "{{ID}}", {{MEMORY}}, 0, 1) databases: - file: $(ADARAVIS)/db/aravisCamera.template - args: - P: - R: - PORT: - TIMEOUT: - ADDR: + args: { P, R, PORT, TIMEOUT, ADDR } pvi: - yaml_path: ADDriver.pvi.device.yaml + yaml_path: ADAravis.pvi.device.yaml ui_macros: P: R: @@ -75,16 +120,37 @@ entity_models: pv_prefix: $(P)$(R) - name: aravisSettings - description: |- - Creates detailed settings screens for an Aravis camera + + description: | + Create detailed settings screens for an Aravis camera from one of + the predefined database files in ADGenICam or from the auto generated + database file for a specific camera. + + Specify which one using the CLASS parameter or leave CLASS as the + default value to auto generate database file. In this case start.sh + will contact the camera and generate the database file from its XML + description of all its configuration parameters. + parameters: camera: type: object description: the aravisCamera object to create settings for + pvi: - yaml_path: arvFeature.pvi.device.yaml + # TODO - fix ibek to support yaml + #yaml_path: "{{CLASS}}.pvi.device.yaml" + yaml_path: "AutoADGenICam.pvi.device.yaml" ui_macros: P: "{{ camera.P }}" R: "{{ camera.R }}" pv: true pv_prefix: "{{ camera.P }}{{ camera.R }}" + + databases: + - file: "{{ camera.CLASS }}.template" + args: + P: "{{ camera.P }}" + R: "{{ camera.R }}" + PORT: "{{ camera.PORT }}" + TIMEOUT: "{{ camera.TIMEOUT }}" + ADDR: "{{ camera.ADDR }}" diff --git a/ADAravis/arvFeature.pvi.device.yaml b/ADAravis/ADAravis.pvi.device.yaml similarity index 99% rename from ADAravis/arvFeature.pvi.device.yaml rename to ADAravis/ADAravis.pvi.device.yaml index bec1424..662dc56 100644 --- a/ADAravis/arvFeature.pvi.device.yaml +++ b/ADAravis/ADAravis.pvi.device.yaml @@ -1,5 +1,5 @@ label: arvFeature -parent: ADGenICam +parent: ADDriver children: - type: Group name: ADAravis diff --git a/ADGenICam/ADGenICam.pvi.device.yaml b/ADGenICam/ADGenICam.pvi.device.yaml index 8a912a4..807e781 100644 --- a/ADGenICam/ADGenICam.pvi.device.yaml +++ b/ADGenICam/ADGenICam.pvi.device.yaml @@ -3,7 +3,7 @@ parent: ADDriver children: - type: Group - name: Genicam + name: AutoADGenICam layout: type: Grid labelled: true diff --git a/schemas/ibek.support.schema.json b/schemas/ibek.support.schema.json index a46e450..4eeac91 100644 --- a/schemas/ibek.support.schema.json +++ b/schemas/ibek.support.schema.json @@ -1,17 +1,16 @@ { "$defs": { - "BoolArg": { + "BoolParam": { "additionalProperties": false, "description": "An argument with an bool value", "properties": { "type": { "const": "bool", "default": "bool", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "bool" + ], + "title": "Type", "type": "string" }, "description": { @@ -24,6 +23,11 @@ { "type": "boolean" }, + { + "description": "A Jinja2 template string", + "pattern": ".*\\{\\{.*\\}\\}.*", + "type": "string" + }, { "type": "null" } @@ -33,10 +37,9 @@ } }, "required": [ - "name", "description" ], - "title": "BoolArg", + "title": "BoolParam", "type": "object" }, "Comment": { @@ -46,7 +49,11 @@ "type": { "const": "comment", "default": "comment", - "title": "Type" + "enum": [ + "comment" + ], + "title": "Type", + "type": "string" }, "when": { "allOf": [ @@ -105,12 +112,57 @@ "title": "Database", "type": "object" }, - "Definition": { + "Define": { "additionalProperties": false, - "description": "A single definition of a class of Entity that an IOC instance may instantiate", + "description": "A calculated value for an Entity Model", + "properties": { + "description": { + "description": "Description of what the value will be used for", + "title": "Description", + "type": "string" + }, + "value": { + "description": "The contents of the value", + "title": "Value" + }, + "type": { + "anyOf": [ + { + "$ref": "#/$defs/DefineType" + }, + { + "type": "null" + } + ], + "default": "str", + "description": "The type of the value" + } + }, + "required": [ + "description", + "value" + ], + "title": "Define", + "type": "object" + }, + "DefineType": { + "description": "The type of a value", + "enum": [ + "str", + "float", + "int", + "bool", + "list" + ], + "title": "DefineType", + "type": "string" + }, + "EntityModel": { + "additionalProperties": false, + "description": "A Model for a class of Entity that an IOC instance may instantiate", "properties": { "name": { - "description": "Publish Definition as type . for IOC instances", + "description": "Publish EntityModel as type . for IOC instances", "title": "Name", "type": "string" }, @@ -119,54 +171,67 @@ "title": "Description", "type": "string" }, - "args": { + "pre_defines": { + "additionalProperties": { + "$ref": "#/$defs/Define" + }, "default": [], - "description": "The arguments IOC instance should supply", - "items": { - "anyOf": [ + "description": "Calculated values to use as additional arguments With Jinja evaluation before all Args", + "title": "Pre Defines", + "type": "object" + }, + "parameters": { + "additionalProperties": { + "description": "union of arg types", + "discriminator": { + "mapping": { + "bool": "#/$defs/BoolParam", + "enum": "#/$defs/EnumParam", + "float": "#/$defs/FloatParam", + "id": "#/$defs/IdParam", + "int": "#/$defs/IntParam", + "object": "#/$defs/ObjectParam", + "str": "#/$defs/StrParam" + }, + "propertyName": "type" + }, + "oneOf": [ { - "$ref": "#/$defs/FloatArg" + "$ref": "#/$defs/FloatParam" }, { - "$ref": "#/$defs/StrArg" + "$ref": "#/$defs/StrParam" }, { - "$ref": "#/$defs/IntArg" + "$ref": "#/$defs/IntParam" }, { - "$ref": "#/$defs/BoolArg" + "$ref": "#/$defs/BoolParam" }, { - "$ref": "#/$defs/ObjectArg" + "$ref": "#/$defs/ObjectParam" }, { - "$ref": "#/$defs/IdArg" + "$ref": "#/$defs/IdParam" }, { - "$ref": "#/$defs/EnumArg" + "$ref": "#/$defs/EnumParam" } ] }, - "title": "Args", - "type": "array" - }, - "values": { "default": [], - "description": "The values IOC instance should supply", - "items": { - "$ref": "#/$defs/Value" - }, - "title": "Values", - "type": "array" + "description": "The arguments IOC instance should supply", + "title": "Parameters", + "type": "object" }, - "databases": { - "default": [], - "description": "Databases to instantiate", - "items": { - "$ref": "#/$defs/Database" + "post_defines": { + "additionalProperties": { + "$ref": "#/$defs/Define" }, - "title": "Databases", - "type": "array" + "default": [], + "description": "Calculated values to use as additional arguments With Jinja evaluation after all Args", + "title": "Post Defines", + "type": "object" }, "pre_init": { "default": [], @@ -200,6 +265,15 @@ "title": "Post Init", "type": "array" }, + "databases": { + "default": [], + "description": "Databases to instantiate", + "items": { + "$ref": "#/$defs/Database" + }, + "title": "Databases", + "type": "array" + }, "env_vars": { "default": [], "description": "Environment variables to set in the boot script", @@ -210,20 +284,39 @@ "type": "array" }, "pvi": { - "allOf": [ + "anyOf": [ { "$ref": "#/$defs/EntityPVI" + }, + { + "type": "null" } ], "default": null, "description": "PVI definition for Entity" + }, + "sub_entities": { + "default": [], + "description": "The sub-entity instances that this collection is to instantiate", + "items": { + "$ref": "#/$defs/SubEntity" + }, + "title": "Sub Entities", + "type": "array" + }, + "shared": { + "default": [], + "description": "A place to create any anchors required for repeating YAML", + "items": {}, + "title": "Shared", + "type": "array" } }, "required": [ "name", "description" ], - "title": "Definition", + "title": "EntityModel", "type": "object" }, "EntityPVI": { @@ -276,18 +369,17 @@ "title": "EntityPVI", "type": "object" }, - "EnumArg": { + "EnumParam": { "additionalProperties": false, "description": "An argument with an enum value", "properties": { "type": { "const": "enum", "default": "enum", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "enum" + ], + "title": "Type", "type": "string" }, "description": { @@ -312,11 +404,10 @@ } }, "required": [ - "name", "description", "values" ], - "title": "EnumArg", + "title": "EnumParam", "type": "object" }, "EnvironmentVariable": { @@ -341,18 +432,17 @@ "title": "EnvironmentVariable", "type": "object" }, - "FloatArg": { + "FloatParam": { "additionalProperties": false, "description": "An argument with a float value", "properties": { "type": { "const": "float", "default": "float", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "float" + ], + "title": "Type", "type": "string" }, "description": { @@ -365,6 +455,11 @@ { "type": "number" }, + { + "description": "A Jinja2 template string", + "pattern": ".*\\{\\{.*\\}\\}.*", + "type": "string" + }, { "type": "null" } @@ -374,24 +469,22 @@ } }, "required": [ - "name", "description" ], - "title": "FloatArg", + "title": "FloatParam", "type": "object" }, - "IdArg": { + "IdParam": { "additionalProperties": false, "description": "Explicit ID argument that an object can refer to", "properties": { "type": { "const": "id", "default": "id", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "id" + ], + "title": "Type", "type": "string" }, "description": { @@ -413,24 +506,22 @@ } }, "required": [ - "name", "description" ], - "title": "IdArg", + "title": "IdParam", "type": "object" }, - "IntArg": { + "IntParam": { "additionalProperties": false, "description": "An argument with an int value", "properties": { "type": { "const": "int", "default": "int", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "int" + ], + "title": "Type", "type": "string" }, "description": { @@ -443,6 +534,11 @@ { "type": "integer" }, + { + "description": "A Jinja2 template string", + "pattern": ".*\\{\\{.*\\}\\}.*", + "type": "string" + }, { "type": "null" } @@ -452,24 +548,22 @@ } }, "required": [ - "name", "description" ], - "title": "IntArg", + "title": "IntParam", "type": "object" }, - "ObjectArg": { + "ObjectParam": { "additionalProperties": false, "description": "A reference to another entity defined in this IOC", "properties": { "type": { "const": "object", "default": "object", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "object" + ], + "title": "Type", "type": "string" }, "description": { @@ -482,6 +576,7 @@ { "type": "string" }, + {}, { "type": "null" } @@ -491,24 +586,22 @@ } }, "required": [ - "name", "description" ], - "title": "ObjectArg", + "title": "ObjectParam", "type": "object" }, - "StrArg": { + "StrParam": { "additionalProperties": false, "description": "An argument with a str value", "properties": { "type": { "const": "str", "default": "str", - "title": "Type" - }, - "name": { - "description": "Name of the argument that the IOC instance should pass", - "title": "Name", + "enum": [ + "str" + ], + "title": "Type", "type": "string" }, "description": { @@ -530,10 +623,31 @@ } }, "required": [ - "name", "description" ], - "title": "StrArg", + "title": "StrParam", + "type": "object" + }, + "SubEntity": { + "additionalProperties": true, + "description": "A loosely defined class to declare the Entities\nin an ibek.support.yaml file in the 'sub_entities' property of an Entity\nsection", + "properties": { + "type": { + "description": "The type of this entity", + "title": "Type", + "type": "string" + }, + "entity_enabled": { + "default": true, + "description": "enable or disable this entity instance", + "title": "Entity Enabled", + "type": "boolean" + } + }, + "required": [ + "type" + ], + "title": "SubEntity", "type": "object" }, "Text": { @@ -543,7 +657,11 @@ "type": { "const": "text", "default": "text", - "title": "Type" + "enum": [ + "text" + ], + "title": "Type", + "type": "string" }, "when": { "default": "every", @@ -561,34 +679,6 @@ "title": "Text", "type": "object" }, - "Value": { - "additionalProperties": false, - "description": "A calculated string value for a definition", - "properties": { - "name": { - "description": "Name of the value that the IOC instance will expose", - "title": "Name", - "type": "string" - }, - "description": { - "description": "Description of what the value will be used for", - "title": "Description", - "type": "string" - }, - "value": { - "description": "The contents of the value", - "title": "Value", - "type": "string" - } - }, - "required": [ - "name", - "description", - "value" - ], - "title": "Value", - "type": "object" - }, "When": { "enum": [ "first", @@ -600,26 +690,33 @@ } }, "additionalProperties": false, - "description": "Lists the definitions for a support module, this defines what Entities it supports\n\nProvides the deserialize entry point.", + "description": "Lists the EntityModels for a support module, this defines what Entities it supports", "properties": { + "shared": { + "default": [], + "description": "A place to create any anchors required for repeating YAML", + "items": {}, + "title": "Shared", + "type": "array" + }, "module": { "description": "Support module name, normally the repo name", "title": "Module", "type": "string" }, - "defs": { - "description": "The definitions an IOC can create using this module", + "entity_models": { + "description": "The Entity Models an IOC can create using this module", "items": { - "$ref": "#/$defs/Definition" + "$ref": "#/$defs/EntityModel" }, - "title": "Defs", + "title": "Entity Models", "type": "array" } }, "required": [ "module", - "defs" + "entity_models" ], "title": "Support", "type": "object" -} \ No newline at end of file +}