epics-base / p4p

Python bindings for the PVAccess network client and server.
BSD 3-Clause "New" or "Revised" License
27 stars 38 forks source link

add support to initialise NTEnum like NTScalar #154

Open m2es3h opened 3 months ago

m2es3h commented 3 months ago

When initialising an NTEnum with a python dict, it is assumed that the dict is meant for the Value.value and contains index and choices keys for the value. This PR adds ability to initialise value and any other fields of the NTEnum, similar to initialising an NTScalar.

pv = SharedPV(
    nt=NTEnum(display=True),
    initial={
        'value.index': 0,
        'value.choices': ['STOP', 'START', 'STANDBY'],
        'display.description': "Pump on/off control word."
    }
)