Openthread: [api] unify enable/disable API style

Created on 11 Sep 2019  路  4Comments  路  Source: openthread/openthread

Is your feature request related to a problem? Please describe.
Currently we have two styles for enable/disable. Most uses two separate APIs. But otLinkRawSetEnable(bool) and otLinkRawSrcMatchEnable(bool) accepts a parameter to disable the functionality, shall we unify the style by adding two disable APIs?

P4

Most helpful comment

The following APIs seem to follow the SetEnabled(bool) model:

  • otChannelManagerSetAutoChannelSelectionEnabled
  • otChannelMonitorSetEnabled
  • otIp6SetEnabled
  • otIp6SetMulticastPromiscuousEnabled
  • otIp6SetReceiveFilterEnabled
  • otIp6SetSlaacEnabled
  • otLinkSetEnabled
  • otLinkRawSetEnable
  • otLinkRawSetPromiscuous
  • otThreadSetEnabled
  • otThreadSetRouterRoleEnabled
  • otPlatRadioEnableSrcMatch
  • otPlatRadioSetPromiscuous

All 4 comments

The following APIs seem to follow the SetEnabled(bool) model:

  • otChannelManagerSetAutoChannelSelectionEnabled
  • otChannelMonitorSetEnabled
  • otIp6SetEnabled
  • otIp6SetMulticastPromiscuousEnabled
  • otIp6SetReceiveFilterEnabled
  • otIp6SetSlaacEnabled
  • otLinkSetEnabled
  • otLinkRawSetEnable
  • otLinkRawSetPromiscuous
  • otThreadSetEnabled
  • otThreadSetRouterRoleEnabled
  • otPlatRadioEnableSrcMatch
  • otPlatRadioSetPromiscuous

Thanks! Which style is recommended for new APIs?

I think the preference has been the SetEnabled(bool) style, rather than two separate APIs.

Thank you for the confirmation!

Was this page helpful?
0 / 5 - 0 ratings