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


Java ConsumerIrManager类代码示例

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


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

示例1: onCreate

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content_main);
    irManager = (ConsumerIrManager) getSystemService(CONSUMER_IR_SERVICE);

    findViewById(R.id.tvpower).setOnClickListener(new ClickListener(hex2ir(CMD_TV_POWER)));
    findViewById(R.id.tvsource).setOnClickListener(new ClickListener(hex2ir(CMD_TV_SOURCE)));
    findViewById(R.id.tvchnext).setOnClickListener(new ClickListener(hex2ir(CMD_TV_CH_NEXT)));
    findViewById(R.id.tvchprev).setOnClickListener(new ClickListener(hex2ir(CMD_TV_CH_PREV)));
    findViewById(R.id.tvback).setOnClickListener(new ClickListener(hex2ir(CMD_TV_BACK)));
    findViewById(R.id.tvleft).setOnClickListener(new ClickListener(hex2ir(CMD_TV_LEFT)));
    findViewById(R.id.tvright).setOnClickListener(new ClickListener(hex2ir(CMD_TV_RIGHT)));
    findViewById(R.id.tvok).setOnClickListener(new ClickListener(hex2ir(CMD_TV_ENTER)));

    findViewById(R.id.sbpower).setOnClickListener(new ClickListener(hex2ir(CMD_SB_POWER)));
    findViewById(R.id.sbsource).setOnClickListener(new ClickListener(hex2ir(CMD_SB_SOURCE)));
    findViewById(R.id.sbvoldown).setOnClickListener(new ClickListener(hex2ir(CMD_SB_VOLDOWN)));
    findViewById(R.id.sbvolup).setOnClickListener(new ClickListener(hex2ir(CMD_SB_VOLUP)));
}
 
开发者ID:j4velin,项目名称:IR-Remote,代码行数:21,代码来源:MainActivity.java

示例2: checkInfrared

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
private void checkInfrared() {
    if (mIrManager.hasIrEmitter()) {

        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
            // On KitKat, check if we're using 4.4.3+ API
            int lastIdx = Build.VERSION.RELEASE.lastIndexOf(".");
            int VERSION_MR = Integer.valueOf(Build.VERSION.RELEASE.substring(lastIdx + 1));
            mIsUsingNewApi = (VERSION_MR >= 3);
        } else {
            mIsUsingNewApi = true;
        }

        ConsumerIrManager.CarrierFrequencyRange[] freqs = mIrManager.getCarrierFrequencies();
        if (freqs != null) {
            for (ConsumerIrManager.CarrierFrequencyRange freq : freqs) {
                int carrierFreq = MahouCode.getCarrierFrequency();
                mCanTransmitCode = ((carrierFreq >= freq.getMinFrequency()) && (carrierFreq <= freq.getMaxFrequency()));
            }
        }
    }
}
 
开发者ID:daveenguyen,项目名称:NezumimiApp,代码行数:22,代码来源:MainActivity.java

示例3: onCreate

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
/**
 * Initialization of the Activity after it is first created.  Must at least
 * call {@link android.app.Activity#setContentView setContentView()} to
 * describe what is to be displayed in the screen.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Be sure to call the super class.
    super.onCreate(savedInstanceState);

    // Get a reference to the ConsumerIrManager
    mCIR = (ConsumerIrManager)getSystemService(Context.CONSUMER_IR_SERVICE);

    // See assets/res/any/layout/consumer_ir.xml for this
    // view layout definition, which is being set here as
    // the content of our screen.
    setContentView(R.layout.consumer_ir);

    // Set the OnClickListener for the button so we see when it's pressed.
    findViewById(R.id.send_button).setOnClickListener(mSendClickListener);
    findViewById(R.id.get_freqs_button).setOnClickListener(mGetFreqsClickListener);
    mFreqsText = (TextView) findViewById(R.id.freqs_text);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:24,代码来源:ConsumerIr.java

示例4: onClick

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
public void onClick(View v) {
    StringBuilder b = new StringBuilder();

    if (!mCIR.hasIrEmitter()) {
        mFreqsText.setText("No IR Emitter found!");
        Log.e(TAG, "No IR Emitter found!\n");
        return;
    }

    // Get the available carrier frequency ranges
    ConsumerIrManager.CarrierFrequencyRange[] freqs = mCIR.getCarrierFrequencies();
    b.append("IR Carrier Frequencies:\n");
    for (ConsumerIrManager.CarrierFrequencyRange range : freqs) {
        b.append(String.format("    %d - %d\n", range.getMinFrequency(),
                    range.getMaxFrequency()));
    }
    mFreqsText.setText(b.toString());
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:19,代码来源:ConsumerIr.java

示例5: onCreate

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	TextView textView = (TextView)findViewById(R.id.textview);
	
	ConsumerIrManager manager = (ConsumerIrManager) getSystemService(CONSUMER_IR_SERVICE);
	
	StringBuilder builder = new StringBuilder();
	
	builder.append("ConsumerIrManager.hasIrEmitter()=");
	builder.append(manager.hasIrEmitter());
	Log.d(TAG, "----------------");
	Log.d(TAG, builder.toString());
	Log.d(TAG, "----------------");	
	
	if( manager.hasIrEmitter() == true){
		CarrierFrequencyRange[] ranges = manager.getCarrierFrequencies();
		for(CarrierFrequencyRange range : ranges){
			builder.append(range.getMinFrequency());
			builder.append("/");
			builder.append(range.getMaxFrequency());
			builder.append(" : ");
		}
	}
	textView.setText(builder.toString());

}
 
开发者ID:cafedeaqua,项目名称:IR-blaster-sample,代码行数:30,代码来源:MainActivity.java

示例6: RNIRManagerModule

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
public RNIRManagerModule(ReactApplicationContext reactContext) {
  super(reactContext);
  manager = (ConsumerIrManager) reactContext.getSystemService(CONSUMER_IR_SERVICE);
}
 
开发者ID:danielr18,项目名称:react-native-ir-manager,代码行数:5,代码来源:RNIRManagerModule.java

示例7: getConsumerIrManager

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
/**
 * 返回 {@link ConsumerIrManager}
 */
public static ConsumerIrManager getConsumerIrManager()
{
    return (ConsumerIrManager) get(CONSUMER_IR_SERVICE);
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:8,代码来源:Managers.java

示例8: getConsumerIrManager

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@TargetApi(19)
public static ConsumerIrManager getConsumerIrManager() {
    return (ConsumerIrManager) getSystemService(Context.CONSUMER_IR_SERVICE);
}
 
开发者ID:simplesoft-duongdt3,项目名称:Android-App-Template,代码行数:5,代码来源:ServiceUtil.java

示例9: transmit

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
public void transmit(Context context) {
    ConsumerIrManager IR = (ConsumerIrManager) context.getSystemService(Context.CONSUMER_IR_SERVICE);

    IR.transmit(frequency, pattern);
}
 
开发者ID:42SK,项目名称:TVKILL,代码行数:6,代码来源:Transmitter.java

示例10: ConsumerIrManagerBase

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@SuppressWarnings("ResourceType")
public ConsumerIrManagerBase(Context context) {
	super(context);
    // Get a reference to the ConsumerIrManager
    mCIR = (ConsumerIrManager)context.getSystemService(Context.CONSUMER_IR_SERVICE);
}
 
开发者ID:tihtw,项目名称:irdb-android,代码行数:7,代码来源:ConsumerIrManagerBase.java

示例11: getConsumerIrManager

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
ConsumerIrManager getConsumerIrManager() {
	return mCIR;
}
 
开发者ID:tihtw,项目名称:irdb-android,代码行数:4,代码来源:ConsumerIrManagerBase.java

示例12: getCarrierFrequencies

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@Override
public CarrierFrequencyRange[] getCarrierFrequencies() {
	CarrierFrequencyRange[] result = null;
	if(mCIR!=null) {
		ConsumerIrManager.CarrierFrequencyRange[] ranges = mCIR.getCarrierFrequencies();
		result = new CarrierFrequencyRange[ranges.length];
		int n=0;
		for (ConsumerIrManager.CarrierFrequencyRange range : ranges) {
			result[n++] = new CarrierFrequencyRange(range.getMinFrequency(),
					                              range.getMaxFrequency());
           }
	}		
	return result;
}
 
开发者ID:tihtw,项目名称:irdb-android,代码行数:15,代码来源:ConsumerIrManagerBase.java

示例13: consumerIr

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
/**
 * @since 4.0.0
 */
public static ConsumerIrManager consumerIr(Context context) {
    return (ConsumerIrManager) context.getSystemService(CONSUMER_IR_SERVICE);
}
 
开发者ID:pushbit,项目名称:sprockets-android,代码行数:7,代码来源:Managers.java

示例14: onResume

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	if (DEBUG) Log.d(TAG, "onResume");
	irManager = (ConsumerIrManager)getSystemService(CONSUMER_IR_SERVICE);
	boolean hasIrEmitter = irManager.hasIrEmitter();
	Log.d(TAG, "hasIrEmitter=" + hasIrEmitter);
	if (hasIrEmitter) {
		CarrierFrequencyRange[]	ranges = irManager.getCarrierFrequencies();
		for (CarrierFrequencyRange range: ranges) {
			Log.d(TAG, "range"
				+ ", max=" + range.getMaxFrequency()
				+ ", min=" + range.getMinFrequency()
				);
		}
	}
	else {
		irManager = null;
		Button button = (Button)findViewById(R.id.button);
		button.setText("No IrEmitter");
		try {
			Object c = Class.forName("com.lge.hardware.IRBlaster.IRBlaster");
		}
		catch (Exception e) {
			button.setText(e.toString());
		}
	}
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:29,代码来源:Sample.java

示例15: consumerIrManager

import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@TargetApi(AndroidHelper.API_19)
public static ConsumerIrManager consumerIrManager() {
    return (ConsumerIrManager) get(Context.CONSUMER_IR_SERVICE);
}
 
开发者ID:shkschneider,项目名称:android_Skeleton,代码行数:5,代码来源:SystemServices.java


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