1/** 2@mainpage 3 4@tableofcontents 5 6<a href="../index.html">Back to libIIO</a> 7 8@section license License 9Libiio and the C# bindings have been developed and is released under the terms of the GNU Lesser General Public 10License, version 2 or (at your option) any later version. 11This open-source license allows anyone to use the library for C# proprietary or 12open-source, commercial or non-commercial applications. 13(if you change the bindings or library, send the source of the bindings and library along with the binary). 14 15The full terms of the library license can be found at: http://opensource.org/licenses/LGPL-2.1 and the iio-utils license can be found at: https://opensource.org/licenses/GPL-2.0 16 17@section code_model Code Model 18The basic bricks of the libiio API, and therefore the C# bindings are the the iio namepace, and the classes of that nameplace: iio.Channel, iio.Context, iio.Device, iio.IOBuffer, iio.Trigger, and iio.Attr (channel or device attributes). 19 20![Caption text](doc/codemodel.svg) 21 22@section creating_context Creating a context 23 24Creating a context is quite easy with the iio.Context class: 25 26~~~{.cs} 27Context ctx = new Context("ip:10.44.2.241"); 28~~~ 29 30@subsection navigation Navigation 31@subsubsection device_obj Device objects 32 33~~~{.cs} 34 foreach (Device dev in ctx.devices) 35 { 36 Console.WriteLine("\t" + dev.id + ": " + dev.name); 37 } 38~~~ 39 40@subsubsection channel_obj Channel objects 41 42Each iio.Channel can be either input, or output. This information can be retrieved with iio.Channel.output 43As for the Device objects, the iio.Channel object features an ID and optionally a name 44The ID can be obtained with iio.Channel.id, and the name can be obtained with iio.Channel.name. 45Important note: two iio_channel can have the same ID, as long as one is input and the other is output. 46 47~~~{.cs} 48 foreach (Channel chn in dev.channels) 49 { 50 string type = "input"; 51 if (chn.output) 52 type = "output"; 53 Console.WriteLine("\t\t\t" + chn.id + ": " + chn.name + " (" + type + ")"); 54 } 55~~~ 56 57@subsection list_params Parameters 58Different kinds of parameters are available: parameters that apply to a iio_device, and parameters that apply to one or more iio_channel. 59 60for Channel attributes: iio.Channel.attrs 61 62~~~{.cs} 63 foreach (Attr attr in chn.attrs) 64 { 65 Console.WriteLine("\t\t\t\t" + attr.name); 66 if (attr.name.CompareTo("frequency") == 0) 67 { 68 Console.WriteLine("Attribute content: " + attr.read()); 69 } 70 } 71~~~ 72 73For Device Attributes: iio.Device.attrs 74 75~~~{.cs} 76 foreach (Attr attr in dev.attrs) 77 Console.WriteLine("\t\t\t" + attr.name); 78~~~ 79 80 81\example ExampleProgram.cs Small example program 82*/ 83