|
37 | 37 | import java.util.ArrayList; |
38 | 38 | import java.util.concurrent.locks.ReentrantLock; |
39 | 39 |
|
| 40 | +import javax.management.RuntimeErrorException; |
| 41 | + |
40 | 42 | import com.neuronrobotics.sdk.commands.bcs.core.NamespaceCommand; |
41 | 43 | import com.neuronrobotics.sdk.commands.bcs.core.PingCommand; |
42 | 44 | import com.neuronrobotics.sdk.commands.bcs.core.RpcArgumentsCommand; |
@@ -922,36 +924,26 @@ public BowlerDatagram send(BowlerAbstractCommand command,MACAddress addr, int re |
922 | 924 | for(int i=0;i<retry;i++){ |
923 | 925 |
|
924 | 926 | BowlerDatagram ret; |
925 | | - |
926 | | - ret = send( command,addr); |
927 | | - //System.out.println(ret); |
928 | | - if(ret != null){ |
929 | | - addr.setValues(ret.getAddress()); |
930 | | - //if(!ret.getRPC().contains("_err")) |
931 | | - |
932 | | - return ret; |
933 | | - } |
934 | | - |
935 | | - if(retry>1){ |
936 | | - //only force a reconnect if the retry is above one. |
937 | | - //a device failing to respond could just be the result of a wrong packet type level. |
938 | | -// try { |
939 | | -// //Log.warning("Reconnecting in the send engine loop, retry "+retry+" times"); |
940 | | -// //reconnect(); |
941 | | -// } catch (IOException e) { |
942 | | -// // TODO Auto-generated catch block |
943 | | -// e.printStackTrace(); |
944 | | -// } |
945 | | - |
946 | | - } |
947 | | - Log.error("Sending Synchronus packet and there was a failure, will retry "+(retry-i-1)+" more times"); |
948 | | - ThreadUtil.wait(150*i); |
949 | | - if( BowlerDatagram.isUseBowlerV4()){ |
950 | | - //If the ping fails to get a response, try the older bowler format |
951 | | - BowlerDatagram.setUseBowlerV4(false); |
952 | | - }else{ |
953 | | - BowlerDatagram.setUseBowlerV4(true); |
| 927 | + try{ |
| 928 | + ret = send( command,addr); |
| 929 | + //System.out.println(ret); |
| 930 | + if(ret != null){ |
| 931 | + addr.setValues(ret.getAddress()); |
| 932 | + //if(!ret.getRPC().contains("_err")) |
| 933 | + |
| 934 | + return ret; |
| 935 | + } |
| 936 | + }catch(MalformattedDatagram | NullPointerException e){ |
| 937 | + Log.error("Sending Synchronus packet and there was a failure, will retry "+(retry-i-1)+" more times"); |
| 938 | + ThreadUtil.wait(150*i); |
| 939 | + if( BowlerDatagram.isUseBowlerV4()){ |
| 940 | + //If the ping fails to get a response, try the older bowler format |
| 941 | + BowlerDatagram.setUseBowlerV4(false); |
| 942 | + }else{ |
| 943 | + BowlerDatagram.setUseBowlerV4(true); |
| 944 | + } |
954 | 945 | } |
| 946 | + |
955 | 947 | } |
956 | 948 | return null; |
957 | 949 | } |
|
0 commit comments