当前位置: 首页>>代码示例>>C#>>正文


C# BusAttachment.GetInterfaces方法代码示例

本文整理汇总了C#中BusAttachment.GetInterfaces方法的典型用法代码示例。如果您正苦于以下问题:C# BusAttachment.GetInterfaces方法的具体用法?C# BusAttachment.GetInterfaces怎么用?C# BusAttachment.GetInterfaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BusAttachment的用法示例。


在下文中一共展示了BusAttachment.GetInterfaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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]);
        }
开发者ID:kalperin,项目名称:alljoyn_core,代码行数:37,代码来源:BusAttachmentTests.cs

示例2: CreateInterfaceTest

        public void CreateInterfaceTest()
        {
            BusAttachment bus = new BusAttachment("interfacetest", true, 4);
            InterfaceDescription[] secureIntf = new InterfaceDescription[1];
            InterfaceDescription[] nonsecureIntf = new InterfaceDescription[1];

            bus.CreateInterface("secureIntf", secureIntf, true);
            bus.CreateInterface("nonsecureIntf", nonsecureIntf, false);
            secureIntf[0].AddMethod("foo", "say", "ab", "str,arr1,arr2", (byte)0, "");
            nonsecureIntf[0].AddSignal("bar", "say", "str,arr1", (byte)0, "");
            secureIntf[0].Activate();
            nonsecureIntf[0].Activate();
            Assert.IsNotNull(bus.GetInterface("secureIntf"));
            Assert.IsNotNull(bus.GetInterface("nonsecureIntf"));
            InterfaceDescription[] intfs = new InterfaceDescription[12];
            bus.GetInterfaces(intfs);
            Assert.IsNotNull(intfs[0]);
            Assert.IsNotNull(intfs[1]);

            // BUGBUG: DeleteInterface is throwing an exception saying the interfaces don't exist
            //bus.DeleteInterface(bus.GetInterface("secureIntf"));
            //bus.DeleteInterface(bus.GetInterface("nonsecureIntf"));
            //Assert.IsNull(bus.GetInterface("secureIntf"));
            //Assert.IsNull(bus.GetInterface("nonsecureIntf"));
            //InterfaceDescription[] nullIntfs = new InterfaceDescription[2];
            //bus.GetInterfaces(nullIntfs);
            //Assert.IsNull(nullIntfs[0]);
            //Assert.IsNull(nullIntfs[1]);

            // TODO: It doesn't seem like you can create multiple interfaces at a time
            //InterfaceDescription[] multiIntf = new InterfaceDescription[5];
            //bus.CreateInterface("multiIntf", multiIntf, false);

            try
            {
                InterfaceDescription nonExisting = bus.GetInterface("notThere");
                Assert.IsFalse(true);
            }
            catch (Exception ex)
            {
                Logger.LogMessage("%s", ex.Message);
            }
        }
开发者ID:kalperin,项目名称:alljoyn_core,代码行数:43,代码来源:BusAttachmentTests.cs


注:本文中的BusAttachment.GetInterfaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。