| | |
| | | package com.hdl.sdk.ttl_sdk.activity; |
| | | |
| | | import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_BAUDRATE; |
| | | import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_UART_PATH; |
| | | |
| | | import android.app.AlertDialog; |
| | | import android.app.ProgressDialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.support.v7.widget.LinearLayoutManager; |
| | | import android.support.v7.widget.RecyclerView; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hdl.sdk.ttl.Config.Configuration; |
| | | import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLSerialPortCore; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLTtlSdk; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.BgmInfoEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DevicesInfoEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DiscoverNewDevicesEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.UpdateRemarkFeedBackEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ThirdPartyBgmInfoEvent; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.WarningInfoEvent; |
| | | import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLStringUtils; |
| | | import com.hdl.sdk.ttl_sdk.R; |
| | | import com.hdl.sdk.ttl_sdk.adapter.HDLMainListAdapter; |
| | | import com.hdl.sdk.ttl_sdk.base.BaseActivity; |
| | | //import com.hdl.sdk.ttl_sdk.bean.ZigbeeActivity2; |
| | | import com.hdl.sdk.ttl_sdk.utlis.HDLLog; |
| | | import com.hdl.sdk.ttl_sdk.utlis.HDLWarningType; |
| | | |
| | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_BAUDRATE; |
| | | import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_UART_PATH; |
| | | |
| | | /** |
| | | * Modify by JLChen on 2019/6/27 |
| | |
| | | // private RelativeLayout topBarBack; |
| | | private TextView topBarTitle; |
| | | private TextView tvVersion; |
| | | private EditText etGatewaySubID; |
| | | private EditText etGatewaydeviceID; |
| | | private Button btnSearch; |
| | | private Button btnSearchScene; |
| | | private Button btnGetLocal; |
| | | private Button btnClose; |
| | | private Button btnOpen; |
| | |
| | | private void initView() { |
| | | topBarTitle = findViewById(R.id.tv_top_b_header_title); |
| | | tvVersion = findViewById(R.id.tv_version); |
| | | etGatewaySubID = findViewById(R.id.et_gateway_subID); |
| | | etGatewaydeviceID = findViewById(R.id.et_gateway_deviceID); |
| | | btnSearch = findViewById(R.id.btn_search); |
| | | btnSearchScene = findViewById(R.id.btn_searchScene); |
| | | btnGetLocal = findViewById(R.id.btn_getlocal); |
| | | btnClose = findViewById(R.id.btn_close); |
| | | btnOpen = findViewById(R.id.btn_open); |
| | |
| | | btnSearch.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (TextUtils.isEmpty(etGatewaySubID.getText().toString()) || TextUtils.isEmpty(etGatewaydeviceID.getText().toString())) { |
| | | Toast.makeText(MainActivity.this, "请输入网关的子网号设备号!", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | /**全部重新搜索,清空原设备列表数据*/ |
| | | clearListView(); |
| | | HDLDeviceManager.clearAllDeviceList(); |
| | | HDLCommand.getHomeDevices(); |
| | | HDLCommand.getHomeDevices(Integer.parseInt(etGatewaySubID.getText().toString()), Integer.parseInt(etGatewaydeviceID.getText().toString())); |
| | | mProgressDialog.show(); |
| | | } |
| | | }); |
| | | |
| | | btnSearchScene.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | CtrlSceneActivity.open(MainActivity.this, etGatewaySubID.getText().toString(), etGatewaydeviceID.getText().toString()); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | for (int i = 0; i < mDevicesDataList.size(); i++) { |
| | | if (TextUtils.isEmpty(mDevicesDataList.get(i).getRemark())) { |
| | | mAllDevicesList.add("暂无备注" + "-" + mDevicesDataList.get(i).getSourceSubnetID() + "-" + mDevicesDataList.get(i).getSourceDeviceID()); |
| | | mAllDevicesList.add("模块子网设备号" + ":" + mDevicesDataList.get(i).getDeviceSubnetID() + "-" + mDevicesDataList.get(i).getDeviceDeviceID()); |
| | | } else { |
| | | mAllDevicesList.add(mDevicesDataList.get(i).getRemark() + "-" + mDevicesDataList.get(i).getSourceSubnetID() + "-" + mDevicesDataList.get(i).getSourceDeviceID()); |
| | | mAllDevicesList.add(mDevicesDataList.get(i).getRemark() + ":" + mDevicesDataList.get(i).getDeviceSubnetID() + "-" + mDevicesDataList.get(i).getDeviceDeviceID()); |
| | | } |
| | | } |
| | | mHDLMainListAdapter.notifyDataSetChanged(); |