⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmctrlmmode.c

📁 基于h323协议的软phone
💻 C
字号:
/***********************************************************************
        Copyright (c) 2002 RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Ltd.. No part of this document may be reproduced in any
form whatsoever without written prior approval by RADVISION Ltd..

RADVISION Ltd. reserve the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
***********************************************************************/

#include "rvinternal.h"
#include "cmictrl.h"
#include "cmConf.h"
#include "caputils.h"
#include "strutils.h"
#include "cmchan.h"
#include "oidutils.h"
#include "stkutils.h"
#include "h245.h"
#include "cmCtrlMSD.h"
#include "cmdebprn.h"

#ifdef __cplusplus
extern "C" {
#endif


#define ifE(a) if(a)(a)



/* multipoint mode command on/off____________________________________________________________ */

int multipointModeCommand(H245Control* ctrl,int lcn)
{
    HAPP hApp=(HAPP)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
    int nesting;

    if (!hApp) return RV_ERROR_UNKNOWN;
    if (lcn);
    ctrl->multiPointMode=1;

    cmiCBEnter(hApp, "cmEvCallMiscStatus: haCall=0x%p, hsCall=0x%p, status=%s.",(HAPPCALL)emaGetApplicationHandle((EMAElement)cmiGetByControl((HCONTROL)ctrl)), cmiGetByControl((HCONTROL)ctrl), "mpModeOn");
    nesting=emaPrepareForCallback((EMAElement)cmiGetByControl((HCONTROL)ctrl));
    ifE(((cmElem*)hApp)->cmMySessionEvent.cmEvCallMiscStatus)((HAPPCALL)emaGetApplicationHandle((EMAElement)cmiGetByControl((HCONTROL)ctrl)), (HCALL)cmiGetByControl((HCONTROL)ctrl),   cmMiscMpOn);
    emaReturnFromCallback((EMAElement)cmiGetByControl((HCONTROL)ctrl),nesting);
    cmiCBExit(hApp, "cmEvCallMiscStatus.");
    return RV_TRUE;
}

int cancelMultipointModeCommand(H245Control* ctrl,int lcn)
{
    HAPP hApp=(HAPP)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
    int nesting;
    if (!hApp) return RV_ERROR_UNKNOWN;
    if (lcn);
    ctrl->multiPointMode=0;

    cmiCBEnter(hApp, "cmEvCallMiscStatus: haCall=0x%p, hsCall=0x%p, status=%s.",(HAPPCALL)emaGetApplicationHandle((EMAElement)cmiGetByControl((HCONTROL)ctrl)), cmiGetByControl((HCONTROL)ctrl), "mpModeOff");
    nesting=emaPrepareForCallback((EMAElement)cmiGetByControl((HCONTROL)ctrl));
    ifE(((cmElem*)hApp)->cmMySessionEvent.cmEvCallMiscStatus)((HAPPCALL)emaGetApplicationHandle((EMAElement)cmiGetByControl((HCONTROL)ctrl)), (HCALL)cmiGetByControl((HCONTROL)ctrl),   cmMiscMpOff);
    emaReturnFromCallback((EMAElement)cmiGetByControl((HCONTROL)ctrl),nesting);
    cmiCBExit(hApp, "cmEvCallMiscStatus.");
    return RV_TRUE;
}



RVAPI int RVCALLCONV
cmCallMultipointCommand(
          /* Send multipoint command (on or off) message */
          IN  HCALL hsCall,
          IN  RvBool isModeOn /* RV_TRUE: mp mode (on), RV_FALSE: cancel mp mode (off) */
          )
{
    HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsCall);
    HCONTROL ctrl=cmiGetControl(hsCall);
    int nodeId, message;
    int res = 0;
    if (!hsCall || !hApp) return RV_ERROR_UNKNOWN;

    cmiAPIEnter(hApp, "cmCallMultipointCommand: hsCall=0x%p, %s.", hsCall, (isModeOn)?"on":"off");

    if (emaLock((EMAElement)hsCall))
    {
        HPVT hVal = ((cmElem *)hApp)->hVal;

        message=pvtAddRoot(hVal,((cmElem*)hApp)->synProtH245,0,NULL);
        nodeId=pvtAddBranch2(hVal,message,__h245(command), __h245(miscellaneousCommand) );
        pvtAdd(hVal,nodeId,__h245(logicalChannelNumber),10000,NULL,NULL);
        pvtAddBranch2(hVal,nodeId,__h245(type),(isModeOn)?__h245(multipointModeCommand):__h245(cancelMultipointModeCommand));
        res = sendMessageH245(ctrl, message);
        pvtDelete(hVal,message);
        emaUnlock((EMAElement)cmiGetByControl((HCONTROL)ctrl));
    }
    cmiAPIExit(hApp, "cmCallMultipointCommand: [%d].", res);
    return res;
}



RVAPI int RVCALLCONV
cmCallMultipointStatus(
          /* Get the multipoint mode status (on or off) */
          IN  HCALL hsCall,
          OUT RvBool *isModeOn /* RV_TRUE: mp mode (on), RV_FALSE: cancel mp mode (off) */
          )
{
    HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsCall);
    H245Control* ctrl=(H245Control*)cmiGetControl(hsCall);

    if (!hsCall || !hApp || !isModeOn) return RV_ERROR_UNKNOWN;

    cmiAPIEnter(hApp, "cmCallMultipointStatus: hsCall=0x%p, &isModeOn=%p", hsCall, isModeOn);
    if (emaLock((EMAElement)hsCall))
    {
        *isModeOn = ctrl->multiPointMode;
        emaUnlock((EMAElement)cmiGetByControl((HCONTROL)ctrl));
    }
    cmiAPIExit(hApp, "cmCallMultipointStatus: [%s (%d)].", (ctrl->multiPointMode)?"on":"off", ctrl->multiPointMode);
    return RV_TRUE;
}

#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -