[yast-commit] r48968 - in /branches/tmp/lslezak/workshop/core/scr/src: DBusMsg.cc DBusMsg.h DBusServer.cc
Author: lslezak
Date: Thu Jul 10 15:46:39 2008
New Revision: 48968
URL: http://svn.opensuse.org/viewcvs/yast?rev=48968&view=rev
Log:
- added Write, Execute and Dir methods
Modified:
branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc
branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h
branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc
Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc?rev=48968&r1=48967&r2=48968&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc (original)
+++ branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc Thu Jul 10 15:46:39 2008
@@ -489,3 +489,13 @@
return std::string();
}
+
+int DBusMsg::type() const
+{
+ if (msg != NULL)
+ {
+ return dbus_message_get_type(msg);
+ }
+
+ return DBUS_MESSAGE_TYPE_INVALID;
+}
Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h?rev=48968&r1=48967&r2=48968&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h (original)
+++ branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h Thu Jul 10 15:46:39 2008
@@ -38,6 +38,7 @@
bool isMethodCall(const std::string &interface, const std::string &method) const;
int arguments() const;
+ int type() const;
bool empty() const;
DBusMessage *getMessage() const;
Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc?rev=48968&r1=48967&r2=48968&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc (original)
+++ branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc Thu Jul 10 15:46:39 2008
@@ -58,10 +58,14 @@
request.interface().c_str(), request.method().c_str());
// check this is a method call for the right object, interface & method
- if (request.isMethodCall("org.opensuse.yast.SCR", "Read") && request.path() == "/SCR")
+ if (request.type() == DBUS_MESSAGE_TYPE_METHOD_CALL && request.interface() == "org.opensuse.yast.SCR" && request.path() == "/SCR")
{
int args = request.arguments();
- if (args == 0) continue;
+ if (args == 0)
+ {
+ // TODO return an ERROR
+ continue;
+ }
YCPValue arg0 = request.getYCPValue(0);
@@ -75,8 +79,25 @@
YCPValue arg = request.getYCPValue(1);
YCPValue opt = request.getYCPValue(2);
+ std::string method(request.method());
+
// result from SCR::
- YCPValue ret = sa->Read(pth, arg, opt);
+ YCPValue ret;
+
+ if (method == "Read")
+ ret = sa->Read(pth, arg, opt);
+ else if (method == "Write")
+ ret = sa->Write(pth, arg, opt);
+ else if (method == "Execute")
+ ret = sa->Execute(pth, arg, opt);
+ else if (method == "Dir")
+ ret = sa->Dir(pth);
+ else
+ {
+ y2warning("Unknown requested method %s", method.c_str());
+ // TODO return ERROR
+ continue;
+ }
DBusMsg reply;
reply.createReply(request);
@@ -93,7 +114,10 @@
}
else
{
- y2milestone("Sending result %s", ret->toString().c_str());
+ if (!ret.isNull())
+ {
+ y2milestone("Sending result %s", ret->toString().c_str());
+ }
}
y2milestone("Flushing connection...");
@@ -101,12 +125,6 @@
y2milestone("...done");
}
}
- else if (request.isMethodCall("org.opensuse.yast.SCR", "Write"))
- {
- }
- else if (request.isMethodCall("org.opensuse.yast.SCR", "Execute"))
- {
- }
else if (request.isMethodCall("org.freedesktop.DBus.Introspectable", "Introspect"))
{
y2milestone("Requesting path: %s", request.path().c_str());
@@ -117,7 +135,7 @@
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\"> <node>
participants (1)
-
lslezak@svn.opensuse.org