-
Notifications
You must be signed in to change notification settings - Fork 153
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
expose releaseAddress() for master node #244
Changes from all commits
7747a20
f162427
5691179
547a6cb
d0d8251
ab487cc
59a6573
252edf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,16 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(renewAddress_overload, RF24Mesh::renewAdd | |
// ******************** RF24Mesh exposed ************************** | ||
BOOST_PYTHON_MODULE(RF24Mesh) | ||
{ | ||
{ //::RF24Mesh | ||
{ | ||
/* Binding this class is useless unless we can properly expose RF24Mesh::addrList. | ||
A converter from addrListStruct[] to bp::list<AddrListStruct> needs to be implemented. | ||
// ::RF24Mesh::addrListStruct | ||
bp::class_<RF24Mesh::addrListStruct>("addrListStruct", bp::init<>()) | ||
.def_readonly("nodeID", &RF24Mesh::addrListStruct::nodeID) | ||
.def_readwrite("address", &RF24Mesh::addrListStruct::address); | ||
*/ | ||
|
||
//::RF24Mesh | ||
bp::class_<RF24Mesh>("RF24Mesh", bp::init<RF24&, RF24Network&>((bp::arg("_radio"), bp::arg("_network")))) | ||
//bool begin(uint8_t channel = MESH_DEFAULT_CHANNEL, rf24_datarate_e data_rate = RF24_1MBPS, uint32_t timeout=MESH_RENEWAL_TIMEOUT ); | ||
.def("begin", &RF24Mesh::begin, begin_overload(bp::args("channel", "data_rate", "timeout"))) | ||
|
@@ -80,14 +89,22 @@ BOOST_PYTHON_MODULE(RF24Mesh) | |
.def("setNodeID", &RF24Mesh::setNodeID, (bp::arg("nodeID"))) | ||
//void DHCP(); | ||
.def("DHCP", &RF24Mesh::DHCP) | ||
//int16_t getNodeID(uint16_t address=MESH_BLANK_ID); | ||
//int16_t getNodeID(uint16_t address); | ||
.def("getNodeID", &RF24Mesh::getNodeID, getNodeID_overload(bp::args("address"))) | ||
//int16_t getNodeID(); where address arg defaults to MESH_BLANK_ID | ||
.def("getNodeID", &RF24Mesh::getNodeID, getNodeID_overload()) | ||
//bool checkConnection(); | ||
.def("checkConnection", &RF24Mesh::checkConnection) | ||
//uint16_t renewAddress(uint32_t timeout=MESH_RENEWAL_TIMEOUT); | ||
.def("renewAddress", &RF24Mesh::renewAddress, getNodeID_overload(bp::args("timeout"))) | ||
//uint16_t renewAddress(uint32_t timeout); | ||
.def("renewAddress", &RF24Mesh::renewAddress, renewAddress_overload(bp::args("timeout"))) | ||
//uint16_t renewAddress(); where timeout arg defaults to MESH_RENEWAL_TIMEOUT | ||
.def("renewAddress", &RF24Mesh::renewAddress, renewAddress_overload()) | ||
//bool releaseAddress(); | ||
.def("releaseAddress", &RF24Mesh::releaseAddress) | ||
.def("releaseAddress", (bool(RF24Mesh::*)()) & RF24Mesh::releaseAddress) | ||
#ifndef MESH_NO_MASTER | ||
//bool releaseAddress(uint16_t address); | ||
.def("releaseAddress", (bool(RF24Mesh::*)(uint16_t)) & RF24Mesh::releaseAddress, (bp::args("address"))) | ||
#endif | ||
Comment on lines
-90
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to test this in the python wrapper (on a master and a child) to ensure I did this correctly. I know it compiles, but that doesn't indicate expected runtime behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to work as expected on master nodes and child nodes. However, I'm noticing problems with the overloads for These py bindings also don't expose the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bindings for I gave up on exposing FYI, all of this is already done in pyrf24 package, and the |
||
//int16_t getAddress(uint8_t nodeID); | ||
.def("getAddress", &RF24Mesh::getAddress, (bp::arg("nodeID"))) | ||
//void setChannel(uint8_t _channel); | ||
|
@@ -100,6 +117,14 @@ BOOST_PYTHON_MODULE(RF24Mesh) | |
.def("saveDHCP", &RF24Mesh::saveDHCP) | ||
//void loadDHCP(); | ||
.def("loadDHCP", &RF24Mesh::loadDHCP) | ||
// mesh_address | ||
.def_readwrite("mesh_address", &RF24Mesh::mesh_address) | ||
|
||
// Returning an array of wrapped addrListStruct objects in boost.python is non-trivial. | ||
// I'm commenting out the members related to the RF24Mesh::addrList until a solution can be found. | ||
// .def_readonly("addrListTop", &RF24Mesh::addrListTop) | ||
// .def_readonly("addrList", &RF24Mesh::addrList) | ||
|
||
//void setStaticAddress(uint8_t nodeID, uint16_t address); | ||
.def("setStaticAddress", &RF24Mesh::setStaticAddress, (bp::arg("nodeID"), bp::arg("address"))); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized this should be spelled
MESH_NOMASTER
. I'll submit a commit to master to fix this.