-
Notifications
You must be signed in to change notification settings - Fork 1
/
input.pl
executable file
·45 lines (33 loc) · 1021 Bytes
/
input.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl -w
use utf8;
use Net::DBus;
use Net::DBus::Reactor;
use Net::DBus::Service;
use Net::DBus::Object;
binmode(STDIN, ':encoding(utf8)');
binmode(STDOUT, ':encoding(utf8)');
binmode(STDERR, ':encoding(utf8)');
package TextObject;
use base qw(Net::DBus::Object);
use Net::DBus::Exporter qw(org.presentationText.TextService);
sub new {
my $class = shift;
my $service = shift;
my $self = $class->SUPER::new($service, "/org/presentationText/TextService/object");
bless $self, $class;
return $self;
}
dbus_signal("newMessage", ["string"]);
dbus_method("sendNewMessage");
sub sendNewMessage {
my $self = shift;
print "Ready> ";
my $msg = <STDIN>;
return $self->emit_signal("newMessage", $msg);
}
package main;
my $bus = Net::DBus->session();
my $service = $bus->export_service("org.presentationText.TextService");
my $object = TextObject->new($service);
print "Execute emitter.pl to start sending message to display\n";
Net::DBus::Reactor->main->run();