I'm not an expert when it comes to Bluetooth, or protocols, or streams, so please, correct me whereever I went wrongt. Here's what I'm trying to do:
I'm trying to send data from a python script to my NXT brick (which is using lejos, of course). The basic BT setup works, I can send data to my NXT with the BTSend prog from the pcsamples.
The problems begin when python comes into play. from what I gathered so far, I can only send RFCOMM protocol messages or (via a special NXT python package) Lego Bluetooth protocol messages with python (using pybluez).
Looking at the NXTConnection and NXTInputStream classes, I see plenty of low-level stuff involving headers, bit shifting operations and what not. My guess is that whatever it is the lejos developers are doing there needs to be done on the sender as well, which it is when you use the lejos classes for sending data, but not when you use python.
So, my question basically is: do you guys think I need to reimplement this stuff from NXTConnection in python to send data (like Integers, for instance) from a python script to my NXT brick? Or is there any other way for me to send a message lejos will understand?
It looks like no one even mentions pybluez in this forum... doesn't seem to be a common usecase
Thanks in advance,
This is where you talk about the NXJ software itself, installation issues, and programming talk.
2 posts • Page 1 of 1
ok, I got rid of the dataInputStream form the BTReceive sample. Just writing data to an RFCOMM socket still wouldn't work as expected, but using the NXT Python's brick.message_write() I can finally send and read data. Still need to figure out how to build a "received" reply for message_write() in Java, but that should be doable.
Who is online
Users browsing this forum: No registered users and 1 guest