本文整理汇总了C#中BusAttachment.RemoveMatch方法的典型用法代码示例。如果您正苦于以下问题:C# BusAttachment.RemoveMatch方法的具体用法?C# BusAttachment.RemoveMatch怎么用?C# BusAttachment.RemoveMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusAttachment
的用法示例。
在下文中一共展示了BusAttachment.RemoveMatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMatchTest
public void AddMatchTest()
{
BusAttachment bus = new BusAttachment("addmatch", true, 4);
AddMatchBusObj busObj = new AddMatchBusObj(bus);
BusListener bl = new BusListener(bus);
bus.RegisterBusListener(bl);
busObj.MatchValid = true;
bus.Start();
bus.ConnectAsync(connectSpec).AsTask().Wait();
BusAttachment service = new BusAttachment("service", true, 4);
BusObject busObj2 = new BusObject(service, "/serviceTest", false);
InterfaceDescription[] intf = new InterfaceDescription[1];
service.CreateInterface("org.alljoyn.addmatchtest", intf, false);
intf[0].AddSignal("testSig", "s", "str", (byte)0, "");
intf[0].Activate();
busObj2.AddInterface(intf[0]);
service.RegisterBusObject(busObj2);
service.Start();
service.ConnectAsync(connectSpec).AsTask().Wait();
service.RequestName("org.alljoyn.addmatch", (byte)RequestNameType.DBUS_NAME_DO_NOT_QUEUE);
service.BindSessionPort(43, new ushort[1], new SessionOpts(TrafficType.TRAFFIC_MESSAGES, false,
ProximityType.PROXIMITY_ANY, TransportMaskType.TRANSPORT_ANY), new SessionPortListener(service));
service.AdvertiseName("org.alljoyn.addmatch", TransportMaskType.TRANSPORT_ANY);
bl.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(
(string name, TransportMaskType transport, string namePrefix) =>
{
if (namePrefix == "org.alljoyn.addmatch")
{
foundService.Set();
}
});
bus.FindAdvertisedName("org.alljoyn.addmatch");
foundService.WaitOne();
Task<JoinSessionResult> join = bus.JoinSessionAsync("org.alljoyn.addmatch", 43, new SessionListener(bus),
new SessionOpts(TrafficType.TRAFFIC_MESSAGES, false, ProximityType.PROXIMITY_ANY, TransportMaskType.TRANSPORT_ANY),
new SessionOpts[1], null).AsTask<JoinSessionResult>();
join.Wait();
Assert.IsTrue(QStatus.ER_OK != join.Result.Status);
bus.AddMatch("type='signal',interface='org.alljoyn.addmatchtest',member='testSig'");
for (int i = 0; i < 5; i++)
{
calledHandle.Reset();
MsgArg sigArg1 = new MsgArg("s", new object[] { "hello" + i });
busObj2.Signal("", 0, intf[0].GetSignal("testSig"), new MsgArg[] { sigArg1 }, 0, (byte)AllJoynFlagType.ALLJOYN_FLAG_GLOBAL_BROADCAST);
calledHandle.WaitOne();
}
bus.RemoveMatch("type='signal',interface='org.alljoyn.addmatchtest',member='testSig'");
busObj.MatchValid = false;
for (int i = 0; i < 10; i++)
{
MsgArg sigArg1 = new MsgArg("s", new object[] { "hello" + i });
busObj2.Signal("", 0, intf[0].GetSignal("testSig"), new MsgArg[] { sigArg1 }, 0, (byte)AllJoynFlagType.ALLJOYN_FLAG_GLOBAL_BROADCAST);
}
bus.AddMatch("type='signal',interface='org.alljoyn.addmatchtest',member='testSig'");
busObj.MatchValid = true;
for (int i = 0; i < 5; i++)
{
calledHandle.Reset();
MsgArg sigArg1 = new MsgArg("s", new object[] { "hello" + i });
busObj2.Signal("", 0, intf[0].GetSignal("testSig"), new MsgArg[] { sigArg1 }, 0, (byte)AllJoynFlagType.ALLJOYN_FLAG_GLOBAL_BROADCAST);
calledHandle.WaitOne();
}
}