Skip to content

Commit

Permalink
Merge pull request #256 from Intermodalics/fix/error_message_when_tim…
Browse files Browse the repository at this point in the history
…out_tango_connection

Fix/error message when timout tango connection
  • Loading branch information
Perrine Aguiar committed May 2, 2017
2 parents 4cd53a9 + 0e69a44 commit 6c260dc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TangoRosStreamer/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
compile 'org.ros.rosjava_messages:sensor_msgs:[0.3,)'
compile 'org.ros.rosjava_messages:geometry_msgs:[0.3,)'
compile 'org.ros.rosjava_messages:dynamic_reconfigure:[0.3,)'
compile 'org.ros.rosjava_messages:tango_ros_messages:[0.0,)'
compile 'org.ros.rosjava_messages:tango_ros_messages:[1.0.0, 1.1)'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile project(':tango_nodelet_manager')
Expand Down
2 changes: 1 addition & 1 deletion TangoRosStreamer/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.intermodalics.tango_ros_streamer"
android:versionCode="17"
android:versionCode="18"
android:versionName="1.1">

<uses-permission android:name="android.permission.CAMERA" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class RunningActivity extends AppCompatRosActivity implements TangoNodele
private static final String TAGS_TO_LOG = TAG + ", " + "tango_client_api, " + "Registrar, "
+ "DefaultPublisher, " + "native, " + "DefaultPublisher" ;
private static final int LOG_TEXT_MAX_LENGTH = 5000;
private static final int MAX_TANGO_CONNECTION_TRY = 50;

private static final String REQUEST_TANGO_PERMISSION_ACTION = "android.intent.action.REQUEST_TANGO_PERMISSION";
public static final String EXTRA_KEY_PERMISSIONTYPE = "PERMISSIONTYPE";
Expand Down Expand Up @@ -538,7 +539,8 @@ protected void init(NodeMainExecutor nodeMainExecutor) {
@Override
public void onStart(ConnectedNode connectedNode) {
int count = 0;
while (count < 50 && !mTangoServiceClientNode.callTangoConnectService(TangoConnectRequest.CONNECT)) {
while (count < MAX_TANGO_CONNECTION_TRY &&
!mTangoServiceClientNode.callTangoConnectService(TangoConnectRequest.CONNECT)) {
try {
count++;
Log.e(TAG, "Trying to connect to Tango, attempt " + count);
Expand All @@ -547,6 +549,10 @@ public void onStart(ConnectedNode connectedNode) {
e.printStackTrace();
}
}
if (count >= MAX_TANGO_CONNECTION_TRY) {
updateTangoStatus(TangoStatus.SERVICE_NOT_CONNECTED);
displayToastMessage(R.string.tango_connect_error);
}
}
});
}});
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tango_ros_common/tango_ros_common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'org.ros.rosjava_messages:tango_ros_messages:[0.0,)'
compile 'org.ros.rosjava_messages:tango_ros_messages:[1.0.0, 1.1)'
compile project(':tango_nodelet_manager')
}
2 changes: 1 addition & 1 deletion tango_ros_common/tango_ros_messages/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>tango_ros_messages</name>
<version>0.0.0</version>
<version>1.0.0</version>
<description>This package contains messages/services used by tango ros lib</description>

<maintainer email="ruben@intermodalics.eu">Ruben Smits</maintainer>
Expand Down

0 comments on commit 6c260dc

Please sign in to comment.