| | |
| | | import android.location.LocationManager; |
| | | import android.os.IBinder; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonArray; |
| | | import com.google.gson.JsonObject; |
| | |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.NetworkUtils; |
| | | import com.hdl.photovoltaic.utils.WifiUtils; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkCode; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | |
| | | break; |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL.equals(topic)) { |
| | | //其它模块 |
| | | switch (type) { |
| | | //获取温度单位 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNIT: { |
| | | uniCallbackData(mode_type, UserConfigManage.getInstance().getTemperature_unit(), callback); |
| | | } |
| | | break; |
| | | //获取当前app语言 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_APP_LANGUAGE: { |
| | | uniCallbackData(mode_type, UserConfigManage.getInstance().getCurrentAppLanguage(), callback); |
| | | } |
| | | break; |
| | | //获取位置信息 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCATION_INFO: { |
| | | this.uniGetLocationInfo(mode_type, data, callback); |
| | | } |
| | | break; |
| | | //应用冲突 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_APPLICATION_CONFLICT: { |
| | | if (callback != null) { |
| | | uniCallbackData(type, HDLUdpConnect.getInstance().isBindSuccess(), callback); |
| | | } |
| | | } |
| | | break; |
| | | //专门收集uni日志 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNI_LOG: { |
| | | String customizeContentFormat = getKeyValue("customizeContentFormat", getKeyValue("data", data)); |
| | | HdlLogLogic.print("uni--->log--->" + customizeContentFormat, true); |
| | | |
| | | } |
| | | break; |
| | | //uni主页点击返回通知 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK: { |
| | | //EventBus事件分发 |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL); |
| | | baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | |
| | | } |
| | | break; |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_MINE_MODEL.equals(topic)) { |
| | | //我的模块 |
| | | switch (type) { |
| | |
| | | break; |
| | | |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL.equals(topic)) { |
| | | //其它模块 |
| | | switch (type) { |
| | | //获取温度单位 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNIT: { |
| | | uniCallbackData(mode_type, UserConfigManage.getInstance().getTemperature_unit(), callback); |
| | | } |
| | | break; |
| | | //获取当前app语言 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_APP_LANGUAGE: { |
| | | uniCallbackData(mode_type, UserConfigManage.getInstance().getCurrentAppLanguage(), callback); |
| | | } |
| | | break; |
| | | //获取位置信息 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCATION_INFO: { |
| | | this.uniGetLocationInfo(mode_type, data, callback); |
| | | } |
| | | break; |
| | | //应用冲突 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_APPLICATION_CONFLICT: { |
| | | if (callback != null) { |
| | | uniCallbackData(type, HDLUdpConnect.getInstance().isBindSuccess(), callback); |
| | | } |
| | | } |
| | | break; |
| | | //专门收集uni日志 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNI_LOG: { |
| | | String customizeContentFormat = getKeyValue("customizeContentFormat", getKeyValue("data", data)); |
| | | HdlLogLogic.print("uni--->log--->" + customizeContentFormat, true); |
| | | |
| | | } |
| | | break; |
| | | //uni主页点击返回通知 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK: { |
| | | //EventBus事件分发 |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL); |
| | | baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | |
| | | } |
| | | break; |
| | | //uni通知原生退出登录 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOGOUT: { |
| | | HDLLinkPMUser.getInstance().logout(0); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | GatewayBean gatewayBean = new GatewayBean(); |
| | | gatewayBean.setDevice_mac(mac); |
| | | list.add(gatewayBean); |
| | | HdlDeviceLogic.getInstance().uploadDataToCloud(UserConfigManage.getInstance().getHomeId(), list, null); |
| | | HdlDeviceLogic.getInstance().uploadOidDataToCloud(UserConfigManage.getInstance().getHomeId(), list, true, null); |
| | | } |
| | | |
| | | /** |
| | |
| | | // com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(data); |
| | | try { |
| | | String devices = getKeyValue("devices", getKeyValue("data", data)); |
| | | String homeId = UserConfigManage.getInstance().getHomeId(); //getKeyValue("homeId", getKeyValue("data", data)); |
| | | String homeId = UserConfigManage.getInstance().getHomeId(); //绑定成功之后通知 |
| | | Gson gson = new Gson(); |
| | | Type typeOfT = new TypeToken<List<GatewayBean>>() { |
| | | }.getType(); |
| | |
| | | baseEventBus.setData(list); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | //进来住宅详情都要上传一次oid列表到云端; |
| | | HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null); |
| | | HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, list, false, null); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (callback != null) { |
| | | callback.invoke(getJSONObject(uniCallBackBaseBean)); |
| | | // callback.invoke(uniCallBackBaseBean); |
| | | HdlLogLogic.print("uni--->接收--->" + type + "--->" + new Gson().toJson(uniCallBackBaseBean), true); |
| | | HdlLogLogic.print("uni--->回复--->" + type + "--->" + new Gson().toJson(uniCallBackBaseBean), true); |
| | | } |
| | | } catch (Exception e) { |
| | | HdlLogLogic.print("uni--->接收--->" + type + "--->" + e.getMessage(), true); |
| | | HdlLogLogic.print("uni--->回复--->" + type + "--->" + e.getMessage(), true); |
| | | } |
| | | |
| | | |