/** * <summary> * Retrieves a quaternion component for a given identifier in a YAPI context. * <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 quaternion component is online at the time * it is invoked. The returned object is nevertheless valid. * Use the method <c>YQt.isOnline()</c> to test if the quaternion component is * indeed online at a given time. In case of ambiguity when looking for * a quaternion component 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="yctx"> * a YAPI context * </param> * <param name="func"> * a string that uniquely characterizes the quaternion component * </param> * <returns> * a <c>YQt</c> object allowing you to drive the quaternion component. * </returns> */ public static YQt FindQtInContext(YAPIContext yctx, string func) { YQt obj; obj = (YQt)YFunction._FindFromCacheInContext(yctx, "Qt", func); if (obj == null) { obj = new YQt(yctx, func); YFunction._AddToCache("Qt", func, obj); } return(obj); }
/** * <summary> * Retrieves a quaternion component 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 quaternion component is online at the time * it is invoked. The returned object is nevertheless valid. * Use the method <c>YQt.isOnline()</c> to test if the quaternion component is * indeed online at a given time. In case of ambiguity when looking for * a quaternion component 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> * <para> * If a call to this object's is_online() method returns FALSE although * you are certain that the matching device is plugged, make sure that you did * call registerHub() at application initialization time. * </para> * <para> * </para> * </summary> * <param name="func"> * a string that uniquely characterizes the quaternion component * </param> * <returns> * a <c>YQt</c> object allowing you to drive the quaternion component. * </returns> */ public static YQt FindQt(string func) { YQt obj; obj = (YQt)YFunction._FindFromCache("Qt", func); if (obj == null) { obj = new YQt(func); YFunction._AddToCache("Qt", func, obj); } return(obj); }
protected static async Task yInternalGyroCallback(YQt obj, String value) { YGyro gyro = (YGyro)await obj.get_userData(); if (gyro == null) { return; } string tmp = obj.imm_get_functionId().Substring(2); int idx = Convert.ToInt32(tmp); double dbl_value = Convert.ToDouble(value); await gyro._invokeGyroCallbacks(idx, dbl_value); }
public virtual async Task <int> _loadQuaternion() { int now_stamp; int age_ms; now_stamp = (int)((YAPIContext.GetTickCount()) & (0x7FFFFFFF)); age_ms = (((now_stamp - _qt_stamp)) & (0x7FFFFFFF)); if ((age_ms >= 10) || (_qt_stamp == 0)) { if (await this.load(10) != YAPI.SUCCESS) { return(YAPI.DEVICE_NOT_FOUND); } if (_qt_stamp == 0) { _qt_w = YQt.FindQtInContext(_yapi, "" + _serial + ".qt1"); _qt_x = YQt.FindQtInContext(_yapi, "" + _serial + ".qt2"); _qt_y = YQt.FindQtInContext(_yapi, "" + _serial + ".qt3"); _qt_z = YQt.FindQtInContext(_yapi, "" + _serial + ".qt4"); } if (await _qt_w.load(9) != YAPI.SUCCESS) { return(YAPI.DEVICE_NOT_FOUND); } if (await _qt_x.load(9) != YAPI.SUCCESS) { return(YAPI.DEVICE_NOT_FOUND); } if (await _qt_y.load(9) != YAPI.SUCCESS) { return(YAPI.DEVICE_NOT_FOUND); } if (await _qt_z.load(9) != YAPI.SUCCESS) { return(YAPI.DEVICE_NOT_FOUND); } _w = await _qt_w.get_currentValue(); _x = await _qt_x.get_currentValue(); _y = await _qt_y.get_currentValue(); _z = await _qt_z.get_currentValue(); _qt_stamp = now_stamp; } return(YAPI.SUCCESS); }