summaryrefslogtreecommitdiff
path: root/bindings/csharp
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/csharp')
-rw-r--r--bindings/csharp/.gitignore3
-rw-r--r--bindings/csharp/AssemblyInfo.cs.in5
-rw-r--r--bindings/csharp/Attr.cs102
-rw-r--r--bindings/csharp/CMakeLists.txt70
-rw-r--r--bindings/csharp/Channel.cs236
-rw-r--r--bindings/csharp/Context.cs231
-rw-r--r--bindings/csharp/Device.cs262
-rw-r--r--bindings/csharp/IOBuffer.cs143
-rw-r--r--bindings/csharp/Trigger.cs67
-rw-r--r--bindings/csharp/examples/ExampleProgram.cs82
-rw-r--r--bindings/csharp/key.snkbin596 -> 0 bytes
-rw-r--r--bindings/csharp/libiio-sharp.dll.config.cmakein3
-rw-r--r--bindings/csharp/libiio-sharp.pc.cmakein10
13 files changed, 0 insertions, 1214 deletions
diff --git a/bindings/csharp/.gitignore b/bindings/csharp/.gitignore
deleted file mode 100644
index 475b306..0000000
--- a/bindings/csharp/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-AssemblyInfo.cs
-libiio-sharp-0.5.pc
-libiio-sharp.dll.config
diff --git a/bindings/csharp/AssemblyInfo.cs.in b/bindings/csharp/AssemblyInfo.cs.in
deleted file mode 100644
index 5d1de04..0000000
--- a/bindings/csharp/AssemblyInfo.cs.in
+++ /dev/null
@@ -1,5 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly:AssemblyVersion("@LIBIIO_CS_VERSION@")]
-[assembly:AssemblyDelaySign(false)]
diff --git a/bindings/csharp/Attr.cs b/bindings/csharp/Attr.cs
deleted file mode 100644
index 2ddcc3e..0000000
--- a/bindings/csharp/Attr.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * libiio - Library for interfacing industrial I/O (IIO) devices
- *
- * Copyright (C) 2015 Analog Devices, Inc.
- * Author: Paul Cercueil <paul.cercueil@analog.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * */
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace iio
-{
- /// <summary><see cref="iio.Attr"/> class:
- /// Contains the representation of a channel or device attribute.</summary>
- public abstract class Attr
- {
- /// <summary>The name of this attribute.</summary>
- public readonly string name;
-
- /// <summary>The filename in sysfs to which this attribute is bound.</summary>
- public readonly string filename;
-
- internal Attr(string name, string filename = null)
- {
- this.filename = filename == null ? name : filename;
- this.name = name;
- }
-
- /// <summary>Read the value of this attribute as a <c>string</c>.</summary>
- /// <exception cref="System.Exception">The attribute could not be read.</exception>
- public abstract string read();
-
- /// <summary>Set this attribute to the value contained in the <c>string</c> argument.</summary>
- /// <param name="val">The <c>string</c> value to set the parameter to.</param>
- /// <exception cref="System.Exception">The attribute could not be written.</exception>
- public abstract void write(string val);
-
- /// <summary>Read the value of this attribute as a <c>bool</c>.</summary>
- /// <exception cref="System.Exception">The attribute could not be read.</exception>
- public bool read_bool()
- {
- string val = read();
- return (val.CompareTo("1") == 0) || (val.CompareTo("Y") == 0);
- }
-
- /// <summary>Read the value of this attribute as a <c>double</c>.</summary>
- /// <exception cref="System.Exception">The attribute could not be read.</exception>
- public double read_double()
- {
- return double.Parse(read(), CultureInfo.InvariantCulture);
- }
-
- /// <summary>Read the value of this attribute as a <c>long</c>.</summary>
- /// <exception cref="System.Exception">The attribute could not be read.</exception>
- public long read_long()
- {
- return long.Parse(read(), CultureInfo.InvariantCulture);
- }
-
- /// <summary>Set this attribute to the value contained in the <c>bool</c> argument.</summary>
- /// <param name="val">The <c>bool</c> value to set the parameter to.</param>
- /// <exception cref="System.Exception">The attribute could not be written.</exception>
- public void write(bool val)
- {
- if (val)
- write("1");
- else
- write("0");
- }
-
- /// <summary>Set this attribute to the value contained in the <c>long</c> argument.</summary>
- /// <param name="val">The <c>long</c> value to set the parameter to.</param>
- /// <exception cref="System.Exception">The attribute could not be written.</exception>
- public void write(long val)
- {
- write(val.ToString(CultureInfo.InvariantCulture));
- }
-
- /// <summary>Set this attribute to the value contained in the <c>double</c> argument.</summary>
- /// <param name="val">The <c>double</c> value to set the parameter to.</param>
- /// <exception cref="System.Exception">The attribute could not be written.</exception>
- public void write(double val)
- {
- write(val.ToString(CultureInfo.InvariantCulture));
- }
- }
-}
diff --git a/bindings/csharp/CMakeLists.txt b/bindings/csharp/CMakeLists.txt
deleted file mode 100644
index 7e9d19b..0000000
--- a/bindings/csharp/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-cmake_minimum_required(VERSION 2.8.7)
-project(libiio-sharp NONE)
-
-if (WIN32)
- set(MCS_EXECUTABLE_NAME csc)
-else()
- set(MCS_EXECUTABLE_NAME mcs)
-endif()
-
-find_program(MCS_EXECUTABLE
- NAMES ${MCS_EXECUTABLE_NAME}
- HINTS "C:/Windows/Microsoft.NET/Framework/v4.0.30319"
- PATHS ENV MCS_EXECUTABLE_PATH
- DOC "C# compiler")
-mark_as_advanced(MCS_EXECUTABLE)
-
-if (MCS_EXECUTABLE)
- option(CSHARP_BINDINGS "Install C# bindings" ON)
-
- if (CSHARP_BINDINGS)
- set(LIBIIO_CS_PC_IN "${CMAKE_CURRENT_SOURCE_DIR}/libiio-sharp.pc.cmakein")
- set(LIBIIO_CS_PC "${CMAKE_CURRENT_BINARY_DIR}/libiio-sharp-${VERSION}.pc")
- configure_file(${LIBIIO_CS_PC_IN} ${LIBIIO_CS_PC} @ONLY)
- if(NOT SKIP_INSTALL_ALL)
- install(FILES ${LIBIIO_CS_PC} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
- endif()
-
- set(LIBIIO_CS_DLL_CONFIG_IN "${CMAKE_CURRENT_SOURCE_DIR}/libiio-sharp.dll.config.cmakein")
- set(LIBIIO_CS_DLL_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/libiio-sharp.dll.config")
- configure_file(${LIBIIO_CS_DLL_CONFIG_IN} ${LIBIIO_CS_DLL_CONFIG} @ONLY)
- if(NOT SKIP_INSTALL_ALL)
- install(FILES ${LIBIIO_CS_DLL_CONFIG} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cli/libiio-sharp-${VERSION})
- endif()
-
- set(LIBIIO_CS_VERSION ${VERSION}.0.0)
- set(LIBIIO_CS_INFO_IN ${CMAKE_CURRENT_SOURCE_DIR}/AssemblyInfo.cs.in)
- set(LIBIIO_CS_INFO ${CMAKE_CURRENT_BINARY_DIR}/AssemblyInfo.cs)
- configure_file(${LIBIIO_CS_INFO_IN} ${LIBIIO_CS_INFO} @ONLY)
-
- set(LIBIIO_CS_DLL "${CMAKE_CURRENT_BINARY_DIR}/libiio-sharp.dll")
- set(LIBIIO_CS_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/Attr.cs
- ${CMAKE_CURRENT_SOURCE_DIR}/Channel.cs
- ${CMAKE_CURRENT_SOURCE_DIR}/Context.cs
- ${CMAKE_CURRENT_SOURCE_DIR}/Device.cs
- ${CMAKE_CURRENT_SOURCE_DIR}/IOBuffer.cs
- ${CMAKE_CURRENT_SOURCE_DIR}/Trigger.cs
- ${LIBIIO_CS_INFO}
- )
-
- foreach(SRC ${LIBIIO_CS_SOURCES})
- file(TO_NATIVE_PATH ${SRC} TMP)
- set(LIBIIO_CS_SOURCES_REALPATH ${LIBIIO_CS_SOURCES_REALPATH} ${TMP})
- endforeach(SRC)
-
- file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/key.snk SIGN_KEY)
- file(TO_NATIVE_PATH ${LIBIIO_CS_DLL} LIBIIO_CS_DLL_OUT)
-
- add_custom_command(OUTPUT ${LIBIIO_CS_DLL}
- COMMAND ${MCS_EXECUTABLE} /target:library /out:${LIBIIO_CS_DLL_OUT} /debug /keyfile:${SIGN_KEY} ${LIBIIO_CS_SOURCES_REALPATH}
- DEPENDS ${LIBIIO_CS_SOURCES}
- )
-
- add_custom_target(libiio-sharp ALL DEPENDS ${LIBIIO_CS_DLL})
-
- if(NOT SKIP_INSTALL_ALL)
- install(FILES ${LIBIIO_CS_DLL} ${LIBIIO_CS_DLL}.mdb DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cli/libiio-sharp-${VERSION})
- endif()
- endif()
-endif()
diff --git a/bindings/csharp/Channel.cs b/bindings/csharp/Channel.cs
deleted file mode 100644
index 491a4ad..0000000
--- a/bindings/csharp/Channel.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * libiio - Library for interfacing industrial I/O (IIO) devices
- *
- * Copyright (C) 2015 Analog Devices, Inc.
- * Author: Paul Cercueil <paul.cercueil@analog.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * */
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace iio
-{
- /// <summary><see cref="iio.Channel"/> class:
- /// Contains the representation of an input or output channel.</summary>
- public class Channel
- {
- private class ChannelAttr : Attr
- {
- private IntPtr chn;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_channel_attr_read(IntPtr chn, [In()] string name, [Out()] StringBuilder val, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_channel_attr_write(IntPtr chn, [In()] string name, string val);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_channel_attr_get_filename(IntPtr chn, [In()] string attr);
-
- public ChannelAttr(IntPtr chn, string name) : base(name, Marshal.PtrToStringAnsi(iio_channel_attr_get_filename(chn, name)))
- {
- this.chn = chn;
- }
-
- public override string read()
- {
- StringBuilder builder = new StringBuilder(1024);
- int err = iio_channel_attr_read(chn, name, builder, (uint) builder.Capacity);
- if (err < 0)
- throw new Exception("Unable to read channel attribute " + err);
- return builder.ToString();
- }
-
- public override void write(string str)
- {
- int err = iio_channel_attr_write(chn, name, str);
- if (err < 0)
- throw new Exception("Unable to write channel attribute " + err);
- }
- }
-
-
- private IntPtr chn;
- private uint sample_size;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_channel_get_id(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_channel_get_name(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_channel_get_attrs_count(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_channel_get_attr(IntPtr chn, uint index);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.I1)]
- private static extern bool iio_channel_is_output(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.I1)]
- private static extern bool iio_channel_is_scan_element(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void iio_channel_enable(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void iio_channel_disable(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.I1)]
- private static extern bool iio_channel_is_enabled(IntPtr chn);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_channel_read_raw(IntPtr chn, IntPtr buf, IntPtr dst, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_channel_write_raw(IntPtr chn, IntPtr buf, IntPtr src, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_channel_read(IntPtr chn, IntPtr buf, IntPtr dst, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_channel_write(IntPtr chn, IntPtr buf, IntPtr src, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_channel_get_data_format(IntPtr chn);
-
- /// <summary>The name of this channel.</summary>
- public readonly string name;
-
- /// <summary>An identifier of this channel.</summary>
- /// <remarks>It is possible that two channels have the same ID,
- /// if one is an input channel and the other is an output channel.</remarks>
- public readonly string id;
-
- /// <summary>Contains <c>true</c> if the channel is an output channel,
- /// <c>false</c> otherwise.</summary>
- public readonly bool output;
-
- /// <summary>Contains <c>true</c> if the channel is a scan element,
- /// <c>false</c> otherwise.</summary>
- /// <remarks>If a channel is a scan element, then it is possible to enable it
- /// and use it for I/O operations.</remarks>
- public readonly bool scan_element;
-
- /// <summary>A <c>list</c> of all the attributes that this channel has.</summary>
- public readonly List<Attr> attrs;
-
- internal Channel(IntPtr chn)
- {
- this.chn = chn;
- attrs = new List<Attr>();
- sample_size = (uint)Marshal.ReadInt32(iio_channel_get_data_format(this.chn)) / 8;
- uint nb_attrs = iio_channel_get_attrs_count(chn);
-
- for (uint i = 0; i < nb_attrs; i++)
- attrs.Add(new ChannelAttr(this.chn, Marshal.PtrToStringAnsi(iio_channel_get_attr(chn, i))));
-
- IntPtr name_ptr = iio_channel_get_name(this.chn);
- if (name_ptr == IntPtr.Zero)
- name = "";
- else
- name = Marshal.PtrToStringAnsi(name_ptr);
-
- id = Marshal.PtrToStringAnsi(iio_channel_get_id(this.chn));
- output = iio_channel_is_output(this.chn);
- scan_element = iio_channel_is_scan_element(this.chn);
- }
-
- /// <summary>Enable the current channel, so that it can be used for I/O operations.</summary>
- public void enable()
- {
- iio_channel_enable(this.chn);
- }
-
- /// <summary>Disable the current channel.</summary>
- public void disable()
- {
- iio_channel_disable(this.chn);
- }
-
- /// <summary>Returns whether or not the channel has been enabled.</summary>
- public bool is_enabled()
- {
- return iio_channel_is_enabled(this.chn);
- }
-
- /// <summary>Extract the samples corresponding to this channel from the
- /// given <see cref="iio.IOBuffer"/> object.</summary>
- /// <param name="buffer">A valid instance of the <see cref="iio.IOBuffer"/> class.</param>
- /// <param name="raw">If set to <c>true</c>, the samples are not converted from their
- /// hardware format to their host format.</param>
- /// <returns>A <c>byte</c> array containing the extracted samples.</returns>
- /// <exception cref="System.Exception">The samples could not be read.</exception>
- public byte[] read(IOBuffer buffer, bool raw = false)
- {
- if (!is_enabled())
- throw new Exception("Channel must be enabled before the IOBuffer is instantiated");
- if (this.output)
- throw new Exception("Unable to read from output channel");
-
- byte[] array = new byte[(int) (buffer.samples_count * sample_size)];
- MemoryStream stream = new MemoryStream(array, true);
- GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned);
- IntPtr addr = handle.AddrOfPinnedObject();
- uint count;
-
- if (raw)
- count = iio_channel_read_raw(this.chn, buffer.buf, addr, buffer.samples_count * sample_size);
- else
- count = iio_channel_read(this.chn, buffer.buf, addr, buffer.samples_count * sample_size);
- handle.Free();
- stream.SetLength((long) count);
- return stream.ToArray();
-
- }
-
- /// <summary>
- /// Write the specified array of samples corresponding to this channel into the
- /// given <see cref="iio.IOBuffer"/> object.</summary>
- /// <param name="buffer">A valid instance of the <see cref="iio.IOBuffer"/> class.</param>
- /// <param name="array">A <c>byte</c> array containing the samples to write.</param>
- /// <param name="raw">If set to <c>true</c>, the samples are not converted from their
- /// host format to their native format.</param>
- /// <returns>The number of bytes written.</returns>
- /// <exception cref="System.Exception">The samples could not be written.</exception>
- public uint write(IOBuffer buffer, byte[] array, bool raw = false)
- {
- if (!is_enabled())
- throw new Exception("Channel must be enabled before the IOBuffer is instantiated");
- if (!this.output)
- throw new Exception("Unable to write to an input channel");
-
- GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned);
- IntPtr addr = handle.AddrOfPinnedObject();
- uint count;
-
- if (raw)
- count = iio_channel_write_raw(this.chn, buffer.buf, addr, (uint) array.Length);
- else
- count = iio_channel_write(this.chn, buffer.buf, addr, (uint) array.Length);
- handle.Free();
-
- return count;
- }
- }
-}
diff --git a/bindings/csharp/Context.cs b/bindings/csharp/Context.cs
deleted file mode 100644
index e5c478f..0000000
--- a/bindings/csharp/Context.cs
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * libiio - Library for interfacing industrial I/O (IIO) devices
- *
- * Copyright (C) 2015 Analog Devices, Inc.
- * Author: Paul Cercueil <paul.cercueil@analog.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace iio
-{
- public class Version
- {
- public readonly uint major;
- public readonly uint minor;
- public readonly string git_tag;
-
- internal Version(uint major, uint minor, string git_tag)
- {
- this.major = major;
- this.minor = minor;
- this.git_tag = git_tag;
- }
- }
-
- /// <summary><see cref="iio.Context"/> class:
- /// Contains the representation of an IIO context.</summary>
- public class Context : IDisposable
- {
- private IntPtr ctx;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_create_network_context(
- [In()][MarshalAs(UnmanagedType.LPStr)] string hostname
- );
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_create_context_from_uri(
- [In()][MarshalAs(UnmanagedType.LPStr)] string uri
- );
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_create_default_context();
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void iio_context_destroy(IntPtr ctx);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_context_get_name(IntPtr ctx);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_context_get_description(IntPtr ctx);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_context_get_xml(IntPtr ctx);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void iio_library_get_version(ref uint major, ref uint minor, [Out()] StringBuilder git_tag);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_context_get_version(IntPtr ctx, ref uint major, ref uint minor, [Out()] StringBuilder git_tag);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_context_get_devices_count(IntPtr ctx);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_context_get_device(IntPtr ctx, uint index);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.I1)]
- private static extern bool iio_device_is_trigger(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_context_set_timeout(IntPtr ctx, uint timeout_ms);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_context_clone(IntPtr ctx);
-
- /// <summary>A XML representation of the current context.</summary>
- public readonly string xml;
-
- /// <summary>The name of the current context.</summary>
- public readonly string name;
-
- /// <summary>Retrieve a human-readable information string about the current context.</summary>
- public readonly string description;
- public readonly Version library_version, backend_version;
-
- /// <summary>A <c>List</c> of all the IIO devices present on the current context.</summary>
- public readonly List<Device> devices;
-
- /// <summary>Initializes a new instance of the <see cref="iio.Context"/> class,
- /// using the provided URI. For compatibility with existing code, providing
- /// an IP address or a hostname here will automatically create a network
- /// context.</summary>
- /// <param name="uri">URI to use for the IIO context creation</param>
- /// <returns>an instance of the <see cref="iio.Context"/> class</returns>
- /// <exception cref="System.Exception">The IIO context could not be created.</exception>
- public Context(string uri) : this(getContextFromString(uri)) {}
-
- /// <summary>Initializes a new instance of the <see cref="iio.Context"/> class,
- /// using the local or the network backend of the IIO library.</summary>
- /// <remarks>This function will create a network context if the IIOD_REMOTE
- /// environment variable is set to the hostname where the IIOD server runs.
- /// If set to an empty string, the server will be discovered using ZeroConf.
- /// If the environment variable is not set, a local context will be created
- /// instead.</remarks>
- /// <exception cref="System.Exception">The IIO context could not be created.</exception>
- public Context() : this(iio_create_default_context()) {}
-
- private static IntPtr getContextFromString(string str)
- {
- IntPtr ptr = iio_create_context_from_uri(str);
- if (ptr == IntPtr.Zero)
- ptr = iio_create_network_context(str);
- return ptr;
- }
-
- private Context(IntPtr ctx)
- {
- this.ctx = ctx;
-
- if (ctx == IntPtr.Zero)
- throw new Exception("Unable to create IIO context");
-
- uint nb_devices = iio_context_get_devices_count(ctx);
-
- devices = new List<Device>();
- for (uint i = 0; i < nb_devices; i++)
- {
- IntPtr ptr = iio_context_get_device(ctx, i);
- if (iio_device_is_trigger(ptr))
- devices.Add(new Trigger(this, ptr));
- else
- devices.Add(new Device(this, ptr));
- }
-
- xml = Marshal.PtrToStringAnsi(iio_context_get_xml(ctx));
- name = Marshal.PtrToStringAnsi(iio_context_get_name(ctx));
- description = Marshal.PtrToStringAnsi(iio_context_get_description(ctx));
-
- uint major = 0;
- uint minor = 0;
- StringBuilder builder = new StringBuilder(8);
- iio_library_get_version(ref major, ref minor, builder);
- library_version = new Version(major, minor, builder.ToString());
-
- major = 0;
- minor = 0;
- builder.Clear();
- int err = iio_context_get_version(ctx, ref major, ref minor, builder);
- if (err < 0)
- throw new Exception("Unable to read backend version");
- backend_version = new Version(major, minor, builder.ToString());
- }
-
- ~Context()
- {
- if (ctx != IntPtr.Zero)
- Dispose(false);
- }
-
- /// <summary>Clone this instance.</summary>
- public Context clone()
- {
- return new Context(iio_context_clone(this.ctx));
- }
-
- /// <summary>Get the <see cref="iio.Device"/> object of the specified name.</summary>
- /// <param name="name">Name or ID of the device to look for</param>
- /// <exception cref="System.Exception">The IIO device with the specified
- /// name or ID could not be found in the current context.</exception>
- public Device get_device(string name)
- {
- foreach (Device each in devices) {
- if (each.name.CompareTo(name) == 0 ||
- each.id.CompareTo(name) == 0)
- return each;
- }
-
- throw new Exception("Device " + name + " not found");
- }
-
- /// <summary>Set a timeout for I/O operations.</summary>
- /// <param name="timeout">The timeout value, in milliseconds</param>
- /// <exception cref="System.Exception">The timeout could not be applied.</exception>
- public void set_timeout(uint timeout)
- {
- int ret = iio_context_set_timeout(ctx, timeout);
- if (ret < 0)
- throw new Exception("Unable to set timeout");
- }
-
- /// <summary>Releases all resource used by the <see cref="iio.Context"/> object.</summary>
- /// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="iio.Context"/>. The
- /// <see cref="Dispose"/> method leaves the <see cref="iio.Context"/> in an unusable state. After calling
- /// <see cref="Dispose"/>, you must release all references to the <see cref="iio.Context"/> so the garbage
- /// collector can reclaim the memory that the <see cref="iio.Context"/> was occupying.</remarks>
- public void Dispose()
- {
- Dispose(true);
- }
-
- private void Dispose(bool clean)
- {
- if (ctx != IntPtr.Zero)
- {
- if (clean)
- GC.SuppressFinalize(this);
- iio_context_destroy(ctx);
- ctx = IntPtr.Zero;
- }
- }
- }
-}
diff --git a/bindings/csharp/Device.cs b/bindings/csharp/Device.cs
deleted file mode 100644
index 8d7fa82..0000000
--- a/bindings/csharp/Device.cs
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * libiio - Library for interfacing industrial I/O (IIO) devices
- *
- * Copyright (C) 2015 Analog Devices, Inc.
- * Author: Paul Cercueil <paul.cercueil@analog.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace iio
-{
- /// <summary><see cref="iio.Device"/> class:
- /// Contains the representation of an IIO device.</summary>
- public class Device
- {
- private class DeviceAttr : Attr
- {
- private IntPtr dev;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_attr_read(IntPtr dev, [In()] string name, [Out()] StringBuilder val, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_attr_write(IntPtr dev, [In()] string name, [In()] string val);
-
- public DeviceAttr(IntPtr dev, string name) : base(name)
- {
- this.dev = dev;
- }
-
- public override string read()
- {
- StringBuilder builder = new StringBuilder(1024);
- int err = iio_device_attr_read(dev, name, builder, 1024);
- if (err < 0)
- throw new Exception("Unable to read device attribute " + err);
- return builder.ToString();
- }
-
- public override void write(string str)
- {
- int err = iio_device_attr_write(dev, name, str);
- if (err < 0)
- throw new Exception("Unable to write device attribute " + err);
- }
- }
-
- private class DeviceDebugAttr : Attr
- {
- private IntPtr dev;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_debug_attr_read(IntPtr dev, [In()] string name, [Out()] StringBuilder val, uint len);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_debug_attr_write(IntPtr dev, [In()] string name, [In()] string val);
-
- public DeviceDebugAttr(IntPtr dev, string name) : base(name)
- {
- this.dev = dev;
- }
-
- public override string read()
- {
- StringBuilder builder = new StringBuilder(1024);
- int err = iio_device_debug_attr_read(dev, name, builder, 1024);
- if (err < 0)
- throw new Exception("Unable to read debug attribute " + err);
- return builder.ToString();
- }
-
- public override void write(string str)
- {
- int err = iio_device_debug_attr_write(dev, name, str);
- if (err < 0)
- throw new Exception("Unable to write debug attribute " + err);
- }
- }
-
- private Context ctx;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_device_get_id(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_device_get_name(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_device_get_channels_count(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_device_get_channel(IntPtr dev, uint index);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_device_get_attrs_count(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint iio_device_get_debug_attrs_count(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_device_get_attr(IntPtr dev, uint index);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_device_get_debug_attr(IntPtr dev, uint index);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_get_trigger(IntPtr dev, IntPtr triggerptr);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_set_trigger(IntPtr dev, IntPtr trigger);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_get_sample_size(IntPtr dev);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_reg_write(IntPtr dev, uint addr, uint value);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_device_reg_read(IntPtr dev, uint addr, ref uint value);
-
- internal IntPtr dev;
-
- /// <summary>An identifier of this device.</summary>
- /// <remarks>The identifier is only valid in this IIO context</remarks>
- public readonly string id;
-
- /// <summary>The name of this device.</summary>
- public readonly string name;
-
- /// <summary>A <c>list</c> of all the attributes that this device has.</summary>
- public readonly List<Attr> attrs;
-
- /// <summary>A <c>list</c> of all the debug attributes that this device has.</summary>
- public readonly List<Attr> debug_attrs;
-
- /// <summary>A <c>list</c> of all the <see cref="iio.Channel"/> objects that this device possesses.</summary>
- public readonly List<Channel> channels;
-
- internal Device(Context ctx, IntPtr dev)
- {
- this.ctx = ctx;
- this.dev = dev;
- channels = new List<Channel>();
- attrs = new List<Attr>();
- debug_attrs = new List<Attr>();
-
- uint nb_channels = iio_device_get_channels_count(dev),
- nb_attrs = iio_device_get_attrs_count(dev),
- nb_debug_attrs = iio_device_get_debug_attrs_count(dev);
-
- for (uint i = 0; i < nb_channels; i++)
- channels.Add(new Channel(iio_device_get_channel(dev, i)));
-
- for (uint i = 0; i < nb_attrs; i++)
- attrs.Add(new DeviceAttr(dev, Marshal.PtrToStringAnsi(iio_device_get_attr(dev, i))));
- for (uint i = 0; i < nb_debug_attrs; i++)
- debug_attrs.Add(new DeviceDebugAttr(dev, Marshal.PtrToStringAnsi(iio_device_get_debug_attr(dev, i))));
-
- id = Marshal.PtrToStringAnsi(iio_device_get_id(dev));
-
- IntPtr name_ptr = iio_device_get_name(dev);
- if (name_ptr == IntPtr.Zero)
- name = "";
- else
- name = Marshal.PtrToStringAnsi(name_ptr);
- }
-
- /// <summary>Get the <see cref="iio.Channel"/> object of the specified name.</summary>
- /// <param name="name">Name or ID of the channel to look for</param>
- /// <exception cref="System.Exception">The IIO device with the specified
- /// name or ID could not be found in the current context.</exception>
- public Channel get_channel(string name)
- {
- foreach (Channel each in channels) {
- if (each.name.CompareTo(name) == 0 ||
- each.id.CompareTo(name) == 0)
- return each;
- }
-
- throw new Exception("Channel " + name + " not found");
- }
-
- /// <summary>Affect a trigger to this device.</summary>
- /// <param name="trig">A valid instance of the <see cref="iio.Trigger"/> class.</param>
- /// <exception cref="System.Exception">The trigger could not be set.</exception>
- public void set_trigger(Trigger trig)
- {
- int err = iio_device_set_trigger(this.dev, trig == null ? IntPtr.Zero : trig.dev);
- if (err < 0)
- throw new Exception("Unable to set trigger: err=" + err);
- }
-
- /// <summary>Get the current trigger affected to this device.</summary>
- /// <returns>An instance of the <see cref="iio.Trigger"/> class.</returns>
- /// <exception cref="System.Exception">The instance could not be retrieved.</exception>
- public Trigger get_trigger()
- {
- IntPtr ptr = (IntPtr)0;
- int err = iio_device_get_trigger(this.dev, ptr);
- if (err < 0)
- throw new Exception("Unable to get trigger: err=" + err);
-
- ptr = Marshal.ReadIntPtr(ptr);
-
- foreach (Trigger trig in ctx.devices) {
- if (trig.dev == ptr)
- return trig;
- }
-
- return null;
- }
-
- /// <summary>Get the current sample size of the device.</summary>
- /// <remarks>The sample size varies each time channels get enabled or disabled.</remarks>
- /// <exception cref="System.Exception">Internal error. Please report any bug.</exception>
- public uint get_sample_size()
- {
- int ret = iio_device_get_sample_size(dev);
- if (ret < 0)
- throw new Exception("Internal error. Please report any bug.");
- return (uint) ret;
- }
- /// <summary>Set a value to one register of this device.</summary>
- /// <param name="addr">The address of the register concerned.</param>
- /// <param name="value">The value that will be used for this register.</param>
- /// <exception cref="System.Exception">The register could not be written.</exception>
- public void reg_write(uint addr, uint value)
- {
- int err = iio_device_reg_write(dev, addr, value);
- if (err < 0)
- throw new Exception("Unable to write register");
- }
-
- /// <summary>Read the content of a register of this device.</summary>
- /// <param name="addr">The address of the register concerned.</param>
- /// <exception cref="System.Exception">The register could not be read.</exception>
- public uint reg_read(uint addr)
- {
- uint value = 0;
- int err = iio_device_reg_read(dev, addr, ref value);
- if (err < 0)
- throw new Exception("Unable to read register");
- return value;
- }
- }
-}
diff --git a/bindings/csharp/IOBuffer.cs b/bindings/csharp/IOBuffer.cs
deleted file mode 100644
index 1697f6e..0000000
--- a/bindings/csharp/IOBuffer.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * libiio - Library for interfacing industrial I/O (IIO) devices
- *
- * Copyright (C) 2015 Analog Devices, Inc.
- * Author: Paul Cercueil <paul.cercueil@analog.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace iio
-{
- /// <summary><see cref="iio.IOBuffer"/> class:
- /// The class used for all I/O operations.</summary>
- public class IOBuffer : IDisposable
- {
- private bool circular_buffer_pushed;
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_device_create_buffer(IntPtr dev, uint samples_count,
- [MarshalAs(UnmanagedType.I1)] bool circular);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void iio_buffer_destroy(IntPtr buf);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_buffer_refill(IntPtr buf);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int iio_buffer_push_partial(IntPtr buf, uint samples_count);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_buffer_start(IntPtr buf);
-
- [DllImport("libiio.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr iio_buffer_end(IntPtr buf);
-
- internal IntPtr buf;
-
- /// <summary>The size of this buffer, in samples.</summary>
- public readonly uint samples_count;
-
- /// <summary>If <c>true</c>, the buffer is circular.</summary>
- public readonly bool circular;
-
- /// <summary>Initializes a new instance of the <see cref="iio.IOBuffer"/> class.</summary>
- /// <param name="dev">The <see cref="iio.Device"/> object that represents the device
- /// where the I/O operations will be performed.</param>
- /// <param name="samples_count">The size of the buffer, in samples.</param>
- /// <param name="circular">If set to <c>true</c>, the buffer is circular.</param>
- /// <exception cref="System.Exception">The buffer could not be created.</exception>
- public IOBuffer(Device dev, uint samples_count, bool circular = false)
- {
- this.samples_count = samples_count;
- this.circular = circular;
- this.circular_buffer_pushed = false;
-
- buf = iio_device_create_buffer(dev.dev, samples_count, circular);
- if (buf == IntPtr.Zero)
- throw new Exception("Unable to create buffer");
- }
-
- ~IOBuffer()
- {
- if (buf != IntPtr.Zero)
- Dispose(false);
- }
-
- /// <summary>Fetch a new set of samples from the hardware.</summary>
- /// <exception cref="System.Exception">The buffer could not be refilled.</exception>
- public void refill()
- {
- int err = iio_buffer_refill(this.buf);
- if (err < 0)
- throw new Exception("Unable to refill buffer: err=" + err);
- }
-
- /// <summary>Submit the samples contained in this buffer to the hardware.</summary>
- /// <exception cref="System.Exception">The buffer could not be pushed.</exception>
- public void push(uint samples_count)
- {
- if (circular && circular_buffer_pushed)
- throw new Exception("Circular buffer already pushed\n");
-
- int err = iio_buffer_push_partial(this.buf, samples_count);
- if (err < 0)
- throw new Exception("Unable to push buffer: err=" + err);
- circular_buffer_pushed = true;
- }
-
- public void push()
- {
- push(this.samples_count);
- }
-
- /// <summary>Releases all resource used by the <see cref="iio.IOBuffer"/> object.</summary>
- /// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="iio.IOBuffer"/>. The
- /// <see cref="Dispose"/> method leaves the <see cref="iio.IOBuffer"/> in an unusable state. After calling
- /// <see cref="Dispose"/>, you must release all references to the <see cref="iio.IOBuffer"/> so the garbage
- /// collector can reclaim the memory that the <see cref="iio.IOBuffer"/> was occupying.</remarks>
- public void Dispose()
- {
- Dispose(true);
- }
-
- private void Dispose(bool clean)
- {
- if (buf != IntPtr.Zero)
- {
- if (clean)
- GC.SuppressFinalize(this);
- iio_buffer_destroy(buf);
- buf = IntPtr.Zero;
- }
- }
-
- /// <summary>Copy the given array of samples inside the <see cref="iio.IOBuffer"/> object.</summary>
- /// <param name="array">A <c>byte</c> array containing the samples that should be written.</param>
- /// <remarks>The number of samples written will not exceed the size of the buffer.</remarks>
- public void fill(byte[] array)
- {
- int length = (int) iio_buffer_end(buf) - (int) iio_buffer_start(buf);
- if (length > array.Length)
- length = array.Length;
- Marshal.Copy(array, 0, iio_buffer_start(buf), length);
- }
- }
-}
diff --git a/bindings/csharp/Trigger.cs b/bindings/csharp/Trigger.cs
deleted file mode 100644
index 4614143..0000000
--- a/bindings/csharp/Trigger.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * libiio - Library for interfacing industrial I/O (IIO) devices
- *
- * Copyright (C) 2015 Analog Devices, Inc.
- * Author: Paul Cercueil <paul.cercueil@analog.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace iio
-{
- /// <summary><see cref="iio.Trigger"/> class:
- /// Contains the representation of an IIO device that can act as a trigger.</summary>
- public class Trigger : Device
- {
- internal Trigger(Context ctx, IntPtr ptr) : base(ctx, ptr) { }
-
- /// <summary>Configure a new frequency for this trigger.</summary>
- /// <exception cref="System.Exception">The new frequency could not be set.</exception>
- public void set_rate(ulong rate)
- {
- foreach (Attr each in attrs)
- if (each.name.Equals("frequency"))
- {
- each.write((long) rate);
- return;
- }
- throw new Exception("Trigger has no frequency?");
- }
-
- /// <summary>Get the currently configured frequency of this trigger.</summary>
- /// <exception cref="System.Exception">The configured frequency could not be obtained.</exception>
- public ulong get_rate()
- {
- foreach (Attr each in attrs)
- if (each.name.Equals("frequency"))
- return (ulong) each.read_long();
- throw new Exception("Trigger has no frequency?");
- }
-
- public new void set_trigger(Trigger trig)
- {
- throw new InvalidComObjectException("Device is already a trigger");
- }
-
- public new Trigger get_trigger()
- {
- throw new InvalidComObjectException("Device is already a trigger");
- }
- }
-}
diff --git a/bindings/csharp/examples/ExampleProgram.cs b/bindings/csharp/examples/ExampleProgram.cs
deleted file mode 100644
index f33e381..0000000
--- a/bindings/csharp/examples/ExampleProgram.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using iio;
-
-namespace IIOCSharp
-{
- class ExampleProgram
- {
- static void Main(string[] args)
- {
- Context ctx = new Context("10.44.2.241");
- if (ctx == null)
- {
- Console.WriteLine("Unable to create IIO context");
- return;
- }
-
- Console.WriteLine("IIO context created: " + ctx.name);
- Console.WriteLine("IIO context description: " + ctx.description);
-
- Console.WriteLine("IIO context has " + ctx.devices.Count + " devices:");
- foreach (Device dev in ctx.devices) {
- Console.WriteLine("\t" + dev.id + ": " + dev.name);
-
- if (dev is Trigger)
- {
- Console.WriteLine("Found trigger! Rate=" + ((Trigger) dev).get_rate());
- }
-
- Console.WriteLine("\t\t" + dev.channels.Count + " channels found:");
-
- foreach (Channel chn in dev.channels)
- {
- string type = "input";
- if (chn.output)
- type = "output";
- Console.WriteLine("\t\t\t" + chn.id + ": " + chn.name + " (" + type + ")");
-
- if (chn.attrs.Count == 0)
- continue;
-
- Console.WriteLine("\t\t\t" + chn.attrs.Count + " channel-specific attributes found:");
- foreach (Attr attr in chn.attrs)
- {
- Console.WriteLine("\t\t\t\t" + attr.name);
- if (attr.name.CompareTo("frequency") == 0)
- {
- Console.WriteLine("Attribute content: " + attr.read());
- }
- }
-
- }
-
- /* If we find cf-ad9361-lpc, try to read a few bytes from the first channel */
- if (dev.name.CompareTo("cf-ad9361-lpc") == 0)
- {
- Channel chn = dev.channels[0];
- chn.enable();
- IOBuffer buf = new IOBuffer(dev, 0x8000);
- buf.refill();
-
- Console.WriteLine("Read " + chn.read(buf).Length + " bytes from hardware");
- buf.Dispose();
- }
-
- if (dev.attrs.Count == 0)
- continue;
-
- Console.WriteLine("\t\t" + dev.attrs.Count + " device-specific attributes found:");
- foreach (Attr attr in dev.attrs)
- Console.WriteLine("\t\t\t" + attr.name);
-
- }
-
- /* Wait for user input */
- Console.ReadLine();
- }
- }
-}
diff --git a/bindings/csharp/key.snk b/bindings/csharp/key.snk
deleted file mode 100644
index fc21149..0000000
--- a/bindings/csharp/key.snk
+++ /dev/null
Binary files differ
diff --git a/bindings/csharp/libiio-sharp.dll.config.cmakein b/bindings/csharp/libiio-sharp.dll.config.cmakein
deleted file mode 100644
index c9ef9bb..0000000
--- a/bindings/csharp/libiio-sharp.dll.config.cmakein
+++ /dev/null
@@ -1,3 +0,0 @@
-<configuration>
- <dllmap dll="libiio.dll" target="libiio.so.@LIBIIO_VERSION_MAJOR@"/>
-</configuration>
diff --git a/bindings/csharp/libiio-sharp.pc.cmakein b/bindings/csharp/libiio-sharp.pc.cmakein
deleted file mode 100644
index 5e6fd22..0000000
--- a/bindings/csharp/libiio-sharp.pc.cmakein
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@CMAKE_INSTALL_PREFIX@/lib
-
-Name: libiio-cs
-Description: CLI bindings for libiio
-Version: @VERSION@
-
-Requires:
-Libs: -r:${libdir}/cli/libiio-sharp-@VERSION@/libiio-sharp.dll