wjc
2023-06-28 975b91521a04e159f45fb34fc7b55afbf455f7f5
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -14,45 +14,56 @@
    /*********UniMP wgt id*********/
    public final static String UNI_APP_ID = "__UNI__A2E7300";//光伏wgt包小程序id
    /*********UniMP Event 原生和小程序交互 自定义通知事件*********/
    public final static String UNI_EVENT_uniMPOnClose = "uni_MPOnClose";//自定义小程序关闭事件
    public final static String UNI_EVENT_GetAppParams = "uni_GetAppParams";//获取APP应用信息
    //region --------【小程序】发送到【原生】(加前缀:uni_)--------
    /*********住宅【电站】模块*********/
    public final static String UNI_EVENT_REPLY_HOME_MODEL = "uni_home_model";//住宅模块
    public final static String UNI_EVENT_REPLY_HOME_LIST = "list";//获取住宅【电站】列表
    public final static String UNI_EVENT_REPLY_HOME_CREATION = "creation";//住宅【电站】创建
    public final static String UNI_EVENT_REPLY_HOME_EDIT = "edit";//住宅【电站】编辑
    public final static String UNI_EVENT_REPLY_HOME_DETAILS = "details";//住宅【电站】详情
    public final static String UNI_EVENT_REPLY_Home_DEl = "del";//住宅【电站】删除
    /*********设备模块*********/
    public final static String UNI_EVENT_REPLY_DEVICE_MODEL = "uni_device_model";//设备模块
    public final static String UNI_EVENT_REPLY_DEVICE_LIST = "list";//逆变器设备列表
    public final static String UNI_EVENT_REPLY_DEVICE_CHILD_LIST = "child_list";//逆变器【下挂】设备列表
    public final static String UNI_EVENT_REPLY_DEVICE_ADD = "add";//设备添加
    public final static String UNI_EVENT_REPLY_DEVICE_DEL = "del";//设备删除
    public final static String UNI_EVENT_REPLY_DEVICE_OID = "oid";//设备【包括下挂设备】oid列表
//    //【小程序】发送到【原生】 加前缀:uni_
//public final static String UNI_EVENT_HOME_MODEL = "uni_home_model";//住宅模块
//    public final static String UNI_EVENT__DEVICE_MODEL = "uni_device_model";//设备模块
//    /*********住宅【电站】模块*********/
//    public final static String UNI_EVENT_HOME_LIST = "list";//获取住宅【电站】列表
//    public final static String UNI_EVENT_HOME_CREATION = "creation";//住宅【电站】创建
//    public final static String UNI_EVENT_HOME_EDIT = "edit";//住宅【电站】编辑
//    public final static String UNI_EVENT_HOME_DETAILS = "details";//住宅【电站】详情
//    public final static String UNI_EVENT_Home_DEl = "del";//住宅【电站】删除
//    /*********设备模块*********/
//    public final static String UNI_EVENT_DEVICE_LIST = "list";//逆变器设备列表
//    public final static String UNI_EVENT_DEVICE_CHILD_LIST = "child_list";//逆变器【下挂】设备列表
//    public final static String UNI_EVENT_DEVICE_ADD = "add";//设备添加
//    public final static String UNI_EVENT_DEVICE_DEL = "del";//设备删除
//    public final static String UNI_EVENT_DEVICE_OID = "oid";//设备【包括下挂设备】oid列表
    /*********Wifi模块*********/ //卫锦定义
    public final static String UNI_EVENT_REPLY_WIFI_MODEL = "uni_wifi_model";//wifi模块
    public final static String UNI_EVENT_REPLY_WIFI_LIST = "list";//获取wifi列表
    public final static String UNI_EVENT_REPLY_WIFI_INFO = "info";//获取当前wifi信息
    public final static String UNI_EVENT_REPLY_WIFI_CONNECT = "connect";//连接wifi
    //endregion
    //region --------【原生】主动发送到【小程序】--------
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_MODEL = "uni_notification_model";//通知模块
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_LIST = "list";//逆变器设备列表
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_CHILD_LIST = "child_list";//逆变器【下挂】设备列表
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_ADD = "add";//设备添加
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_DEL = "del";//设备删除
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_OID = "oid";//设备【包括下挂设备】oid列表
    //endregion
    //【原生】主动发送到【小程序】 加前缀:app_
    //【原生】打开【小程序】页面路径(UNI_EVENT_HOME_CREATION+?key=value&key=参数一)
    //region --------【原生】打开【小程序】页面路径(UNI_EVENT_OPEN_HOME_CREATION+?key=value&key=参数一)--------
    /*********住宅模块*********/
    public final static String UNI_EVENT_HOME_CREATION = "pages/powerStation/powerStationCreate";//住宅【电站】创建
    public final static String UNI_EVENT_HOME_EDIT = "pages/powerStation/powerStationEdit";//住宅【电站】编辑
    public final static String UNI_EVENT_HOME_DETAILS = "pages/powerStationDetail/index";//住宅【电站】详情
//    public final static String UNI_EVENT_Home_DEl = "del";//住宅【电站】删除
    public final static String UNI_EVENT_OPEN_HOME_CREATION = "pages/powerStation/powerStationCreate";//住宅【电站】创建
    public final static String UNI_EVENT_OPEN_HOME_EDIT = "pages/powerStation/powerStationEdit";//住宅【电站】编辑
    public final static String UNI_EVENT_OPEN_HOME_DETAILS = "pages/powerStationDetail/index";//住宅【电站】详情
    public final static String UNI_EVENT_OPEN_HOME_DEl = "del";//住宅【电站】删除
    /*********设备模块*********/
    //设备模块打开页面全路径
    //endregion
    /**
     * 小程序与原生通讯数据格式
     * 自定义格式
     * 自定义数据格式
     */
    public static class UniCallBackBaseBean implements Serializable {
@@ -60,7 +71,6 @@
        private String path;//打开小程序路径(暂时用不上)
        private String code;//状态码
        private String mes;//信息描述
        private String topic;//暂时用不上
        private String type;//功能类型
        private Object data;//附加json数据
@@ -83,7 +93,6 @@
            this.code = code;
        }
        public String getMes() {
            return mes == null ? "" : mes;
        }
@@ -100,13 +109,6 @@
            this.data = data;
        }
        public String getTopic() {
            return topic;
        }
        public void setTopic(String topic) {
            this.topic = topic;
        }
        public String getType() {
            return type == null ? "" : type;
@@ -122,20 +124,6 @@
        public void setPath(String path) {
            this.path = path;
        }
        /**
         * 当前对象转 JSONObject
         *
         * @return JSONObject
         */
        public JSONObject getJSONObject() {
            try {
                String json = new Gson().toJson(this);
                return new JSONObject(json);
            } catch (Exception e) {
                return new JSONObject();
            }
        }