I have this function and I need to know what there is in the "str"
-------------
function sendPut(str, content) {
var xhr = new XMLHttpRequest();
xhr.open("PUT", "http://" + ipPort + "/" + str);
xhr.send(content);
}
--------
I haver tried
document.writeln( str );
and
document.getElementById
in different ways but not got any "str" data on my website.
Although I don't think your function will work, you can see the value of 'str' (if it is displayable) with an 'alert()' function
Code:
function sendPut(str, content) { alert('Contents of "str": '+str);
var xhr = new XMLHttpRequest();
xhr.open("PUT", "http://" + ipPort + "/" + str);
xhr.send(content);
}
BTW, you should enclose your code between [ code] and [ /code] tags (without the spaces)
to make it easier to see your question. It also retains formatting of indentation, if any.
But I need to know what is in the "str"
It is supposed to be a mailbox message using message wrapping and have this kind of structure
----------------
* Byte 0: 0x80 (direct command with no response from the NXT)
* Byte 1: 0x09 (message command type)
* Byte 2: 0x01 (Mailbox number, 0-9)
* Byte 3: Message Size (including null terminating character)
* Byte 4-N: Message data, where N = Message size + 3 and ends with a null terminating character
-----------------
http://goo.gl/PiqRI
You can read about the message wrapping in PDF Appendix 3 / page 9.
Thanks for your input but this is a hard one.
Is it possible to get the data out of the command.php ?
This must be something special on the site as normal JS would need a server to put the information to.
I'm assuming google is providing this space for you.
Have you alerted the 'content', similar to the command for the 'str'.
It may have special code that make it unreadable with ASCII characters.
So I guess it activates the phone server to receive a command by the
http://" + ipPort + "/" + command.php
and then send the content = "f" or "b" or "l" or "r"
and it is in the phone the content is made to a mailbox message using message wrapping and have this kind of structure
----------------
* Byte 0: 0x80 (direct command with no response from the NXT)
* Byte 1: 0x09 (message command type)
* Byte 2: 0x01 (Mailbox number, 0-9)
* Byte 3: Message Size (including null terminating character)
* Byte 4-N: Message data, where N = Message size + 3 and ends with a null terminating character
-----------------
I have tried to find the command.php file in the cellbots files but have had no luck.
Maybe the command.php is in the android files?
The "cellbots" app make the phone work as a network camera server so the index.html / sendPut send the command to the phone
and then it is transferred to the lego mindstorm nxt robot by bluetooth.
I tried to change "str" to "content"
Code:
function sendPut(str, content) {
alert('Contents of "content": '+content);
var xhr = new XMLHttpRequest();
xhr.open("PUT", "http://" + ipPort + "/" + str);
xhr.send(content);
}
And the alert wrote the key commands f/b/l/r and so on.
So the "str" that give the "command.php" is the best candidate.
There should be some way to get the info from the command.php.
Bookmarks