view src/cs/services/vibr/vibr_env.c @ 301:4bb5772a05a3

AT%SPVER: new command for setting custom speech version lists The speech version list in the Bearer Capability IE tells the network which speech codecs are supported by the MS, and in which order of preference. The standard behaviour is to list all codecs that are supported by the hw+fw platform, and the standard preference order is newer over older, FR over HR. But sometimes it is desirable (for network testing) to artificially restrict which codecs the test MS will declare as supported, and/or to list them in some peculiar non-standard order of preference. Add a new private AT command, AT%SPVER, allowing the user to set and clear custom speech version lists for the Bearer Capability IE composer in CC.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 May 2023 21:43:10 +0000
parents e17bdedfbf2b
children
line wrap: on
line source

/*
 * This module provides the glue to the RiViera environment
 * for our VIBR SWE.
 */

#include "vibr/vibr_env.h"
#include "rv/rv_general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_priorities.h"
#include "rvm/rvm_api.h"
#include "rvm/rvm_use_id_list.h"
#include <string.h>

/* global control block for our SWE */
struct vibr_env *vibr_env;

/* Define global pointer to the error function */
static T_RVM_RETURN (*xxx_error_ft) (T_RVM_NAME    swe_name,
                                     T_RVM_RETURN  error_cause,
                                     T_RVM_ERROR_TYPE  error_type,
                                     T_RVM_STRING   error_msg);

T_RVM_RETURN vibr_get_info (T_RVM_INFO_SWE  *infoSWE)
{
   /* SWE info */

   infoSWE->swe_type = RVM_SWE_TYPE_4;
   infoSWE->type_info.type4.swe_use_id = VIBR_USE_ID;
   memcpy( infoSWE->type_info.type4.swe_name, "VIBR", 5 );

   infoSWE->type_info.type4.stack_size = VIBR_STACK_SIZE;
   infoSWE->type_info.type4.priority   = RVM_VIBR_TASK_PRIORITY;

   /* memory bank info */
   infoSWE->type_info.type4.nb_mem_bank = 1;

   memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "VIBR_PRIM", 10);
   infoSWE->type_info.type4.mem_bank[0].initial_params.size          = VIBR_MB_PRIM_SIZE;
   infoSWE->type_info.type4.mem_bank[0].initial_params.watermark     = VIBR_MB_PRIM_WATERMARK;

   /* linked SWE info: none */
   infoSWE->type_info.type4.nb_linked_swe = 0;

   /* generic functions */
   infoSWE->type_info.type4.set_info = vibr_set_info;
   infoSWE->type_info.type4.init     = vibr_init;
   infoSWE->type_info.type4.core     = vibr_core;
   infoSWE->type_info.type4.stop     = vibr_stop;
   infoSWE->type_info.type4.kill     = vibr_kill;

   /* Set the return path */
   infoSWE->type_info.type4.return_path.callback_func = NULL;
   infoSWE->type_info.type4.return_path.addr_id	      = 0;

   return RV_OK;
}

T_RVM_RETURN vibr_set_info(T_RVF_ADDR_ID   addr_id,
                           T_RV_RETURN     return_path[],
                           T_RVF_MB_ID     mbId[],
                           T_RVM_RETURN  (*callBackFct) (T_RVM_NAME SWEntName,
                                                         T_RVM_RETURN errorCause,
                                                         T_RVM_ERROR_TYPE errorType,
                                                         T_RVM_STRING errorMsg))
{

    T_RVF_MB_STATUS   mb_status;

    mb_status = rvf_get_buf(mbId[0],sizeof(struct vibr_env),(void **) &vibr_env);
    if (mb_status == RVF_RED) 
    {
        rvf_send_trace("vibr_set_info: rvf_get_buf() failed", 35,
                       NULL_PARAM, RV_TRACE_LEVEL_ERROR, VIBR_USE_ID);
        return (RVM_MEMORY_ERR);
    }
    memset(vibr_env, 0, sizeof(struct vibr_env));

    /* store the pointer to the error function */
    xxx_error_ft = callBackFct ;

    /* Store the addr id */
    vibr_env->addr_id = addr_id;

    /* Store the memory bank id */
    vibr_env->prim_id = mbId[0];

    return RV_OK;
}

T_RVM_RETURN vibr_init(void)
{
   return RV_OK;
}

T_RVM_RETURN vibr_stop(void)
{
   return RV_OK;
}

T_RVM_RETURN vibr_kill(void)
{
   /* free all memory buffer previously allocated */
   rvf_free_buf ((void *) vibr_env);

   return RV_OK;
}