<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/textViewCmdId"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:text="CMDID"
        app:layout_constraintBottom_toBottomOf="@+id/cmdid"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/cmdid" />

    <EditText
        android:id="@+id/cmdid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin_small"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:ems="10"
        android:imeOptions="actionDone"
        android:inputType="text"
        android:maxLines="1"
        android:lines="1"
        android:singleLine="true"
        android:text="XY-ANDROIDSIM-001"
        app:layout_constraintLeft_toRightOf="@+id/textViewCmdId"
        app:layout_constraintTop_toTopOf="parent" />

    <Spinner
        android:id="@+id/protocol"
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:spinnerMode="dropdown"
        android:entries="@array/protocols"
        app:layout_constraintLeft_toRightOf="@+id/cmdid"
        app:layout_constraintTop_toTopOf="@+id/cmdid" />

    <TextView
        android:id="@+id/textViewServer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Server"
        app:layout_constraintBottom_toBottomOf="@+id/server"
        app:layout_constraintStart_toStartOf="@id/textViewCmdId"
        app:layout_constraintTop_toTopOf="@+id/server" />

    <EditText
        android:id="@+id/server"
        android:layout_width="128dp"
        android:layout_height="wrap_content"
        android:maxLines="1"
        android:lines="1"
        android:singleLine="true"
        android:inputType="text"
        android:imeOptions="actionDone"
        android:hint="@string/main_server"
        app:layout_constraintStart_toStartOf="@+id/cmdid"
        app:layout_constraintTop_toBottomOf="@+id/cmdid" />

    <EditText
        android:id="@+id/port"
        android:layout_width="48dp"
        android:layout_height="wrap_content"
        android:inputType="none|number"
        android:imeOptions="actionDone"
        android:maxLines="1"
        android:text=""
        app:layout_constraintBottom_toBottomOf="@+id/server"
        app:layout_constraintLeft_toRightOf="@+id/server"
        app:layout_constraintTop_toTopOf="@+id/server" />

    <Spinner
        android:id="@+id/networkProtocol"
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:spinnerMode="dropdown"
        android:entries="@array/networkProtocols"
        app:layout_constraintLeft_toRightOf="@+id/port"
        app:layout_constraintTop_toTopOf="@+id/port" />

    <TextView
        android:id="@+id/textViewHeartbeat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/main_heartbeat"
        app:layout_constraintBottom_toBottomOf="@+id/heartbeat"
        app:layout_constraintStart_toStartOf="@id/textViewCmdId"
        app:layout_constraintTop_toTopOf="@+id/heartbeat" />

    <EditText
        android:id="@+id/heartbeat"
        android:layout_width="48dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:layout_marginTop="0dp"
        android:ems="10"
        android:inputType="none|number"
        android:imeOptions="actionDone"
        android:maxLines="1"
        android:text=""
        android:hint="@string/main_heartbeat_default"
        app:layout_constraintStart_toEndOf="@+id/textViewHeartbeat"
        app:layout_constraintTop_toBottomOf="@+id/server" />

    <TextView
        android:id="@+id/textViewPacketSize"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:text="@string/main_packet_size"
        app:layout_constraintBottom_toBottomOf="@+id/packetSize"
        app:layout_constraintStart_toEndOf="@+id/heartbeat"
        app:layout_constraintTop_toTopOf="@+id/packetSize" />

    <EditText
        android:id="@+id/packetSize"
        android:layout_width="64dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:ems="10"
        android:inputType="none|number"
        android:imeOptions="actionDone"
        android:maxLines="1"
        android:text="2048"
        android:hint="@string/main_packet_size_default"
        app:layout_constraintLeft_toRightOf="@+id/textViewPacketSize"
        app:layout_constraintTop_toTopOf="@+id/heartbeat" />

    <Spinner
        android:id="@+id/network"
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:entries="@array/networks"
        android:spinnerMode="dropdown"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        app:layout_constraintLeft_toRightOf="@+id/packetSize"
        app:layout_constraintTop_toTopOf="@+id/heartbeat" />

    <Button
        android:id="@+id/btnStartServ"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin_small"
        android:text="Start"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/heartbeat"

        />

    <Button
        android:id="@+id/btnStopServ"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:enabled="false"
        android:text="Stop"
        app:layout_constraintStart_toEndOf="@+id/btnStartServ"
        app:layout_constraintTop_toTopOf="@+id/btnStartServ" />

    <Button
        android:id="@+id/btnSaveCfg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="Save"
        app:layout_constraintStart_toEndOf="@+id/btnStopServ"
        app:layout_constraintTop_toTopOf="@+id/btnStartServ" />

    <Button
        android:id="@+id/btnChannels"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="通道设置"
        app:layout_constraintStart_toEndOf="@+id/btnSaveCfg"
        app:layout_constraintTop_toTopOf="@+id/btnStartServ" />


    <Button
        android:id="@+id/btnTakePhoto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tp_ch1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnStartServ" />

    <Button
        android:id="@+id/btnTakePhoto2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tp_ch2"
        app:layout_constraintStart_toEndOf="@+id/btnTakePhoto"
        app:layout_constraintTop_toTopOf="@+id/btnTakePhoto" />

    <Button
        android:id="@+id/btnTakePhoto3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tp_ch3"
        app:layout_constraintStart_toEndOf="@+id/btnTakePhoto2"
        app:layout_constraintTop_toTopOf="@+id/btnTakePhoto" />

    <Button
        android:id="@+id/btnTakePhoto4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tp_ch4"
        app:layout_constraintStart_toEndOf="@+id/btnTakePhoto3"
        app:layout_constraintTop_toTopOf="@+id/btnTakePhoto" />

    <Button
        android:id="@+id/takeVideoBtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin_small"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tv_ch1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnTakePhoto" />

    <Button
        android:id="@+id/takeVideoBtn2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tv_ch2"
        app:layout_constraintStart_toEndOf="@+id/takeVideoBtn"
        app:layout_constraintTop_toTopOf="@+id/takeVideoBtn" />

    <Button
        android:id="@+id/takeVideoBtn3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tv_ch3"
        app:layout_constraintStart_toEndOf="@+id/takeVideoBtn2"
        app:layout_constraintTop_toTopOf="@+id/takeVideoBtn" />

    <Button
        android:id="@+id/takeVideoBtn4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        android:text="@string/btn_tv_ch4"
        app:layout_constraintStart_toEndOf="@+id/takeVideoBtn3"
        app:layout_constraintTop_toTopOf="@+id/takeVideoBtn" />

    <Button
        android:id="@+id/btnSendHb"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/main_send_hb"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin_small"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/takeVideoBtn" />

    <Button
        android:id="@+id/btnRestartApp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/main_restart_app"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        app:layout_constraintStart_toEndOf="@+id/btnSendHb"
        app:layout_constraintTop_toTopOf="@+id/btnSendHb" />

    <Button
        android:id="@+id/btnReboot"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/main_reboot"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        app:layout_constraintStart_toEndOf="@+id/btnRestartApp"
        app:layout_constraintTop_toTopOf="@+id/btnSendHb" />

    <Button
        android:id="@+id/btnCameraInfo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/main_camera_info"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:minWidth="@dimen/activity_btn_min_width"
        android:minHeight="@dimen/activity_btn_min_height"
        app:layout_constraintStart_toEndOf="@+id/btnReboot"
        app:layout_constraintTop_toTopOf="@+id/btnSendHb" />


    <Button
        android:id="@+id/simchange"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:text="sim卡获取"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnStartServ" />

    <Button
        android:id="@+id/simchange2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:layout_marginTop="8dp"
        android:text="切换sim2"
        android:visibility="gone"
        app:layout_constraintStart_toEndOf="@+id/simchange"
        app:layout_constraintTop_toBottomOf="@+id/btnStartServ" />



    <Button
        android:id="@+id/gps"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:text="gps" />

    <Button
        android:id="@+id/netgps"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:text="network_gps" />

    <Button
        android:id="@+id/tcpudp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:text="网络通信" />

    <Button
        android:id="@+id/tcpudpsend"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:text="心跳发送" />

    <Button
        android:id="@+id/video"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:text="录制视频" />

    <Button
        android:id="@+id/video2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:text="录制视频结束"
        tools:layout_editor_absoluteX="426dp"
        tools:layout_editor_absoluteY="380dp" />

    <androidx.constraintlayout.helper.widget.Flow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="32dp"
        app:constraint_referenced_ids="gps,netgps,tcpudp,tcpudpsend,video,video2"
        app:flow_horizontalGap="20dp"
        app:flow_wrapMode="chain"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/logs"
        app:layout_constraintTop_toBottomOf="@+id/btnSendHb" />


    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/leftBarrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="right"
        app:constraint_referenced_ids="textViewCmdId,cmdid,protocol,networkProtocol,btnSaveCfg,btnTakePhoto4,btnChannels,network,takeVideoBtn4"
        tools:layout_editor_absoluteX="46dp" />


    <TextView
        android:id="@+id/logs"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_margin="4dp"
        android:padding="4dp"
        android:background="@drawable/textview_border"
        android:orientation="horizontal"
        android:lineSpacingMultiplier="1.25"
        android:scrollbars="vertical"
        android:singleLine="false"
        android:text="Logs"
        android:textColor="@color/black"
        android:textIsSelectable="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/leftBarrier"
        app:layout_constraintTop_toTopOf="parent" />

    <SurfaceView
        android:id="@+id/surfaceView"
        android:layout_width="411dp"
        android:layout_height="441dp"
        android:layout_marginStart="2dp"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="parent"
        tools:layout_editor_absoluteY="288dp" />

</androidx.constraintlayout.widget.ConstraintLayout>