当前位置: 首页>>代码示例>>Java>>正文


Java CIRControl类代码示例

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


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

示例1: ConsumerIrManagerHtc

import com.htc.circontrol.CIRControl; //导入依赖的package包/类
public ConsumerIrManagerHtc(Context context) {
	super(context);
	mContext = context;
	mControl = new CIRControl(context, mHandler);

	//supportedAPIs = supportedAPIs & HTCSUPPORT;
}
 
开发者ID:tihtw,项目名称:irdb-android,代码行数:8,代码来源:ConsumerIrManagerHtc.java

示例2: handleMessage

import com.htc.circontrol.CIRControl; //导入依赖的package包/类
@Override
    public void handleMessage(Message msg)
    {
        Log.d(TAG, "handleMessage: WTF " + msg.what);

        Log.d(TAG, "mOnLearnListener: " + mOnLearnListener);

        if(msg.what == CIRControl.MSG_RET_LEARN_IR && mOnLearnListener != null){
            OnLearnListener listener = mOnLearnListener.get();
            if(listener != null) {
                if (msg.arg1 != CIRControl.ERR_NONE) {
                    listener.onError(""+msg.arg1);
                    return;
                }

                UUID rid = (UUID) msg.getData().getSerializable(CIRControl.KEY_RESULT_ID);
                Log.d(TAG, "Receive IR Returned UUID: " + rid);


                HtcIrData mLearnKey = (HtcIrData) msg.getData().getSerializable(CIRControl.KEY_CMD_RESULT);

                //HTC IR DATA to IRDB IR DATA
                int[] frame = HtcIrFrameToIrdbIrFrame(mLearnKey.getFrame());

                JSONObject jsonObject = new JSONObject();
                try {
                    jsonObject.put("format", "raw");
                    jsonObject.put("freq", mLearnKey.getFrequency() / 1000.0);
                    jsonObject.put("data", new JSONArray(frame));

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                listener.onLearn(jsonObject.toString());

}
        }
    }
 
开发者ID:tihtw,项目名称:irdb-android,代码行数:40,代码来源:ConsumerIrManagerHtc.java

示例3: HtcInfrared

import com.htc.circontrol.CIRControl; //导入依赖的package包/类
public HtcInfrared(Context c) throws Exception{
	super();
	try{
		mHandler = new IrMessageHandler();
		mCirControl = new CIRControl(c, mHandler);
		mCirControl.start();			
	} catch (NoClassDefFoundError ncde){
		throw new Exception("No HTC Device");
	}
	super.init();

}
 
开发者ID:nibdev,项目名称:otrta,代码行数:13,代码来源:HtcInfrared.java

示例4: handleMessage

import com.htc.circontrol.CIRControl; //导入依赖的package包/类
@Override
public void handleMessage(android.os.Message msg) {

	int messageType = msg.what;
	int errorId = msg.arg1;

	
	if (messageType == CIRControl.MSG_RET_CANCEL){
		if (mCancelFinishedListener != null) mCancelFinishedListener.onCanceled();
	}
	
	if (messageType == CIRControl.MSG_RET_STARTED){
		if (mStartedListener != null) mStartedListener.onStarted();

	}else if (messageType == CIRControl.MSG_RET_LEARN_IR){
		if (errorId == CIRControl.ERR_NONE){
			HtcIrData mLearnCode = (HtcIrData) msg.getData().getSerializable(CIRControl.KEY_CMD_RESULT);
			if (mCodeLearnedListener != null) mCodeLearnedListener.onCodeLearned(mLearnCode, "");
		}else{
			if (errorId == CIRControl.ERR_PULSE_ERROR){
				if (mCodeLearnedListener != null) mCodeLearnedListener.onCodeLearned(null, "PULSE ERROR");
			}else if (errorId == CIRControl.ERR_OUT_OF_FREQ){
				if (mCodeLearnedListener != null) mCodeLearnedListener.onCodeLearned(null, "OUT OF FREQUENCY");
			}else if (errorId == CIRControl.ERR_LEARNING_TIMEOUT){
				if (mCodeLearnedListener != null) mCodeLearnedListener.onCodeLearned(null, "Learning Timeout");
			}else{
				if (mCodeLearnedListener != null) mCodeLearnedListener.onCodeLearned(null, "Unknown Error Id: " + errorId);
			}
		}
	}
}
 
开发者ID:nibdev,项目名称:otrta,代码行数:32,代码来源:IrMessageHandler.java


注:本文中的com.htc.circontrol.CIRControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。