Beispiel #1
0
 public function invoke($s)
 {
     $m = new DBusMessage(DBUS_MESSAGE_TYPE_METHOD_CALL);
     $m->setDestination(self::dbus_destination);
     $m->setPath(self::dbus_path_invoke);
     $m->setInterface(self::dbus_interface);
     $m->setMember("Invoke");
     $m->setAutoStart(true);
     $m->appendArgs($s);
     $this->_debug("invoke: %s\n", $s);
     $r = $this->dbus_connection->sendWithReplyAndBlock($m, $this->timeout);
     if (!$r) {
         throw new Exception("dbus_connection_send_with_reply_and_block() failed");
     }
     $tmp = $r->getArgs();
     $this->_debug("reply:  %s\n", $tmp[0]);
     if ($tmp[0] == "" || $tmp[0] == "OK") {
         return array($tmp[0], null);
     }
     list($r, $s) = explode(" ", $tmp[0], 2);
     if ($r == "ERROR") {
         throw new Skype_Exception(null, intval($s));
     }
     return array($r, $s);
 }
Beispiel #2
0
    }
    return $_ARG;
}
$dbus = dbus_bus_get(DBUS_BUS_SESSION);
$m = new DBusMessage(DBUS_MESSAGE_TYPE_METHOD_CALL);
$m->setDestination("org.kde.VisualNotifications");
$cli_args = arguments($argv);
if (empty($cli_args['input'])) {
    $cli_args['input'] = array();
}
switch ($cli_args['input'][0]) {
    case 'notify':
        $m->setPath("/VisualNotifications");
        $m->setInterface("org.kde.VisualNotifications");
        $m->setAutoStart(true);
        $m->setMember("Notify");
        $m->appendArgs("DBus test app");
        $m->appendArg1(0, 'u');
        $m->appendArgs('', '', "Summary", "Text body", array());
        $m->appendArg1(array(), 'a{sv}');
        $m->appendArg1(0);
        break;
    case 'introspect':
        $m->setPath("/VisualNotifications");
        $m->setInterface("org.freedesktop.DBus.Introspectable");
        $m->setAutoStart(true);
        $m->setMember("Introspect");
        break;
    case 'getnots':
        $m->setDestination("org.kde.NotificationItemWatcher");
        $m->setPath("/NotificationItemWatcher");
Beispiel #3
0
    }
    return $_ARG;
}
$dbus = dbus_bus_get(DBUS_BUS_SESSION);
$m = new DBusMessage(DBUS_MESSAGE_TYPE_METHOD_CALL);
$m->setDestination("org.freedesktop.Notifications");
$cli_args = arguments($argv);
if (empty($cli_args['input'])) {
    $cli_args['input'] = array();
}
switch ($cli_args['input'][0]) {
    case 'notify':
        $m->setPath("/org/freedesktop/Notifications");
        $m->setInterface("org.freedesktop.Notifications");
        $m->setAutoStart(true);
        $m->setMember("Notify");
        // Application Name
        $m->appendArgs("DBus test app");
        // Replaces ID
        $m->appendArg1(0, 'u');
        // Notification Icon, Summary, Body, Actions
        $m->appendArgs('', 'Summary', 'Text body', array());
        // Hints
        $m->appendArg1(array(), 'a{sv}');
        // Expiration Timeout
        $m->appendArg1(0);
        break;
    case 'introspect':
        $m->setPath("/org/freedesktop/Notifications");
        $m->setInterface("org.freedesktop.DBus.Introspectable");
        $m->setAutoStart(true);