private void OnNewChannels(ChannelDetails[] channels) { foreach (ChannelDetails c in channels) { ObjectPath object_path = c.Channel; string channel_type = c.Properties["org.freedesktop.Telepathy.Channel.ChannelType"] as string; HandleType handle_type = (HandleType)c.Properties["org.freedesktop.Telepathy.Channel.TargetHandleType"]; uint handle = (uint)c.Properties["org.freedesktop.Telepathy.Channel.TargetHandle"]; Console.WriteLine(MSG_PREFIX + "OnNewChannels: op {0}, channel_type {1}, handle_type {2}, handle {3}", object_path, channel_type, handle_type, handle); if (channel_type.Equals(Constants.CHANNEL_TYPE_DBUSTUBE)) { itube = bus.GetObject <IDBusTube> (Constants.CONNMANAGER_GABBLE_IFACE, object_path); //itube.NewTube += OnNewTube; itube.TubeChannelStateChanged += OnTubeChannelStateChanged; itube.Closed += OnTubeClosed; // get tube initiator handle // should be = to self_handle on client // should be != to self_handle on server Properties p = bus.GetObject <Properties> (Constants.CONNMANAGER_GABBLE_IFACE, object_path); tube_initiator = (uint)p.Get(Constants.CHANNEL_IFACE, "InitiatorHandle"); if (tube_initiator == self_handle) { Console.WriteLine(MSG_PREFIX + "Offering DTube"); addr = itube.Offer(new Dictionary <string, object>(), SocketAccessControl.Localhost); Console.WriteLine(MSG_PREFIX + "Tube from {0} offered", addr); } else { addr = itube.Accept(SocketAccessControl.Localhost); Console.WriteLine(MSG_PREFIX + "Tube from {0} accepted", addr); } } } }
public void Offer() { address = tube.Offer(new Dictionary <string, object>(), SocketAccessControl.Localhost); Console.WriteLine("Tube from {0} offered", address); }
private void OnNewChannels(ChannelDetails[] channels) { foreach (ChannelDetails c in channels) { ObjectPath object_path = c.Channel; string channel_type = c.Properties["org.freedesktop.Telepathy.Channel.ChannelType"] as string; HandleType handle_type = (HandleType) c.Properties["org.freedesktop.Telepathy.Channel.TargetHandleType"]; uint handle = (uint) c.Properties["org.freedesktop.Telepathy.Channel.TargetHandle"]; Console.WriteLine (MSG_PREFIX + "OnNewChannels: op {0}, channel_type {1}, handle_type {2}, handle {3}", object_path, channel_type, handle_type, handle); if (channel_type.Equals (Constants.CHANNEL_TYPE_DBUSTUBE)) { itube = bus.GetObject<IDBusTube> (Constants.CONNMANAGER_GABBLE_IFACE, object_path); //itube.NewTube += OnNewTube; itube.TubeChannelStateChanged += OnTubeChannelStateChanged; itube.Closed += OnTubeClosed; // get tube initiator handle // should be = to self_handle on client // should be != to self_handle on server Properties p = bus.GetObject<Properties> (Constants.CONNMANAGER_GABBLE_IFACE, object_path); tube_initiator = (uint) p.Get (Constants.CHANNEL_IFACE, "InitiatorHandle"); if (tube_initiator == self_handle) { Console.WriteLine (MSG_PREFIX + "Offering DTube"); addr = itube.Offer (new Dictionary<string, object>(), SocketAccessControl.Localhost); Console.WriteLine (MSG_PREFIX + "Tube from {0} offered", addr); } else { addr = itube.Accept (SocketAccessControl.Localhost); Console.WriteLine (MSG_PREFIX + "Tube from {0} accepted", addr); } } } }