void
dmz::QtPluginCanvasLink::update_link_attribute_object (
      const Handle LinkHandle,
      const Handle AttributeHandle,
      const UUID &SuperIdentity,
      const Handle SuperHandle,
      const UUID &SubIdentity,
      const Handle SubHandle,
      const UUID &AttributeIdentity,
      const Handle AttributeObjectHandle,
      const UUID &PrevAttributeIdentity,
      const Handle PrevAttributeObjectHandle) {

   if (AttributeObjectHandle) {

      LinkStruct *ls = _linkTable.lookup (LinkHandle);

      if (ls) { _attrObjTable.store (AttributeObjectHandle, ls); }

      if (_flowAttrHandle) {

         ObjectModule *objMod (get_object_module ());

         if (objMod) {

            Mask state;

            if (objMod->lookup_state (AttributeObjectHandle, _flowAttrHandle, state)) {

               update_object_state (
                  UUID (),
                  AttributeObjectHandle,
                  _flowAttrHandle,
                  state,
                  0);
            }
         }
      }
   }

   if (PrevAttributeObjectHandle) { _attrObjTable.remove (PrevAttributeObjectHandle); }
}
task smart_PTC_monitor()
{
  /*-----------------------------------------------------------------------------*/
  /*                                                                             */
  /*  task smart_PTC_monitor()                                                         */
  /*                                                                             */
  /*  task written by Vamfun...Mentor Vex 1508, 599.                             */
  /*  8.21.2012  [email protected]... blog info  http://vamfun.wordpress.com      */
  /*                                                                             */
  /*  Sets up periodic loop to calculate object states used in PTC monitor.      */
  /*  States are passed to a current limiter that incorportes user logic to      */
  /*  determine what motors should be limited when a PTC monitor trips.          */
  /*  The current_limiter limits motor commands to keep currents below PTC safe  */
  /*  limits.  It also slew rate limits the motor inputs.   The current_limiter  */
  /*  loop runs at PTC_TASK_DELAY_MS update rate.  The current and temperatures  */
  /*  are updated 6 times slower.                                                */
  /*                                                                             */
  /*-----------------------------------------------------------------------------*/
  //Monitor code
  int loop_cnt = 0;
  bStopTasksBetweenModes = false;  //This keeps monitor running between  autonomous and user tasks to keep temperature
  // models working
  // Initialize
  ClearTimer(T1);//T1 is reserved for state update timer

  initialize_object_state();

  while(true)
  {
    //we need this because we have are no longer stopping all tasks between modes
    //there might be a better way to do this without stopping tasks every cycle.  CDS..action
    if(bIfiRobotDisabled || !bIfiAutonomousMode)
    {
      StopTask(autonomous);

    }
    if(bIfiRobotDisabled || bIfiAutonomousMode)
    {
      StopTask(usercontrol);

    }

    Time_sec = (float)time100[T2]/10.;  //Run time in sec
    v_battery = nImmediateBatteryLevel/1000.;
    //Create logic to toggle the engage logic based upon push of switch_PTC
    switch_state_last = switch_state;
    switch_state = (bool)SensorValue(switch_PTC);
    if( switch_state && !switch_state_last )  //toggle PTC_monitor_engage and debounce switch
    {
      PTC_monitor_engage =  !PTC_monitor_engage;
    }

    if(loop_cnt > 5)  //Run the current computations and temperature updates at  90ms.  Adjust PTC_TASK_DELAY_MS
      //until dt_ms reads 90ms.   This will ensure that the current limiter runs at about
    //6 times faster or about 15ms.

    {
      PTC_monitor_threshold_check(); //if T> Tm then set trip = 1, else if T< .9*Tm reset trip.
      dt_ms = time1[T1] ;// update time msec

      update_object_state(); //compute currents and use these to update PTC temperatures

      ClearTimer(T1);//reset loop timer
      loop_cnt = 1;
    }
    else
    {
      loop_cnt ++;
    }

    current_limiter(); // this is where M[port].cmd_out -> current limit-> motor[port]

    wait1Msec(PTC_TASK_DELAY_MS);

  } //end while

}  //end smart_PTC_monitor() task