/* * libiio - Library for interfacing industrial I/O (IIO) devices * * Copyright (C) 2015 Analog Devices, Inc. * Author: Paul Cercueil * * 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 { /// class: /// Contains the representation of an IIO device that can act as a trigger. public class Trigger : Device { internal Trigger(Context ctx, IntPtr ptr) : base(ctx, ptr) { } /// Configure a new frequency for this trigger. /// The new frequency could not be set. 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?"); } /// Get the currently configured frequency of this trigger. /// The configured frequency could not be obtained. 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"); } } }