How to send command packet via bluetooth?

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

How to send command packet via bluetooth?

Postby Rickz2020 » Thu Jan 26, 2012 3:23 pm

I know how to send data using serialization in C#, but I read in a previous post that leJOS does not currently support serialization in most of it's classes.

I am currently sending/receiving simple integers via bluetooth, but would like to be able to send a "command packet" containing a number of integers - an array.

How could I do this? Is there a sample showing how it's done and if so could you please point me in the right direction?

Thanks.
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.

Re: How to send command packet via bluetooth?

Postby skoehler » Thu Jan 26, 2012 4:05 pm

Send an integer with the length of the array. Then send the elements of the array.
skoehler
leJOS Team Member
 
Posts: 1350
Joined: Thu Oct 30, 2008 4:54 pm

Re: How to send command packet via bluetooth?

Postby Rickz2020 » Fri Jan 27, 2012 1:50 pm

Thanks, that gave me an idea. I ended up sending a value to indicate start and finish of the "packet" and then just read all the data in the middle into their appropriate locations. Code looks far sexier now.

Thanks. :D
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 4 guests

more stuff