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

[Request] make multicast_level and node_address members protected #187

Closed
2bndy5 opened this issue Aug 11, 2021 · 2 comments · Fixed by #176
Closed

[Request] make multicast_level and node_address members protected #187

2bndy5 opened this issue Aug 11, 2021 · 2 comments · Fixed by #176

Comments

@2bndy5
Copy link
Member

2bndy5 commented Aug 11, 2021

This feature request is similar to nRF24/RF24#782 in that I'll be using inheritence to provide additional functionality in the newer python wrappers that isn't available in the the C++ libs (for low-memory reasons).

With this feature added, I do plan on letting users set the multicast_level and node_address members via existing functionality (RF24Network::multicast_level() and RF24Network::begin() respectively). The following psuedo-code might help to better describe my intentions here

import pyRF24.rf24 as rf24
import pyRF24.rf24_network as rf24_network

THIS_NODE = 0o1

radio = rf24.RF24(22, 0)
if not radio.begin:
    print("radio hardware not responding")
    exit()

network = rf24_network.RF24Network(radio)

# new python wrapper's setter for the node's logical address
# keep in mind that channel should be set with radio.set_channel(new_chnl) or radio.channel = new_chnl
network.node_address = THIS_NODE  # underlying functionality calls RF24Network::begin(THIS_NODE)
# new python wrapper's getter for the node's logical address
addr = network.node_address  # simply returns the private/protected member RF24Network::node_address

# set the multicast level
network.multicast_level = 1  # underlying functionality calls RF24Network::multicast_level()
# get the current multicast level
lvl = network.multicast_level  # simply returns the private/protected member RF24Network::multicast_level
@TMRh20
Copy link
Member

TMRh20 commented Aug 11, 2021 via email

@2bndy5
Copy link
Member Author

2bndy5 commented Aug 11, 2021

I'll also prefix the private/protected multicast_level with a _. This is to not confuse with the public function by the same name.

2bndy5 added a commit that referenced this issue Aug 11, 2021
@2bndy5 2bndy5 linked a pull request Aug 24, 2021 that will close this issue
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.

2 participants