| | |
| | | private static final int SEARCH_BROACAST = 101;//广播 |
| | | private static final int SEARCH_MULTICAST = 102;//组播 |
| | | |
| | | private static boolean bSearchAll = true; //是否全部重新搜索,或者发现新设备搜索 |
| | | private static boolean bSearchAll = true; //是否全部重新搜索,或者发现新设备搜索 |
| | | |
| | | /** |
| | | * 酒店搜索 |
| | |
| | | public void run() { |
| | | if (bean.getCount() < 3) { |
| | | HDLLog.I("没有收到新设备,发送第 " + (bean.getCount() + 1) + " 次搜索命令"); |
| | | secondTimeSearch(random1, random2, HDLDeviceManager.realDevicesDataList); |
| | | secondTimeSearch(random1, random2, (bean.getCount() + 1), HDLDeviceManager.realDevicesDataList); |
| | | } else { |
| | | if (searchTimer != null) { |
| | | searchTimer.cancel(); |
| | |
| | | |
| | | } |
| | | } |
| | | }, 500, 500); |
| | | }, 800, 800); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | isRefreshAllDevicesState = false; |
| | | /*** 全部重新搜索才清空list数组*/ |
| | | if(bSearchAll) { |
| | | if (bSearchAll) { |
| | | HDLDeviceManager.devicesDataList.clear(); |
| | | HDLDeviceManager.realDevicesDataList.clear(); |
| | | HDLDeviceManager.listRemarks.clear(); |
| | |
| | | * @param arg2 随机数2 |
| | | * @param devicesDataList 所有设备信息集 |
| | | */ |
| | | public static void secondTimeSearch(byte arg1, byte arg2, List<DevicesData> devicesDataList) { |
| | | public static void secondTimeSearch(byte arg1, byte arg2, int countSend, List<DevicesData> devicesDataList) { |
| | | if (devicesDataList == null || devicesDataList.size() == 0) { |
| | | return; |
| | | } |
| | |
| | | sendData += (bytes[i] & 0xff) + ","; |
| | | } |
| | | } |
| | | HDLLog.I("第二次发送的搜索数据:" + sendData); |
| | | HDLLog.I("第" + countSend + "次发送的搜索数据:" + sendData); |
| | | HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_COMMAND, 255, 255, bytes); |
| | | } |
| | | } |
| | |
| | | } |
| | | if ((HDLDeviceManager.listRemarks != null && HDLDeviceManager.listRemarks.size() == 0) || isSearching) { |
| | | isRefreshAllDevicesState = false; |
| | | if(HDLDeviceManager.devicesDataList != null && HDLDeviceManager.devicesDataList.size() > 0){ |
| | | if (HDLDeviceManager.devicesDataList != null && HDLDeviceManager.devicesDataList.size() > 0) { |
| | | HandleSearch.OnDeviceListGetSuccessCallBack(); |
| | | } |
| | | return; |