-
Notifications
You must be signed in to change notification settings - Fork 135
Raspberry.IO.GeneralPurpose.Configuration.GpioConnectionConfigurationSection
raspberry-sharp edited this page Oct 14, 2012
·
7 revisions
The GpioConnectionConfigurationSection
class implements a configuration section dedicated to configuration of GPIO access.
<section name="gpioConnection"
type="Raspberry.IO.GeneralPurpose.Configuration.GpioConnectionConfigurationSection, Raspberry.IO.GeneralPurpose" />
<gpioConnection driver="driverTypeAndAssembly" />
driverTypeAndAssembly
is the fully qualified name of the IConnectionDriver implementation.
<configSections>
<section name="gpioConnection"
type="Raspberry.IO.GeneralPurpose.Configuration.GpioConnectionConfigurationSection, Raspberry.IO.GeneralPurpose" />
</configSections>
<gpioConnection driver="Raspberry.IO.GeneralPurpose.FileConnectionDriver, Raspberry.IO.GeneralPurpose" />
Value of driver
attribute of gpioConnection
section is used by GpioConnection to load a default connection driver if not specified in initializer. By default, MemoryConnectionDriver
is used.
`GpioConnectionConfigurationSection may be used as follow:
IConnectionDriver driver;
var configurationSection = ConfigurationManager.GetSection("gpioConnection") as GpioConnectionConfigurationSection;
if (configurationSection != null && !string.IsNullOrEmpty(configurationSection.DriverTypeName))
driver = (IConnectionDriver) Activator.CreateInstance(Type.GetType(configurationSection.DriverTypeName, true));
else
driver = new MemoryConnectionDriver();