Ask Your Question
1

how to report master connection status in android

asked 2012-04-16 01:21:18 -0600

rosdai gravatar image

updated 2012-04-18 03:49:05 -0600

Hi,

I'm working on an android application which connects a master on PC. I wonder if there's any way to feedback the current connection status in android user interface ? I can see the status in logcat in eclipse, but is there a way to show it to the android user?

one of the idea is to catch the registration error, and make a toast to handle it. is it possible to catch the registration error? if yes, where to catch it?

following is the logcat from eclipse. i want to tell the user "connecting to master failed" whenever the following error occurs.

04-17 12:16:50.856: E/Registrar(17158): Exception caught while communicating with master.
04-17 12:16:50.856: E/Registrar(17158): java.lang.RuntimeException: java.net.ConnectException: orome.intern.vmi.ei.tum.de/192.168.13.7:11311 - Connection refused
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:157)
04-17 12:16:50.856: E/Registrar(17158):     at $Proxy0.unregisterPublisher(Native Method)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.MasterClient.unregisterPublisher(MasterClient.java:161)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.Registrar$3$1.call(Registrar.java:170)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.Registrar$3$1.call(Registrar.java:167)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.Registrar.callMaster(Registrar.java:111)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.Registrar.access$100(Registrar.java:51)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.Registrar$3.call(Registrar.java:167)
04-17 12:16:50.856: E/Registrar(17158):     at org.ros.internal.node.client.Registrar$3.call(Registrar.java:164)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:444)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
04-17 12:16:50.856: E/Registrar(17158):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
04-17 12:16:50.856: E/Registrar(17158):     at java.lang.Thread.run(Thread.java:1019)
04-17 12:16:50.856: E/Registrar(17158): Caused by: java.net.ConnectException: orome.intern.vmi.ei.tum.de/192.168.13.7:11311 - Connection refused
04-17 12:16:50.856: E/Registrar(17158):     at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl ...
(more)
edit retag flag offensive close merge delete

Comments

Master connections are not maintained. The go up and down as necessary. What exactly do you want to report to the user? Do you want to ping the master to see if it's alive?

damonkohler gravatar image damonkohler  ( 2012-04-16 10:18:02 -0600 )edit

ping master could also be an idea thx for that! how can i do it? i wanted to catch the error above and make a toast to the user. but i don't know where to catch this error.

rosdai gravatar image rosdai  ( 2012-04-17 00:23:27 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-04-18 10:28:48 -0600

damonkohler gravatar image

updated 2012-04-22 23:20:14 -0600

edit flag offensive delete link more

Comments

thx! i think the second one is what I'm looking for. any idea where i should implement it? in my nodemain?

rosdai gravatar image rosdai  ( 2012-04-19 03:08:04 -0600 )edit

That's a good place, yes. Wherever you call newPublisher().

damonkohler gravatar image damonkohler  ( 2012-04-19 20:11:17 -0600 )edit

thank you Damon Kohler. just another stupic question, what should the parameter be? somehow i can't figure out what type my registrant is. also shall i instantiate a new registrantlistener or there's any method to create a new one (like messagefactory)

rosdai gravatar image rosdai  ( 2012-04-19 22:00:27 -0600 )edit

See the example I linked to above. I just pushed it, so it may take a few minutes to show up.

damonkohler gravatar image damonkohler  ( 2012-04-22 23:20:42 -0600 )edit

this is really helpful. thx a lot!

rosdai gravatar image rosdai  ( 2012-04-24 04:31:14 -0600 )edit

Hi, dead link in your answer, should be https://github.com/rosjava/rosjava_co...

autonomy gravatar image autonomy  ( 2016-10-21 09:13:30 -0600 )edit

All the above links are now dead. Does anyone know where they have moved to?

Tav_PG gravatar image Tav_PG  ( 2019-09-11 23:16:53 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-04-16 01:21:18 -0600

Seen: 1,168 times

Last updated: Apr 22 '12