| | |
| | | import android.content.pm.PackageManager; |
| | | import android.location.Location; |
| | | import android.location.LocationManager; |
| | | import android.net.wifi.ScanResult; |
| | | import android.os.IBinder; |
| | | import android.os.SystemClock; |
| | | import android.provider.Settings; |
| | |
| | | //解密负载数据(写密钥给网关一定是明文,因为那时网关还没有密钥) |
| | | TcpClient.getInstance().sendDataToLinkGateway(mac, false, TopicApi, jsonArray, "", new HDLLinkCallBack() { |
| | | @Override |
| | | public void onSuccess(String msg) { |
| | | public void onSuccess(String s) { |
| | | if (callback != null) { |
| | | uniSuccessCallback(type, msg, callback); |
| | | try { |
| | | if (s.startsWith("{")) { |
| | | uniSuccessCallback(type, new Gson().fromJson(s, JsonObject.class), callback); |
| | | } else if (s.startsWith("[")) { |
| | | uniSuccessCallback(type, new Gson().fromJson(s, JsonArray.class), callback); |
| | | } else { |
| | | uniSuccessCallback(type, s, callback); |
| | | } |
| | | } catch (Exception e) { |
| | | uniSuccessCallback(type, s, callback); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (callback != null) { |
| | | callback.invoke(getJSONObject(uniCallBackBaseBean)); |
| | | // callback.invoke(uniCallBackBaseBean); |
| | | Gson gson = new Gson(); |
| | | HdlLogLogic.print("回复---uni---" + type + "---" + new Gson().toJson(uniCallBackBaseBean), true); |
| | | } |
| | | } catch (Exception e) { |