// Find the exact Hardware Id of the specified function, if currently connected // If device is not known as connected, return a clean error // This function will not cause any network access public virtual string getFriendlyName(YAPIContext ctx) { if (_classname.Equals("Module")) { if (_logicalName.Equals("")) { return(_serial + ".module"); } else { return(_logicalName + ".module"); } } else { YPEntry moduleYP = ctx._yHash.imm_resolveFunction("Module", _serial); string module = moduleYP.getFriendlyName(ctx); int pos = module.IndexOf(".", StringComparison.Ordinal); module = module.Substring(0, pos); if (_logicalName.Equals("")) { return(module + "." + _funcId); } else { return(module + "." + _logicalName); } } }
/// <summary> /// Returns a global identifier of the function in the format MODULE_NAME.FUNCTION_NAME. /// The returned string uses the logical names of the module and of the function if they are defined, /// otherwise the serial number of the module and the hardware identifier of the function /// (for example: MyCustomName.relay1) /// </summary> /// <returns> a string that uniquely identifies the function using logical names /// (ex: MyCustomName.relay1) /// </returns> /// <exception cref="YAPI_Exception"> on error </exception> public virtual async Task <string> get_friendlyName() { YPEntry yp = _yapi._yHash.imm_resolveFunction(_className, _func); return(yp.getFriendlyName(_yapi)); }