Advertisement
Guest User

wifi-led

a guest
Nov 11th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.71 KB | None | 0 0
  1.   public static byte getCheckValue(int i, int j, int k, int l, int i1, int j1)
  2.     {
  3.         int k1 = 255 + (i + (j + (k + (l + (j1 + i1)))));
  4.         if (k1 != 0);
  5.         int l1 = k1 % 255;
  6.         if (l1 == 0)
  7.         {
  8.             l1 = 255;
  9.         }
  10.         return (byte)l1;
  11.     }
  12.  
  13.     public static void main(String args[])
  14.     {
  15.         Protocol protocol;
  16.         byte abyte0[];
  17.         String s;
  18.         int i;
  19.         protocol = new Protocol();
  20.         protocol.setProduct(0);
  21.         protocol.setProduct_mode(0);
  22.         protocol.setStatic_dynamic(1);
  23.         protocol.setSwith_on(1);
  24.         protocol.setBar_no(50);
  25.         protocol.setColorRGB(255, 6, 32);
  26.         protocol.setSpeed(0);
  27.         protocol.setPause(0);
  28.         protocol.setDynamic_mode(0);
  29.         protocol.setDynamic_effect(0);
  30.         protocol.setController(0);
  31.         protocol.setRGB_sort(0);
  32.         protocol.setIC_number(0);
  33.         protocol.setCurCheckValue(50, 255, 6, 32, 1, 0);
  34.         protocol.setAll();
  35.         abyte0 = protocol.getAll();
  36.         s = "";
  37.         i = 0;
  38. _L3:
  39.         if (i < 20) goto _L2; else goto _L1
  40. _L1:
  41.         byte abyte1[];
  42.         String s1;
  43.         int j;
  44.         System.out.println((new StringBuilder("###########:")).append(s).toString());
  45.         protocol.exchangeBytes();
  46.         abyte1 = protocol.getAll();
  47.         s1 = "";
  48.         j = 0;
  49. _L4:
  50.         if (j >= 20)
  51.         {
  52.             System.out.println((new StringBuilder("###########:")).append(s1).toString());
  53.             return;
  54.         }
  55.         break MISSING_BLOCK_LABEL_224;
  56. _L2:
  57.         s = (new StringBuilder(String.valueOf(s))).append(protocol.printHexString(abyte0[i])).append("*").toString();
  58.         i++;
  59.           goto _L3
  60.         s1 = (new StringBuilder(String.valueOf(s1))).append(protocol.printHexString(abyte1[j])).append("*").toString();
  61.         j++;
  62.           goto _L4
  63.     }
  64.  
  65.     public static byte[] shortToByteArray(short word0)
  66.     {
  67.         byte abyte0[] = new byte[2];
  68.         int i = 0;
  69.         do
  70.         {
  71.             if (i >= 2)
  72.             {
  73.                 return abyte0;
  74.             }
  75.             abyte0[i] = (byte)(0xff & word0 >>> 8 * ((-1 + abyte0.length) - i));
  76.             i++;
  77.         } while (true);
  78.     }
  79.  
  80.     public void exchangeBytes()
  81.     {
  82.         int ai[] = new int[2];
  83.         int i = 2;
  84.         do
  85.         {
  86.             if (i >= 11)
  87.             {
  88.                 return;
  89.             }
  90.             ai[0] = all[i];
  91.             ai[1] = all[21 - i];
  92.             exchangeInt(ai);
  93.             all[i] = (byte)ai[0];
  94.             all[21 - i] = (byte)ai[1];
  95.             i++;
  96.         } while (true);
  97.     }
  98.  
  99.     public byte[] getAll()
  100.     {
  101.         return all;
  102.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement