ioio


IOIO Hanging while we use more leds and connected two activity in IOIO


I have a problem while connect more led,am doing a project facing an issue hanging app while project running, ioio is connect and discount app will be hang.while am checking an issue(Receiver not registered: ioio.lib.android.accessory.AccessoryConnectionBootstrap#e596d07)am facing this type of error
class Looper extends BaseIOIOLooper {
#Override
protected void setup() throws ConnectionLostException {
ioioVersions(ioio_, "IOIO connected!");
led1 = ioio_.openDigitalOutput(1, false);
led2 = ioio_.openDigitalOutput(2, false);
led3 = ioio_.openDigitalOutput(3, false);
led4 = ioio_.openDigitalOutput(4, false);
led5 = ioio_.openDigitalOutput(5, false);
led6 = ioio_.openDigitalOutput(6, false);
led7 = ioio_.openDigitalOutput(7, false);
led8 = ioio_.openDigitalOutput(8, false);
led9 = ioio_.openDigitalOutput(9, false);
led10 = ioio_.openDigitalOutput(10, false);
led11= ioio_.openDigitalOutput(11, false);
led12 = ioio_.openDigitalOutput(12, false);
led13 = ioio_.openDigitalOutput(13, false);
led14 = ioio_.openDigitalOutput(14, false);
led15 = ioio_.openDigitalOutput(15, false);
led16 = ioio_.openDigitalOutput(16, false);
led17 = ioio_.openDigitalOutput(17, false);
enableUi(true);
}
#Override
public void loop() throws ConnectionLostException, InterruptedException {
//enableUi(true);
/* left.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
clickFunction();
}
});
right.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
clickFunction();
}
});
*/
clickFunction();
Thread.sleep(100);
}
#Override
public void disconnected() {
enableUi(false);
ioio_.disconnect();
toast("IOIO disconnected");
}
#Override
public void incompatible() {
ioioVersions(ioio_, "Incompatible firmware version!");
}
}
private void clickFunction() {
wheel1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led4.write(true);
showLightDialog(4,lightDesc[4]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
wheel2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led7.write(true);
showLightDialog(7,lightDesc[7]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
sidemirror.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led3.write(true);
showLightDialog(3,lightDesc[3]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
frontmirror.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led17.write(true);
showLightDialog(17,lightDesc[17]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
grill.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led6.write(true);
showLightDialog(6,lightDesc[6]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led2.write(true);
showLightDialog(2,lightDesc[2]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
headlight.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led5.write(true);
showLightDialog(5,lightDesc[5]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led1.write(true);
showLightDialog(1,lightDesc[1]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led8.write(true);
showLightDialog(8,lightDesc[8]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper3.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led15.write(true);
showLightDialog(15,lightDesc[15]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper4.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led12.write(true);
showLightDialog(12,lightDesc[12]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper5.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led14.write(true);
showLightDialog(14,lightDesc[14]);
} catch (ConnectionLostException e) {
e.printStackTrace();
}
}
});
bumper6.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led13.write(true);
showLightDialog(13,lightDesc[13]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper7.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led16.write(true);
showLightDialog(16,lightDesc[16]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper8.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led10.write(true);
showLightDialog(10,lightDesc[10]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper9.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led11.write(true);
showLightDialog(11,lightDesc[11]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
bumper10.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
try {
resetLights();
led9.write(true);
showLightDialog(9,lightDesc[9]);
Thread.sleep(1000);
} catch (ConnectionLostException | InterruptedException e) {
e.printStackTrace();
}
}
});
}
#Override
protected IOIOLooper createIOIOLooper() {
return new Looper();
}
private void toast(final String message) {
final Context context = this;
runOnUiThread(new Runnable() {
#Override
public void run() {
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}
});
}
private void enableUi(final boolean enable) {
/*try {
resetLights();
} catch (ConnectionLostException e) {
e.printStackTrace();
}*/
runOnUiThread(new Runnable() {
#Override
public void run() {
if (enable){
try {
resetLights();
} catch (ConnectionLostException e) {
e.printStackTrace();
}
}
}
});
}
private void ioioVersions(IOIO ioio, String title) {
toast(String.format("%s\n" +
"IOIOLib: %s\n" +
"Application firmware: %s\n" +
"Bootloader firmware: %s\n" +
"Hardware: %s",
title,
ioio.getImplVersion(IOIO.VersionType.IOIOLIB_VER),
ioio.getImplVersion(IOIO.VersionType.APP_FIRMWARE_VER),
ioio.getImplVersion(IOIO.VersionType.BOOTLOADER_VER),
ioio.getImplVersion(IOIO.VersionType.HARDWARE_VER)));
}
public void resetLights() throws ConnectionLostException {
led1.write(false);
led2.write(false);
led3.write(false);
led4.write(false);
led5.write(false);
led6.write(false);
led7.write(false);
led8.write(false);
led9.write(false);
led10.write(false);
led11.write(false);
led12.write(false);
led13.write(false);
led14.write(false);
led15.write(false);
led16.write(false);
led17.write(false);
}
public void showLightDialog(final int lightPort,String title) {
new AlertDialog.Builder(this)
.setTitle(title)
.setMessage("\n\nDo you want to view the more details..?")
.setPositiveButton(R.string.view, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Intent intent = null;
// if(lightPort==1){
Intent intent = new Intent(MainActivity.this, SwitchOn.class);
//intent.putParcelableArrayListExtra("light_list", (Parcelable) mSwitchPojoList);
//intent.putParcelableArrayListExtra("light_list", (ArrayList<? extends Parcelable>) mSwitchPojoList);
intent.putExtra("light_port", lightPort);
intent.putExtra("light_count", lightsCount);
startActivityForResult(intent, REQUEST_DATA);
overridePendingTransition(R.anim.left_in, R.anim.left_out);
//}
// continue with delete
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
try {
resetLights();
} catch (ConnectionLostException e) {
e.printStackTrace();
}
dialog.dismiss();
}
})
//.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}

Related Links

IOIO Hanging while we use more leds and connected two activity in IOIO

Categories

HOME
reflection
single-sign-on
comparison
android-4.4-kitkat
q
at-command
elm
maven-3
infragistics
jgroups
google-project-tango
elasticsearch-hadoop
vault
offline
usergrid
static-libraries
interop
sms-gateway
nhibernate-envers
amazonsellercentral
functional-testing
mustache.php
devops
bootstrap-material-design
rst2pdf
fopen
windows-error-reporting
strncpy
compatibility
gsmcomm
google-sites-2016
noraui
usbserial
subset-sum
language-concepts
gesture
libvpx
webdriver-manager
angularjs-factory
awt
glew
password-encryption
turbogears
vao
logfiles
avconv
parentheses
react-scripts
domain-model
hls.js
statsd
elgg
setter
tactic
worker-thread
snmptrapd
android-cursor
zendesk-app
iso8601
titanium-android
abcpdf9
heidisql
libpng
rotativa
radtreelist
impresspages
pagerank
sdhc
t4mvc
pundit
android-listview
ibaction
pretty-print
fscommand
c3
winddk
android-imagebutton
rdtsc
applescript-objc
tld
navigationservice
access-rights
sitemesh
gridcontrol
dataadapter
html-editor
angularjs-controller
isnullorempty
chrono
netbeans-6.9
buildr
gnustep
spyware
servicehost
appender
fixed-width
database-management
ti-dsp
genealogy
rtml

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App