public static ProviderMetadata GetProviderMetadata()
{
return new ProviderMetadata(
AcmeProviderMetaData2.ProviderInformation,
AcmeProviderMetaData2.GetProviderCapabilities(),
AcmeProviderMetaData2.GetProviderPropertyMetadata(),
AcmeProviderMetaData2.GetVendorExtensionsEntityMetadata(),
AcmeProviderMetaData2.GetDevicePropertyGroupMetadata()); ;
}
//...
//not showing the rest here
//...
/// <summary>
/// Gets the list of capabilites this provider supports.
/// </summary>
/// <returns>List of provider capabilities</returns>
public static Collection<ProviderCapability> GetProviderCapabilities()
{
List<ProviderCapability> acmeCapability = new List<ProviderCapability>();
acmeCapability.Add(ProviderCapability.Discovery);
acmeCapability.Add(ProviderCapability.TcpTransport);
acmeCapability.Add(ProviderCapability.BluetoothTransport);
acmeCapability.Add(ProviderCapability.HttpTransport);
acmeCapability.Add(ProviderCapability.SerialTransport);
acmeCapability.Add(ProviderCapability.VendorDefinedTransport);
acmeCapability.Add(ProviderCapability.TriggeredDiscovery);
acmeCapability.Add(ProviderCapability.ProviderDefunctEvent);
return new Collection<ProviderCapability>(acmeCapability);
}
/// <summary>
/// Returns meta data for vendor specific entities like command,response etc.
/// </summary>
/// <returns>Dictionary of vendor entity key vs its meta data</returns>
public static Dictionary<VendorEntityKey, VendorEntityMetadata>
GetVendorExtensionsEntityMetadata()
{
Dictionary<VendorEntityKey, VendorEntityMetadata> vendorData
= new Dictionary<VendorEntityKey, VendorEntityMetadata>();
//Transport One
VendorEntityKey key1 = new VendorEntityKey(
typeof(VendorDefinedTransportSettings),
"CustomAcmeTransportSettings",
EntityType.TransportSettings);
Dictionary<string, VendorEntityParameterMetadata> dict
= new Dictionary<string, VendorEntityParameterMetadata>();
string host = "127.0.0.1";
VendorEntityParameterMetadata dataForHost
= new VendorEntityParameterMetadata(typeof(string),
"Enter the host address as a string",
host, false);
dict.Add("Host", dataForHost);
VendorEntityParameterMetadata dataForPort
= new VendorEntityParameterMetadata(typeof(int),
"Enter the port as an int", 6666, false);
dict.Add("Port", dataForPort);
VendorEntityMetadata metaData1
= new VendorEntityMetadata(
"VendorDefinedTransportSettings keys", dict);
//Transport two
VendorEntityKey key2 = new VendorEntityKey(
typeof(VendorDefinedTransportSettings),
"Transport2", EntityType.TransportSettings);
Dictionary<string, VendorEntityParameterMetadata> dict2
= new Dictionary<string, VendorEntityParameterMetadata>();
string property1 = "test1";
VendorEntityParameterMetadata dataForproperty1
= new VendorEntityParameterMetadata(typeof(string),
"Enter the host address as a string",
property1,
false);
dict2.Add("property1", dataForproperty1);
VendorEntityMetadata metaData2 = new VendorEntityMetadata(
"Transport2 keys", dict2);
vendorData.Add(key1, metaData1);
vendorData.Add(key2, metaData2);
return vendorData;
}