本文整理汇总了C#中BusAttachment.CreateInterfacesFromXml方法的典型用法代码示例。如果您正苦于以下问题:C# BusAttachment.CreateInterfacesFromXml方法的具体用法?C# BusAttachment.CreateInterfacesFromXml怎么用?C# BusAttachment.CreateInterfacesFromXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusAttachment
的用法示例。
在下文中一共展示了BusAttachment.CreateInterfacesFromXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddInterfaceTest
public void AddInterfaceTest()
{
BusAttachment bus = new BusAttachment("addinterface", true, 4);
bus.CreateInterfacesFromXml(signalIntf);
bus.CreateInterfacesFromXml(methodIntf);
bus.CreateInterfacesFromXml(propertyIntf);
bus.CreateInterfacesFromXml(mixedIntf);
bus.CreateInterfacesFromXml(emptyIntf);
InterfaceDescription[] annIntf = new InterfaceDescription[1];
bus.CreateInterface("org.alljoyn.Annotated", annIntf, false);
annIntf[0].AddMethod("method", "ss", "s", "in1,in2,out1", (byte)0, "");
annIntf[0].AddProperty("property", "s", (byte)PropAccessType.PROP_ACCESS_RW);
annIntf[0].AddSignal("signal", "suy", "str,uint,byte", (byte)0, "");
annIntf[0].AddAnnotation("org.freedesktop.DBus.Deprecated", "false");
annIntf[0].AddMemberAnnotation("method", "org.freedesktop.DBus.Method.NoReply", "true");
annIntf[0].AddPropertyAnnotation("property", "org.freedesktop.DBus.Property.EmitsChangedSignal", "true");
annIntf[0].Activate();
BusObject busObj = new BusObject(bus, "/addinterfaces", false);
busObj.AddInterface(bus.GetInterface("org.alljoyn.Signals"));
busObj.AddInterface(bus.GetInterface("org.alljoyn.Methods"));
busObj.AddInterface(bus.GetInterface("org.alljoyn.Properties"));
busObj.AddInterface(bus.GetInterface("org.alljoyn.Empty"));
busObj.AddInterface(bus.GetInterface("org.alljoyn.Annotated"));
}
示例2: CreateInterfacesFromXMLTest
public void CreateInterfacesFromXMLTest()
{
BusAttachment bus = new BusAttachment("xmlinterfaces", true, 4);
bus.CreateInterfacesFromXml(signalIntf);
bus.CreateInterfacesFromXml(methodIntf);
bus.CreateInterfacesFromXml(propertyIntf);
bus.CreateInterfacesFromXml(mixedIntf);
InterfaceDescription i = bus.GetInterface("org.alljoyn.Signals");
Assert.IsNotNull(i);
Assert.IsNotNull(bus.GetInterface("org.alljoyn.Methods"));
Assert.IsNotNull(bus.GetInterface("org.alljoyn.Properties"));
Assert.IsNotNull(bus.GetInterface("org.alljoyn.Mixed"));
InterfaceDescription[] intfs = new InterfaceDescription[14];
bus.GetInterfaces(intfs);
Assert.IsNotNull(intfs[0]);
Assert.IsNotNull(intfs[1]);
Assert.IsNotNull(intfs[2]);
Assert.IsNotNull(intfs[3]);
// BUGBUG: DeleteInterface is throwing an exception saying the interfaces don't exist
//bus.DeleteInterface(bus.GetInterface("org.alljoyn.Signals"));
//bus.DeleteInterface(bus.GetInterface("org.alljoyn.Methods"));
//bus.DeleteInterface(bus.GetInterface("org.alljoyn.Properties"));
//bus.DeleteInterface(bus.GetInterface("org.alljoyn.Mixed"));
//Assert.IsNull(bus.GetInterface("org.alljoyn.Signals"));
//Assert.IsNull(bus.GetInterface("org.alljoyn.Methods"));
//Assert.IsNull(bus.GetInterface("org.alljoyn.Properties"));
//Assert.IsNull(bus.GetInterface("org.alljoyn.Mixed"));
//InterfaceDescription[] nullIntfs = new InterfaceDescription[14];
//bus.GetInterfaces(nullIntfs);
//Assert.IsNull(nullIntfs[0]);
//Assert.IsNull(nullIntfs[1]);
//Assert.IsNull(nullIntfs[2]);
//Assert.IsNull(nullIntfs[3]);
}