SamsungResponce.java
Go to the documentation of this file.
00001 
00009 package org.rosmultimedia.player.samsung.driver;
00010 
00011 import java.util.Arrays;
00012 
00018 public class SamsungResponce {
00019         public static final String ACK = "00";
00020         public static final String CONFIRMED = "02";
00021 
00022         private String code;
00023         private String[] datas;
00024         private String result;
00025         //private String app;
00026         private int appSize;
00027         //private int resultSize;
00028 
00029         public SamsungResponce(char[] data) {
00030                 this.datas = new String(data).split(" ");
00031                 // self.datas = self.__byteToHex( self.data ).split( " " )
00032 
00033                 int offset = 0;
00034                 int leng = this.datas.length;
00035 
00036                 if (leng >= 1) {
00037                         // Get code
00038                         this.code = this.datas[offset];
00039 
00040                         if (leng >= 2) {
00041                                 // Get app
00042                                 this.appSize = Integer.valueOf(this.datas[offset]);
00043                                 int decay = 3;                  // code + size + separator
00044                                 offset = this.appSize + decay;
00045 
00046                                 if (leng >= offset) {
00047                                         //this.resultSize = Integer.valueOf(this.datas[offset]);
00048                                         decay = decay + 2;      // old_decay + size + separator
00049                                         offset = this.appSize + decay;
00050 
00051                                         if (leng >= offset) {
00052                                                 this.result = Arrays.toString(
00053                                                                 Arrays.copyOfRange(
00054                                                                                 this.datas,
00055                                                                                 offset,
00056                                                                                 this.datas.length-1));
00057                                         }
00058                                 }
00059                         }
00060                 }
00061         }
00062 
00063         public String getResult() {
00064                 return this.result;
00065         }
00066 
00067         public String getCode() {
00068                 return this.code;
00069         }
00070 
00071         public String byteToHex (byte[] byteString) {
00072                 return ""; // ''.join( [ "%02X " % ord( x ) for x in byteStr ] )
00073         }
00074 
00075 }


smarthome_media_samsungtv_driver
Author(s): Mickael Gaillard , Erwan Le Huitouze
autogenerated on Thu Jun 6 2019 21:03:50