Open chenym250 opened 7 years ago
In case someone who may have encountered the same issue finds this post in the future, I was able to bypass this issue by encoding the raw data into a Base64 string and passing the string to a simple service hosted on the robot (written in Python or C++), which would then decode the string and call sendRemoteBufferToOutput() function via qimessaging's Python (or C++) API.
I want to be able to send binary audio data remotely to a pepper robot. While I was able to do so using Naoqi's sendRemoteBufferToOutput() method with qi framework and C++ SDK (2.5.5), I can't find a simple way to call that method in Java.
In C++, sendRemoteBufferToOutput() accepts an ALValue constructed from a binary buffer (ALValue.setBinary()); in Java it's even more ambiguous. According to jnaoqi's API, it accepts merely an Object. I tried passing a byte array or a list of bytes or a byteBuffer, none of which works, and I constantly get this error:
qimessaging.jni: Cannot serialize return value: Unable to convert JObject in AnyValue
(Additionally, when I was using qimessaging's API I got this error:
qimessaging.remoteobject: no promise found for req id:162 obj: 60 func: 2 type: Reply
)I looked into old documentations, and in version 1.14 there is a binding class for ALValue, called Variant, that I can't find in the new API. Qimessaging seemed to support customizable serializers, but I don't think it was included in the 2.5.5 release. So I ran out of ideas. Another way I can think of now is to wrap either ALValue or my entire C++ application in JNI, but I'd like to know the right way to call sendRemoteBufferToOutput() in Java before going that route.
In conclusion, my issue is: is it possible to pass a byte buffer to sendRemoteBufferToOutput() in Java?