Search in sources :

Example 1 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class PerfInParaCache method put.

public void put(String key, String newValue) {
    InPara outPara = inParaMap.get(key);
    if (null == outPara) {
        // 没注册就put不允许
        return;
    }
    outPara.setKey(key);
    List<String> values = outPara.getValues();
    if (values != null) {
        values.add(0, newValue);
    }
// 先不需要这句,只有注册才需要,普通的put前一定是注册过的
//		outParaMap.put(key, outPara);
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Example 2 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DataCacheController method getInParaFromCache.

/**
	 * 获取缓存中的出参值,只有在Connecting态才应该走缓存
	 * @param paraName
	 * @return
	 */
public String getInParaFromCache(String paraName) {
    if (null == paraName || inParaCache == null) {
        return null;
    }
    InPara result = inParaCache.get(paraName);
    if (result == null || InPara.DISPLAY_DISABLE == result.getDisplayProperty()) {
        return null;
    }
    List<String> values = result.getValues();
    if (values != null && values.size() > 0) {
        return values.get(0);
    }
    return null;
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Example 3 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DataCacheController method setInPara.

/**
	 * 只有在Connecting态才应该走缓存,Connected态应直接送队列,这个是直接送队列
	 */
public void setInPara(String paraName, Object newValue, boolean isGlobal) {
    InPara inPara = new InPara();
    inPara.setKey(paraName);
    if (newValue == null) {
        newValue = "";
    }
    List<String> values = new ArrayList<String>();
    values.add(newValue.toString());
    inPara.setValues(values);
    inPara.setGlobal(isGlobal);
    paraTaskCache.add(inPara);
}
Also used : InPara(com.tencent.wstt.gt.InPara) ArrayList(java.util.ArrayList)

Example 4 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DataCacheController method transParasToConsole.

/**
	 * 将缓存中的出入参数据全部传给控制台(注册与设值),
	 * 完成后将outParaCache这个一次性缓存清理掉
	 */
public void transParasToConsole() {
    /*
		 * 1.入参
		 */
    if (inParaCache != null) {
        Collection<InPara> inParas = inParaCache.getAll();
        if (inParas != null) {
            for (InPara para : inParas) {
                // 加消费者队列
                paraTaskCache.add(para);
            }
        }
        // 完成后将outParaCache这个一次性缓存清理掉
        inParaCache.clear();
        inParaCache = null;
    }
    /*
		 * 2.出参
		 */
    if (outParaCache != null) {
        Collection<OutPara> outParas = outParaCache.getAll();
        if (outParas != null) {
            for (OutPara para : outParas) {
                // 加消费者队列
                paraTaskCache.add(para);
            }
            // 完成后将outParaCache这个一次性缓存清理掉
            outParaCache.clear();
            outParaCache = null;
        }
    }
}
Also used : InPara(com.tencent.wstt.gt.InPara) OutPara(com.tencent.wstt.gt.OutPara)

Example 5 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class ConnectedState method getInPara.

@Override
public float getInPara(String paraName, float origVal, boolean isGlobal) {
    // connected态的这个方法需要直接调aidl接口
    InPara iv = getInPara(paraName, isGlobal);
    float result = origVal;
    if (null != iv) {
        if (InPara.DISPLAY_DISABLE == iv.getDisplayProperty()) {
            result = origVal;
        } else {
            List<String> vals = iv.getValues();
            String val = vals.get(0);
            if (val.equals("<null>")) {
                result = 0;
            } else if (matchInParaType(val, "float")) {
                result = Float.parseFloat(vals.get(0));
            }
        }
    }
    return result;
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Aggregations

InPara (com.tencent.wstt.gt.InPara)30 ArrayList (java.util.ArrayList)4 ParamConst (com.tencent.wstt.gt.manager.ParamConst)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 OutPara (com.tencent.wstt.gt.OutPara)1