how to report master connection status in android
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 ...
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?
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.