]> rtime.felk.cvut.cz Git - orte.git/blobdiff - orte/Robot_Demo/src/org/ocera/orte/demo/HokuyoScanSubscribe.java
ROBOT_DEMO: use new constants and fix behavior of callback functions
[orte.git] / orte / Robot_Demo / src / org / ocera / orte / demo / HokuyoScanSubscribe.java
index 485c67289d1f42ffa580569a2a9bf2f3fe8f99be..900d9f21d0b5f3ecd97971ac12ebdd04b5460e40 100644 (file)
@@ -11,12 +11,10 @@ import org.ocera.orte.types.MessageData;
 import org.ocera.orte.types.NtpTime;
 import org.ocera.orte.types.RecvInfo;
 import org.ocera.orte.types.SubsProp;
+import org.ocera.orte.types.ORTEConstant;
 
 public class HokuyoScanSubscribe extends SubscriptionCallback{
 
-    public final static int IMMEDIATE    = 0x02;
-    public final static int BEST_EFFORTS = 0x01;
-    
        private Subscription sub;
        private HokuyoView view;
        private HokuyoScanType hokuyomsg;
@@ -41,8 +39,8 @@ public class HokuyoScanSubscribe extends SubscriptionCallback{
                                                        "hokuyo_scan",                                  
                                                        minSeparation,  
                                                        deadline,
-                                                       IMMEDIATE,
-                                                       BEST_EFFORTS,
+                                                       ORTEConstant.IMMEDIATE,
+                                                       ORTEConstant.BEST_EFFORTS,
                                                        0);
        }
        
@@ -76,6 +74,7 @@ public class HokuyoScanSubscribe extends SubscriptionCallback{
        }
        
     public void callback(RecvInfo info, MessageData msg) {
-       view.setData(((HokuyoScanType)msg).hokuyo);
-       }
-}
\ No newline at end of file
+      if (info.getRecvStatus() == ORTEConstant.NEW_DATA)
+        view.setData(((HokuyoScanType)msg).hokuyo);
+    }
+}