• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java HciErrorCode类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.sinovoice.hcicloudsdk.common.HciErrorCode的典型用法代码示例。如果您正苦于以下问题:Java HciErrorCode类的具体用法?Java HciErrorCode怎么用?Java HciErrorCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

HciErrorCode类属于com.sinovoice.hcicloudsdk.common包,在下文中一共展示了HciErrorCode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initHciCloud

点赞 3

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
protected void initHciCloud() {
    InitParam initparam = new InitParam();
    String authDirPath = getFilesDir().getAbsolutePath();
    initparam.addParam(InitParam.AuthParam.PARAM_KEY_AUTH_PATH, authDirPath);
    initparam.addParam(InitParam.AuthParam.PARAM_KEY_AUTO_CLOUD_AUTH, "no");
    initparam.addParam(InitParam.AuthParam.PARAM_KEY_CLOUD_URL, "test.api.hcicloud.com:8888");
    initparam.addParam(InitParam.AuthParam.PARAM_KEY_DEVELOPER_KEY, "0a5e69f8fb1c019b2d87a17acf200889");
    initparam.addParam(InitParam.AuthParam.PARAM_KEY_APP_KEY, "0d5d5466");
    String logDirPath = FileUtils.createRootPath(this) + "/hcicloud";
    FileUtils.createDir(logDirPath);
    initparam.addParam(InitParam.LogParam.PARAM_KEY_LOG_FILE_PATH, logDirPath);
    initparam.addParam(InitParam.LogParam.PARAM_KEY_LOG_FILE_COUNT, "5");
    initparam.addParam(InitParam.LogParam.PARAM_KEY_LOG_FILE_SIZE, "1024");
    initparam.addParam(InitParam.LogParam.PARAM_KEY_LOG_LEVEL, "5");
    int errCode = HciCloudSys.hciInit(initparam.getStringConfig(), this);
    if (errCode != HciErrorCode.HCI_ERR_NONE) {
        LogUtils.e("HciCloud初始化失败" + errCode);
        return;
    }
    LogUtils.e("HciCloud初始化成功");
}
 

开发者ID:weiwenqiang,
项目名称:GitHub,
代码行数:22,
代码来源:ReaderApplication.java

示例2: init

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * HciCloudϵͳ��ʼ��
 * @param context
 * @return
 * 
 */
public int init(Context context) {
    String initConfig = getInitConfig(context);
    Log.i(TAG, "initConfig: " + initConfig);

    // ��ʼ��
    int initErrorCode = HciCloudSys.hciInit(initConfig, context);
    if (initErrorCode != HciErrorCode.HCI_ERR_NONE) {
        Log.e(TAG, "hciInit error. initErrorCode: " + initErrorCode);
    } else {
        Log.i(TAG, "hciInit success.");
    }
    
    return initErrorCode;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:21,
代码来源:HciCloudSysHelper.java

示例3: checkExpireTime

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * �����Ȩ����ʱ��
 * 
 * @return
 */
public int checkExpireTime() {
	int result = ERRORCODE_NONE;
	
    AuthExpireTime expireTime = new AuthExpireTime();
    int errorCode = HciCloudSys.hciGetAuthExpireTime(expireTime);
    Log.d(TAG, "hciGetAuthExpireTime(), errorCode: " + errorCode);
    
    if (errorCode == HciErrorCode.HCI_ERR_SYS_AUTHFILE_INVALID) {
        // ��Ȩ�ļ������ڻ�Ƿ�
    	result = ERRORCODE_AUTH_FILE_INVALID;
    } else if (errorCode == HciErrorCode.HCI_ERR_NONE) {
        // ��ȡ�ɹ����жϹ���ʱ��
        long expireTimeValue = expireTime.getExpireTime();
        long currTime = System.currentTimeMillis();

        // �������ʱ��ms�����˴�Ϊ1��
        final long TIME_DIFFERENCE_MAX = 1 * 24 * 3600 * 1000L;
        long timeDifference = expireTimeValue * 1000 - currTime;

        if(timeDifference < 0){
        	result = ERRORCODE_AUTH_FILE_HAS_EXPIRED;
        }else if (timeDifference < TIME_DIFFERENCE_MAX) {
            // ʱ����С���趨��ֵ
        	result = ERRORCODE_AUTH_FILE_WILL_EXPIRED;
        }else{
        	Log.v(TAG, "authfile expireTime is valid.");
        }
    } else {
        //
    	Log.e(TAG, "�������������");
    }
    
    return result;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:40,
代码来源:HciCloudSysHelper.java

示例4: checkAuthByNet

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * ������ȡ��Ȩ
 * 
 * @return 
 */
public int checkAuthByNet() {
    int errorCode = HciCloudSys.hciCheckAuth();
    Log.v(TAG, "hciCheckAuth(), errorCode: " + errorCode);
    
    if(errorCode == HciErrorCode.HCI_ERR_NONE){
    	Log.v(TAG, "hciCheckAuth success.");
    }else{
    	Log.e(TAG, "hciCheckAuth fail.");
    }
    return errorCode;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:17,
代码来源:HciCloudSysHelper.java

示例5: checkCapkeysEnable

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * ���ȫ��capkey�Ƿ����
 * 
 * @return
 */
public int checkCapkeysEnable() {
	int errorCode = HciErrorCode.HCI_ERR_NONE;
    for (String capKey : SysConfig.ALL_CAPKEY_ARRAY) {
        CapabilityItem item = new CapabilityItem();
        errorCode = HciCloudSys.hciGetCapability(capKey, item);
        item = null;
        if (errorCode != HciErrorCode.HCI_ERR_NONE) {
            Log.e(TAG, "hciGetCapability() fail, code: " + errorCode + ", capKey: " + capKey);
            break;
        }
    }
    return errorCode;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:19,
代码来源:HciCloudSysHelper.java

示例6: drawPenScript

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * ���Ʊ�ʽ��Ч��
 * 
 * @param x
 * @param y
 */
private void drawPenScript(int x, int y) {
	int penScriptResult = HWRManager.instance().penScript(x, y);

	Canvas canvas = new Canvas(this.mPenScriptBitmap);
	if (penScriptResult == HciErrorCode.HCI_ERR_NONE) {
		List<HwrPenScriptResultItem> items = HWRManager
				.instance().getPenScriptRetList();
		for (int k = 0; k < items.size(); k++) {

			HwrPenScriptResultItem item = items.get(k);
			short[] pageImg = item.getPageImg();
			long colorL = item.getPenColor();

			// ��unsigned ��ֵ��Ϊ ��ɫֵ
			colorL = colorL & 0xffffffL;
			colorL = colorL | 0xff000000L;
			mBrushPaint.setColor((int) colorL);

			for (int h = 0; h < item.getHeight(); h++) {
				for (int w = 0; w < item.getWidth(); w++) {
					int pos = h * item.getWidth() + w;
					if (pageImg[pos] == 0) {
						canvas.drawPoint(w + item.getX(), h + item.getY(),
								mBrushPaint);
					}
				}
			}
		}
	} else {
		StrokeMgr.instance().isBrush = false;
	}
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:39,
代码来源:StrokeView.java

示例7: uninitCloudHWR

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
private boolean uninitCloudHWR(Session session){
    int result = HciCloudHwr.hciHwrSessionStop(session);
	Log.v(TAG, "hwr session stop result:" + result);
	
	if(result != HciErrorCode.HCI_ERR_NONE){
		return false;
	}
	
	mIsReleaseSuccess = true;
	return true;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:12,
代码来源:HWRManager.java

示例8: initHwr

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
    * ��ʼ�����Ƶ�hwr����
    */
private void initHwr() {
	int errorCode = mCLoudHwrHelper.init(getApplicationContext());
	if (errorCode  == HciErrorCode.HCI_ERR_NONE) {
		mHciHwrInited = true;
		Log.d(TAG, "mHciHwrInited: " + mHciHwrInited);
	}else{
		Log.e(TAG, "hwr init fatal. errorCode: " + errorCode);
		return;
	}
	
	//Hwr Manager
	mHwrManager.prepareRecog();
	mHwrManager.setOnHwrRecogResultChangedListener(this);
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:18,
代码来源:Pathfinder.java

示例9: handleMessage

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
	Pathfinder pathfinder = mOuter.get();
	if(pathfinder == null){
		Log.e(TAG, "pathfinder is null.");
		return;
	}
	
	switch (msg.what) {
	case MSG_WHAT_CHECK_AUTH_FINISH:
		int errorCode = msg.arg1;
		if (errorCode  == HciErrorCode.HCI_ERR_NONE) {
			pathfinder.mHciSysInited = pathfinder.checkExpireTimeAndCapkeys();
			Log.d(TAG, "handlerMessage(), mHciSysInited: " + pathfinder.mHciSysInited);
			
			if(pathfinder.mHciSysInited){
				pathfinder.initHwr();
			}
        }
		break;
	case MSG_WHAT_ASR_RESULT:
	    String asrResult = (String) msg.obj;
	    Log.i(TAG, "handler, asr result = " + asrResult);
	    
	    pathfinder.getCurrentInputConnection().commitText(asrResult, 1);
	    pathfinder.updateCandidates();
	    break;
	default:
		break;
	}
	super.handleMessage(msg);
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-pathfinder,
代码行数:33,
代码来源:Pathfinder.java

示例10: onCreate

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	
    mAccountInfo = AccountInfo.getInstance();
       boolean loadResult = mAccountInfo.loadAccountInfo(this);
       if (loadResult) {
           // ������Ϣ�ɹ�����������
       	Log.i(TAG, "���������˺ųɹ�");
       } else {
           // ������Ϣʧ�ܣ���ʾʧ�ܽ���
       	Log.e(TAG, "���������˺�ʧ�ܣ�����assets/AccountInfo.txt�ļ�����д��ȷ�������˻���Ϣ���˻���Ҫ��www.hcicloud.com������������ע�����롣");
       	
           return;
       }
	
	mHciCloudSysHelper = HciCloudSysHelper.getInstance();
	
	// �˷������߳������ģ����ҽ����н�����زŻ��������ִ�С�
       // �˴�ֻ����ʾ�ϳ������÷���û�жԺ�ʱ�������д�����Ҫ�����߷����̨�߳̽��г�ʼ������
       // �������ȵ���HciCloudSys�ij�ʼ������
       int sysInitResult = mHciCloudSysHelper.init(this);
       if (sysInitResult != HciErrorCode.HCI_ERR_NONE) {
           Log.e(TAG, "hci init error, error code = " + sysInitResult);
           
           return;
       }
	
       //��ȡ¼����������ʵ��
	mHciCloudAsrRecorderHelper = HciCloudAsrRecorderHelper.getInstance();
	
	//����UI��Ϣ��������¼����������ʵ����
	mUIHandler = new WeakRefHandler(this);
	mHciCloudAsrRecorderHelper.setUIHandler(mUIHandler);
	
       //��ʼ���ؼ�
     	initView();
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-voicewake,
代码行数:40,
代码来源:HciCloudAsrRecorderActivity.java

示例11: initRecorder

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * ��ʼ��������
 */
public void initRecorder() {
	int asrInitResult = mHciCloudAsrRecorderHelper.init(this);
       if (asrInitResult != HciErrorCode.HCI_ERR_NONE) {
           Log.e(TAG, "asrRecorder init error, error code = " + asrInitResult);
           
           return;
       }
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-voicewake,
代码行数:12,
代码来源:HciCloudAsrRecorderActivity.java

示例12: init

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * HciCloudϵͳ��ʼ��
 * 
 * @return ��ʼ��״̬���ɹ���ʧ��
 */
public int init(Context context) {
    // ������Ϣ,����InitParam, ������ò������ַ���
    InitParam initParam = getInitParam(context);
    String strConfig = initParam.getStringConfig();
    Log.i(TAG, "strConfig value:" + strConfig);

    // ��ʼ��
    int initResult = HciCloudSys.hciInit(strConfig, context);
    if (initResult != HciErrorCode.HCI_ERR_NONE) {
        Log.e(TAG, "hciInit error: " + initResult);

        return initResult;
    } else {
        Log.i(TAG, "hciInit success");
    }

    // ��ȡ��Ȩ/������Ȩ�ļ� :
    initResult = checkAuth();
    if (initResult != HciErrorCode.HCI_ERR_NONE) {
        // ����ϵͳ�Ѿ���ʼ���ɹ�,�ڽ���ǰ��Ҫ���÷���hciRelease()����ϵͳ�ķ���ʼ��
        HciCloudSys.hciRelease();
        return initResult;
    }

    return HciErrorCode.HCI_ERR_NONE;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-voicewake,
代码行数:32,
代码来源:HciCloudSysHelper.java

示例13: init

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * Asr�����ʼ�� 
 * �������� : AsrInitParam:�����ʵ��ͨ��addParam(key, value)�ķ�ʽ���Asr��ʼ���IJ���,
 * ��ͨ��getStringConfig() ��ȡ��ʼ��ʱ��Ҫ���ַ������� config ��ʼ������:
 * HciCloudAsr.hciAsrInit(config)
 */
public int init(Context context) {
	this.mCapKey = AccountInfo.getInstance().getCapKey();
	this.mContext = context;
	this.mActivity = (HciCloudAsrRecorderActivity)context;

	// ���ó�ʼ������
	mAsrInitParam = new AsrInitParam();
	String asrDirPath = mContext.getFilesDir().getPath().replace("files", "lib");
	mAsrInitParam.addParam(AsrInitParam.PARAM_KEY_INIT_CAP_KEYS, mCapKey);
	mAsrInitParam.addParam(AsrInitParam.PARAM_KEY_DATA_PATH, asrDirPath);
	mAsrInitParam.addParam(AsrInitParam.PARAM_KEY_FILE_FLAG, "android_so");
	
	// ��ʼ��¼��������
	if (mAsrRecorder == null) {
		mAsrRecorder = new ASRRecorder();
	}
	mAsrRecorder.init(mAsrInitParam.getStringConfig(),
			new ASRResultProcess());
	
	Log.v(TAG, "init parameters:" + mAsrInitParam.getStringConfig());	
	
	// ����ʶ�����
	mAsrConfig = new AsrConfig();
	// PARAM_KEY_CAP_KEY ����ʹ�õ�����
	mAsrConfig.addParam(AsrConfig.PARAM_KEY_CAP_KEY, mCapKey);
	// PARAM_KEY_AUDIO_FORMAT ��Ƶ��ʽ���ݲ�ͬ������ʹ�ò��õ���Ƶ��ʽ
	mAsrConfig.addParam(AsrConfig.PARAM_KEY_AUDIO_FORMAT,
			AsrConfig.HCI_ASR_AUDIO_FORMAT_PCM_16K16BIT);
	// PARAM_KEY_ENCODE ��Ƶ����ѹ����ʽ��ʹ��OPUS������Ч��С��������
	// asrConfig.addParam(AsrConfig.PARAM_KEY_ENCODE, "opus");
	
	//��������¼��
	mAsrConfig.addParam(AsrConfig.PARAM_KEY_CONTINUOUS, "yes");
	mAsrConfig.addParam(AsrConfig.PARAM_KEY_REALTIME, "yes");
	
	// �﷨��ص�����,��ʹ������˵�������Բ������ø���
	if (mCapKey.contains("grammar")) {
		mGrammar = loadGrammar("wordlist_utf8.txt");
		
		// ���ر����﷨��ȡ�﷨ID
		AsrGrammarId id = new AsrGrammarId();
		
		long startTime = System.currentTimeMillis();
		ASRRecorder.loadGrammar("grammarType=wordlist", mGrammar, id);
		long usedTime = System.currentTimeMillis() - startTime;
		
		Log.v(TAG, "loadGrammar usedTime = " + usedTime + "ms");
		
		// PARAM_KEY_GRAMMAR_TYPE �﷨���ͣ�ʹ������˵����ʱ���������´˲���
		mAsrConfig.addParam(AsrConfig.PARAM_KEY_GRAMMAR_TYPE,
				AsrConfig.HCI_ASR_GRAMMAR_TYPE_ID);
		mAsrConfig.addParam(AsrConfig.PARAM_KEY_GRAMMAR_ID,
				"" + id.getGrammarId());
	}

	return HciErrorCode.HCI_ERR_NONE;
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-voicewake,
代码行数:64,
代码来源:HciCloudAsrRecorderHelper.java

示例14: checkAuth

点赞 2

import com.sinovoice.hcicloudsdk.common.HciErrorCode; //导入依赖的package包/类
/**
 * ��ȡ��Ȩ
 * 
 * @return true �ɹ�
 */
private int checkAuth() {
    // ��ȡϵͳ��Ȩ����ʱ��
    int initResult;
    AuthExpireTime objExpireTime = new AuthExpireTime();
    initResult = HciCloudSys.hciGetAuthExpireTime(objExpireTime);
    if (initResult == HciErrorCode.HCI_ERR_NONE) {
        // ��ʾ��Ȩ����,���û�����Ҫ��ע��ֵ,�˴�����ɺ���
        Date date = new Date(objExpireTime.getExpireTime() * 1000);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd",
                Locale.CHINA);
        Log.i(TAG, "expire time: " + sdf.format(date));

        if (objExpireTime.getExpireTime() * 1000 < System
                .currentTimeMillis()) {
            // ��ȡ��Ȩ����, ����ֵΪ������
            Log.i(TAG, "expired date");

            initResult = HciCloudSys.hciCheckAuth();
            if (initResult == HciErrorCode.HCI_ERR_NONE) {
                Log.i(TAG, "checkAuth success");
                return initResult;
            } else {
                Log.e(TAG, "checkAuth failed: " + initResult);
                return initResult;
            }
        } else {
            // �Ѿ��ɹ���ȡ����Ȩ,���Ҿ�����Ȩ�����г����ʱ��(>7��)
            Log.i(TAG, "checkAuth success");
            return initResult;
        }
    } else if (initResult == HciErrorCode.HCI_ERR_SYS_AUTHFILE_INVALID) {
        // �����ȡAuth�ļ�ʧ��(�����һ������,��û����Ȩ�ļ�),��ʼ��ȡ��Ȩ
        Log.i(TAG, "authfile invalid");

        initResult = HciCloudSys.hciCheckAuth();
        if (initResult == HciErrorCode.HCI_ERR_NONE) {
            Log.i(TAG, "checkAuth success");
            return initResult;
        } else {
            Log.e(TAG, "checkAuth failed: " + initResult);
            return initResult;
        }
    } else {
        // ����ʧ��ԭ��,�����SDK�����ĵ���"�����ֶ�ֵ"�еĴ�����ĺ������������
        Log.e(TAG, "getAuthExpireTime Error:" + initResult);
        return initResult;
    }
}
 

开发者ID:open-sinovoice,
项目名称:sinovoice-voicewake,
代码行数:54,
代码来源:HciCloudSysHelper.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)