Skip to content

Commit 1c9f83c

Browse files
authored
Merge pull request #4 from lauralindzey/get_binary_data
Fix get_binary_data to use py::bytes
2 parents 0b2861e + 5e08332 commit 1c9f83c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/pyMOOS.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ class AsyncCommsWrapper : public MOOS::MOOSAsyncCommClient {
215215
}
216216
;//namesapce
217217

218-
219218
PYBIND11_MODULE(pymoos, m) {
220219
m.doc() = "python wrapper for MOOS";
221220

@@ -258,8 +257,8 @@ PYBIND11_MODULE(pymoos, m) {
258257

259258
.def("is_binary", &CMOOSMsg::IsBinary, "Check if data type is "
260259
"binary.")
261-
.def("binary_data",&CMOOSMsg::GetString, "Return string value (here"
262-
" in binary) of the message.")
260+
.def("binary_data", [](CMOOSMsg& msg) {return py::bytes(msg.GetString());},
261+
"Return string value (as a bytes object) of the message.")
263262
.def("binary_data_size",&CMOOSMsg::GetBinaryDataSize, "Return size"
264263
" of binary message (0 if not binary type)/")
265264
.def("mark_as_binary",&CMOOSMsg::MarkAsBinary, "Mark string payload"

0 commit comments

Comments
 (0)