ddbus/examples/server/source/app.d

27 lines
788 B
D
Raw Permalink Normal View History

2015-04-26 01:46:51 +00:00
import std.stdio;
2015-05-09 17:15:34 +00:00
import ddbus;
2015-04-26 01:46:51 +00:00
2015-05-02 00:36:06 +00:00
void testServe(Connection conn) {
auto router = new MessageRouter();
MessagePattern patt = MessagePattern(ObjectPath("/root"), interfaceName("ca.thume.test"), "test");
2015-05-02 00:36:06 +00:00
router.setHandler!(int,int)(patt,(int par) {
writeln("Called with ", par);
return par;
});
patt = MessagePattern(ObjectPath("/signaler"), interfaceName("ca.thume.test"), "signal",true);
2015-05-02 00:53:39 +00:00
router.setHandler!(void,int)(patt,(int par) {
writeln("Signalled with ", par);
});
2015-05-02 00:36:06 +00:00
registerRouter(conn, router);
writeln("Getting name...");
bool gotem = requestName(conn, busName("ca.thume.ddbus.test"));
2015-05-02 00:36:06 +00:00
writeln("Got name: ",gotem);
simpleMainLoop(conn);
}
void main() {
Connection conn = connectToBus();
testServe(conn);
2017-12-03 20:59:18 +00:00
writeln("It worked!");
2015-04-26 01:46:51 +00:00
}