I am facing a problem with the IR emitter on my Galaxy S5 running under Android 5.0.
Before I updated it to 5.0, my app was perfectly working on my phone but now, the device I am suppose to manage has no reaction. When I click on my app to send an IR code, the led blinks to indicate that the IR manager is activated and I can receive a signal with a IR photodiode connected to my scope. Unfortunately, the shape of the signal I get is very different from what it should be.
I can add that the same code running on my tablet under Android 4.4.2 still works perfectly.
To help in answering my question, a sample of my code :
private String commande="0000 0070 0000 0032 0080 003F 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 "
+ "0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 "
+ "0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 "
+ "0010 0010 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0030 0010 0A98";
IRManager=(ConsumerIrManager)activité.getSystemService(Context.CONSUMER_IR_SERVICE);
code=commandConversion(commande);
IRManager.transmit(code.getFrequency(),code.getCodes());
private RemoteCommandeCode commandConversion(String command) {
List<String> list;
RemoteCommandeCode code;
int frequency;
list= new ArrayList<String>(Arrays.asList(command.split(" ")));
list.remove(0); // dummy
frequency = Integer.parseInt(liste.remove(0), 16); // frequency
list.remove(0); // seq1
list.remove(0); // seq2
code=new RemoteCommandeCode(list.size());
for (int i = 0; i < list.size(); i++) {
code.setCode(i,Integer.parseInt(list.get(i), 16));
}
frequency = (int) (1000000 / (frequency * 0.241246));
code.setFrequency(frequency);
return(code);
}
public class RemoteCommandeCode {
private int fréquence;
private int [] codes;
public RemoteCommandeCode(int nombreCodes){
codes=new int[nombreCodes];
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
public int [] getCodes() {
return codes;
}
public void setCodes(int [] codes) {
this.codes = codes;
}
public void setCode(int i,int code){
codes[i]=code;
}
}
As asked, images of the signal emitted with the simple code "0000 0070 0000 0003 0010 0020 0010 0020 0010 0020", I get on 4.4.2 :
and on Android 5.0 :
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…