nimi-python icon indicating copy to clipboard operation
nimi-python copied to clipboard

get_channel_name() should be deprecated and replaced by get_channel_names() in nifgen, and niswitch

Open sbethur opened this issue 4 years ago • 0 comments

Description of issue

nifgen and niswitch Python bindings contain get_channel_name(index) method whose input is a single 1-based channel index. Being 1-based contradicts with the GetChannelNameFromString(), which is 0-based, present in some (niscope, nidigital) MI APIs and may one day be added to the nifgen or niswitch APIs.

As per the decision here:

  • get_channel_name(index) should be deprecated in nifgen, and niswitch.
    • Consider using Deprecated library for this.
    • Create an issue for getting rid of it altogether eventually and attach it to 2.0 Source Breakers milestone
  • Add get_channel_names(indices)
    • Since GetChannelNameFromString() is not present in the C API of these drivers, a fancy function needs to be written in Python for calling GetChannelName in a loop and aggregating the results in a list. Ideally, the fancy function is single-sourced for all 3 bindings.
    • We would also need to write tests to verify the behavior of get_channel_names(indices) using fancy function is identical to its counterparts in niscope and nidigital which use GetChannelNameFromString()
    • Additionally, if and when GetChannelNameFromString() is added to C API, the implementation in Python should be switched over from fancy function to C entry point. Eventually, we should be able to get rid of the fancy function altogether.

Note: This issue originally referenced nidcpower too, but it got moved to these newly created issues - #1586 and #1588.

sbethur avatar Apr 10 '20 21:04 sbethur