Ver código fonte

<增加转换盒音量设置>

weizhengliang 4 anos atrás
pai
commit
a6468179ec

+ 19 - 1
SerialPortLibrary/src/main/java/com/kongqw/serialportlibrary/thread/SerialPortReadThread.java

@@ -42,7 +42,7 @@ public abstract class SerialPortReadThread extends Thread {
                 mReadBuffer = new byte[count];
                 int size = mInputStream.read(mReadBuffer);
 
-                Log.d("wzl", "received data size: " + size + ", data: " + Arrays.toString(mReadBuffer));
+                Log.d("wzl", "received data size: " + size + ", data: " + bytesToHexString(mReadBuffer));
 
                 byte[] readBytes = new byte[size];
                 System.arraycopy(mReadBuffer, 0, readBytes, 0, size);
@@ -78,4 +78,22 @@ public abstract class SerialPortReadThread extends Thread {
         }
 
     }
+
+    /**
+     * byte数组转换成十六进制字符串
+     *
+     * @param bArray
+     * @return HexString
+     */
+    public static final String bytesToHexString(byte[] bArray) {
+        StringBuffer sb = new StringBuffer(bArray.length);
+        String sTemp;
+        for (int i = 0; i < bArray.length; i++) {
+            sTemp = Integer.toHexString(0xFF & bArray[i]);
+            if (sTemp.length() < 2)
+                sb.append(0);
+            sb.append(sTemp.toUpperCase());
+        }
+        return sb.toString();
+    }
 }

+ 72 - 0
app/src/main/java/com/wdkl/tradition/MyApplication.java

@@ -32,6 +32,8 @@ import java.util.concurrent.TimeUnit;
 
 import okhttp3.OkHttpClient;
 
+import static com.wdkl.tradition.common.Constants.DEFAULT_VOLUME;
+
 /**
  * Created by 胡博文 on 2017/8/17.
  * #                                                   #
@@ -106,6 +108,76 @@ public class MyApplication extends Application {
             SharedPreferencesUtil.putIntSp(this, Constants.MSG_SP, SharedPreferencesUtil.SipCallingVoice, 90);
         }
 
+        //转换盒主机和分机输入输出音量设置
+        int value;
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic1);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic1, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[0] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[0] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker1);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker1, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[1] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[1] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic1);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic1, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[2] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[2] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker1);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker1, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[3] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[3] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic2);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic2, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[4] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[4] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker2);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker2, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[5] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[5] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic2);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic2, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[6] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[6] = value;
+        }
+
+        value = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker2);
+        if (-100 == value) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker2, DEFAULT_VOLUME);
+            Constants.TRADITION_VOLUMES[7] = DEFAULT_VOLUME;
+        } else {
+            Constants.TRADITION_VOLUMES[7] = value;
+        }
+
+        if (SerialPortService.getInstance().getPortOpened()) {
+            SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+        }
+
         //检查launch版本
         if (needCheckLaunch) {
             checkLaunch();

+ 278 - 3
app/src/main/java/com/wdkl/tradition/TraditionActivity.java

@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
 import android.app.AlarmManager;
 import android.app.PendingIntent;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.net.ConnectivityManager;
@@ -12,11 +13,16 @@ import android.net.wifi.WifiManager;
 import android.os.CountDownTimer;
 import android.os.Handler;
 import android.os.Message;
+import android.support.v7.app.AlertDialog;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
 import android.widget.RadioButton;
 import android.widget.RadioGroup;
+import android.widget.SeekBar;
 import android.widget.TextView;
 
 import com.google.gson.Gson;
@@ -63,6 +69,7 @@ import java.util.ArrayList;
 
 import okhttp3.Call;
 
+import static com.wdkl.tradition.common.Constants.DEFAULT_VOLUME;
 import static com.wdkl.tradition.common.Constants.EVENT_BROADCAST;
 import static com.wdkl.tradition.common.Constants.EVENT_CALL_OUT;
 import static com.wdkl.tradition.common.Constants.EVENT_EMERGENCY_CALL;
@@ -76,6 +83,7 @@ import static com.wdkl.tradition.common.Constants.EVENT_SIP_REGISTER_STATUS;
 import static com.wdkl.tradition.common.Constants.EVENT_UDP;
 import static com.wdkl.tradition.common.Constants.isConversation;
 import static com.wdkl.tradition.common.Constants.isMacRegister;
+import static com.wdkl.tradition.service.SerialSignalTypeEnum.MCU_MSG_DEVICEID_INFO;
 import static com.wdkl.tradition.util.ethernetwifiwithsipconnectstatus.WifiBindSipStatusConnector.ethernetStatus;
 
 /**
@@ -94,6 +102,7 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
     RadioButton rbDualMode, rbSingleMode;
 
     TextView version_tv;
+    Button btnVolumeSet;
 
     private InitDataEntity initDataEntity;
     private RoomEntity roomEntity;
@@ -155,6 +164,13 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
         tvSerialReceive = findViewById(R.id.activity_tradition_layout_tv_serial_receive);
         tvSerialSend = findViewById(R.id.activity_tradition_layout_tv_serial_send);
         tvVersionname = findViewById(R.id.activity_tradition_layout_tv_versionname);
+        btnVolumeSet = findViewById(R.id.btn_volume_set);
+        btnVolumeSet.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showTraditionVolumeSettingsDialog();
+            }
+        });
 
 
         groupCallMode = findViewById(R.id.group_calling_mode);
@@ -250,7 +266,7 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
         netRefresh();
         CallVoiceShowProgress();
 
-        SerialPortService.getInstance().sendRegMode(0);
+        SerialPortService.getInstance().sendRegMode(0);  //
     }
 
     private void CallVoiceShowProgress() {
@@ -292,6 +308,256 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
 
     }
 
+    private void showTraditionVolumeSettingsDialog() {
+        AlertDialog.Builder builder = new AlertDialog.Builder(TraditionActivity.this);
+        final AlertDialog dialog = builder.create();
+        dialog.setCanceledOnTouchOutside(false);
+        View dialogView = View.inflate(TraditionActivity.this, R.layout.dialog_volume_setting, null);
+        final TextView tvMainMic1 = dialogView.findViewById(R.id.tv_main_mic1);
+        final TextView tvMainMic2 = dialogView.findViewById(R.id.tv_main_mic2);
+        final TextView tvMainSpeak1 = dialogView.findViewById(R.id.tv_main_speak1);
+        final TextView tvMainSpeak2 = dialogView.findViewById(R.id.tv_main_speak2);
+        final TextView tvSubMic1 = dialogView.findViewById(R.id.tv_sub_mic1);
+        final TextView tvSubMic2 = dialogView.findViewById(R.id.tv_sub_mic2);
+        final TextView tvSubSpeak1 = dialogView.findViewById(R.id.tv_sub_speaker1);
+        final TextView tvSubSpeak2 = dialogView.findViewById(R.id.tv_sub_speaker2);
+
+
+        final SeekBar mainMicBar1 = dialogView.findViewById(R.id.sb_main_mic1);
+        mainMicBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvMainMic1.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[0] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic1, Constants.TRADITION_VOLUMES[0]);
+            }
+        });
+
+        final SeekBar mainSpeakBar1 = dialogView.findViewById(R.id.sb_main_speak1);
+        mainSpeakBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvMainSpeak1.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[1] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker1, Constants.TRADITION_VOLUMES[1]);
+            }
+        });
+
+        final SeekBar subMicBar1 = dialogView.findViewById(R.id.sb_sub_mic1);
+        subMicBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvSubMic1.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[2] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic1, Constants.TRADITION_VOLUMES[2]);
+            }
+        });
+
+        final SeekBar subSpeakerBar1 = dialogView.findViewById(R.id.sb_sub_speaker1);
+        subSpeakerBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvSubSpeak1.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[3] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker1, Constants.TRADITION_VOLUMES[3]);
+            }
+        });
+
+        final SeekBar mainMicBar2 = dialogView.findViewById(R.id.sb_main_mic2);
+        mainMicBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvMainMic2.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[4] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic2, Constants.TRADITION_VOLUMES[4]);
+            }
+        });
+
+
+
+        final SeekBar mainSpeakBar2 = dialogView.findViewById(R.id.sb_main_speak2);
+        mainSpeakBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvMainSpeak2.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[5] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker2, Constants.TRADITION_VOLUMES[5]);
+            }
+        });
+
+        final SeekBar subMicBar2 = dialogView.findViewById(R.id.sb_sub_mic2);
+        subMicBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvSubMic2.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[6] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic2, Constants.TRADITION_VOLUMES[6]);
+            }
+        });
+
+        final SeekBar subSpeakerBar2 = dialogView.findViewById(R.id.sb_sub_speaker2);
+        subSpeakerBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                tvSubSpeak2.setText(String.valueOf(progress));
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                Constants.TRADITION_VOLUMES[7] = seekBar.getProgress();
+                SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+                SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker2, Constants.TRADITION_VOLUMES[7]);
+            }
+        });
+
+        Button btnSubmit = dialogView.findViewById(R.id.btn_submit);
+        btnSubmit.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dialog.dismiss();
+            }
+        });
+
+        Button btnRestore = dialogView.findViewById(R.id.btn_restore);
+        btnRestore.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                restoreVolumeSettings();
+
+                //更新UI
+                mainMicBar1.setProgress(DEFAULT_VOLUME);
+                mainSpeakBar1.setProgress(DEFAULT_VOLUME);
+                subMicBar1.setProgress(DEFAULT_VOLUME);
+                subSpeakerBar1.setProgress(DEFAULT_VOLUME);
+                mainMicBar2.setProgress(DEFAULT_VOLUME);
+                mainSpeakBar2.setProgress(DEFAULT_VOLUME);
+                subMicBar2.setProgress(DEFAULT_VOLUME);
+                subSpeakerBar2.setProgress(DEFAULT_VOLUME);
+
+                dialog.dismiss();
+            }
+        });
+
+        dialog.setView(dialogView);
+        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
+            @Override
+            public void onShow(DialogInterface dialog) {
+                mainMicBar1.setProgress(Constants.TRADITION_VOLUMES[0]);
+                mainSpeakBar1.setProgress(Constants.TRADITION_VOLUMES[1]);
+                subMicBar1.setProgress(Constants.TRADITION_VOLUMES[2]);
+                subSpeakerBar1.setProgress(Constants.TRADITION_VOLUMES[3]);
+                mainMicBar2.setProgress(Constants.TRADITION_VOLUMES[4]);
+                mainSpeakBar2.setProgress(Constants.TRADITION_VOLUMES[5]);
+                subMicBar2.setProgress(Constants.TRADITION_VOLUMES[6]);
+                subSpeakerBar2.setProgress(Constants.TRADITION_VOLUMES[7]);
+            }
+        });
+        dialog.show();
+
+        //设置dialog显示宽度
+        try {
+            Window window = dialog.getWindow();
+            WindowManager.LayoutParams lp = window.getAttributes();
+            lp.width = 960;
+            lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
+            window.setAttributes(lp);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void restoreVolumeSettings() {
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic1, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker1, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic1, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker1, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic2, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker2, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic2, DEFAULT_VOLUME);
+        SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker2, DEFAULT_VOLUME);
+
+        for (int i = 0; i < Constants.TRADITION_VOLUMES.length; i++) {
+            Constants.TRADITION_VOLUMES[i] = DEFAULT_VOLUME;
+        }
+
+        SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+    }
+
 
     private void initSip() {
         //=============================================SIP启动服务===================================//
@@ -501,6 +767,7 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
             getRoomInfo();
             getSystemInfo();
 
+            //SerialPortService.getInstance().checkDeviceId();
         }
     }
 
@@ -664,7 +931,12 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
             }
 
             String uartAddr = SerialPortService.getUAddr(model.getSlaveAddH(), model.getSlaveAddL());
-            LogUtil.d("onSerialReceived", "addr==" + uartAddr);
+            LogUtil.d("wzl", "addr==" + uartAddr + ", serialSignalTypeEnum==" + serialSignalTypeEnum);
+            if (serialSignalTypeEnum == MCU_MSG_DEVICEID_INFO) {
+                //LogUtil.d("wzl", "data: " + new String(model.getData()));
+                LogUtil.d("wzl", "data: " + SerialPortService.bytesToHexString(model.getData()) + ", id: " + new String(model.getData()));
+                SerialPortService.getInstance().checkDeviceId();
+            }
             if (isMacRegister) {
                 switch (serialSignalTypeEnum) {
                     case MCU_MSG_CALLIN_REQ:
@@ -947,6 +1219,8 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
                         sbMainCallingVoiceSet.setProgress(voiceSys);
                         SharedPreferencesUtil.putIntSp(TraditionActivity.this, Constants.MSG_SP, SharedPreferencesUtil.SbCallingVoice, voiceSys);
                         VoiceManagerUtil.setCallVoice(MyApplication.getAppContext(), voiceSys);
+                        VoiceManagerUtil.setSystemVoice(MyApplication.getAppContext(), voiceSys);
+                        VoiceManagerUtil.setMusicVoice(MyApplication.getAppContext(), voiceSys);
                         break;
                     case "call_mode_change_tradition_system": //护士主机改变传统转接盒的通话模式
                         if (Constants.HOST_ID.equals(udpEntity.getNurseHostID())) {
@@ -958,7 +1232,8 @@ public class TraditionActivity extends BaseActivity implements ISerialPortListen
                         break;
                     case "tradition_check":
                         String netState = ethernetStatus ? "1" : "0";
-                        UdpSendUtil.sendTraditionState(netState, sipState);
+                        String regState = isMacRegister ? "1" : "0";
+                        UdpSendUtil.sendTraditionState(netState, sipState, regState);
                         break;
                 }
 

+ 3 - 0
app/src/main/java/com/wdkl/tradition/common/Constants.java

@@ -146,6 +146,9 @@ public class Constants {
 
 
 
+    //转换盒音量
+    public static int[] TRADITION_VOLUMES = new int[8];
+    public static final int DEFAULT_VOLUME = 128;
 
     /**
      * 白天还是晚上<br>

+ 13 - 4
app/src/main/java/com/wdkl/tradition/service/SerialPortService.java

@@ -113,7 +113,7 @@ public class SerialPortService implements OnOpenSerialPortListener {
 
                         @Override
                         public void onDataSent(byte[] bytes) {
-                            //Log.i(TAG, "onDataSent byte: " + Arrays.toString(bytes)+ " hex:"+bytesToHexString(bytes));
+                            //Log.i("wzl", "send byte: " + " hex:"+bytesToHexString(bytes));
                         }
                     })
                     .openSerialPort(this.device.getFile(), 115200);
@@ -224,9 +224,9 @@ public class SerialPortService implements OnOpenSerialPortListener {
 
     private void sendSignal(SerialModel signal) {
         SerialSignalTypeEnum serialSignalTypeEnum = SerialSignalTypeEnum.getEnum(signal.getDataType());
-        //if (serialSignalTypeEnum != SerialSignalTypeEnum.APP_MSG_CONNECT_CHK) {
-            Log.d(TAG, " >>>>>>>>>>>> 发送包: " + serialSignalTypeEnum.getDesc());
-        //}
+        if (serialSignalTypeEnum != SerialSignalTypeEnum.APP_MSG_CONNECT_CHK) {
+            Log.d("wzl", " >>>>>>>>>>>> 发送包: " + serialSignalTypeEnum.getDesc() + ", send bytes: " + bytesToHexString(signal.getSendBytes()));
+        }
         if (mSerialPortManager != null) {
             mSerialPortManager.sendBytes(signal.getSendBytes());
         }
@@ -328,6 +328,15 @@ public class SerialPortService implements OnOpenSerialPortListener {
         }
     }
 
+    public void checkDeviceId() {
+        SerialModel serialModel = new SerialModel(
+                (byte) 0xFF, (byte) 0xFF,
+                SerialSignalTypeEnum.APP_MSG_INQUIRE_REQ.getDataType(),
+                (byte) 0x03
+        );
+        sendSignal(serialModel);
+    }
+
 
     public interface CallingCheckCallback {
         void onCallingCheckComplete(String uAddr, int status);

+ 1 - 0
app/src/main/java/com/wdkl/tradition/service/SerialSignalTypeEnum.java

@@ -27,6 +27,7 @@ public enum SerialSignalTypeEnum {
     MCU_MSG_CALLIN_REQ((byte)0x03, "分机呼叫请求"),
     MCU_MSG_CALLOFF_REQ((byte)0x04, "分机呼叫挂断请求"),
     MCU_MSG_SOSON_REQ((byte)0x05, "防水紧急按钮呼叫请求"),
+    MCU_MSG_DEVICEID_INFO((byte)0x06, "设备ID信息"),
     MCU_MSG_VERSION_INFO((byte)0x07, "MCU软件版本"),
     MCU_MSG_INQUIRE_RES((byte)0x31, "查询设备连接状态"),
     MCU_MSG_DEVICEMAC_RES((byte)0x32, "已注册设备MAC地址确认"),

+ 30 - 0
app/src/main/java/com/wdkl/tradition/util/AnalysisUdpUtil.java

@@ -7,6 +7,7 @@ import com.wdkl.tradition.common.Constants;
 import com.wdkl.tradition.entity.BroadCastEntity;
 import com.wdkl.tradition.entity.MessageEvent;
 import com.wdkl.tradition.entity.UdpEntity;
+import com.wdkl.tradition.service.SerialPortService;
 
 import org.greenrobot.eventbus.EventBus;
 
@@ -197,6 +198,35 @@ public class AnalysisUdpUtil {
                             AutoRebootUtil.reboot(MyApplication.getAppContext());
                         }
                         break;
+                    case "tradition_reg":
+                        if (Constants.IP_ADDRESS.equals(data[1])) {
+                            if ("0".equals(data[2])) {
+                                Constants.isMacRegister = false;
+                            }
+                        }
+                        break;
+                    case "tradition_volume":
+                        if (Constants.IP_ADDRESS.equals(data[1])) {
+                            Constants.TRADITION_VOLUMES[0] = Integer.parseInt(data[2]);
+                            Constants.TRADITION_VOLUMES[1] = Integer.parseInt(data[3]);
+                            Constants.TRADITION_VOLUMES[2] = Integer.parseInt(data[4]);
+                            Constants.TRADITION_VOLUMES[3] = Integer.parseInt(data[5]);
+                            Constants.TRADITION_VOLUMES[4] = Integer.parseInt(data[6]);
+                            Constants.TRADITION_VOLUMES[5] = Integer.parseInt(data[7]);
+                            Constants.TRADITION_VOLUMES[6] = Integer.parseInt(data[8]);
+                            Constants.TRADITION_VOLUMES[7] = Integer.parseInt(data[9]);
+                            SerialPortService.getInstance().setMCUVolumes(Constants.TRADITION_VOLUMES);
+
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic1, Constants.TRADITION_VOLUMES[0]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker1, Constants.TRADITION_VOLUMES[1]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic1, Constants.TRADITION_VOLUMES[2]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker1, Constants.TRADITION_VOLUMES[3]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainMic2, Constants.TRADITION_VOLUMES[4]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.MainSpeaker2, Constants.TRADITION_VOLUMES[5]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubMic2, Constants.TRADITION_VOLUMES[6]);
+                            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.SubSpeaker2, Constants.TRADITION_VOLUMES[7]);
+                        }
+                        break;
                 }
             } else if ("#".equals(udpMsg.substring(0, 1))) {
                 LogUtil.d("isBelongToHostMachine", "udpMsg==" + udpMsg);

+ 9 - 0
app/src/main/java/com/wdkl/tradition/util/SharedPreferencesUtil.java

@@ -14,6 +14,15 @@ public class SharedPreferencesUtil {
     public static final String SbCallingVoice = "SbCallingVoice";
     public static final String SipCallingVoice = "SipCallingVoice";
 
+    public static final String MainMic1 = "MainMic1";  //主机麦克风(免提)
+    public static final String MainMic2 = "MainMic2";  //主机麦克风(手柄)
+    public static final String MainSpeaker1 = "MainSpeaker1";  //主机喇叭(免提)
+    public static final String MainSpeaker2 = "MainSpeaker2";  //主机喇叭(手柄)
+    public static final String SubMic1 = "SubMic1";  //分机麦克风(免提)
+    public static final String SubMic2 = "SubMic2";  //分机麦克风(手柄)
+    public static final String SubSpeaker1 = "SubSpeaker1";  //分机喇叭(免提)
+    public static final String SubSpeaker2 = "SubSpeaker2";  //分机喇叭(手柄)
+
     private static SharedPreferencesUtil mSharedPreferencesUtil;
 
     public static SharedPreferencesUtil getInstance() {

+ 3 - 1
app/src/main/java/com/wdkl/tradition/util/SipUtil/SipHelperUtil.java

@@ -160,7 +160,9 @@ public class SipHelperUtil implements EthernetWifiCallBackI {
         if (sipservice != null) {
             sipservice.clearListener();
         }
-        getSipServiceStartHandler().removeCallbacks(getSipServiceStartRunnable());
+        if (getSipRegisterHandler() != null) {
+            getSipServiceStartHandler().removeCallbacks(getSipServiceStartRunnable());
+        }
         sipRegisterHandler.removeCallbacks(sipRegisterRunnable);
         if (getSipServiceConnection() != null && isRegister) {
             try {

+ 4 - 4
app/src/main/java/com/wdkl/tradition/util/UdpSendUtil.java

@@ -63,13 +63,13 @@ public class UdpSendUtil {
         AnalysisUdpUtil.sendString(str);
     }
 
-    public static void sendTraditionState(String net, String sip) {
+    public static void sendTraditionState(String net, String sip, String regState) {
         AnalysisUdpUtil.sendAndroidUdpData("tradition_state"
-                , Constants.IP_ADDRESS
+                , Constants.HOST_ID
                 , net
                 , sip
-                , "0"
-                , "0"
+                , Constants.IP_ADDRESS
+                , regState
                 , "0"
                 , "0"
                 , "0"

+ 25 - 0
app/src/main/res/drawable/seek_bar_bg.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@android:id/background">
+        <shape>
+            <corners android:radius="3dp" />
+            <solid android:color="#ECF0F1" />
+        </shape>
+    </item>
+    <item android:id="@android:id/secondaryProgress">
+        <clip>
+            <shape>
+                <corners android:radius="3dp" />
+                <solid android:color="#C6CACE" />
+            </shape>
+        </clip>
+    </item>
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape>
+                <corners android:radius="3dp" />
+                <solid android:color="#FF8C00" />
+            </shape>
+        </clip>
+    </item>
+</layer-list>

+ 14 - 0
app/src/main/res/drawable/seek_bar_thumb.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <!-- solid表示远的填充色 -->
+    <solid android:color="#FF8C00" />
+    <!-- stroke则代表远的边框线 -->
+    <stroke
+        android:width="1dp"
+        android:color="#FF8C00" />
+    <!-- size控制高宽 -->
+    <size
+        android:width="20dp"
+        android:height="20dp" />
+</shape>

+ 8 - 0
app/src/main/res/layout/activity_tradition.xml

@@ -214,6 +214,14 @@
                 app:dsb_trackHeight="3dp" />
         </LinearLayout>
 
+        <Button
+            android:id="@+id/btn_volume_set"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:layout_marginLeft="20dp"
+            android:text="音量设置"/>
+
     </LinearLayout>
 
     <TextView

+ 403 - 0
app/src/main/res/layout/dialog_volume_setting.xml

@@ -0,0 +1,403 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:background="#7CC5F0">
+
+    <!-- 1.主机麦克风输入(免提)-->
+    <RelativeLayout
+        android:id="@+id/rl_main_mic_volume1"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center">
+
+        <TextView
+            android:id="@+id/tv_main_mic_title1"
+            style="@style/TextViewStyle1"
+            android:text="转换盒主机麦克风输入(免提):"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_main_mic1"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:layout_toRightOf="@+id/tv_main_mic_title1"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_main_mic1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/tv_main_mic_title1"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 2.主机麦克风输入(手柄)-->
+    <RelativeLayout
+        android:id="@+id/rl_main_mic_volume2"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/rl_main_mic_volume1"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center">
+
+        <TextView
+            android:id="@+id/tv_main_mic_title2"
+            style="@style/TextViewStyle1"
+            android:text="转换盒主机麦克风输入(手柄):"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_main_mic2"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_main_mic_title2"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_main_mic2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_main_mic_title2"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 3.主机喇叭输出(免提)-->
+    <RelativeLayout
+        android:id="@+id/rl_main_speaker_volume1"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_main_mic_volume1"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center">
+
+        <TextView
+            android:id="@+id/tv_main_speak_title1"
+            style="@style/TextViewStyle1"
+            android:text="转换盒主机喇叭输出(免提)"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_main_speak1"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_main_speak_title1"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_main_speak1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_main_speak_title1"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 4.主机喇叭输出(手柄) -->
+    <RelativeLayout
+        android:id="@+id/rl_main_speaker_volume2"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_main_mic_volume2"
+        android:layout_toRightOf="@id/rl_main_mic_volume1"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/tv_main_speak_title2"
+            style="@style/TextViewStyle1"
+            android:text="转换盒主机喇叭输出(手柄)"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_main_speak2"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_main_speak_title2"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_main_speak2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_main_speak_title2"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 5.分机麦克风输入(免提) -->
+    <RelativeLayout
+        android:id="@+id/rl_sub_mic_volume1"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_main_speaker_volume1"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center">
+
+        <TextView
+            android:id="@+id/tv_sub_mic_title1"
+            style="@style/TextViewStyle1"
+            android:text="分机麦克风输入(免提)"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_sub_mic1"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_sub_mic_title1"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_sub_mic1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_sub_mic_title1"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 6.分机麦克风输入(手柄) -->
+    <RelativeLayout
+        android:id="@+id/rl_sub_mic_volume2"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_main_speaker_volume2"
+        android:layout_toRightOf="@id/rl_sub_mic_volume1"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/tv_sub_mic_title2"
+            style="@style/TextViewStyle1"
+            android:text="分机麦克风输入(手柄)"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_sub_mic2"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_sub_mic_title2"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_sub_mic2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_sub_mic_title2"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 7.分机喇叭输出(免提) -->
+    <RelativeLayout
+        android:id="@+id/rl_sub_speaker_volume1"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_sub_mic_volume1"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center">
+
+        <TextView
+            android:id="@+id/tv_sub_speaker_title1"
+            style="@style/TextViewStyle1"
+            android:text="分机喇叭输出(免提)"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_sub_speaker1"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_sub_speaker_title1"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_sub_speaker1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_sub_speaker_title1"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <!-- 8.分机喇叭输出(手柄) -->
+    <RelativeLayout
+        android:id="@+id/rl_sub_speaker_volume2"
+        android:layout_width="@dimen/volume_settings_bar_width"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_sub_mic_volume2"
+        android:layout_toRightOf="@id/rl_sub_speaker_volume1"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp"
+        android:gravity="center"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/tv_sub_speaker_title2"
+            style="@style/TextViewStyle1"
+            android:text="分机喇叭输出(手柄)"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <TextView
+            android:id="@+id/tv_sub_speaker2"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            android:layout_toRightOf="@id/tv_sub_speaker_title2"
+            android:layout_marginLeft="8dp"
+            android:gravity="center"
+            android:text="10"
+            android:textSize="20sp"
+            android:textColor="@color/colorPrimaryDark" />
+
+        <SeekBar
+            android:id="@+id/sb_sub_speaker2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/tv_sub_speaker_title2"
+            android:layout_marginTop="20dp"
+            android:maxHeight="4dp"
+            android:minHeight="4dp"
+            android:max="255"
+            android:progress="0"
+            android:progressDrawable="@drawable/seek_bar_bg"
+            android:scrollbarStyle="insideInset"
+            android:thumb="@drawable/seek_bar_thumb"/>
+    </RelativeLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/rl_sub_speaker_volume1"
+        android:layout_marginBottom="20dp"
+        android:orientation="horizontal">
+
+        <Button
+            android:id="@+id/btn_restore"
+            style="?android:buttonBarButtonStyle"
+            android:layout_height="wrap_content"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_marginStart="80dp"
+            android:layout_marginEnd="80dp"
+            android:text="恢复默认值"
+            android:textSize="20sp" />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"/>
+        <Button
+            android:id="@+id/btn_submit"
+            style="?android:buttonBarButtonStyle"
+            android:layout_height="wrap_content"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_marginStart="80dp"
+            android:layout_marginEnd="80dp"
+            android:text="确定"
+            android:textSize="20sp" />
+    </LinearLayout>
+
+</RelativeLayout>

+ 3 - 0
app/src/main/res/values/dimens.xml

@@ -0,0 +1,3 @@
+<resources>
+    <dimen name="volume_settings_bar_width">600dp</dimen>
+</resources>

+ 6 - 0
app/src/main/res/values/styles.xml

@@ -8,4 +8,10 @@
         <item name="colorAccent">@color/colorAccent</item>
     </style>
 
+    <style name="TextViewStyle1">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:textSize">22sp</item>
+        <item name="android:textColor">@color/black</item>
+    </style>
 </resources>