mac
2024-05-14 f7c38847b8e00c84c30e51a92c03071d3e9a9da8
2024年05月14日09:08:49

备份代码
10个文件已修改
208 ■■■■ 已修改文件
app/build.gradle 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_my_power_station.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/fragment_home_page.xml 151 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/build.gradle
@@ -146,6 +146,7 @@
    //屏幕适配库
    implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
    //图片加载库
    implementation 'com.github.bumptech.glide:glide:4.13.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -901,9 +901,9 @@
    /**
     * 初始化逆变器
     *
     * @param mac 网关mac
     * @param mac 逆变器mac
     */
    public void initializeGateway(String mac, LinkCallBack<Boolean> linkCallBack) {
    public void initializeInverter(String mac, LinkCallBack<Boolean> linkCallBack) {
        String requestUrl = TopicApi.GATEWAY_INITIALIZE_REMOTE;
        JsonObject jObject = new JsonObject();
        jObject.addProperty("device_mac", mac);
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -237,7 +237,6 @@
                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_TIME: {
                        this.uniGetInverterTime(mode_type, data, callback);
                    }
                    break;
                    //逆变器时间编辑
                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_TIME_EDIT: {
@@ -267,6 +266,11 @@
                    //获取未处理/未读消息数量
                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_MESSAGE_NUMBER: {
                        this.uniGetMessageNumber(mode_type, data, callback);
                    }
                    break;
                    //初始化逆变器
                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_INITIALIZEINVERTER: {
                        this.setInitializeGateway(mode_type, data, callback);
                    }
                    break;
@@ -1723,6 +1727,28 @@
        ).start();
    }
    /**
     * 初始化你逆变器
     *
     * @param type     账号
     * @param data     uni请求数据
     * @param callback uni回调
     */
    public void setInitializeGateway(String type, Object data, DCUniMPJSCallback callback) {
        String mac = getKeyValue("mac", getKeyValue("data", data));
        HdlDeviceLogic.getInstance().initializeInverter(mac, new LinkCallBack<Boolean>() {
            @Override
            public void onSuccess(Boolean obj) {
                uniCallbackData(type, obj, callback);
            }
            @Override
            public void onError(HDLLinkException e) {
                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
            }
        });
    }
    /**
     * 发送modbus协议数据
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -5,10 +5,7 @@
import android.os.Process;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -36,8 +33,6 @@
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.uni.HDLUniMPSDKManager;
import com.hdl.photovoltaic.utils.AppManagerUtils;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.ConfirmationTipDialog;
import com.hdl.sdk.link.HDLLinkLocalSdk;
import com.hdl.sdk.link.common.event.EventListener;
import com.hdl.sdk.link.core.bean.LinkResponse;
@@ -45,7 +40,6 @@
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
import com.hdl.sdk.link.core.config.HDLLinkConfig;
import com.hdl.sdk.link.core.connect.HDLUdpConnect;
import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
import org.greenrobot.eventbus.Subscribe;
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java
@@ -209,7 +209,7 @@
        }
        for (int i = 0; i < list.size(); i++) {
            GatewayBean gatewayBean = list.get(i);
            HdlDeviceLogic.getInstance().initializeGateway(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
            HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
                @Override
                public void onSuccess(Boolean obj) {
//                                HdlLogLogic.print("初始化逆变器成功-->mac:" + cloudInverterDeviceBean.getOsn(),true);
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -707,7 +707,7 @@
        }
        for (int i = 0; i < list.size(); i++) {
            GatewayBean gatewayBean = list.get(i);
            HdlDeviceLogic.getInstance().initializeGateway(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
            HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
                @Override
                public void onSuccess(Boolean obj) {
//                                HdlLogLogic.print("初始化逆变器成功-->mac:" + cloudInverterDeviceBean.getOsn(),true);
app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java
@@ -291,7 +291,7 @@
                    public void Confirm() {
                        confirmationCancelDialog.dismiss();
                        showLoading("解绑中...");
                        HdlDeviceLogic.getInstance().initializeGateway(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
                        HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
                            @Override
                            public void onSuccess(Boolean obj) {
                                hideLoading();
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -51,6 +51,7 @@
    public final static String UNI_EVENT_REPLY_DEVICE_Link_read_SEND = "link_property_read";//link协议属性读取
    public final static String UNI_EVENT_REPLY_DEVICE_MESSAGE_NUMBER = "message_number";//消息总数量
    public final static String UNI_EVENT_REPLY_DEVICE_DELETE_OID = "delete_Oid";//删除设备oid
    public final static String UNI_EVENT_REPLY_DEVICE_INITIALIZEINVERTER = "initializeInverter";//重置逆变器
    /*********OTA模块*********/
@@ -108,7 +109,7 @@
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_USERINFO = "refresh_userinfo";//刷新用户信息
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_TEMPERATURE = "temperature_format_changed";//刷新单位温度
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_REFRESH_UNREAD_NUMBER = "refresh_unread_messages_number";//刷新未读消息数量
    public final static String UNI_EVENT_NOTIFICATION_MQTT_CONNECT_SUCCESS= "mqtt_connect_success";//通知mqtt连接成功
    public final static String UNI_EVENT_NOTIFICATION_MQTT_CONNECT_SUCCESS = "mqtt_connect_success";//通知mqtt连接成功
    public final static String UNI_EVENT_NOTIFICATION_REMOVE_VIEW = "remove_view";//通知uni移除界面
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_ADD = "add";//设备添加
    public final static String UNI_EVENT_NOTIFICATION_DEVICE_DEL = "del";//设备删除
app/src/main/res/layout/activity_my_power_station.xml
@@ -12,7 +12,7 @@
        android:id="@+id/my_home_page_fcv0"
        android:name="com.hdl.photovoltaic.ui.home.HomePageFragment"
        android:layout_width="match_parent"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
@@ -21,10 +21,9 @@
        app:layout_constraintTop_toTopOf="parent" />
    <!--电站-Fragment-->
    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/my_power_station_fcv1"
        android:name="com.hdl.photovoltaic.ui.powerstation.HouseListFragment"
        android:layout_width="match_parent"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
@@ -35,7 +34,7 @@
    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/my_message_fcv2"
        android:name="com.hdl.photovoltaic.ui.message.MessageFragment"
        android:layout_width="match_parent"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
@@ -46,7 +45,7 @@
    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/my_me_fcv3"
        android:name="com.hdl.photovoltaic.ui.me.MeFragment"
        android:layout_width="match_parent"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
app/src/main/res/layout/fragment_home_page.xml
@@ -53,45 +53,138 @@
                android:layout_marginStart="@dimen/dp_16"
                android:layout_marginEnd="@dimen/dp_16">
                <LinearLayout
                <RelativeLayout
                    android:id="@+id/home_page_station_ll"
                    android:layout_width="375dp"
                    android:layout_width="0dp"
                    android:layout_height="@dimen/dp_56"
                    android:orientation="horizontal"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent">
                    <!--全部-->
                    <include
                        android:id="@+id/home_page_station_all_ic"
                        layout="@layout/item_station" />
                    <View
                        android:layout_width="15.5dp"
                        android:layout_height="match_parent" />
                    <!--故障-->
                    <include
                        android:id="@+id/home_page_station_fault_ic"
                        layout="@layout/item_station" />
                    <RelativeLayout
                        android:id="@+id/station_status_all_rl"
                        android:layout_width="74dp"
                        android:layout_height="match_parent"
                        android:background="@drawable/station_status_no_ffffff">
                    <View
                        android:layout_width="16dp"
                        android:layout_height="match_parent" />
                    <!--离线-->
                    <include
                        android:id="@+id/home_page_station_offline_ic"
                        layout="@layout/item_station" />
                        <TextView
                            android:id="@+id/station_status_all_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_25"
                            android:layout_marginTop="7dp"
                            android:gravity="center"
                            android:text="999"
                            android:textColor="@color/text_90000000"
                            android:textSize="@dimen/text_21"
                            android:textStyle="bold" />
                    <View
                        android:layout_width="15.5dp"
                        android:layout_height="match_parent" />
                    <!--待接入-->
                    <include
                        android:id="@+id/home_page_station_connected_ic"
                        layout="@layout/item_station" />
                        <TextView
                            android:id="@+id/station_status_number_all_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_17"
                            android:layout_below="@+id/station_status_all_tv"
                            android:layout_marginTop="1dp"
                            android:gravity="center"
                            android:text="state"
                            android:textColor="@color/text_40000000"
                            android:textSize="@dimen/text_14" />
                    </RelativeLayout>
                    <RelativeLayout
                        android:id="@+id/station_status_faults_rl"
                        android:layout_width="74dp"
                        android:layout_height="match_parent"
                        android:layout_marginStart="@dimen/dp_16"
                        android:layout_toEndOf="@+id/station_status_all_rl"
                        android:background="@drawable/station_status_no_ffffff">
                        <TextView
                            android:id="@+id/station_status_faults_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_25"
                            android:layout_marginTop="7dp"
                            android:gravity="center"
                            android:text="999"
                            android:textColor="@color/text_90000000"
                            android:textSize="@dimen/text_21"
                            android:textStyle="bold" />
                        <TextView
                            android:id="@+id/station_status_number_faults_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_17"
                            android:layout_below="@+id/station_status_faults_tv"
                            android:layout_marginTop="1dp"
                            android:gravity="center"
                            android:text="state"
                            android:textColor="@color/text_40000000"
                            android:textSize="@dimen/text_14" />
                    </RelativeLayout>
                    <RelativeLayout
                        android:id="@+id/station_status_off_rl"
                        android:layout_width="74dp"
                        android:layout_height="match_parent"
                        android:layout_marginStart="@dimen/dp_16"
                        android:layout_toEndOf="@+id/station_status_faults_rl"
                        android:background="@drawable/station_status_no_ffffff">
                        <TextView
                            android:id="@+id/station_status_off_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_25"
                            android:layout_marginTop="7dp"
                            android:gravity="center"
                            android:text="999"
                            android:textColor="@color/text_90000000"
                            android:textSize="@dimen/text_21"
                            android:textStyle="bold" />
                        <TextView
                            android:id="@+id/station_status_number_off_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_17"
                            android:layout_below="@+id/station_status_off_tv"
                            android:layout_marginTop="1dp"
                            android:gravity="center"
                            android:text="state"
                            android:textColor="@color/text_40000000"
                            android:textSize="@dimen/text_14" />
                    </RelativeLayout>
                    <RelativeLayout
                        android:id="@+id/station_status_connected_rl"
                        android:layout_width="74dp"
                        android:layout_height="match_parent"
                        android:layout_marginStart="@dimen/dp_16"
                        android:layout_toEndOf="@+id/station_status_off_rl"
                        android:background="@drawable/station_status_no_ffffff">
                        <TextView
                            android:id="@+id/station_status_connected_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_25"
                            android:layout_marginTop="7dp"
                            android:gravity="center"
                            android:text="999"
                            android:textColor="@color/text_90000000"
                            android:textSize="@dimen/text_21"
                            android:textStyle="bold" />
                        <TextView
                            android:id="@+id/station_status_number_connected_tv"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/dp_17"
                            android:layout_below="@+id/station_status_connected_tv"
                            android:layout_marginTop="1dp"
                            android:gravity="center"
                            android:text="state"
                            android:textColor="@color/text_40000000"
                            android:textSize="@dimen/text_14" />
                    </RelativeLayout>
                </LinearLayout>
                </RelativeLayout>
                <androidx.constraintlayout.widget.ConstraintLayout
                    android:id="@+id/home_page_station_info_cl"