static InternalStuff() { logMutex = new Mutex(); InternalStuff.log("+---------------------+"); InternalStuff.log("| START |"); InternalStuff.log("+---------------------+"); InternalStuff.log("DLL path is " + System.Reflection.Assembly.GetExecutingAssembly().Location); apiMutex = new Mutex(); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YGroundSpeed hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering GroundSpeed callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YRealTimeClock hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering RealTimeClock callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YWakeUpSchedule hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering WakeUpSchedule callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YModule hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering Module callback"); _func.registerBeaconCallback(beaconChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YAccelerometer hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering Accelerometer callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YMultiCellWeighScale hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering MultiCellWeighScale callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YBluetoothLink hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering BluetoothLink callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YPowerSupply hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering PowerSupply callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YGenericSensor hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering GenericSensor callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YCurrent hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering Current callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YSegmentedDisplay hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering SegmentedDisplay callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YQuadratureDecoder hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering QuadratureDecoder callback"); _func.registerValueCallback(valueChangeCallback); }
// perform the 2nd stage setup that requires YoctoAPI object protected void init(YMultiAxisController hwd) { if (hwd == null) { return; } base.init(hwd); InternalStuff.log("registering MultiAxisController callback"); _func.registerValueCallback(valueChangeCallback); }
//--- (generated code: YFunction implementation) internal YFunctionProxy(YFunction hwd, string instantiationName) { InternalStuff.log("YFunction constructor for " + instantiationName); // integrity test FctCount++; _instanceId = FctCount; base_init(hwd, instantiationName); _allProxies.Add(this); }
public static string PreRegisterHub(string addr) { string errmsg = ""; InternalStuff.initYoctopuceLibrary(ref errmsg, true); InternalStuff.log("Pre-registering Hub (" + addr + ") ..."); if (YAPI.PreregisterHub(addr, ref errmsg) != YAPI.SUCCESS) { string msg = addr + " Hub asynch registering failed (" + errmsg + ")"; return(msg); } try { YAPI.UpdateDeviceList(ref errmsg); } catch (Exception) { } return(""); }
// perform the initial setup that may be done without a YoctoAPI object (hwd can be null) internal virtual void base_init(YFunction hwd, string instantiationName) { string errmsg = ""; _func = hwd; _instantiationName = instantiationName; InternalStuff.initYoctopuceLibrary(ref errmsg, true); if (_func != null) { try { _func.set_userData(this); _hwdid = _func.get_hardwareId(); //InternalStuff.log(" hwdID = " + _hwdid); } catch (Exception) { //InternalStuff.log("Failed to find out HwdID, device is probably offline "); } } }
public static void FreeLibrary() { InternalStuff.log("Freeing Yoctopuce library"); if (!LibraryAPIInitialized) { return; } // wait for the inner thread to stop; InnerThreadMustStop = true; int retries = 0; while (InnerThreadMustStop && retries < 50) { Thread.Sleep(100); retries++; } apiMutex.WaitOne(); YAPI.FreeAPI(); LibraryAPIInitialized = false; apiMutex.ReleaseMutex(); }
//--- (end of YPowerSupply definitions) //--- (YPowerSupply implementation) internal YPowerSupplyProxy(YPowerSupply hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("PowerSupply " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YCurrent definitions) //--- (YCurrent implementation) internal YCurrentProxy(YCurrent hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("Current " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YAltitude definitions) //--- (YAltitude implementation) internal YAltitudeProxy(YAltitude hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("Altitude " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YTemperature definitions) //--- (YTemperature implementation) internal YTemperatureProxy(YTemperature hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("Temperature " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YGenericSensor definitions) //--- (YGenericSensor implementation) internal YGenericSensorProxy(YGenericSensor hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("GenericSensor " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YAccelerometer definitions) //--- (YAccelerometer implementation) internal YAccelerometerProxy(YAccelerometer hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("Accelerometer " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YWakeUpMonitor definitions) //--- (YWakeUpMonitor implementation) internal YWakeUpMonitorProxy(YWakeUpMonitor hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("WakeUpMonitor " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YMessageBox definitions) //--- (YMessageBox implementation) internal YMessageBoxProxy(YMessageBox hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("MessageBox " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
// property cache //--- (end of YVoc definitions) //--- (YVoc implementation) internal YVocProxy(YVoc hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("Voc " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YPwmInput definitions) //--- (YPwmInput implementation) internal YPwmInputProxy(YPwmInput hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("PwmInput " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
// property cache //--- (end of YMultiAxisController definitions) //--- (YMultiAxisController implementation) internal YMultiAxisControllerProxy(YMultiAxisController hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("MultiAxisController " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }
//--- (end of YDisplay definitions) //--- (YDisplay implementation) internal YDisplayProxy(YDisplay hwd, string instantiationName) : base(hwd, instantiationName) { InternalStuff.log("Display " + instantiationName + " instantiation"); base_init(hwd, instantiationName); }