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 "csf_common.h" michael@0: #include "CC_SIPCCLineInfo.h" michael@0: #include "CC_SIPCCLine.h" michael@0: #include "CC_SIPCCCall.h" michael@0: michael@0: extern "C" michael@0: { michael@0: #include "cpr_types.h" michael@0: #include "ccapi_line.h" michael@0: #include "ccapi_line_info.h" michael@0: } michael@0: michael@0: using namespace std; michael@0: using namespace CSF; michael@0: michael@0: #define MAX_SUPPORTED_NUM_CALLS 100 michael@0: michael@0: //FIXME: Header file "ccapi_line.h" has misnamed the retain function as "CCAPI_Device_retainLineInfo" michael@0: // Checked the source file and it's declared correctly there, so I have to declare it myself here. michael@0: michael@0: //Also CCAPI_LineInfo_getCalls() in source file and CCAPI_lineInfo_getCalls() in header (lowercase 'l' in lineInfo) michael@0: michael@0: extern "C" void CCAPI_Line_retainLineInfo(cc_lineinfo_ref_t ref); michael@0: extern "C" void CCAPI_LineInfo_getCalls(cc_lineid_t line, cc_call_handle_t handles[], int *count); michael@0: extern "C" void CCAPI_LineInfo_getCallsByState(cc_lineid_t line, cc_call_state_t state, cc_call_handle_t handles[], int *count); michael@0: michael@0: CSF_IMPLEMENT_WRAP(CC_SIPCCLineInfo, cc_lineinfo_ref_t); michael@0: michael@0: CC_SIPCCLineInfo::CC_SIPCCLineInfo (cc_lineinfo_ref_t lineinfo) : lineinfo(lineinfo) michael@0: { michael@0: CCAPI_Line_retainLineInfo(lineinfo); michael@0: } michael@0: michael@0: CC_SIPCCLineInfo::~CC_SIPCCLineInfo() michael@0: { michael@0: CCAPI_Line_releaseLineInfo(lineinfo); michael@0: } michael@0: michael@0: string CC_SIPCCLineInfo::getName() michael@0: { michael@0: return CCAPI_lineInfo_getName(lineinfo); michael@0: } michael@0: michael@0: string CC_SIPCCLineInfo::getNumber() michael@0: { michael@0: return CCAPI_lineInfo_getNumber(lineinfo); michael@0: } michael@0: michael@0: cc_uint32_t CC_SIPCCLineInfo::getButton() michael@0: { michael@0: return CCAPI_lineInfo_getButton(lineinfo); michael@0: } michael@0: michael@0: cc_line_feature_t CC_SIPCCLineInfo::getLineType() michael@0: { michael@0: return CCAPI_lineInfo_getLineType(lineinfo); michael@0: } michael@0: michael@0: bool CC_SIPCCLineInfo::getRegState() michael@0: { michael@0: if (CCAPI_lineInfo_getRegState(lineinfo)) michael@0: { michael@0: return true; michael@0: } michael@0: else michael@0: { michael@0: return false; michael@0: } michael@0: } michael@0: michael@0: bool CC_SIPCCLineInfo::isCFWDActive() michael@0: { michael@0: if (CCAPI_lineInfo_isCFWDActive(lineinfo)) michael@0: { michael@0: return true; michael@0: } michael@0: else michael@0: { michael@0: return false; michael@0: } michael@0: } michael@0: michael@0: string CC_SIPCCLineInfo::getCFWDName() michael@0: { michael@0: return CCAPI_lineInfo_getCFWDName(lineinfo); michael@0: } michael@0: michael@0: vector CC_SIPCCLineInfo::getCalls (CC_LinePtr linePtr) michael@0: { michael@0: vector callsVector; michael@0: michael@0: cc_call_handle_t handles[MAX_SUPPORTED_NUM_CALLS] = {}; michael@0: int numCalls = csf_countof(handles); michael@0: michael@0: CCAPI_LineInfo_getCalls(linePtr->getID(), handles, &numCalls) ; michael@0: michael@0: for (int i=0; i CC_SIPCCLineInfo::getCallsByState (CC_LinePtr linePtr, cc_call_state_t state) michael@0: { michael@0: vector callsVector; michael@0: michael@0: cc_call_handle_t handles[MAX_SUPPORTED_NUM_CALLS] = {}; michael@0: int numCalls = csf_countof(handles); michael@0: michael@0: CCAPI_LineInfo_getCallsByState(linePtr->getID(), state, handles, &numCalls) ; michael@0: michael@0: for (int i=0; i CC_SIPCCLineInfo::getCapabilitySet() michael@0: { michael@0: bitset lineCaps; michael@0: michael@0: for (int i=0; i