1# Copyright (C) 2009 Nokia Corporation
2# Copyright (C) 2009-2012 Collabora Ltd.
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17# 02110-1301 USA
18
19"""
20Some handy constants for other tests to share and enjoy.
21"""
22
23from dbus import PROPERTIES_IFACE, INTROSPECTABLE_IFACE
24from servicetest import tp_name_prefix, tp_path_prefix
25
26CM = "org.freedesktop.Telepathy.ConnectionManager"
27
28DBUS_ERROR_NO_REPLY = 'org.freedesktop.DBus.Error.NoReply'
29
30HT_CONTACT = 1
31HT_ROOM = 2
32
33CHANNEL = tp_name_prefix + ".Channel"
34CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable"
35CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
36CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold"
37CHANNEL_IFACE_MEDIA_SIGNALLING = CHANNEL + ".Interface.MediaSignalling"
38CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text"
39CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
40CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube"
41CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube"
42CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube"
43CHANNEL_TYPE_STREAMED_MEDIA = CHANNEL + ".Type.StreamedMedia"
44CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text"
45
46TP_AWKWARD_PROPERTIES = tp_name_prefix + ".Properties"
47PROPERTY_FLAG_READ = 1
48PROPERTY_FLAG_WRITE = 2
49
50CHANNEL_TYPE = CHANNEL + '.ChannelType'
51TARGET_HANDLE_TYPE = CHANNEL + '.TargetHandleType'
52TARGET_HANDLE = CHANNEL + '.TargetHandle'
53TARGET_ID = CHANNEL + '.TargetID'
54REQUESTED = CHANNEL + '.Requested'
55INITIATOR_HANDLE = CHANNEL + '.InitiatorHandle'
56INITIATOR_ID = CHANNEL + '.InitiatorID'
57INTERFACES = CHANNEL + '.Interfaces'
58
59CONN = tp_name_prefix + ".Connection"
60CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing'
61CONN_IFACE_AVATARS = CONN + '.Interface.Avatars'
62CONN_IFACE_CAPS = CONN + '.Interface.Capabilities'
63CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts'
64CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities'
65CONN_IFACE_REQUESTS = CONN + '.Interface.Requests'
66CONN_IFACE_SIMPLE_PRESENCE = CONN + '.Interface.SimplePresence'
67CONN_IFACE_POWER_SAVING = CONN + '.Interface.PowerSaving'
68CONN_IFACE_SERVICE_POINT = CONN + '.Interface.ServicePoint'
69
70CONN_STATUS_CONNECTED = 0
71CONN_STATUS_CONNECTING = 1
72CONN_STATUS_DISCONNECTED = 2
73
74ATTR_CONTACT_ID = CONN + '/contact-id'
75ATTR_ALIAS = CONN_IFACE_ALIASING + '/alias'
76ATTR_AVATAR_TOKEN = CONN_IFACE_AVATARS + '/token'
77ATTR_PRESENCE = CONN_IFACE_SIMPLE_PRESENCE + '/presence'
78
79CONN_STATUS_REASON_NONE = 0
80CONN_STATUS_REASON_REQUESTED = 1
81CONN_STATUS_REASON_NETWORK_ERROR = 2
82
83GROUP_REASON_NONE = 0
84GROUP_REASON_OFFLINE = 1
85GROUP_REASON_KICKED = 2
86GROUP_REASON_BUSY = 3
87GROUP_REASON_INVITED = 4
88GROUP_REASON_BANNED = 5
89GROUP_REASON_ERROR = 6
90GROUP_REASON_INVALID_CONTACT = 7
91GROUP_REASON_NO_ANSWER = 8
92GROUP_REASON_RENAMED = 9
93GROUP_REASON_PERMISSION_DENIED = 10
94GROUP_REASON_SEPARATED = 11
95
96PRESENCE_TYPE_UNSET = 0
97PRESENCE_TYPE_OFFLINE = 1
98PRESENCE_TYPE_AVAILABLE = 2
99PRESENCE_TYPE_AWAY = 3
100PRESENCE_TYPE_XA = 4
101PRESENCE_TYPE_HIDDEN = 5
102PRESENCE_TYPE_BUSY = 6
103PRESENCE_TYPE_UNKNOWN = 7
104PRESENCE_TYPE_ERROR = 8
105
106ERROR = tp_name_prefix + '.Error'
107INVALID_ARGUMENT = ERROR + '.InvalidArgument'
108INVALID_HANDLE = ERROR + '.InvalidHandle'
109NOT_IMPLEMENTED = ERROR + '.NotImplemented'
110NOT_AVAILABLE = ERROR + '.NotAvailable'
111PERMISSION_DENIED = ERROR + '.PermissionDenied'
112CANCELLED = ERROR + '.Cancelled'
113NOT_YOURS = ERROR + '.NotYours'
114DISCONNECTED = ERROR + '.Disconnected'
115NOT_CAPABLE = ERROR + '.NotCapable'
116
117TUBE_PARAMETERS = CHANNEL_IFACE_TUBE + '.Parameters'
118TUBE_STATE = CHANNEL_IFACE_TUBE + '.State'
119STREAM_TUBE_SERVICE = CHANNEL_TYPE_STREAM_TUBE + '.Service'
120DBUS_TUBE_SERVICE_NAME = CHANNEL_TYPE_DBUS_TUBE + '.ServiceName'
121DBUS_TUBE_DBUS_NAMES = CHANNEL_TYPE_DBUS_TUBE + '.DBusNames'
122
123TUBE_CHANNEL_STATE_LOCAL_PENDING = 0
124TUBE_CHANNEL_STATE_REMOTE_PENDING = 1
125TUBE_CHANNEL_STATE_OPEN = 2
126TUBE_CHANNEL_STATE_NOT_OFFERED = 3
127
128MEDIA_STREAM_TYPE_AUDIO = 0
129MEDIA_STREAM_TYPE_VIDEO = 1
130
131SOCKET_ADDRESS_TYPE_UNIX = 0
132SOCKET_ADDRESS_TYPE_ABSTRACT_UNIX = 1
133SOCKET_ADDRESS_TYPE_IPV4 = 2
134SOCKET_ADDRESS_TYPE_IPV6 = 3
135
136SOCKET_ACCESS_CONTROL_LOCALHOST = 0
137SOCKET_ACCESS_CONTROL_PORT = 1
138SOCKET_ACCESS_CONTROL_NETMASK = 2
139SOCKET_ACCESS_CONTROL_CREDENTIALS = 3
140
141TUBE_STATE_LOCAL_PENDING = 0
142TUBE_STATE_REMOTE_PENDING = 1
143TUBE_STATE_OPEN = 2
144TUBE_STATE_NOT_OFFERED = 3
145
146TUBE_TYPE_DBUS = 0
147TUBE_TYPE_STREAM = 1
148
149MEDIA_STREAM_DIRECTION_NONE = 0
150MEDIA_STREAM_DIRECTION_SEND = 1
151MEDIA_STREAM_DIRECTION_RECEIVE = 2
152MEDIA_STREAM_DIRECTION_BIDIRECTIONAL = 3
153
154MEDIA_STREAM_PENDING_LOCAL_SEND = 1
155MEDIA_STREAM_PENDING_REMOTE_SEND = 2
156
157MEDIA_STREAM_TYPE_AUDIO = 0
158MEDIA_STREAM_TYPE_VIDEO = 1
159
160MEDIA_STREAM_STATE_DISCONNECTED = 0
161MEDIA_STREAM_STATE_CONNECTING = 1
162MEDIA_STREAM_STATE_CONNECTED = 2
163
164MEDIA_STREAM_DIRECTION_NONE = 0
165MEDIA_STREAM_DIRECTION_SEND = 1
166MEDIA_STREAM_DIRECTION_RECEIVE = 2
167MEDIA_STREAM_DIRECTION_BIDIRECTIONAL = 3
168
169SERVICE_POINT_TYPE_NONE = 0
170SERVICE_POINT_TYPE_EMERGENCY = 1
171SERVICE_POINT_TYPE_COUNSELING = 2
172
173CLIENT = tp_name_prefix + '.Client'
174CLIENT_PATH = tp_path_prefix + '/Client'
175OBSERVER = tp_name_prefix + '.Client.Observer'
176APPROVER = tp_name_prefix + '.Client.Approver'
177HANDLER = tp_name_prefix + '.Client.Handler'
178CLIENT_IFACE_REQUESTS = CLIENT + '.Interface.Requests'
179
180ACCOUNT = tp_name_prefix + '.Account'
181ACCOUNT_IFACE_AVATAR = ACCOUNT + '.Interface.Avatar'
182ACCOUNT_IFACE_ADDRESSING = ACCOUNT + '.Interface.Addressing'
183ACCOUNT_IFACE_HIDDEN = ACCOUNT + '.Interface.Hidden.DRAFT1'
184ACCOUNT_IFACE_NOKIA_CONDITIONS = 'com.nokia.Account.Interface.Conditions'
185ACCOUNT_PATH_PREFIX = tp_path_prefix + '/Account/'
186
187AM = tp_name_prefix + '.AccountManager'
188AM_IFACE_HIDDEN = AM + '.Interface.Hidden.DRAFT1'
189AM_PATH = tp_path_prefix + '/AccountManager'
190
191CR = tp_name_prefix + '.ChannelRequest'
192CDO = tp_name_prefix + '.ChannelDispatchOperation'
193
194CD = tp_name_prefix + '.ChannelDispatcher'
195CD_IFACE_OP_LIST = tp_name_prefix + '.ChannelDispatcher.Interface.OperationList'
196CD_PATH = tp_path_prefix + '/ChannelDispatcher'
197CD_REDISPATCH = CD + '.Interface.Redispatch.DRAFT'
198
199MC = tp_name_prefix + '.MissionControl5'
200MC_PATH = tp_path_prefix + '/MissionControl5'
201
202TESTDOT = "org.freedesktop.Telepathy.MC.Test."
203TESTSLASH = "/org/freedesktop/Telepathy/MC/Test/"
204
205TEST_DBUS_ACCOUNT_SERVICE = TESTDOT + "DBusAccountService"
206TEST_DBUS_ACCOUNT_SERVICE_PATH = TESTSLASH + "DBusAccountService"
207TEST_DBUS_ACCOUNT_SERVICE_IFACE = TEST_DBUS_ACCOUNT_SERVICE
208
209TEST_DBUS_ACCOUNT_PLUGIN_PATH = TESTSLASH + "DBusAccountPlugin"
210TEST_DBUS_ACCOUNT_PLUGIN_IFACE = TESTDOT + "DBusAccountPlugin"
211
212PARAM_FLAG_REQUIRED = 1
213PARAM_FLAG_REGISTER = 2
214PARAM_FLAG_HAS_DEFAULT = 4
215PARAM_FLAG_SECRET = 8
216PARAM_FLAG_DBUS_PROPERTY = 16
217