コード例 #1
0
        private PicoDevice(PicoDeviceHandle handle)
        {
            this.handle       = handle;
            this.dataCallback = (string channelNames, IntPtr samplesPtr, UInt32 samplesPerChannel) =>
            {
                // Don't split the data out if we haven't got any listeners
                if (this.StreamingData.GetInvocationList().Length == 0)
                {
                    return;
                }

                var  channels      = channelNames.Split(',').Select(p => p.Trim(' ')).ToArray();
                uint srcStartIndex = 0;

                var outDict = new Dictionary <string, float[]>();

                foreach (var channel in channels)
                {
                    var channelData = new float[samplesPerChannel];
                    var srcStartPtr = new IntPtr(samplesPtr.ToInt64() + srcStartIndex);
                    Marshal.Copy(srcStartPtr, channelData, 0, (int)samplesPerChannel);

                    outDict.Add(channel, channelData);
                    srcStartIndex += samplesPerChannel;
                }

                this.StreamingData?.Invoke(this, new StreamingDataArgs(outDict));
            };

            if (Native.device_set_callback(this.handle, this.dataCallback) == false)
            {
                ThrowException();
            }
        }
コード例 #2
0
 internal static extern bool device_stop_streaming(PicoDeviceHandle device);
コード例 #3
0
 internal static extern UInt32 device_start_streaming(PicoDeviceHandle device, UInt32 samples_per_second);
コード例 #4
0
 internal static extern bool device_set_callback(PicoDeviceHandle device, StreamingCallbackInternal callback);
コード例 #5
0
 internal static extern bool device_disable_channel(PicoDeviceHandle device, string channel);
コード例 #6
0
 internal static extern bool device_enable_channel(PicoDeviceHandle device, string channel, string range, string coupling);
コード例 #7
0
 internal static extern StringHandle device_get_channel_ranges(PicoDeviceHandle device, string channel);
コード例 #8
0
 internal static extern StringHandle device_get_variant(PicoDeviceHandle device);
コード例 #9
0
 internal static extern StringHandle device_get_serial(PicoDeviceHandle device);