michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #pragma once michael@0: michael@0: #include "CC_Common.h" michael@0: #include "CC_Observer.h" michael@0: michael@0: #include michael@0: michael@0: extern "C" michael@0: { michael@0: #include "ccapi_types.h" michael@0: #include "ccapi_service.h" michael@0: } michael@0: michael@0: namespace CSF michael@0: { michael@0: class ECC_API CC_Service michael@0: { michael@0: public: michael@0: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_Service) michael@0: protected: michael@0: CC_Service() {} michael@0: public: michael@0: virtual ~CC_Service() {}; michael@0: michael@0: public: michael@0: /** michael@0: * Clients use CC_Observer to receive CCAPI events (Device, Line, Call) from the service. michael@0: */ michael@0: virtual void addCCObserver ( CC_Observer * observer ) = 0; michael@0: virtual void removeCCObserver ( CC_Observer * observer ) = 0; michael@0: michael@0: /** michael@0: * Use init() immediately on creating the service, and destroy() when finished with it. michael@0: * password is required for Asterisk not CUCM. michael@0: * deviceName is required for CUCM not Asterisk. michael@0: */ michael@0: virtual bool init(const std::string& user, const std::string& password, const std::string& domain, const std::string& deviceName) = 0; michael@0: virtual void destroy() = 0; michael@0: michael@0: /** michael@0: * TODO: Set config parameters prior to starting the service. michael@0: * Need to design a nice abstraction for this accommodating SIPCC and CTI. michael@0: */ michael@0: michael@0: /** michael@0: * Use start() to attempt to register for a device and stop() to cancel a current michael@0: * registration (or registration attempt). michael@0: */ michael@0: virtual bool startService() = 0; michael@0: virtual void stop() = 0; michael@0: michael@0: michael@0: /** michael@0: * Check on the current status/health of the service. michael@0: */ michael@0: virtual bool isStarted() = 0; michael@0: michael@0: /** michael@0: * Obtain the currently selected Device. michael@0: * If multiple devices are discoverable (i.e. in CTI), all known devices will appear michael@0: * in getDevices(), but only the ActiveDevice will be controllable at any given time. michael@0: */ michael@0: virtual CC_DevicePtr getActiveDevice() = 0; michael@0: virtual std::vector getDevices() = 0; michael@0: michael@0: /** michael@0: * Global settings for audio and video control. Return nullptr if Media control is not michael@0: * available in this implementation. Return nullptr in any case if media is not yet michael@0: * initialized. michael@0: * TODO: Assuming for now that media init aligns with init/destroy. michael@0: */ michael@0: virtual AudioControlPtr getAudioControl() = 0; michael@0: virtual VideoControlPtr getVideoControl() = 0; michael@0: michael@0: virtual bool setLocalVoipPort(int port) = 0; michael@0: virtual bool setRemoteVoipPort(int port) = 0; michael@0: virtual bool setP2PMode(bool mode) = 0; michael@0: virtual bool setSDPMode(bool mode) = 0; michael@0: michael@0: private: michael@0: CC_Service(const CC_Service& rhs); michael@0: CC_Service& operator=(const CC_Service& rhs); michael@0: }; michael@0: }