| | |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.NetworkUtils; |
| | | import com.hdl.photovoltaic.utils.PermissionUtils; |
| | | import com.hdl.photovoltaic.utils.WifiUtils; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | |
| | | String type = getKeyValue("type", data);//小类 |
| | | String logTag = getKeyValue("logTag", data);//标记uni指令 |
| | | String mode_type = "大类-" + topic + "---" + "小类-" + type;//用来打印的 |
| | | HdlLogLogic.print(logTag + ":" + "uni---发送---" + mode_type + "\r\n" + data, true); |
| | | HdlLogLogic.print(logTag + ":" + "uni---发送---" + mode_type + "---" + data, true); |
| | | if (HDLUniMP.UNI_EVENT_REPLY_USER_MODEL.equals(topic)) { |
| | | //用户模块 |
| | | switch (type) { |
| | |
| | | jsonObject.addProperty("appKey", AppConfigManage.getAppKey()); |
| | | jsonObject.addProperty("appSecret", AppConfigManage.getAppSecret()); |
| | | uniSuccessCallback(mode_type, jsonObject, callback); |
| | | HdlLogLogic.print("获取用户本地缓存信息---->>>" + jsonObject.toString()); |
| | | HdlLogLogic.print("获取用户本地缓存信息----" + jsonObject.toString()); |
| | | } |
| | | break; |
| | | } |
| | |
| | | break; |
| | | //创建电站 |
| | | case HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION: { |
| | | //uin创建电站成功后通知 |
| | | // HdlResidenceLogic.getInstance().getResidenceIdList("","","","","","",1,50,null); |
| | | try { |
| | | String dataJsonStr = getKeyValue("data", data); |
| | | if (!TextUtils.isEmpty(dataJsonStr)) { |
| | | Gson gson = new Gson(); |
| | | HouseIdBean houseIdBean = gson.fromJson(dataJsonStr, HouseIdBean.class); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true); |
| | | } |
| | | HdlLogLogic.print("uin创建电站成功后通知---"+dataJsonStr, true); |
| | | } catch (Exception e) { |
| | | HdlLogLogic.print("uin创建电站成功后通知---" + e.getMessage(), true); |
| | | } |
| | | |
| | | //EventBus事件分发 |
| | | HdlCommonLogic.getInstance().postEventBus(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL, HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION, getKeyValue("data", data)); |
| | | // HdlCommonLogic.getInstance().postEventBusSticky(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL, HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION, getKeyValue("data", data)); |
| | | if (callback != null) { |
| | | uniSuccessCallback(type, null, callback); |
| | | } |
| | |
| | | WifiUtils wifiUtils = WifiUtils.getInstance(); |
| | | //wifi模块 |
| | | switch (type) { |
| | | //获取位置权限 |
| | | case HDLUniMP.UNI_EVENT_REPLY_AUTHORIZATION_GET: { |
| | | boolean isLocalAuthor = PermissionUtils.checkPermission(HDLApp.getInstance(), Manifest.permission.ACCESS_FINE_LOCATION); |
| | | if (callback != null) { |
| | | JsonObject jsonObject = new JsonObject(); |
| | | jsonObject.addProperty("localAuthor", isLocalAuthor); |
| | | uniSuccessCallback(mode_type, jsonObject, callback); |
| | | } |
| | | } |
| | | break; |
| | | //获取手机wifi列表 |
| | | case HDLUniMP.UNI_EVENT_REPLY_PHONE_WIFI_LIST: { |
| | | if (callback != null) { |
| | |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL.equals(topic)) { |
| | | //其它模块 |
| | | switch (type) { |
| | | |
| | | //获取温度单位 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNIT: { |
| | | uniSuccessCallback(mode_type, UserConfigManage.getInstance().getTemperature_unit(), callback); |
| | |
| | | break; |
| | | //uni通知原生退出登录 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOGOUT: { |
| | | HdlLogLogic.print("uni通知原生退出登录--->", true); |
| | | HdlLogLogic.print("uni通知原生退出登录---", true); |
| | | HDLLinkPMUser.getInstance().logout(0); |
| | | } |
| | | break; |
| | |
| | | if (callback != null) { |
| | | uniSuccessCallback(type, null, callback); |
| | | } |
| | | List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId,null); |
| | | List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | GatewayBean gatewayBean = list.get(i); |
| | | HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), null); |
| | |
| | | UserConfigManage.getInstance().setBingEmail(cUserInfo.getMemberEmail()); |
| | | UserConfigManage.getInstance().setUserImageUrl(cUserInfo.getMemberHeadIcon()); |
| | | UserConfigManage.getInstance().Save(); |
| | | HdlLogLogic.print("头像路径---->>>" + cUserInfo.getMemberHeadIcon()); |
| | | HdlLogLogic.print("头像路径----" + cUserInfo.getMemberHeadIcon()); |
| | | } |
| | | |
| | | @Override |