本文整理汇总了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;
}
示例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());
}
}
}
示例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();
}
示例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);
}
}
}
}