Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Commit

Permalink
Small format changes to Orb Basic Sample readme. Code was fine.
Browse files Browse the repository at this point in the history
  • Loading branch information
zenelk committed Nov 18, 2013
1 parent c0d596b commit d8cb84e
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions samples/OrbBasicSample/README.md
Expand Up @@ -12,33 +12,33 @@ The sample programmatically loads the .orbbas files in this directory into the L

## Initializing an OrbBasic Program Object

In the sample, when you click an item in the ListView, you will initialize the `OrbBasicProgram` object. This is the first step in putting an OrbBasic program on the ball. At this point, you are only providing the object with the byte array of data, or the text file content. Here is the code:

// Retrieve byte array from file
Resources res = getResources();

InputStream in_s = res.openRawResource(mOrbBasicProgramResource);
byte[] program = new byte[in_s.available()];
in_s.read(program);

// Create the OrbBasic Program object
mOrbBasicProgram = new OrbBasicProgram(program);
mOrbBasicProgram.setRobot(mRobot);

// Set the listener for the OrbBasic Program Events
mOrbBasicProgram.setOrbBasicProgramEventListener(new OrbBasicProgram.OrbBasicProgramEventListener() {
@Override
public void onEraseCompleted(boolean success) {
String successStr = (success) ? "Success":"Failure";
addMessageToStatus("Done Erasing: " + successStr);
}

@Override
public void onLoadProgramComplete(boolean success) {
String successStr = (success) ? "Success":"Failure";
addMessageToStatus("Done Loading: " + successStr);
}
});
In the sample, when you click an item in the ListView, you will initialize the *OrbBasicProgram* object. This is the first step in putting an OrbBasic program on the ball. At this point, you are only providing the object with the byte array of data, or the text file content. Here is the code:

// Retrieve byte array from file
Resources res = getResources();
InputStream in_s = res.openRawResource(mOrbBasicProgramResource);
byte[] program = new byte[in_s.available()];
in_s.read(program);
// Create the OrbBasic Program object
mOrbBasicProgram = new OrbBasicProgram(program);
mOrbBasicProgram.setRobot(mRobot);
// Set the listener for the OrbBasic Program Events
mOrbBasicProgram.setOrbBasicProgramEventListener(new OrbBasicProgram.OrbBasicProgramEventListener() {
@Override
public void onEraseCompleted(boolean success) {
String successStr = (success) ? "Success":"Failure";
addMessageToStatus("Done Erasing: " + successStr);
}
@Override
public void onLoadProgramComplete(boolean success) {
String successStr = (success) ? "Success":"Failure";
addMessageToStatus("Done Loading: " + successStr);
}
});
The event listener notifies you when an erase storage command or a load program command is finished.

Expand All @@ -60,7 +60,7 @@ You can run the program with the `executeProgram()` function. Depending on the

The AsyncDataListener set up is the same as the StreamingExample, Locator Sample, and a few others in our SDK.

In the `onRobotConnected` event of the `SpheroConnectionView` you should set up AsyncDataListening when you connect to a robot.
In the *onRobotConnected* event of the *SpheroConnectionView* you should set up AsyncDataListening when you connect to a robot.

@Override
public void onRobotConnected(Robot arg0) {
Expand Down

0 comments on commit d8cb84e

Please sign in to comment.