protected Dispatcher(Connection conn, string channel_type, string [] property_keys) { this.conn = conn; ChannelType = channel_type; this.property_keys = property_keys; InitializeRequestsInterface (); }
public void AddConnection(Connection conn) { if (conns.Contains (conn)) throw new Exception ("Cannot add connection"); conns.Add (conn); conn.Register (Path, this); //((ExportObject)conn.RegisteredObjects[Path]).Registered = false; }
protected Channel(Connection conn) { if (conn == null) { throw new ArgumentNullException ("conn"); } this.conn = conn; InitializeRequestsInterface (); }
public ContactListChannel(Connection conn, string target_id) : base(conn) { if (target_id == null) { throw new ArgumentNullException ("target_id"); } this.target_id = target_id; ChannelType = Constants.CHANNEL_TYPE_CONTACTLIST; }
protected Channel(Connection conn, uint target_handle, string channel_type) : this(conn) { if (target_handle == 0 || target_handle == conn.SelfHandle) { throw new ArgumentException ("Invalid TargetId", "target_id"); } this.target_handle = target_handle; this.ChannelType = channel_type; }
public static ExportObject CreateExportObject(Connection conn, ObjectPath object_path, object obj) { Type type = obj.GetType (); #if DLR if (type.Name == "RubyObject" || type.FullName == "IronPython.Runtime.Types.OldInstance") return new DynamicExportObject (conn, object_path, obj); #endif return new ExportObject (conn, object_path, obj); }
public static void Init (Connection conn) { IOFunc dispatchHandler = delegate (IOChannel source, IOCondition condition, IntPtr data) { if ((condition & IOCondition.Hup) == IOCondition.Hup) { if (Protocol.Verbose) Console.Error.WriteLine ("Warning: Connection was probably hung up (" + condition + ")"); //TODO: handle disconnection properly, consider memory management return false; } //this may not provide expected behaviour all the time, but works for now conn.Iterate (); return true; }; Init (conn, dispatchHandler); }
public PendingCall(Connection conn) { this.conn = conn; }
public NameRequisition(Connection connection, bool allowReplacement) { this.Connection = connection; this.AllowReplacement = allowReplacement; }
public void RemoveConnection(Connection conn) { Console.Error.WriteLine ("RemoveConn"); if (!conns.Remove (conn)) throw new Exception ("Cannot remove connection"); //conn.Unregister (Path); List<string> namesToDisown = new List<string> (); foreach (KeyValuePair<string, Connection> pair in Names) { if (pair.Value == conn) namesToDisown.Add (pair.Key); } List<MatchRule> toRemove = new List<MatchRule> (); foreach (KeyValuePair<MatchRule, List<Connection>> pair in Rules) { //while (pair.Value.Remove (Caller)) { } while (pair.Value.Remove (conn)) { } //while (pair.Value.Remove (Caller)) { Console.WriteLine ("Remove!"); } //pair.Value.RemoveAll ( delegate (Connection conn) { conn == Caller; } ) if (pair.Value.Count == 0) toRemove.Add (pair.Key); //Rules.Remove (pair); //Rules.Remove<KeyValuePair<MatchRule,List<Connection>>> (pair); //((ICollection<System.Collections.Generic.KeyValuePair<MatchRule,List<Connection>>>)Rules).Remove<KeyValuePair<MatchRule,List<Connection>>> (pair); //((ICollection<System.Collections.Generic.KeyValuePair<MatchRule,List<Connection>>>)Rules).Remove (pair); } foreach (MatchRule r in toRemove) Rules.Remove (r); // TODO: Check the order of signals // TODO: Atomicity foreach (string name in namesToDisown) Names.Remove (name); foreach (string name in namesToDisown) NameOwnerChanged (name, ((ServerConnection)conn).UniqueName, String.Empty); // TODO: Unregister earlier? conn.Unregister (Path); }
public static object GetObject (Connection conn, string bus_name, ObjectPath object_path, Type declType) { Type proxyType = TypeImplementer.GetImplementation (declType); BusObject inst = (BusObject)Activator.CreateInstance (proxyType); inst.conn = conn; inst.bus_name = bus_name; inst.object_path = object_path; return inst; }
public ExportObject (Connection conn, string bus_name, ObjectPath object_path, object obj) : base (conn, bus_name, object_path) { this.obj = obj; }
static void Init (Connection conn, IOFunc dispatchHandler) { IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle); IO.AddWatch (channel, IOCondition.In | IOCondition.Hup, dispatchHandler); }
private static bool DeviceIsOnUsbBus(Connection conn, string halNameOnDbus, HalDevice device) { bool deviceIsOnUsbSubsystem; bool thereIsAPathToParent; do { string subsystem = TryGetDevicePropertyString(device, "info.subsystem"); deviceIsOnUsbSubsystem = subsystem.Contains("usb"); string pathToParent = TryGetDevicePropertyString(device, "info.parent"); thereIsAPathToParent = String.IsNullOrEmpty(pathToParent); device = conn.GetObject<HalDevice>(halNameOnDbus, new ObjectPath(pathToParent)); } while (!deviceIsOnUsbSubsystem && !thereIsAPathToParent); return deviceIsOnUsbSubsystem; }
public ExportObject(Connection conn, ObjectPath object_path, object obj) : base(conn, null, object_path) { this.obj = obj; }
public BusObject (Connection conn, string bus_name, ObjectPath object_path) { this.conn = conn; this.bus_name = bus_name; this.object_path = object_path; }
public GPS() { DbusConnection = Bus.System; gps = DbusConnection.GetObject<Gpsd> ("org.gpsd", new ObjectPath ("/org/gpsd")); gps.fix += HandleGpsfix; }