📄 userinput.c
字号:
else
{
pvtGetChildByFieldId(hVal, nodeId, __h245(logicalChannelNumber),
&userInputSignalStruct->cmUserInputSignalRtp.logicalChannelNumber, NULL);
optId = pvtGetChildByFieldId(hVal, nodeId, __h245(timestamp),
&userInputSignalStruct->cmUserInputSignalRtp.timestamp, NULL);
if (optId<0)
userInputSignalStruct->cmUserInputSignalRtp.timestamp =0;
optId = pvtGetChildByFieldId(hVal, nodeId, __h245(expirationTime),
&userInputSignalStruct->cmUserInputSignalRtp.expirationTime, NULL);
if (optId<0)
userInputSignalStruct->cmUserInputSignalRtp.expirationTime =0;
}
cmiAPIExit(hApp, "cmUserInputGetSignal: hApp=0x%p", hApp);
return RV_TRUE;
}
RVAPI int RVCALLCONV
cmUserInputGetSignalUpdate(
IN HAPP hApp,
IN RvInt32 signalUserInputId,
OUT cmUserInputSignalStruct * userInputSignalStruct
)
{
int nodeId;
HPVT hVal;
if (!hApp ) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmUserInputGetSignalUpdate: hApp=0x%p, UI id=%d", hApp, signalUserInputId);
hVal = ((cmElem *)hApp)->hVal;
nodeId=pvtGetChild(hVal,signalUserInputId,__h245(duration), NULL);
pvtGet(hVal,nodeId,NULL,NULL,&userInputSignalStruct->duration,NULL);
nodeId = pvtGetChild(hVal,signalUserInputId,__h245(rtp), NULL);
if (nodeId<0)
userInputSignalStruct->cmUserInputSignalRtp.logicalChannelNumber=0;
else
pvtGetChildByFieldId(hVal, nodeId, __h245(logicalChannelNumber),
&userInputSignalStruct->cmUserInputSignalRtp.logicalChannelNumber, NULL);
cmiAPIExit(hApp, "cmUserInputGetSignalUpdate: hApp=0x%p", hApp);
return RV_TRUE;
}
RVAPI int RVCALLCONV /* return nodeId to make possible getting nonStandrd */
cmUserInputSupportGet(
IN HAPP hApp,
IN RvInt32 supportUserInputId,
OUT cmUserInputSupportIndication * userInputSupportIndication
)
{
HPVT hVal;
int nodeId;
if (!hApp) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmUserInputSupportGet: hApp=0x%p, UI id=%d", hApp, supportUserInputId);
hVal = ((cmElem *)hApp)->hVal;
nodeId =pvtChild(hVal,supportUserInputId);
*userInputSupportIndication=(cmUserInputSupportIndication)(pvtGetSyntaxIndex(hVal,nodeId)-1);
#if (RV_LOGMASK_COMPILEMASK & RV_LOGLEVEL_LEAVE)
{
RvPstFieldId fieldId;
char buff[30];
pvtGet(hVal,nodeId,&fieldId,NULL,NULL,NULL);
cmiAPIExit(hApp, "cmUserInputSupportGet: (%d) hApp=0x%p",
pstGetFieldName(pvtGetSynTree(hVal,supportUserInputId),fieldId,sizeof(buff),buff), hApp);
}
#endif
return *userInputSupportIndication;
}
/* user input________________________________________________________________________________ */
RVAPI int RVCALLCONV
cmCallSendUserInput(
/* send user input msg: userInputId tree is deleted */
/* Note: Select one of nonStandard or userData options */
IN HCALL hsCall,
IN RvInt32 userInputId /* indication.userInput tree node id */
)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)hsCall);
HPVT hVal;
H245Control* ctrl=(H245Control*)cmiGetControl(hsCall);
int message, res = RV_ERROR_UNKNOWN;
if (!hsCall || !hApp) return RV_ERROR_UNKNOWN;
if (userInputId<0) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmCallSendUserInput: hsCall=0x%p, id=%d", hsCall, userInputId);
if (emaLock((EMAElement)hsCall))
{
hVal = ((cmElem *)hApp)->hVal;
message=pvtAddRoot(hVal,((cmElem*)hApp)->synProtH245,0,NULL);
pvtMoveTree(hVal,pvtAddBranch2(hVal,message, __h245(indication), __h245(userInput)),userInputId);
res = sendMessageH245((HCONTROL)ctrl, message);
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsCall);
}
cmiAPIExit(hApp, "cmCallSendUserInput=%d", res);
return res;
}
RVAPI int RVCALLCONV /* userInput message node id or negative value on failure */
cmUserInputBuildNonStandard(
/* Build userUser message with non-standard data */
IN HAPP hApp,
IN cmNonStandardIdentifier *identifier,
IN char *data,
IN int dataLength /* in bytes */
)
{
HPVT hVal;
int rootId, nsId,ret;
if (!hApp) return RV_ERROR_UNKNOWN;
if (!identifier) return RV_ERROR_UNKNOWN;
if (!data || dataLength<1) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmUserInputBuildNonStandard: hApp=0x%p, id=0x%p, data=0x%p (%d)",
hApp, identifier, data, dataLength);
hVal = ((cmElem *)hApp)->hVal;
if ((rootId=pvtAddRootByPath(hVal, ((cmElem*)hApp)->synProtH245, (char*)"indication.userInput", 0, NULL)) <0)
{
cmiAPIExit(hApp, "cmUserInputBuildNonStandard: [-1]");
return rootId;
}
nsId = pvtBuildByPath(hVal, rootId, "nonStandard", 0, NULL);
if ((ret=cmNonStandardParameterCreate(hVal, nsId, identifier, data, dataLength)) <0)
{
pvtDelete(hVal, rootId);
cmiAPIExit(hApp, "cmUserInputBuildNonStandard: [%d]",ret);
return RV_ERROR_UNKNOWN;
}
cmiAPIExit(hApp, "cmUserInputBuildNonStandard: [%d]", rootId);
return rootId;
}
RVAPI int RVCALLCONV /* userInput message node id or negative value on failure */
cmUserInputBuildAlphanumeric(
/* Build userUser message with alphanumeric data */
IN HAPP hApp,
IN cmUserInputData *userData
)
{
HPVT hVal;
int rootId,ret;
if (!hApp) return RV_ERROR_UNKNOWN;
if (!userData) return RV_ERROR_UNKNOWN;
if (userData && (!userData->data || userData->length<1)) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmUserInputBuildAlphanumeric: hApp=0x%p, userData=0x%p", hApp, userData);
hVal = ((cmElem *)hApp)->hVal;
if ((rootId=pvtAddRootByPath(hVal, ((cmElem*)hApp)->synProtH245, (char*)"indication.userInput", 0, NULL)) <0)
{
cmiAPIExit(hApp, "cmUserInputBuildAlphanumeric: [%d]", rootId);
return rootId;
}
ret =pvtAdd(hVal, rootId, __h245(alphanumeric), userData->length, userData->data, NULL);
if (ret >= 0)
ret = rootId;
cmiAPIExit(hApp, "cmUserInputBuildAlphanumeric: [%d]", ret);
return ret;
}
RVAPI int RVCALLCONV /* RV_TRUE or negative value on failure */
cmUserInputGet(
/* Note: One of dataLength or userData->length is NULL (the other exists) */
/* Note: pointers are set to addresses in the user input value tree */
IN HAPP hApp,
IN RvInt32 userInputId,
/* 1) nonStandard */
IN cmNonStandardIdentifier *identifier, /* user allocated */
IN char *data, /* user allocated */
INOUT RvInt32 *dataLength, /* (in bytes) IN: data allocation. OUT: correct size */
/* 2) userData */
IN cmUserInputData *userData /*.length: IN: data allocation. OUT: correct size */
)
{
HPVT hVal;
int nsId, userDataLen=-1;
if (!hApp || !identifier || !data || !dataLength || !userData) return RV_ERROR_UNKNOWN;
cmiAPIEnter(hApp, "cmUserInputGet: hApp=0x%p, UI id=%d", hApp, userInputId);
hVal = ((cmElem *)hApp)->hVal;
if ( (nsId = pvtGetChild(hVal, userInputId, __h245(nonStandard), NULL)) >=0)
{
cmNonStandardParameterGet(hVal, nsId, identifier, data, dataLength);
userData->length=0;
cmiAPIExit(hApp, "cmUserInputGet: [1] (nonStandard)");
return RV_TRUE;
}
userDataLen=userData->length;
if ( (nsId = pvtGetChildByFieldId(hVal, userInputId, __h245(alphanumeric), &(userData->length), NULL)) >=0)
{
userDataLen = pvtGetString(hVal, nsId, userDataLen-1, userData->data);
userData->data[userDataLen]=0;
*dataLength=0;
cmiAPIExit(hApp, "cmUserInputGet: [1] (alphanumeric)");
return RV_TRUE;
}
cmiAPIExit(hApp, "cmUserInputGet: [-1] (RV_ERROR_UNKNOWN)");
return RV_ERROR_UNKNOWN;
}
#ifdef __cplusplus
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -