Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object id additions #20

Closed
thomascobb opened this issue Nov 5, 2021 · 3 comments · Fixed by #24
Closed

Object id additions #20

thomascobb opened this issue Nov 5, 2021 · 3 comments · Fixed by #24

Comments

@thomascobb
Copy link

At the moment we want to make a pmac.DlsPmacAsynMotor have a pmac.Geobrick as a PORT. But what if we wanted to allow a pmac.PowerBrick to be passed as well? iocbuilder allowed us to make a pmac.DeltaTau that pmac.Geobrick could subclass from, should be allow the same inheritance here?

Once we have decided that, we need to put enough information in the schema to allow the GUI to restrict selection of PORT to pmac.DeltaTau instances. This is not a supported concept in JSON schema, so we need to invent our own vocab like https://gregsdennis.github.io/json-everything/usage/vocabs-unique-keys.html

@thomascobb
Copy link
Author

Can inject schema entries like this: wyfo/apischema#128

@thomascobb
Copy link
Author

Here's an idea.

  • Add a new section to the definition file marked interfaces
  • Add a new optional implements entry to a Definition that refers to a named interface in this or another module
  • Abstract baseclasses in builder (like AsynPort) now become interfaces
  • You can now refer to pmac.PmacAsynIPPort or pmac.PmacComms in Geobrick arg PORT type
  • Change is_id to type: id to be explicit
module: pmac

interfaces:
  - name: PmacComms
    args:
      - type: id
        name: name
        description: Asyn port name

definitions:
  - name: PmacAsynIPPort
    implements: pmac.PmacComms
    args:
      # inherits name from PmacComms
      - type: str
        name: IP
        description: IP address of pmac  
    script:
      - pmacAsynIPConfigure({{name}}, {{IP if ":" in IP else IP + ":1025"}})

  - name: Geobrick
    args:
      - type: pmac.PmacComms
        name: PORT
        description: Asyn port name for PmacAsynIPPort to connect to
      # more fields
    script:
      - pmacCreateController({{name}}, {{PORT.name}}, 0, {{numAxes}}, {{movingPoll}}, {{idlePoll}})

What do you reckon?

@thomascobb
Copy link
Author

We decided:

  • Remove is_id from StringArg and make IdArg
  • Make type of ObjectArg "object" and allow any object with an id to be passed to it
definitions:
  - name: PmacAsynIPPort
    args:
      - type: id
        name: name
        description: Asyn port name
      - type: str
        name: IP
        description: IP address of pmac  
    script:
      - pmacAsynIPConfigure({{name}}, {{IP if ":" in IP else IP + ":1025"}})

  - name: Geobrick
    args:
      - type: object
        name: PORT
        description: Asyn port name for PmacAsynIPPort to connect to
      # more fields
    script:
      - pmacCreateController({{name}}, {{PORT.name}}, 0, {{numAxes}}, {{movingPoll}}, {{idlePoll}})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant