| | |
| | | package com.hdl.photovoltaic.other; |
| | | |
| | | |
| | | import android.text.TextUtils; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.WifiUtils; |
| | | |
| | | import org.json.JSONObject; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void onOtherUniMPEventReceive(String appId, String event, Object data, DCUniMPJSCallback callback) { |
| | | if (!HDLUniMP.UNI_APP_ID.equals(appId)) { |
| | | return; |
| | | } |
| | | try { |
| | | org.json.JSONObject jsonObject = null; |
| | | if (data != null) { |
| | | jsonObject = new org.json.JSONObject(data.toString()); |
| | | if (!HDLUniMP.UNI_APP_ID.equals(appId)) { |
| | | return; |
| | | } |
| | | //住宅模块 |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_LIST.equals(event)) { |
| | | String json = data == null ? "{}" : data.toString(); |
| | | json = json.equals("") ? "{}" : json; |
| | | org.json.JSONObject jsonObject = new org.json.JSONObject(json); |
| | | String type_value = ""; |
| | | if (jsonObject.has("type")) { |
| | | type_value = jsonObject.getString("type"); |
| | | } |
| | | |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(event)) { |
| | | //住宅模块 |
| | | switch (type_value) { |
| | | case HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION: { |
| | | //创建 |
| | | HdlResidenceLogic.getInstance().getResidenceList(1, 100, "", "", null); |
| | | |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_HOME_DETAILS: { |
| | | //详情 |
| | | } |
| | | break; |
| | | |
| | | } |
| | | if (callback != null) { |
| | | uniCallbackData(null, "0", "", callback); |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_MODEL.equals(event)) { |
| | | //设备模块 |
| | | switch (type_value) { |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD: { |
| | | //添加 |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST: { |
| | | //获取设备列表 |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_WIFI_MODEL.equals(event)) { |
| | | WifiUtils wifiUtils = new WifiUtils(HDLApp.getInstance()); |
| | | //wifi模块 |
| | | switch (type_value) { |
| | | case HDLUniMP.UNI_EVENT_REPLY_WIFI_LIST: { |
| | | //获取wifi列表 |
| | | if (callback != null) { |
| | | uniCallbackData(wifiUtils.getScanResult(), "0", "", callback); |
| | | } |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_WIFI_INFO: { |
| | | //当前wifi详情 |
| | | if (callback != null) { |
| | | uniCallbackData(wifiUtils.getCurrentConnectWifiInfo(), "0", "", callback); |
| | | } |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_WIFI_CONNECT: { |
| | | //wifi连接 |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | HdlLogLogic.print("uni===原生接收uni发来的数据", event + "\r\n" + data); |
| | | } catch (Exception e) { |