Loginskip to content

May 11th, 2008

Remote launching programs

As many of you know NXT-G is built upon LabView. This means that everything possible with LabView and the NXTToolkit can be encapsulated into an NXT-G block. Doing so, however, is usually hard work (especially if you want to do it right, i.e. have good control panel and icon drawing interface).

Here’s a project in progress. A few weeks ago I looked into the internal of the toolkit VI ‘Write Message’ which send BT string from master to slave devices and vise versa:
writemessage.png
when you go deep into the internal codes (here’s one good use for the NXTToolkit. Unlike regular NXT-G implementation VIs these VIs are not password protected!) you find that for master BT devices the message string is converted into a ‘BT packet’ by this code fragment:
buildmessagepacket.png
As some may recognize, this is a Direct Command message format. The 0×80 0×09 start means BT Write Message telegram w/o reply (unfortunatly the master BT can’t request reply, since the firmware does not support it. If it could, there’ve been many more possible uses for the kind of “trick” I show here). It then adds the mailbox, the message length and the message itself. All this is converted into a byte array and sent over BT using a VI called ‘BT Write Buffer’ (not shown).

Having seen this, I started thinking - what if I send other Direct Command telegrams from the master NXT to a slave NXT? As I said earlier, only non-reply telegrams are possible. Among the possible telegrams is the ‘Run Program’ command (0×00 command). Indeed, if I have a program called ‘remote’ on the slave NXT running the following code on a master NXT executes ‘remote’:
test_rund.png

As I said in the beginning, this can be cast into an NXT-G block which can either run a program by name on a connected NXT, or stop the current program (0×01 Direct Command). The question is - will it be useful for anything? I will be happy to get your feedback on this at this forum topic.

Guy Ziv