/** * demo usage pattern of telepathy-qt API * * @author izicochang@gmail.com * @since 5/23/2007 */ #ifndef QTTELEPATHY_TEST_H #define QTTELEPATHY_TEST_H #include #include #include #include #include #include #include class OrgFreedesktopTelepathyConnectionManagerInterface; class OrgFreedesktopTelepathyConnectionInterface; class OrgFreedesktopTelepathyConnectionInterfaceAliasingInterface; class OrgFreedesktopTelepathyConnectionInterfaceAvatarsInterface; class OrgFreedesktopTelepathyConnectionInterfaceCapabilitiesInterface; class OrgFreedesktopTelepathyConnectionInterfaceForwardingInterface; class OrgFreedesktopTelepathyConnectionInterfacePresenceInterface; class OrgFreedesktopTelepathyConnectionInterfacePrivacyInterface; class OrgFreedesktopTelepathyConnectionInterfaceRenamingInterface; class OrgFreedesktopTelepathyChannelInterface; class OrgFreedesktopTelepathyChannelTypeStreamedMediaInterface; class OrgFreedesktopTelepathyChannelTypeTextInterface; class OrgFreedesktopTelepathyChannelInterfaceChatStateInterface; class OrgFreedesktopTelepathyChannelInterfaceDTMFInterface; class OrgFreedesktopTelepathyChannelInterfaceGroupInterface; class OrgFreedesktopTelepathyChannelInterfacePasswordInterface; class OrgFreedesktopTelepathyChannelInterfaceMediaSignallingInterface; class OrgFreedesktopTelepathyMediaSessionHandlerInterface; class OrgFreedesktopTelepathyMediaStreamHandlerInterface; class OrgFreedesktopTelepathyChannelHandlerInterface; class OrgFreedesktopTelepathyStreamEngineInterface; // some definition should be in telepathy-qt API #define CHANNEL_MEDIA_CAPABILITY_AUDIO 1 #define CHANNEL_MEDIA_CAPABILITY_VIDEO 2 #define CHANNEL_MEDIA_CAPABILITY_NAT_TRAVERSAL_STUN 4 #define CHANNEL_MEDIA_CAPABILITY_NAT_TRAVERSAL_GTALK_P2P 8 #define CHANNEL_CHAT_STATE_GONE 0 #define CHANNEL_CHAT_STATE_INACTIVE 1 #define CHANNEL_CHAT_STATE_ACTIVE 2 #define CHANNEL_CHAT_STATE_PAUSED 3 #define CHANNEL_CHAT_STATE_COMPOSING 4 #define DTMF_EVENT_DIGIT_0 0 #define DTMF_EVENT_DIGIT_1 1 #define DTMF_EVENT_DIGIT_2 2 #define DTMF_EVENT_DIGIT_3 3 #define DTMF_EVENT_DIGIT_4 4 #define DTMF_EVENT_DIGIT_5 5 #define DTMF_EVENT_DIGIT_6 6 #define DTMF_EVENT_DIGIT_7 7 #define DTMF_EVENT_DIGIT_8 8 #define DTMF_EVENT_DIGIT_9 9 #define DTMF_EVENT_ASTERISK 10 #define DTMF_EVENT_HASH 11 #define DTMF_EVENT_LETTER_A 12 #define DTMF_EVENT_LETTER_B 13 #define DTMF_EVENT_LETTER_C 14 #define DTMF_EVENT_LETTER_D 15 #define HANDLE_TYPE_GROUP 4 #define STREAM_ENGINE_IFACE "org.freedesktop.Telepathy.StreamEngine" #define STREAM_ENGINE_PATH "/org/freedesktop/Telepathy/StreamEngine" /** * All the telepathy DBus signals are filtered here */ class MessageFilter: public QObject { Q_OBJECT public: MessageFilter(const QDBusConnection &bus, QObject *parent = 0); ~MessageFilter(); public Q_SLOTS: // connection manager void onNewConnection(const QString& service, const QDBusObjectPath& path, const QString& proto); // connection void onNewChannel(const QDBusObjectPath& objPath, const QString& channelType, uint handleType, uint handle, bool suppressHandler); void OnStatusChanged(uint status, uint reason); // connection aliasing interface void onAliasesChanged(const org::freedesktop::Telepathy::AliasInfoList&); // connection avtars interface void onAvatarUpdated(uint contact, const QString &new_avatar_token); // connection capabilities interface void onCapabilitiesChanged(const org::freedesktop::Telepathy::CapabilitiesChangedInfoList& caps); // forwarding interface void onForwardingChanged(uint forward_to); // connection presence interface void onPresenceUpdate(const org::freedesktop::Telepathy::PresenceStateInTimeMap& presence); // connection privacy interface void onPrivacyModeChanged(const QString& mode); // connection renaming interface void onRenamed(uint old_handle, uint new_handle); // channel void onClose(); // channel streamed media type void onStreamAdded(uint id, uint contactHandle, uint type); void onStreamDirectionChanged(uint id, uint direction, uint pendingFlags); void onStreamError(uint id, uint errno, const QString& message); void onStreamRemoved(uint id); void onStreamStateChanged(uint id, uint state); // channel type text void onLostMessage(); void onReceived(uint id, uint timestamp, uint sender, uint type, uint flags, const QString& text); void onSendError(uint error, uint timestamp, uint type, const QString& text); void onSent(uint timestamp, uint type, const QString& text); // channel group interface void onGroupFlagsChanged(uint added, uint removed); void onMembersChanged(const QString &message, const QList &added, const QList &removed, const QList &local_pending, const QList &remote_pending, uint actor, uint reason); // channel chat state interface void onChatStateChanged(uint contact, uint state); // channel media signalling interface void onNewSessionHandler(const QDBusObjectPath& path, const QString& type); // media session handler void onNewStreamHandler(const QDBusObjectPath& handlerPath, uint streamId, uint mediaType, uint streamDirection); // media stream handler void onAddRemoteCandidate(const QString& candidateId, const org::freedesktop::Telepathy::TransportInfoList& transportList); void onCloseStream(); void onRemoveRemoteCandidate(const QString& candidateId); void onSetActiveCandidatePair(const QString& nativeCandidateId, const QString& remoteCandidateId); void onSetRemoteCandidateList(const org::freedesktop::Telepathy::CandidateInfoList& remoteCandidateList); void onSetRemoteCodecs(const org::freedesktop::Telepathy::CodecInfoList& codecList); void onSetStreamPlaying(bool playing); void onSetStreamSending(bool playing); void onStartTelephonyEvent(uchar event); void onStopTelephonyEvent(); // stream engine void onReceiving(const QDBusObjectPath& channelPath, uint streamId, bool state); public: QDBusConnection bus; OrgFreedesktopTelepathyConnectionManagerInterface* cm; OrgFreedesktopTelepathyConnectionInterface* conn; OrgFreedesktopTelepathyConnectionInterfaceAliasingInterface* aliasingIface; OrgFreedesktopTelepathyConnectionInterfaceAvatarsInterface* avatarsIface; OrgFreedesktopTelepathyConnectionInterfaceCapabilitiesInterface* capabilitiesIface; OrgFreedesktopTelepathyConnectionInterfaceForwardingInterface* forwardingIface; OrgFreedesktopTelepathyConnectionInterfacePresenceInterface* presenceIface; OrgFreedesktopTelepathyConnectionInterfacePrivacyInterface* privacyIface; OrgFreedesktopTelepathyConnectionInterfaceRenamingInterface* renamingIface; OrgFreedesktopTelepathyChannelInterface* anonymousChannel; OrgFreedesktopTelepathyChannelInterface* contactListChannel[3]; OrgFreedesktopTelepathyChannelInterfaceGroupInterface* contactListChannelGroupIface[3]; OrgFreedesktopTelepathyChannelInterface* textChannel; OrgFreedesktopTelepathyChannelTypeTextInterface* textChannelType; OrgFreedesktopTelepathyChannelInterfaceChatStateInterface* textChannelChatStateIface; uint smContactHandle; uint smContactCapabilies; OrgFreedesktopTelepathyChannelInterface* smChannel; OrgFreedesktopTelepathyChannelTypeStreamedMediaInterface* smChannelType; OrgFreedesktopTelepathyChannelInterfaceDTMFInterface* smChannelDTMFIface; OrgFreedesktopTelepathyChannelInterfaceMediaSignallingInterface* smChannelMediaSignallingIface; OrgFreedesktopTelepathyMediaSessionHandlerInterface* smSessionHandler; OrgFreedesktopTelepathyMediaStreamHandlerInterface* smStreamHandler; OrgFreedesktopTelepathyChannelInterfaceGroupInterface* smChannelGroupIface; OrgFreedesktopTelepathyChannelHandlerInterface* smChannelHandler; OrgFreedesktopTelepathyStreamEngineInterface* smStreamEngine; private: void test_connection(); void test_connection_interface_aliasing(); void test_connection_interface_avatars(); void test_connection_interface_capabilities(); void test_connection_interface_forwarding(); void test_connection_interface_presence(); void test_connection_interface_privacy(); void test_connection_interface_renaming(); void test_channel(); void test_channel_type_contactlist(); void test_channel_type_contactsearch(); void test_channel_type_streamedmedia(); void setupStreamedMediaChannel(const QDBusObjectPath& channelPath); void test_channel_type_roomlist(); void test_channel_type_text(); void test_channel_type_tubes(); }; #endif