Sometimes I make some stupid mistakes. Lately, I chalk that up to working too late at night at this SunSPOT stuff. However, after a full "engineer" work day, there's little time left but late at night to do anything.
SpotClientCommands holds all the commands available in a SpotClient, and provides a means for the execution of these commands whether the SPOT is PC-tethered or out in the wireless wild. The details of my inquiry can be found here. Notice, someone posted a link to a good project-sized examples of how SpotClientCommands is used to create a SPOT shell.
I took a few important lessons from this problem:
1) SpotClientCommands has two different constructors (as of the blue SDK). The first, with 6 arguments, commands directly-connected SPOTs. The second, with 8 arguments, commands SPOTs wirelessly over a basestation.
2) The OTA command server must be enabled on the free range SPOTs and disabled on the basestation.
3) It's safest to execute these commands on a SPOT with the out-of-the-box dummy application installed, but others will work as long as they do not enter deep sleep.
4) Before you can execute any command except for the "hello" command, you must execute the "synchronize" command. SpotClientCommands.execute("synchronize");
Friday, August 29, 2008
Monday, August 25, 2008
ant hello
Each free range SPOT can run a small number of commands using the libraries installed on them by default. The OTA command server is charged with intepreting and performing these commands. One of these commands is "ant hello", and it acts as a good indication that your SPOTs and base station are all communicating correctly, read to accept commands, etc.
After messing with some demos, however, I ran into trouble when trying to invoke the simple command. I pleaded with the SunSPOT World forums:
To recap:
1. Ensure both fre range SPOTs have loaded on them an application that does not deep sleep.
2. Enable the OTA command server on free range SPOTs usng "ant enableota".
3. Ensure your base station is configured as a base station. Remember, anytime you do an "ant info" on the base sation, you must do an "ant startbasestation".
4. Reset all SPOTs with the reset button on each device.
5. With the base station plugged into the USB port, run "ant hello".
After messing with some demos, however, I ran into trouble when trying to invoke the simple command. I pleaded with the SunSPOT World forums:
What is the appropriate response for this command? My basestation is connected, OTA server disabled, and running as a basestation. Client one is configured to run the built-in dummy application, and the OTA server is disabled. Client two is configured to run the current application, and the OTA server is enabled. The response to "ant hello":
-run-spotclient-one:
[java] SPOT Client starting...
[java] There are 0 Sun SPOTs in range
[java] Exiting
How do I get both SPOTs in range?
---
First off, the OTA server must be enabled in order for a SPOT to respond to a hello request. The OTA server is the process that (among other things) responds to the hello). If you turn the OTA server on (ant enableota) on the SPOT with the dummy application, it should begin to respond.
Second, you need to be sure you are not running an application that deep sleeps. If the SPOT is sleeping, it will only respond if it happens to be awake when the hello is sent. You don't say what the "current application" on your second SPOT is. What I'd suggest is that you make sure that OTA is enabled, then connect the SPOT via USB and deploy something like the BounceDemo-OnSPOT, which does not attempt to sleep. If you still encounter problems, posting the output of 'ant sdk-info' and 'ant info' for one of the failing SPOTs will provide a place for people on the forum to help debug the situation.
---
I upgraded my SPOTs to blue-sdk, enabled OTA on both the free range SPOTS (disabled by default), started the base station ("ant startbasestation"), and ran "ant hello" with the base station plugged into my PC. However, the command did not work until the base station and the two free range SPOTs were restarted using their respective reset buttons.
To recap:
1. Ensure both fre range SPOTs have loaded on them an application that does not deep sleep.
2. Enable the OTA command server on free range SPOTs usng "ant enableota".
3. Ensure your base station is configured as a base station. Remember, anytime you do an "ant info" on the base sation, you must do an "ant startbasestation".
4. Reset all SPOTs with the reset button on each device.
5. With the base station plugged into the USB port, run "ant hello".
Sunday, August 24, 2008
MIDlet class specified was not found
This is my first issue with the Java SunSPOT, out-of-the-box. From Netbeans 5.5, when you start a new Sun SPOT Application, a template application is always created. The template application builds and deploys correctly-- assuming you followed all the installation instructions and wrestled away all the PATH or ENV issues-- and should print, "Hello World!", followed by the address of the SPOT client's radio. However, the latter part does not happen. Instead, you get the following error:
java.lang.IllegalArgumentException: MIDlet class specified, org.sunspotworld.src/org/sunspotworld/StartApplication, was not found
What's the problem? Well, this may be something I screwed up in my setup, but the manifest file is set up wrong! Here's what I get with a new project and no alterations:
MIDlet-1: src/org/sunspotworld/StartApplication, , org.sunspotworld.src/org/sunspotworld/StartApplication
The line, written correctly, should read:
MIDlet-1: src/org/sunspotworld/StartApplication, , org.sunspotworld.StartApplication
java.lang.IllegalArgumentException: MIDlet class specified, org.sunspotworld.src/org/sunspotworld/StartApplication, was not found
What's the problem? Well, this may be something I screwed up in my setup, but the manifest file is set up wrong! Here's what I get with a new project and no alterations:
MIDlet-1: src/org/sunspotworld/StartApplication, , org.sunspotworld.src/org/sunspotworld/StartApplication
The line, written correctly, should read:
MIDlet-1: src/org/sunspotworld/StartApplication, , org.sunspotworld.StartApplication
Subscribe to:
Comments (Atom)