Commit efc38ecfa03ecd6f01dd1c045e2122c9d7ffc2f2

Authored by wugian
1 parent 801a98a6

lights null charge

... ... @@ -15,8 +15,11 @@ public class LightOperationUtils {
15 15 byte[] params;
16 16 opcode = (byte) 0xD2;//brightness
17 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 19 Log.d("LightOperationUtils", "setLightValue success");
  20 + } else {
  21 + Log.d("LightOperationUtils", "setLightValue:" + (TelinkLightService.Instance() != null));
  22 +
20 23 }
21 24 // opcode = (byte) 0xE2;//temperature
22 25 // params = new byte[]{0x05, (byte) value};
... ... @@ -27,8 +30,10 @@ public class LightOperationUtils {
27 30 byte opcode = (byte) 0xD0;
28 31 int address = 0xFFFF;
29 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 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 41 byte opcode = (byte) 0xD0;
37 42 int address = 0xFFFF;
38 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 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 237 byte opcode = (byte) 0xD0;
238 238 int address = 0xFFFF;
239 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 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 248 byte opcode = (byte) 0xD0;
247 249 int address = 0xFFFF;
248 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 256 fadeOuting = false;
253 257 }
... ... @@ -321,7 +325,11 @@ public class CinemaControlService extends Service {
321 325 byte[] params;
322 326 opcode = (byte) 0xD2;
323 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 334 // opcode = (byte) 0xE2;
327 335 // params = new byte[]{0x05, (byte) value};
... ...
Please register or login to post a comment