本文整理汇总了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)));
}
示例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()));
}
}
}
}
示例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);
}
示例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());
}
示例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());
}
示例6: RNIRManagerModule
import android.hardware.ConsumerIrManager; //导入依赖的package包/类
public RNIRManagerModule(ReactApplicationContext reactContext) {
super(reactContext);
manager = (ConsumerIrManager) reactContext.getSystemService(CONSUMER_IR_SERVICE);
}
示例7: getConsumerIrManager
import android.hardware.ConsumerIrManager; //导入依赖的package包/类
/**
* 返回 {@link ConsumerIrManager}
*/
public static ConsumerIrManager getConsumerIrManager()
{
return (ConsumerIrManager) get(CONSUMER_IR_SERVICE);
}
示例8: getConsumerIrManager
import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@TargetApi(19)
public static ConsumerIrManager getConsumerIrManager() {
return (ConsumerIrManager) getSystemService(Context.CONSUMER_IR_SERVICE);
}
示例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);
}
示例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);
}
示例11: getConsumerIrManager
import android.hardware.ConsumerIrManager; //导入依赖的package包/类
ConsumerIrManager getConsumerIrManager() {
return mCIR;
}
示例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;
}
示例13: consumerIr
import android.hardware.ConsumerIrManager; //导入依赖的package包/类
/**
* @since 4.0.0
*/
public static ConsumerIrManager consumerIr(Context context) {
return (ConsumerIrManager) context.getSystemService(CONSUMER_IR_SERVICE);
}
示例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());
}
}
}
示例15: consumerIrManager
import android.hardware.ConsumerIrManager; //导入依赖的package包/类
@TargetApi(AndroidHelper.API_19)
public static ConsumerIrManager consumerIrManager() {
return (ConsumerIrManager) get(Context.CONSUMER_IR_SERVICE);
}