/**
  * <summary>
  *   Checks if the function is currently reachable, without raising any error.
  * <para>
  *   If there is a cached value for the function in cache, that has not yet
  *   expired, the device is considered reachable.
  *   No exception is raised if there is an error while trying to contact the
  *   device hosting the function.
  * </para>
  * <para>
  * </para>
  * </summary>
  * <returns>
  *   <c>true</c> if the function can be reached, and <c>false</c> otherwise
  * </returns>
  */
 public bool isOnline()
 {
     if (_func == null)
     {
         return(false);
     }
     return(_func.isOnline());
 }
        public static YFunctionProxy FindFunction(string name)
        {
            // cases to handle:
            // name =""  no matching unknwn
            // name =""  unknown exists
            // name != "" no  matching unknown
            // name !="" unknown exists
            YFunction      func = null;
            YFunctionProxy res  = (YFunctionProxy)YFunctionProxy.FindSimilarUnknownFunction("YFunctionProxy");

            if (name == "")
            {
                if (res != null)
                {
                    return(res);
                }
                res = (YFunctionProxy)YFunctionProxy.FindSimilarKnownFunction("YFunctionProxy");
                if (res != null)
                {
                    return(res);
                }
                func = YFunction.FirstFunction();
                if (func != null)
                {
                    name = func.get_hardwareId();
                    if (func.get_userData() != null)
                    {
                        return((YFunctionProxy)func.get_userData());
                    }
                }
            }
            else
            {
                func = YFunction.FindFunction(name);
                if (func.get_userData() != null)
                {
                    return((YFunctionProxy)func.get_userData());
                }
            }
            if (res == null)
            {
                res = new YFunctionProxy(func, name);
            }
            if (func != null)
            {
                res.linkToHardware(name);
                if (func.isOnline())
                {
                    res.arrival();
                }
            }
            return(res);
        }
Ejemplo n.º 3
0
 protected static void _UpdateValueCallbackList(YFunction func, Boolean add)
 {
     if (add)
     {
         func.isOnline();
         if (!_ValueCallbackList.Contains(func))
         {
             _ValueCallbackList.Add(func);
         }
     }
     else
     {
         _ValueCallbackList.Remove(func);
     }
 }