~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/src/managerimpl.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
class TelephoneTone;
77
77
class VoIPLink;
78
78
 
79
 
#ifdef USE_ZEROCONF
80
 
class DNSService;
81
 
#endif
82
 
 
83
79
class Account;
84
80
class SIPAccount;
85
81
class IAXAccount;
123
119
         */
124
120
        ShortcutPreferences shortcutPreferences;
125
121
 
 
122
        // Manager should not be accessed until initialized.
 
123
        // FIXME this is an evil hack!
 
124
        static std::atomic_bool initialized;
 
125
 
126
126
        /**
127
127
         * Initialisation of thread (sound) and map.
128
128
         * Init a new VoIPLink, audio codec and audio driver
131
131
 
132
132
        void setPath(const std::string &path);
133
133
 
134
 
#ifdef HAVE_DBUS
135
134
        /**
136
 
         * Enter Dbus mainloop
 
135
         * Enter mainloop
137
136
         */
138
137
        int run();
139
 
        // Interrupt Dbus mainloop
 
138
        /**
 
139
         * Interrupt mainloop
 
140
         */
140
141
        int interrupt();
141
 
#endif
142
142
 
143
143
        /*
144
144
         * Terminate all threads and exit DBus loop
420
420
        void sendRegister(const std::string& accountId, bool enable);
421
421
 
422
422
        /**
423
 
         * Register all account in accountMap_
424
 
         */
425
 
        void registerAllAccounts();
426
 
 
427
 
        /**
428
 
         * Unregister all account in accountMap_
429
 
         */
430
 
        void unregisterAllAccounts();
431
 
 
432
 
        /**
433
423
         * Get account list
434
424
         * @return std::vector<std::string> A list of accoundIDs
435
425
         */
480
470
         */
481
471
        std::vector<std::string> getParticipantList(const std::string& confID) const;
482
472
 
 
473
        /**
 
474
         * Get a list of the display names for everyone in a conference
 
475
         * @return std::vector<std::string> A list of display names
 
476
         */
 
477
        std::vector<std::string> getDisplayNames(const std::string& confID) const;
 
478
 
483
479
        std::string getConferenceId(const std::string& callID);
484
480
 
485
481
        /**
507
503
        void removeAccount(const std::string& accountID);
508
504
 
509
505
        /**
510
 
         * Get current codec name
511
 
         * @param call id
512
 
         * @return std::string The codec name
513
 
         */
514
 
        std::string getCurrentAudioCodecName(const std::string& id);
515
 
        std::string getCurrentVideoCodecName(const std::string& id);
516
 
 
517
 
        /**
518
506
         * Set input audio plugin
519
507
         * @param audioPlugin The audio plugin
520
508
         */
523
511
        /**
524
512
             * Set audio device
525
513
             * @param index The index of the soundcard
526
 
             * @param the type of stream, either SFL_PCM_PLAYBACK, SFL_PCM_CAPTURE, SFL_PCM_RINGTONE
 
514
             * @param the type of stream, either PLAYBACK, CAPTURE, RINGTONE
527
515
             */
528
 
        void setAudioDevice(int index, AudioLayer::PCMType streamType);
 
516
        void setAudioDevice(int index, DeviceType streamType);
529
517
 
530
518
        /**
531
519
         * Get list of supported audio output device
550
538
         * @param name The string description of an audio device
551
539
         * @return int  His index
552
540
         */
553
 
        int getAudioDeviceIndex(const std::string &name);
 
541
        int getAudioInputDeviceIndex(const std::string &name);
 
542
        int getAudioOutputDeviceIndex(const std::string &name);
554
543
 
555
544
        /**
556
545
         * Get current alsa plugin
660
649
 
661
650
        /**
662
651
         * Set the audio manager
663
 
         */
664
 
        void setAudioManager(const std::string &api);
665
 
 
666
 
        void switchAudioManager();
667
 
 
668
 
        /**
669
 
         * Set the internal audio sampling rate change. Should close the audio layer and
670
 
         * reopen stream at different rate,
671
 
         */
672
 
        void audioSamplingRateChanged(int);
 
652
         * @return true if api is now in use, false otherwise
 
653
         */
 
654
        bool setAudioManager(const std::string &api);
 
655
 
 
656
        /**
 
657
         * Callback called when the audio layer initialised with its
 
658
         * preferred format.
 
659
         */
 
660
        void hardwareAudioFormatChanged(AudioFormat format);
 
661
 
 
662
        /**
 
663
         * Should be called by any component dealing with an external
 
664
         * audio source, indicating the format used so the mixer format
 
665
         * can be eventually adapted.
 
666
         */
 
667
        void audioFormatUsed(AudioFormat format);
673
668
 
674
669
        /**
675
670
         * Change a specific value in the configuration tree.
787
782
        /**
788
783
         * Get the Call referred to by callID. If the Call does not exist, return NULL
789
784
         */
790
 
        Call *getCallFromCallID(const std::string &callID);
 
785
        std::shared_ptr<Call> getCallFromCallID(const std::string &callID);
791
786
 
792
787
        /**
793
788
         * Process remaining participant given a conference and the current call id.
802
797
         */
803
798
        std::string retrieveConfigPath() const;
804
799
 
805
 
        /*
806
 
         * Initialize zeroconf module and scanning
807
 
         */
808
 
        void initZeroconf();
809
 
 
810
800
        /**
811
801
         * Set current call ID to empty string
812
802
         */
841
831
        // Main thread
842
832
        std::unique_ptr<DTMF> dtmfKey_;
843
833
 
 
834
        /** Buffer to generate DTMF */
 
835
        AudioBuffer dtmfBuf_;
 
836
 
844
837
        /////////////////////
845
838
        // Protected by Mutex
846
839
        /////////////////////
885
878
         */
886
879
        std::string path_;
887
880
 
888
 
#ifdef USE_ZEROCONF
889
 
        // DNSService contain every zeroconf services
890
 
        //  configuration detected on the network
891
 
        DNSService *DNSService_;
892
 
#endif
893
 
 
894
881
        std::map<std::string, bool> IPToIPMap_;
895
882
 
896
883
        bool isIPToIP(const std::string& callID) const;
899
886
         * Load the account map from configuration
900
887
         */
901
888
        int loadAccountMap(Conf::YamlParser &parser);
902
 
        /**
903
 
         * Load default account map (no configuration)
904
 
         */
905
 
        void loadDefaultAccountMap();
906
889
 
907
890
        /**
908
891
         * Instance of the MainBuffer for the whole application
942
925
         */
943
926
        Client* getClient();
944
927
#ifdef SFL_VIDEO
945
 
        VideoControls * getVideoControls();
 
928
        VideoManager * getVideoManager();
946
929
#endif
947
930
 
948
931
        /**
979
962
        IAXAccount *getIaxAccount(const std::string& accountID) const;
980
963
#endif
981
964
 
982
 
        /**
 
965
        /**
983
966
         * Get a pointer to the IP2IP account
984
967
         * @return SIPAccount * Pointer to the IP2IP account
985
968
         */
1000
983
        VoIPLink* getAccountLink(const std::string& accountID);
1001
984
 
1002
985
        /**
1003
 
         * Send registration to all enabled accounts
 
986
         * Free all ressources related to this account.
 
987
         *   ***Current calls using this account are HANG-UP***
 
988
         */
 
989
        void freeAccount(const std::string& accountID);
 
990
 
 
991
        /**
 
992
         * Send registration for all enabled accounts
1004
993
         */
1005
994
        void registerAccounts();
 
995
 
1006
996
        void saveHistory();
1007
997
 
1008
998
        /**
1014
1004
        void
1015
1005
        checkAudio();
1016
1006
 
 
1007
        /**
 
1008
         * Call periodically to poll for VoIP events */
 
1009
        void
 
1010
        pollEvents();
 
1011
 
1017
1012
    private:
1018
1013
        NON_COPYABLE(ManagerImpl);
1019
1014
 
1020
1015
        /**
 
1016
         * Send unregister for all enabled accounts
 
1017
         */
 
1018
        void unregisterAccounts();
 
1019
 
 
1020
        /**
1021
1021
         * Play the dtmf-associated sound
1022
1022
         * @param code  The pressed key
1023
1023
         */