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: #include "CSFLog.h" michael@0: michael@0: #include "CC_Common.h" michael@0: michael@0: #include "CC_SIPCCLine.h" michael@0: #include "CC_SIPCCCall.h" michael@0: #include "CC_SIPCCLineInfo.h" michael@0: michael@0: extern "C" michael@0: { michael@0: #include "ccapi_line.h" michael@0: #include "ccapi_line_listener.h" michael@0: } michael@0: michael@0: using namespace std; michael@0: using namespace CSF; michael@0: michael@0: CSF_IMPLEMENT_WRAP(CC_SIPCCLine, cc_lineid_t); michael@0: michael@0: cc_lineid_t CC_SIPCCLine::getID() michael@0: { michael@0: return lineId; michael@0: } michael@0: michael@0: CC_LineInfoPtr CC_SIPCCLine::getLineInfo () michael@0: { michael@0: cc_lineinfo_ref_t lineInfoRef = CCAPI_Line_getLineInfo(lineId); michael@0: CC_LineInfoPtr lineInfoPtr = CC_SIPCCLineInfo::wrap(lineInfoRef).get(); michael@0: michael@0: //A call to CCAPI_Line_getLineInfo() needs a matching call to CCAPI_Line_releaseLineInfo() michael@0: //However, the CC_SIPCCLineInfo() ctor/dtor does a retain/release internally, so I need to explicitly release michael@0: //here to match up with the call to CCAPI_Line_getLineInfo(). michael@0: michael@0: CCAPI_Line_releaseLineInfo(lineInfoRef); michael@0: michael@0: //CCAPI_Line_getLineInfo() --> requires release be called. michael@0: //CC_SIPCCLineInfo::CC_SIPCCLineInfo() -> Call retain (wrapped in smart_ptr) michael@0: //CCAPI_Line_releaseLineInfo() --> this maps to the call to CCAPI_Line_getLineInfo() michael@0: //CC_SIPCCLineInfo::~CC_SIPCCLineInfo() --> CCAPI_Line_releaseLineInfo() (when smart pointer destroyed) michael@0: michael@0: return lineInfoPtr; michael@0: } michael@0: michael@0: CC_CallPtr CC_SIPCCLine::createCall () michael@0: { michael@0: cc_call_handle_t callHandle = CCAPI_Line_CreateCall(lineId); michael@0: michael@0: return CC_SIPCCCall::wrap(callHandle).get(); michael@0: } michael@0: michael@0: