Dear OpenDDR user,
this is the ALPHA version of the C# porting of OpenDDR!
We implemented all the features of OpenDDR Java version (except Group Aspect Identification), but we still need to improve performance.
All contributions are welcome. Thanks for your helping OpenDDR growing!
Below a description of the directory tree:
A basic explanation of the properties in oddr.properties:
The sample class below shows how to use OpenDDR:
public class SimpleTest
{
public static void Main(string[] args)
{
string oddrPropertiesPath = args[0];
string userAgent = args[1];
Properties props = new Properties(oddrPropertiesPath);
Type stype = Type.GetType("Oddr.ODDRService, OpenDdr");
IService openDDRService = ServiceFactory.newService(stype, props.GetProperty("oddr.vocabulary.device"), props);
IPropertyName vendorDevicePropertyName = openDDRService.NewPropertyName("vendor", @"http://www.openddr.org/oddr-vocabulary");
IPropertyRef vendorDeviceRef = openDDRService.NewPropertyRef(vendorDevicePropertyName, "device");
IPropertyName modelDevicePropertyName = openDDRService.NewPropertyName("model", @"http://www.openddr.org/oddr-vocabulary");
IPropertyRef modelDeviceRef = openDDRService.NewPropertyRef(modelDevicePropertyName, "device");
IPropertyName vendorBrowserPropertyName = openDDRService.NewPropertyName("vendor", @"http://www.openddr.org/oddr-vocabulary");
IPropertyRef vendorBrowserRef = openDDRService.NewPropertyRef(vendorBrowserPropertyName, "webBrowser");
IPropertyName modelBrowserPropertyName = openDDRService.NewPropertyName("model", @"http://www.openddr.org/oddr-vocabulary");
IPropertyRef modelBrowserRef = openDDRService.NewPropertyRef(modelBrowserPropertyName, "webBrowser");
IPropertyRef[] propertyRefs = new IPropertyRef[] { vendorDeviceRef, modelDeviceRef, vendorBrowserRef, modelBrowserRef };
IEvidence e = new BufferedODDRHTTPEvidence();
e.Put("User-Agent", userAgent);
IPropertyValues propertyValues = openDDRService.GetPropertyValues(e, propertyRefs);
if (propertyValues.GetValue(vendorDeviceRef).Exists())
{
Console.WriteLine(propertyValues.GetValue(vendorDeviceRef).GetString());
}
if (propertyValues.GetValue(modelDeviceRef).Exists())
{
Console.WriteLine(propertyValues.GetValue(modelDeviceRef).GetString());
}
if (propertyValues.GetValue(vendorBrowserRef).Exists())
{
Console.WriteLine(propertyValues.GetValue(vendorBrowserRef).GetString());
}
if (propertyValues.GetValue(modelBrowserRef).Exists())
{
Console.WriteLine(propertyValues.GetValue(modelBrowserRef).GetString());
}
Console.WriteLine(((BufferedODDRHTTPEvidence) e).deviceFound.Get("is_wireless_device"));
Console.ReadKey();
}
}