Commit efc38ecfa03ecd6f01dd1c045e2122c9d7ffc2f2

Authored by wugian
1 parent 801a98a6

lights null charge

@@ -15,8 +15,11 @@ public class LightOperationUtils { @@ -15,8 +15,11 @@ public class LightOperationUtils {
15 byte[] params; 15 byte[] params;
16 opcode = (byte) 0xD2;//brightness 16 opcode = (byte) 0xD2;//brightness
17 params = new byte[]{(byte) value}; 17 params = new byte[]{(byte) value};
18 - if (TelinkLightService.Instance().sendCommandNoResponse(opcode, addr, params, true)) { 18 + if (TelinkLightService.Instance() != null && TelinkLightService.Instance().sendCommandNoResponse(opcode, addr, params, true)) {
19 Log.d("LightOperationUtils", "setLightValue success"); 19 Log.d("LightOperationUtils", "setLightValue success");
  20 + } else {
  21 + Log.d("LightOperationUtils", "setLightValue:" + (TelinkLightService.Instance() != null));
  22 +
20 } 23 }
21 // opcode = (byte) 0xE2;//temperature 24 // opcode = (byte) 0xE2;//temperature
22 // params = new byte[]{0x05, (byte) value}; 25 // params = new byte[]{0x05, (byte) value};
@@ -27,8 +30,10 @@ public class LightOperationUtils { @@ -27,8 +30,10 @@ public class LightOperationUtils {
27 byte opcode = (byte) 0xD0; 30 byte opcode = (byte) 0xD0;
28 int address = 0xFFFF; 31 int address = 0xFFFF;
29 byte[] params = new byte[]{0x01, 0x00, 0x00}; 32 byte[] params = new byte[]{0x01, 0x00, 0x00};
30 - if (TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) { 33 + if (TelinkLightService.Instance() != null && TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) {
31 Log.d("LightOperationUtils", "open all success"); 34 Log.d("LightOperationUtils", "open all success");
  35 + } else {
  36 + Log.d("LightOperationUtils", "open:" + (TelinkLightService.Instance() != null));
32 } 37 }
33 } 38 }
34 39
@@ -36,8 +41,10 @@ public class LightOperationUtils { @@ -36,8 +41,10 @@ public class LightOperationUtils {
36 byte opcode = (byte) 0xD0; 41 byte opcode = (byte) 0xD0;
37 int address = 0xFFFF; 42 int address = 0xFFFF;
38 byte[] params = new byte[]{0x00, 0x00, 0x00}; 43 byte[] params = new byte[]{0x00, 0x00, 0x00};
39 - if (TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) { 44 + if (TelinkLightService.Instance() != null && TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) {
40 Log.d("LightOperationUtils", "close all success"); 45 Log.d("LightOperationUtils", "close all success");
  46 + } else {
  47 + Log.d("LightOperationUtils", "close:" + (TelinkLightService.Instance() != null));
41 } 48 }
42 } 49 }
43 } 50 }
@@ -237,8 +237,10 @@ public class CinemaControlService extends Service { @@ -237,8 +237,10 @@ public class CinemaControlService extends Service {
237 byte opcode = (byte) 0xD0; 237 byte opcode = (byte) 0xD0;
238 int address = 0xFFFF; 238 int address = 0xFFFF;
239 byte[] params = new byte[]{0x01, 0x00, 0x00}; 239 byte[] params = new byte[]{0x01, 0x00, 0x00};
240 - if (TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) { 240 + if (TelinkLightService.Instance() != null && TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) {
241 Log.d("aidl", "open all success"); 241 Log.d("aidl", "open all success");
  242 + } else {
  243 + Log.d("aidl", "open all failure:" + (TelinkLightService.Instance() != null));
242 } 244 }
243 } 245 }
244 246
@@ -246,8 +248,10 @@ public class CinemaControlService extends Service { @@ -246,8 +248,10 @@ public class CinemaControlService extends Service {
246 byte opcode = (byte) 0xD0; 248 byte opcode = (byte) 0xD0;
247 int address = 0xFFFF; 249 int address = 0xFFFF;
248 byte[] params = new byte[]{0x00, 0x00, 0x00}; 250 byte[] params = new byte[]{0x00, 0x00, 0x00};
249 - if (TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) {  
250 - Log.d("aidl", "open all success"); 251 + if (TelinkLightService.Instance() != null && TelinkLightService.Instance().sendCommandNoResponse(opcode, address, params)) {
  252 + Log.d("aidl", "close all success");
  253 + } else {
  254 + Log.d("aidl", "close all failure:" + (TelinkLightService.Instance() != null));
251 } 255 }
252 fadeOuting = false; 256 fadeOuting = false;
253 } 257 }
@@ -321,7 +325,11 @@ public class CinemaControlService extends Service { @@ -321,7 +325,11 @@ public class CinemaControlService extends Service {
321 byte[] params; 325 byte[] params;
322 opcode = (byte) 0xD2; 326 opcode = (byte) 0xD2;
323 params = new byte[]{(byte) value}; 327 params = new byte[]{(byte) value};
324 - TelinkLightService.Instance().sendCommandNoResponse(opcode, addr, params, true); 328 + if (TelinkLightService.Instance() != null && TelinkLightService.Instance().sendCommandNoResponse(opcode, addr, params, true)) {
  329 + Log.d("aidl", "set value success:" + value);
  330 + } else {
  331 + Log.d("aidl", "set value failure:" + (TelinkLightService.Instance() != null));
  332 + }
325 333
326 // opcode = (byte) 0xE2; 334 // opcode = (byte) 0xE2;
327 // params = new byte[]{0x05, (byte) value}; 335 // params = new byte[]{0x05, (byte) value};
Please register or login to post a comment