Esempio n. 1
0
 public BusObject(Connection conn, string bus_name, ObjectPath object_path)
 {
     this.conn        = conn;
     this.bus_name    = bus_name;
     this.object_path = object_path;
 }
Esempio n. 2
0
 public T GetObject <T> (string bus_name, ObjectPath path)
 {
     return((T)GetObject(typeof(T), bus_name, path));
 }
Esempio n. 3
0
 public ExportObject(Connection conn, ObjectPath object_path, object obj) : base(conn, null, object_path)
 {
     this.obj = obj;
 }
Esempio n. 4
0
 static void AppendPathArg(StringBuilder sb, int index, ObjectPath value)
 {
     Append(sb, "arg" + index + "path", value.ToString());
 }
Esempio n. 5
0
        //not particularly efficient and needs to be generalized
        internal void HandleMethodCall(MessageContainer method_call)
        {
            //TODO: Ping and Introspect need to be abstracted and moved somewhere more appropriate once message filter infrastructure is complete

            //FIXME: these special cases are slightly broken for the case where the member but not the interface is specified in the message
            if (method_call.Interface == "org.freedesktop.DBus.Peer")
            {
                switch (method_call.Member)
                {
                case "Ping":
                    Send(MessageHelper.ConstructReply(method_call));
                    return;

                case "GetMachineId":
                    if (MachineId != UUID.Zero)
                    {
                        Send(MessageHelper.ConstructReply(method_call, MachineId.ToString()));
                        return;
                    }
                    else
                    {
                        // Might want to send back an error here?
                    }
                    break;
                }
            }

            if (method_call.Interface == "org.freedesktop.DBus.Introspectable" && method_call.Member == "Introspect")
            {
                Introspector intro = new Introspector();
                intro.root_path = method_call.Path;
                intro.WriteStart();

                //FIXME: do this properly
                //this is messy and inefficient
                List <string> linkNodes = new List <string> ();
                int           depth     = method_call.Path.Decomposed.Length;
                foreach (ObjectPath pth in registeredObjects.Keys)
                {
                    if (pth.Value == (method_call.Path.Value))
                    {
                        ExportObject exo = (ExportObject)registeredObjects[pth];
                        exo.WriteIntrospect(intro);
                    }
                    else
                    {
                        for (ObjectPath cur = pth; cur != null; cur = cur.Parent)
                        {
                            if (cur.Value == method_call.Path.Value)
                            {
                                string linkNode = pth.Decomposed[depth];
                                if (!linkNodes.Contains(linkNode))
                                {
                                    intro.WriteNode(linkNode);
                                    linkNodes.Add(linkNode);
                                }
                            }
                        }
                    }
                }

                intro.WriteEnd();

                Message reply = MessageHelper.ConstructReply(method_call, intro.Xml);
                Send(reply);
                return;
            }

            BusObject bo;

            if (registeredObjects.TryGetValue(method_call.Path, out bo))
            {
                ExportObject eo = (ExportObject)bo;
                eo.HandleMethodCall(method_call);
            }
            else
            {
                MaybeSendUnknownMethodError(method_call);
            }
        }
Esempio n. 6
0
 public MatchTest(ObjectPath value)
 {
     Signature = Signature.ObjectPathSig;
     Value     = value;
 }
Esempio n. 7
0
 public ArgMatchTest(int argNum, ObjectPath value)
 {
     ArgNum    = argNum;
     Signature = Signature.ObjectPathSig;
     Value     = value;
 }
Esempio n. 8
0
 public static ExportObject CreateExportObject(Connection conn, ObjectPath object_path, object obj)
 {
     return(new ExportObject(conn, object_path, obj));
 }
Esempio n. 9
0
 public void Write(ObjectPath val)
 {
     Write(val.Value);
 }
Esempio n. 10
0
        public object GetObject(Type type)
        {
            ObjectPath path = ReadObjectPath();

            return(message.Connection.GetObject(type, (string)message.Header[FieldCode.Sender], path));
        }