コード例 #1
0
        public static int GetAcquisition(this ISmartScopeHardwareUsb usb, byte[] buffer)
        {
            usb.GetData(buffer, 0, Constants.SZ_HDR);
            GCHandle         handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
            SmartScopeHeader hdr    = (SmartScopeHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SmartScopeHeader));

            handle.Free();
            if (!hdr.IsValid())
            {
                Logger.Error("Invalid header magic");
                return(0);
            }


            if (hdr.flags.HasFlag(HeaderFlags.TimedOut))
            {
                return(Constants.SZ_HDR);
            }

            if (hdr.flags.HasFlag(HeaderFlags.IsOverview))
            {
                usb.GetData(buffer, Constants.SZ_HDR, Constants.SZ_OVERVIEW);
                return(Constants.SZ_HDR + Constants.SZ_OVERVIEW);
            }

            if (hdr.n_bursts == 0)
            {
                throw new ScopeIOException("number of bursts in this USB pacakge is 0, cannot fetch");
            }

            int len = hdr.n_bursts * hdr.bytes_per_burst;

            usb.GetData(buffer, Constants.SZ_HDR, len);
            return(Constants.SZ_HDR + len);
        }
コード例 #2
0
 public SmartScopeInterfaceUsb(ISmartScopeHardwareUsb hwInterface)
 {
     this.usb = hwInterface;
 }