1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/signaling/include/CC_Service.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,88 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#pragma once 1.9 + 1.10 +#include "CC_Common.h" 1.11 +#include "CC_Observer.h" 1.12 + 1.13 +#include <vector> 1.14 + 1.15 +extern "C" 1.16 +{ 1.17 +#include "ccapi_types.h" 1.18 +#include "ccapi_service.h" 1.19 +} 1.20 + 1.21 +namespace CSF 1.22 +{ 1.23 + class ECC_API CC_Service 1.24 + { 1.25 + public: 1.26 + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_Service) 1.27 + protected: 1.28 + CC_Service() {} 1.29 + public: 1.30 + virtual ~CC_Service() {}; 1.31 + 1.32 + public: 1.33 + /** 1.34 + * Clients use CC_Observer to receive CCAPI events (Device, Line, Call) from the service. 1.35 + */ 1.36 + virtual void addCCObserver ( CC_Observer * observer ) = 0; 1.37 + virtual void removeCCObserver ( CC_Observer * observer ) = 0; 1.38 + 1.39 + /** 1.40 + * Use init() immediately on creating the service, and destroy() when finished with it. 1.41 + * password is required for Asterisk not CUCM. 1.42 + * deviceName is required for CUCM not Asterisk. 1.43 + */ 1.44 + virtual bool init(const std::string& user, const std::string& password, const std::string& domain, const std::string& deviceName) = 0; 1.45 + virtual void destroy() = 0; 1.46 + 1.47 + /** 1.48 + * TODO: Set config parameters prior to starting the service. 1.49 + * Need to design a nice abstraction for this accommodating SIPCC and CTI. 1.50 + */ 1.51 + 1.52 + /** 1.53 + * Use start() to attempt to register for a device and stop() to cancel a current 1.54 + * registration (or registration attempt). 1.55 + */ 1.56 + virtual bool startService() = 0; 1.57 + virtual void stop() = 0; 1.58 + 1.59 + 1.60 + /** 1.61 + * Check on the current status/health of the service. 1.62 + */ 1.63 + virtual bool isStarted() = 0; 1.64 + 1.65 + /** 1.66 + * Obtain the currently selected Device. 1.67 + * If multiple devices are discoverable (i.e. in CTI), all known devices will appear 1.68 + * in getDevices(), but only the ActiveDevice will be controllable at any given time. 1.69 + */ 1.70 + virtual CC_DevicePtr getActiveDevice() = 0; 1.71 + virtual std::vector<CC_DevicePtr> getDevices() = 0; 1.72 + 1.73 + /** 1.74 + * Global settings for audio and video control. Return nullptr if Media control is not 1.75 + * available in this implementation. Return nullptr in any case if media is not yet 1.76 + * initialized. 1.77 + * TODO: Assuming for now that media init aligns with init/destroy. 1.78 + */ 1.79 + virtual AudioControlPtr getAudioControl() = 0; 1.80 + virtual VideoControlPtr getVideoControl() = 0; 1.81 + 1.82 + virtual bool setLocalVoipPort(int port) = 0; 1.83 + virtual bool setRemoteVoipPort(int port) = 0; 1.84 + virtual bool setP2PMode(bool mode) = 0; 1.85 + virtual bool setSDPMode(bool mode) = 0; 1.86 + 1.87 + private: 1.88 + CC_Service(const CC_Service& rhs); 1.89 + CC_Service& operator=(const CC_Service& rhs); 1.90 + }; 1.91 +}