libtelepathy/inc/tp-conn.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /* tp-conn.h
       
     2  *
       
     3  * 
       
     4  * Copyright (C) 2005 Collabora Ltd.
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2.1 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this library; if not, write to the Free Software
       
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
       
    18  *
       
    19  */
       
    20 
       
    21 
       
    22 #ifndef TP_CONN_H
       
    23 #define TP_CONN_H
       
    24 
       
    25 #ifndef DBUS_API_SUBJECT_TO_CHANGE
       
    26 #define DBUS_API_SUBJECT_TO_CHANGE
       
    27 #endif
       
    28 
       
    29 #include "tp-conn-gen.h"
       
    30 #include "tp-conn-iface-forwarding-gen.h"
       
    31 #include "tp-chan.h"
       
    32 #include "tp-conn-signals-marshal.h"
       
    33 #include "tp-ifaces-signals-marshal.h"
       
    34 #include "tp-conn-ifaces-signal-setters.h"
       
    35 #include "tp-interfaces.h"
       
    36 #include "tp-constants.h"
       
    37 
       
    38 #include <dbus/dbus-glib.h>
       
    39 
       
    40 #define DBUS_TYPE_G_ARRAY_OF_STRUCTS dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE_ARRAY);
       
    41 
       
    42 #define TELEPATHY_CONN_TYPE  (tp_conn_get_type ())
       
    43 
       
    44 #define TELEPATHY_CONN(obj)  (G_TYPE_CHECK_INSTANCE_CAST \
       
    45 		                    ((obj), TELEPATHY_CONN_TYPE, \
       
    46 				     TpConn))
       
    47 
       
    48 #define TELEPATHY_CONN_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST \
       
    49 		                          ((klass), TELEPATHY_CONN_TYPE, \
       
    50 					  TpConnClass))
       
    51 
       
    52 #define TELEPATHY_IS_CONN(obj)    (G_TYPE_CHECK_INSTANCE_TYPE \
       
    53 		                      ((obj), TELEPATHY_CONN_TYPE))
       
    54 
       
    55 #define TELEPATHY_IS_CONN_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE \
       
    56 		                           ((klass), TELEPATHY_CONN_TYPE))
       
    57 
       
    58 #define TELEPATHY_CONN_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS \
       
    59 		                            ((obj), TELEPATHY_CONN_TYPE, \
       
    60 					    TpConnClass))
       
    61 
       
    62 #define TELEPATHY_CONN_IFACE_QUARK (tp_get_conn_interface())
       
    63 #define TELEPATHY_CONN_IFACE_ALIASING_QUARK (tp_get_conn_aliasing_interface())
       
    64 #define TELEPATHY_CONN_IFACE_CAPABILITIES_QUARK (tp_get_conn_capabilities_interface())
       
    65 #define TELEPATHY_CONN_IFACE_CONTACTINFO_QUARK (tp_get_conn_contactinfo_interface())
       
    66 #define TELEPATHY_CONN_IFACE_FORWARDING_QUARK (tp_get_conn_forwarding_interface())
       
    67 #define TELEPATHY_CONN_IFACE_PRESENCE_QUARK (tp_get_conn_presence_interface())
       
    68 #define TELEPATHY_CONN_IFACE_PRIVACY_QUARK (tp_get_conn_privacy_interface())
       
    69 #define TELEPATHY_CONN_IFACE_RENAMING_QUARK (tp_get_conn_renaming_interface())
       
    70 #define TELEPATHY_CONN_IFACE_AVATAR_QUARK (tp_get_conn_avatar_interface())
       
    71 
       
    72 
       
    73 /* The signal name for the synthesized StatusChanged signal */
       
    74 #define TP_IFACE_CONN_SIGNAL_STATUSCHANGED_SYNTHESIZED \
       
    75         "received::org-freedesktop-Telepathy-Connection-StatusChanged"
       
    76 
       
    77 typedef struct _tp_conn TpConn;
       
    78 typedef struct _tp_connclass TpConnClass;
       
    79 
       
    80 struct _tp_conn
       
    81 {
       
    82   DBusGProxy parent;
       
    83   GData *interface_list;
       
    84   gboolean first_run;
       
    85 };
       
    86 
       
    87 
       
    88 struct _tp_connclass
       
    89 {
       
    90   DBusGProxyClass parent_class;
       
    91   GData *iface_signal_sigs;
       
    92 };
       
    93 
       
    94 #ifdef __cplusplus
       
    95 extern "C"
       
    96 {
       
    97 #endif
       
    98 #ifdef SYMBIAN
       
    99 IMPORT_C
       
   100 #endif
       
   101 GType tp_conn_get_type(void);
       
   102 #ifdef __cplusplus
       
   103 }
       
   104 #endif
       
   105 
       
   106 /* Actual function definitions */
       
   107 
       
   108 /*
       
   109  * Create a new TpConn (Connection) object.
       
   110  *
       
   111  * @param connection The D-BUS connection
       
   112  * @param name: The D-BUS service name for the connection object
       
   113  * @param path_name: The D-BUS path name for the connection object
       
   114  * @param interface_name: The D-BUS interface name for the connection object
       
   115  * @return A new TpConn connection object, or NULL if unsuccesful.
       
   116  */
       
   117 
       
   118 TpConn *tp_conn_new(DBusGConnection *connection,
       
   119 		    const char      *bus_name,
       
   120 		    const char      *object_path);
       
   121 
       
   122 /* Create a TpChan channel object for this connection. Also initialises
       
   123  * the proxy object that is used for the actual method calls.
       
   124  *
       
   125  * @param connection: The DBusGConnection for the channel
       
   126  * @param tpconn:  The Connection object for which the channel is done
       
   127  * @param bus_name:  The D-Bus interface name for the channel
       
   128  * @param type: The channel type string
       
   129  * @param handle_type: The type of the channel handle
       
   130  * @param handle: The channel handle value is set and stored here after
       
   131  * @param         the call returns.
       
   132  * @param supress_handler: if TRUE, indicates that no handler needs to be
       
   133  *                         launched
       
   134  *
       
   135  * @return A new TpChan (channel) object
       
   136  */ 
       
   137 
       
   138 #ifdef __cplusplus
       
   139 extern "C"
       
   140 {
       
   141 #endif
       
   142 #ifdef SYMBIAN
       
   143 IMPORT_C 
       
   144 #endif 
       
   145 TpChan *tp_conn_new_channel(DBusGConnection *connection, TpConn *tpconn,
       
   146 			    const gchar *bus_name,
       
   147 			    gchar *type, guint handle_type,
       
   148 			    guint handle, gboolean supress_handler);
       
   149 #ifdef __cplusplus
       
   150 }
       
   151 #endif
       
   152 
       
   153 /* Creates the proxy objects for the channel interfaces. GetInterfaces
       
   154  * method should be called before this to acquire the interface name
       
   155  * list.
       
   156  * 
       
   157  * @param self: The connection object
       
   158  * @param interfaces: An array of the interface name strings
       
   159  */
       
   160 
       
   161 void tp_conn_local_set_interfaces(TpConn *self, gchar **interfaces);
       
   162 
       
   163 
       
   164 /*
       
   165  * Provides access to the connection proxy object to use for actual
       
   166  * method calls
       
   167  *
       
   168  * @param self: The connection object whose proxy should be retrieved
       
   169  * @return The D-BUS proxy object
       
   170  */
       
   171 
       
   172 DBusGProxy *tp_conn_get_proxy(TpConn *self);
       
   173 
       
   174 /*
       
   175  * This function checks whether the Connection has the specified
       
   176  * interface and returns a proxy object that can be used to call
       
   177  * its methods, if it exists. The supported interfaces are listed
       
   178  * in the beginning of this header as macros.
       
   179  *
       
   180  * @param self The connection object that is queried for the
       
   181  *             interface proxy object
       
   182  * @param iface_quark GQuark corresponding to the interface name
       
   183  *        string.
       
   184  * @return A DBusGProxy object for the interface, or NULL if not found
       
   185  */
       
   186 #ifdef __cplusplus
       
   187 extern "C"
       
   188 {
       
   189 #endif
       
   190 #ifdef SYMBIAN
       
   191 IMPORT_C
       
   192 #endif
       
   193 DBusGProxy *tp_conn_get_interface(TpConn *self, GQuark iface_quark);
       
   194 #ifdef __cplusplus
       
   195 }
       
   196 #endif
       
   197 
       
   198 GQuark tp_get_conn_interface(void);
       
   199 GQuark tp_get_conn_aliasing_interface(void);
       
   200 GQuark tp_get_conn_capabilities_interface(void);
       
   201 GQuark tp_get_conn_contactinfo_interface(void);
       
   202 GQuark tp_get_conn_forwarding_interface(void);
       
   203 #ifdef __cplusplus
       
   204 extern "C"
       
   205 {
       
   206 #endif
       
   207 #ifdef SYMBIAN
       
   208 IMPORT_C
       
   209 #endif
       
   210 GQuark tp_get_conn_presence_interface(void);
       
   211 GQuark tp_get_conn_avatar_interface(void);
       
   212 #ifdef __cplusplus
       
   213 }
       
   214 #endif
       
   215 GQuark tp_get_conn_privacy_interface(void);
       
   216 GQuark tp_get_conn_renaming_interface(void);
       
   217 
       
   218 
       
   219 
       
   220 #endif