Skip to content

hal: Add the HAL query API and add IntEnum types - #4382

Open
BsAtHome wants to merge 1 commit into
LinuxCNC:masterfrom
BsAtHome:halgs_halquery
Open

hal: Add the HAL query API and add IntEnum types#4382
BsAtHome wants to merge 1 commit into
LinuxCNC:masterfrom
BsAtHome:halgs_halquery

Conversation

@BsAtHome

@BsAtHome BsAtHome commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

This PR adds the complete HAL query API to halmodule as a sub-module hal.query. It also adds IntEnum classes under the hal class so that pin/param/signal types now can be hal.Type.BOOL, hal.Type.REAL,... The same for direction hal.Dir.IN, hal.Dir.RW, etc. The hal.query methods use these in the returned dictionaries too.
The HAL_ prefixed names are also in the enums, but the old [HAL_]FLOAT, [HAL_]BIT, [HAL_]S64 and [HAL_]S64 names were removed from the enumerated type. In the interim, there still are S32/U32 names registered for compatibility. Using the HAL_ prefix is just extra baggage that is not necessary. You should use the plain names without prefix. Note that all hal.HAL_* constants are not changed and still available for compatibility reasons.

The hal.query is a sub-module written using pybind11. The same will also happen to halmodule when we get to that point (@rene-dev will be happy). The pybind11 library is now a build dependency and added as such. A configure check has been added.

The hal.get_realtime_type() method has been updated to return the new hal.RTType IntEnum. The old constants are still available, but it is better to move to enums because they are much more informative than a bare number and IntEnum is fully compatible with numeric values.

The documentation has been updated and the new APIs added to the adoc. Some formatting has also been done.

There are now, in the docs, notices about deprecation of the old-style constants and the IntEnums should be preferred. Also, get_info_pins, get_info_params and get_info_signals are marked as deprecated in the doc. These are replaced by the query API.

@petterreinholdtsen When this is merged, then #4231 can be updated and use the generic query API.

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 this pull request may close these issues.

1 participant