Creating Properties
Properties are what is used to communicate with devices. They are creating using an instance of an IPropertyFactory. The example below shows ho to create a default IPropertyFactory, create a few properties and retrieve the current value of those properties from an attached device:
public async Task QueryDevice(IApi jabraApi, IDevice device)
{
var propertyModule = new PropertyModule(jabraApi);
var propertyFactory = await propertyModule.CreatePropertyFactory();
var properties = await propertyFactory.CreateProperties(
device,
new[] { "audioName", "firmwareVersion", "skuId" }
);
foreach (var property in properties.Values)
{
Console.WriteLine($"{property.Name}: {await property.Get()}");
}
}
In the example above, the IPropertyFactory was created based on the default property definitions that are shipped with the module. That means it only knows about the properties that were defined at the time the module was built. This is a good way to get started with properties, but you may want to adopt the data driven approach to allow you application to support new applications without having to rely on new versions of the property module. For this there is an overload that allows you to create an IPropertyFactory based on a specific property definition:
var propertyFactory = await propertyModule.CreatePropertyFactoryFromFile(
@"path\to\property-definition.json"
);