public XsDataPacket(XsDataPacket pack) : this(xsensdeviceapiPINVOKE.new_XsDataPacket__SWIG_2(XsDataPacket.getCPtr(pack)), true) { if (xsensdeviceapiPINVOKE.SWIGPendingException.Pending) { throw xsensdeviceapiPINVOKE.SWIGPendingException.Retrieve(); } }
/// <summary> /// Callback function when data is available. /// </summary> /// <param name="packet"></param> public void OnDataAvailable(XsDataPacket packet) { _eulerOrientation = packet.orientationEuler(); _rotMatrix = packet.orientationMatrix(); _rotQuat = packet.orientationQuaternion(); _accXs = packet.calibratedAcceleration(); _freeAccXs = packet.freeAcceleration(); // store rotation and acceleration in Unity friendly format _quat = new Quaternion((float)_rotQuat.x(), (float)_rotQuat.y(), (float)_rotQuat.z(), (float)_rotQuat.w()); _acc = new Vector3((float)_accXs.value(0), (float)_accXs.value(1), (float)_accXs.value(2)); _freeAcc = new Vector3((float)_freeAccXs.value(0), (float)_freeAccXs.value(1), (float)_freeAccXs.value(2)); int currentPacketId = packet.packetCounter(); if (_lastPacketId == -1) { // this is the first frame _lastPacketId = currentPacketId; } int packetDiff = currentPacketId - _lastPacketId; if (packetDiff > 10) { Debug.Log("packet loss " + packetDiff); } _lastPacketId = currentPacketId; }
public void swap(XsDataPacket other) { xsensdeviceapiPINVOKE.XsDataPacket_swap(swigCPtr, XsDataPacket.getCPtr(other)); if (xsensdeviceapiPINVOKE.SWIGPendingException.Pending) { throw xsensdeviceapiPINVOKE.SWIGPendingException.Retrieve(); } }
protected override void onLiveDataAvailable(SWIGTYPE_p_XsDevice dev, XsDataPacket packet) { XsDevice device = new XsDevice(dev); XsDataPacket pack = new XsDataPacket(packet); if (DataAvailable != null) { DataAvailable(this, new DataAvailableArgs(device, pack)); } }
public XsDataPacket merge(XsDataPacket other) { XsDataPacket ret = new XsDataPacket(xsensdeviceapiPINVOKE.XsDataPacket_merge__SWIG_1(swigCPtr, XsDataPacket.getCPtr(other)), false); if (xsensdeviceapiPINVOKE.SWIGPendingException.Pending) { throw xsensdeviceapiPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
protected virtual void onLiveDataAvailable(SWIGTYPE_p_XsDevice dev, XsDataPacket packet) { if (SwigDerivedClassHasMethod("onLiveDataAvailable", swigMethodTypes1)) { xsensdeviceapiPINVOKE.XsCallback_onLiveDataAvailableSwigExplicitXsCallback(swigCPtr, SWIGTYPE_p_XsDevice.getCPtr(dev), XsDataPacket.getCPtr(packet)); } else { xsensdeviceapiPINVOKE.XsCallback_onLiveDataAvailable(swigCPtr, SWIGTYPE_p_XsDevice.getCPtr(dev), XsDataPacket.getCPtr(packet)); } }
public XsDataPacket takeFirstDataPacketInQueue() { XsDataPacket ret = new XsDataPacket(xsensdeviceapiPINVOKE.XsDevice_takeFirstDataPacketInQueue(swigCPtr), true); return(ret); }
public XsDataPacket lastAvailableLiveData() { XsDataPacket ret = new XsDataPacket(xsensdeviceapiPINVOKE.XsDevice_lastAvailableLiveData(swigCPtr), true); return(ret); }
public XsDataPacket getDataPacketByIndex(uint index) { XsDataPacket ret = new XsDataPacket(xsensdeviceapiPINVOKE.XsDevice_getDataPacketByIndex(swigCPtr, index), true); return(ret); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(XsDataPacket obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public DataAvailableArgs(XsDevice device, XsDataPacket packet) { Device = device; Packet = packet; }