Ejemplo n.º 1
0
 //必須開啟看門狗,才能執行動作
 //interval: Communication interval of mutual monitoring (100 to 1000msec)
 //alarmLevel:
 //  0=No alarm
 //  1=1-200 Host Port Time Out
 //      Message only (The robot does not stop)
 //  2=2-137 Host Port Time Out
 //      Stops when the operation that is currently performed reaches the target point.
 //  8=8-352 Host Port Time Out
 //      Stops immediately.
 public bool startWatchDog(int interval, int alarmLevel)
 {
     if ((ConnectStatus & CONNECTTYPE.CONNECTED) == 0)
     {
         return(false);
     }
     //已經開啟,直接回傳
     if ((ConnectStatus & CONNECTTYPE.WATCHDOG) > 0)
     {
         return(true);
     }
     try
     {
         //P.94
         _Robot.WatchDogStart(interval, 0, alarmLevel, new TsRemoteS.TSStatusEvent(TSStatusEvent));
         //Return value: None
         ConnectStatus |= CONNECTTYPE.WATCHDOG;
         return(true);
     }
     catch (TsRemoteSException ex)
     {
         //Error processing
         Console.WriteLine("startWatchDog: " + ex.Message);
     }
     return(false);
 }