| | |
| | | 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; |
| | |
| | | break; |
| | | //uni通知原生退出登录 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOGOUT: { |
| | | HdlLogLogic.print("uni通知原生退出登录--->", true); |
| | | HDLLinkPMUser.getInstance().logout(0); |
| | | } |
| | | break; |
| | |
| | | String json = HdlESLocalJsonLogic.getInstance().readHdlESLocalJson(fileName + ".json", deviceModel); |
| | | if (TextUtils.isEmpty(json)) { |
| | | //本地没有缓存 |
| | | HdlESLocalJsonLogic.getInstance().getHdlESLocalJson(fileName, deviceType, deviceModel, new CloudCallBeak<String>() { |
| | | HdlESLocalJsonLogic.getInstance().getHdlESLocalJson(fileName, deviceType, deviceModel, false, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String obj) { |
| | | // if (callback != null) { |
| | |
| | | //解密负载数据(写密钥给网关一定是明文,因为那时网关还没有密钥) |
| | | 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 |
| | |
| | | */ |
| | | private void uniGetCurrentHomeLocalAndCloudGatewayList(String type, Object data, DCUniMPJSCallback callback) { |
| | | String homeId = getKeyValue("homeId", getKeyValue("data", data)); |
| | | // UserConfigManage.getInstance().setHomeId(homeId); |
| | | HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(homeId, new CloudCallBeak<List<GatewayBean>>() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> list) { |
| | |
| | | uniCallBackBaseBean.setData(obj); |
| | | if (callback != null) { |
| | | callback.invoke(getJSONObject(uniCallBackBaseBean)); |
| | | // callback.invoke(uniCallBackBaseBean); |
| | | HdlLogLogic.print("回复---uni---" + type + "---" + new Gson().toJson(uniCallBackBaseBean), true); |
| | | HdlLogLogic.print("回复---uni---" + type + "---" + getJSONObject(uniCallBackBaseBean).toString(), true); |
| | | } |
| | | } catch (Exception e) { |
| | | HdlLogLogic.print("回复---uni---" + type + "---" + e.getMessage(), true); |