Esempio n. 1
0
        /**
         * <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 int registerValueCallback(ValueCallback callback)
        {
            string val;

            if (callback != null)
            {
                YFunction._UpdateValueCallbackList(this, true);
            }
            else
            {
                YFunction._UpdateValueCallbackList(this, false);
            }
            this._valueCallbackInputChain = callback;
            // Immediately invoke value callback with current value
            if (callback != null && this.isOnline())
            {
                val = this._advertisedValue;
                if (!(val == ""))
                {
                    this._invokeValueCallback(val);
                }
            }
            return(0);
        }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YSegmentedDisplay)hwd;
     base.base_init(hwd, instantiationName);
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     value        = (YAPI._atoi(value)).ToString();
     _linkQuality = YAPI._atoi(value);
 }
 protected virtual void valueChangeCallback(YFunction source, string value)
 {
     //InternalStuff.log("new value (" + value + ")");
     _advertisedValue = value;
 }
Esempio n. 5
0
 protected static void _UpdateValueCallbackList(YFunction func, Boolean add)
 {
     if (add)
     {
         func.isOnline();
         if (!_ValueCallbackList.Contains(func))
         {
             _ValueCallbackList.Add(func);
         }
     }
     else
     {
         _ValueCallbackList.Remove(func);
     }
 }
Esempio n. 6
0
 /**
  * <summary>
  *   Retrieves a function for a given identifier.
  * <para>
  *   The identifier can be specified using several formats:
  * </para>
  * <para>
  * </para>
  * <para>
  *   - FunctionLogicalName
  * </para>
  * <para>
  *   - ModuleSerialNumber.FunctionIdentifier
  * </para>
  * <para>
  *   - ModuleSerialNumber.FunctionLogicalName
  * </para>
  * <para>
  *   - ModuleLogicalName.FunctionIdentifier
  * </para>
  * <para>
  *   - ModuleLogicalName.FunctionLogicalName
  * </para>
  * <para>
  * </para>
  * <para>
  *   This function does not require that the function is online at the time
  *   it is invoked. The returned object is nevertheless valid.
  *   Use the method <c>YFunction.isOnline()</c> to test if the function is
  *   indeed online at a given time. In case of ambiguity when looking for
  *   a function by logical name, no error is notified: the first instance
  *   found is returned. The search is performed first by hardware name,
  *   then by logical name.
  * </para>
  * </summary>
  * <param name="func">
  *   a string that uniquely characterizes the function
  * </param>
  * <returns>
  *   a <c>YFunction</c> object allowing you to drive the function.
  * </returns>
  */
 public static YFunction FindFunction(string func)
 {
     YFunction obj;
     obj = (YFunction) YFunction._FindFromCache("Function", func);
     if (obj == null) {
         obj = new YFunction(func);
         YFunction._AddToCache("Function", func, obj);
     }
     return obj;
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YPowerSupply)hwd;
     base.base_init(hwd, instantiationName);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YMultiAxisController)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 9
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YQuadratureDecoder)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 10
0
 // Token: 0x060000BF RID: 191 RVA: 0x00005B18 File Offset: 0x00003D18
 protected void _unregisterFuncCallback(YFunction func)
 {
     YFunction._FunctionCallbacks.Remove(this);
 }
Esempio n. 11
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YStepperMotor)hwd;
     base.base_init(hwd, instantiationName);
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _frequency = YAPI._atof(value);
 }
Esempio n. 13
0
#pragma warning restore 1998


        async Task anButtonValueChangeCallBack(YFunction fct, string value)
        {
            Output.Text += await fct.get_hardwareId() + ": " + value + " (new value)\n";
        }
Esempio n. 14
0
 protected void _unregisterFuncCallback(YFunction func)
 {
     _FunctionCallbacks.Remove(this);
 }
Esempio n. 15
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YRangeFinder)hwd;
     base.base_init(hwd, instantiationName);
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _nextWakeUp = YAPI._hexStrToLong(value);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YVoltageOutput)hwd;
     base.base_init(hwd, instantiationName);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YTemperature)hwd;
     base.base_init(hwd, instantiationName);
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _currentVoltage = YAPI._atof(value);
 }
Esempio n. 20
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YMultiCellWeighScale)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 21
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     YFunction._ClearCache();
     FillList();
 }
Esempio n. 22
0
 protected static void _AddToCache(string classname, string func, YFunction obj)
 {
     _cache[classname + "_" + func] = obj;
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _rgbColor = YAPI._hexStrToInt(value);
     _hslColor = InternalStuff.rgb2hsl(_rgbColor, _hslColor);
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _filesCount = YAPI._atoi(value);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YRealTimeClock)hwd;
     base.base_init(hwd, instantiationName);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YBluetoothLink)hwd;
     base.base_init(hwd, instantiationName);
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YGroundSpeed)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 28
0
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _portState = YAPI._hexStrToInt(value);
 }
Esempio n. 29
0
 public DataEvent(YFunction fun, String value)
 {
     _fun = fun;
     _sensor = null;
     _value = value;
     _report = null;
     _timestamp = 0;
 }
Esempio n. 30
0
 protected void _registerFuncCallback(YFunction func)
 {
     if (!_FunctionCallbacks.Contains(this))
     {
       _FunctionCallbacks.Add(this);
     }
 }
Esempio n. 31
0
 public DataEvent(YSensor sensor, double timestamp, List<int> report)
 {
     _fun = null;
     _sensor = sensor;
     _value = null;
     _timestamp = timestamp;
     _report = report;
 }
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YWakeUpMonitor)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 33
0
 //--- (end of generated code: YDataSet definitions)
 // YDataSet constructor, when instantiated directly by a function
 public YDataSet(YFunction parent, string functionId, string unit, long startTime, long endTime)
 {
     //--- (generated code: YDataSet attributes initialization)
     //--- (end of generated code: YDataSet attributes initialization)
     this._parent     = parent;
     this._functionId = functionId;
     this._unit       = unit;
     this._startTime  = startTime;
     this._endTime    = endTime;
     this._progress   = -1;
     this._summary = new YMeasure();
 }
 protected override void valueChangeCallback(YFunction source, string value)
 {
     base.valueChangeCallback(source, value);
     _slotsInUse = YAPI._atoi(value);
 }
Esempio n. 35
0
 // YDataSet constructor for the new datalogger
 public YDataSet(YFunction parent, string data)
 {
     //--- (generated code: YDataSet attributes initialization)
     //--- (end of generated code: YDataSet attributes initialization)
     this._parent = parent;
     this._startTime = 0;
     this._endTime   = 0;
     this._summary = new YMeasure();
     this._parse(data);
 }
Esempio n. 36
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YGenericSensor)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 37
0
 public YDataStream(YFunction parent)
 {
     this._parent = parent;
     //--- (generated code: YDataStream attributes initialization)
     //--- (end of generated code: YDataStream attributes initialization)
 }
Esempio n. 38
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YCurrent)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 39
0
 public YDataStream(YFunction parent, YDataSet dataset, List<int> encoded)
 {
     this._parent   = parent;
     //--- (generated code: YDataStream attributes initialization)
     //--- (end of generated code: YDataStream attributes initialization)
     this._initFromDataSet(dataset, encoded);
 }
Esempio n. 40
0
 // perform the initial setup that may be done without a YoctoAPI object (hwd can be null)
 internal override void base_init(YFunction hwd, string instantiationName)
 {
     _func = (YAccelerometer)hwd;
     base.base_init(hwd, instantiationName);
 }
Esempio n. 41
0
 static void anButtonValueChangeCallBack(YFunction fct, string value)
 {
     Console.WriteLine(fct.get_hardwareId() + ": " + value + " (new value)");
 }