VAPI API Reference Documentation
2.18.x

Resource manager related API functions

Functions

VSTATUS VAPI_SetResourceManager (IN DEVID DevId, IN EResAction eResAction, OUT U16 *pusQueryInfo)
VSTATUS VAPI_SetConnectionResource (IN DEVID DevId, IN CONNID ConnId, IN U8 ucResourceNum, IN U8 *pucRequiredResource)

Function Documentation

VSTATUS VAPI_SetConnectionResource ( IN DEVID  DevId,
IN CONNID  ConnId,
IN U8  ucResourceNum,
IN U8 pucRequiredResource 
)


Description:
This API allocates the required resources for a connection according to the passed parameters.
This ensures that resources for the most resource-intense codec are available for this connection for the whole session.
This includes a potential switch to a more consuming configuration such as a complex codec (e.g. G.729 or T.38).
This API must be called before VAPI_CreateConnection or VAPI_AllocateConnection APIs.
The allocated resources are freed when the VAPI_SetConnectionResource API is called for the corresponding connection ID.
VAPI_SetConnectionResource can be called several times for a particular connection ID.
In this case the latest one is taken in account and the resource pool updated accordingly.
It is not allowed to free a connection resource if the corresponding connection has not been previously destroyed.
It is not allowed to decrease the resource of a connection if the corresponding connection takes more resource than the required resource.
(e.g if a Connection is T38, it is not possible to change the resource to G711_20ms).

Inputs-Outputs
DevId The device on which resource is to be reserved
ConnId Connection ID.
ucResourceNum Number of required resources.
pucRequiredResource Buffer containing the list of required resources.


Returns:

  • SUCCESS
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_DEVID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_NOMEM
  • VAPI_ERR_INVALID_PARAM
  • VAPI_ERR_NULL_POINTER_PASSED
  • VAPI_ERR_RES_MGR_NOT_ENABLED
  • VAPI_ERR_NO_RESOURCE_ALLOC
  • VAPI_ERR_NO_RESOURCE
  • VAPI_ERR_INVALID_RESOURCE
  • VAPI_ERR_UNKNOWN_RESOURCE


usage

        U8 res = eResG729e;

        /* allocate resource for G729 operation */
        result = VAPI_SetConnectionResource(device_id, endpoint_id, 1, &res);


Commands: List of Comcerto commands sent:

  • NONE
VSTATUS VAPI_SetResourceManager ( IN DEVID  DevId,
IN EResAction  eResAction,
OUT U16 pusQueryInfo 
)


Description:
This API is used to enable, disable or query the VAPI resource manager on a device.
The VAPI resource manager also allows the application to know how many resources is available for different types of codec and packet size.
The VAPI resource manager operates at device level, this means that the resources are calculated per device.
The VAPI resource manager is by default disabled. It can't be disabled or enabled when some connections are currently created

Inputs-Outputs
DevId Id of the device to enable the resource manager on
eResAction Action to perform
pucQueryInfo Pointer to buffer to hold the availability information in case of query.
A NUM_RESOURCES buffer size must be allocated by the application to store the resources information. The format of the returned information is this one:
		Resource type		Number of available resource
		eG711 20			160
		eG711 10			112
		eG711 5				66
		eG726 20			98
		eG726 10			88
		eG726 5				60
		eG729a 20			72
		eG729a 10			62
		....				....
		
Check the ECodecResourceIndex (in vapi.h) for the full list of resources type definition.


Returns:

  • SUCCESS
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_RES_MGR_NOT_ENABLED
  • VAPI_ERR_NULL_POINTER_PASSED
  • VAPI_ERR_INVALID_PARAM


Usage:

        /* Enable the ressource manager */
        result  = VAPI_SetResourceManager(0, eResourceEnable, NULL);
        if (result != SUCCESS)
                error_handler()
...


        /*Print the available ressource*/
        U16 current_res[VAPI_NUM_RESOURCES];

...
        result = VAPI_SetResourceManager(device_id, eResourceQuery, current_res);
        printf("initial resources\n");
        for (i = 0; i < VAPI_NUM_RESOURCES; i++)
                printf("res %d = %d\n", i, current_res[i]);


Commands:

  • No Comcerto commands sent.



Mindspeed Technologies ®
Mindspeed Proprietary and Confidential