public List<int> PartialGDScan(int buffersize,int first, int last) { List<int> listp = new List<int>(); IntPtr pParam = URG.Native.Urg_GetParameters(this.pUrg); this.parameter = (URG.Native.urg_parameter)Marshal.PtrToStructure(pParam, typeof(URG.Native.urg_parameter)); IntPtr pData= URG.Native.Urg_PartialGDScan(this.pUrg,first, last, buffersize); int[] data = new int[buffersize]; Marshal.Copy(pData, data, 0, buffersize); for(int i =0; i<buffersize;i++) listp.Add(data[i]); return listp; }
public virtual void Connect() { try { pUrg = URG.Native.Urg_Initialise(port); //Fill parameters.. IntPtr pParam = URG.Native.Urg_GetParameters(pUrg); parameter = new URG.Native.urg_parameter(); parameter = (URG.Native.urg_parameter)Marshal.PtrToStructure(pParam, typeof(URG.Native.urg_parameter)); if (pUrg != IntPtr.Zero) isConnected = true; } catch (Exception e) { //IConsole.Write("URG Connection Error:", e.Message); Console.WriteLine("URG Connection Error: {0} ", e.Message); } }