/** * <summary> * Registers the callback function that is invoked on every change of advertised value. * <para> * The callback is invoked only during the execution of <c>ySleep</c> or <c>yHandleEvents</c>. * This provides control over the time when the callback is triggered. For good responsiveness, remember to call * one of these two functions periodically. To unregister a callback, pass a null pointer as argument. * </para> * <para> * </para> * </summary> * <param name="callback"> * the callback function to call, or a null pointer. The callback function should take two * arguments: the function object of which the value has changed, and the character string describing * the new advertised value. * @noreturn * </param> */ public async Task <int> registerValueCallback(ValueCallback callback) { string val; if (callback != null) { await YFunction._UpdateValueCallbackList(this, true); } else { await YFunction._UpdateValueCallbackList(this, false); } _valueCallbackDaisyChain = callback; // Immediately invoke value callback with current value if (callback != null && await this.isOnline()) { val = _advertisedValue; if (!(val == "")) { await this._invokeValueCallback(val); } } return(0); }
protected internal static async Task _UpdateTimedReportCallbackList(YFunction func, bool add) { await func._yapi._UpdateTimedReportCallbackList(func, add); }
protected internal static void _AddToCache(string className, string func, YFunction obj) { obj._yapi._yHash.imm_setFunction(className, func, obj); }
internal YDataStream(YFunction parent, YDataSet dataset, List <int> encoded) { _parent = parent; imm_initFromDataSet(dataset, encoded); }
protected internal YDataStream(YFunction parent) { _parent = parent; }
// Retrieve a function object by hardware id, updating the indexes on the // fly if needed internal virtual void imm_setFunction(string className, string func, YFunction yfunc) { imm_getFnByType(className).imm_setFunction(func, yfunc); }