| | |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog; |
| | | import com.hdl.sdk.hdl_core.Util.NetUtil.NetWorkUtil; |
| | | import com.hdl.sdk.hdl_core.Util.SPUtil.SPUtils; |
| | | import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis; |
| | | |
| | |
| | | HDLDeviceManager.init(context); |
| | | } |
| | | |
| | | // /** |
| | | // * 获取本地广播IP |
| | | // * @return |
| | | // */ |
| | | // public static String getLocalBroadCastIp(){ |
| | | // return NetWorkUtil.getLocalBroadCast(); |
| | | // } |
| | | |
| | | /** |
| | | * 获取本地广播IP |
| | | * @return |
| | | */ |
| | | public static String getLocalBroadCastIp(){ |
| | | return NetWorkUtil.getLocalBroadCast(); |
| | | } |
| | | |
| | | /** |
| | | * 是否开启SDK日志打印 |
| | |
| | | } |
| | | } |
| | | //更新所有设备状态 |
| | | HandleSearch.refreshAllDevicesState(); |
| | | // HandleSearch.refreshAllDevicesState(30); |
| | | if (!deviceStateBeanList.isEmpty()) { |
| | | return deviceStateBeanList; |
| | | } else { |
| | |
| | | ) { |
| | | // curState = (int) infos.get(j).getCurState();//旧 |
| | | //20190712解决强制转换int类型闪退 |
| | | curState = HDLUtlis.getIntegerByObject(infos.get(j).getCurState()); |
| | | curState = HDLUtlis.getIntegerByObject(infos.get(j).getCurStateObject()); |
| | | break outter; |
| | | } |
| | | |
| | |
| | | ) { |
| | | //这里应该是要修复的,暂时未找到。 |
| | | //20190712解决强制转换int类型闪退 |
| | | int state = HDLUtlis.getIntegerByObject(infos.get(j).getCurState()); |
| | | int state = HDLUtlis.getIntegerByObject(infos.get(j).getCurStateObject()); |
| | | switch (state) { |
| | | case -1: |
| | | curState = 0; |
| | |
| | | // HDLLog.info("发出数据:"+sendData+"子网id:"+info.getDeviceSubnetID()+" 设备id:"+info.getDeviceDeviceID()); |
| | | cusSendCommand(command, |
| | | info.getDeviceSubnetID(), info.getDeviceDeviceID(), musicBytes, |
| | | info.getPort(), info.getIpAddress()); |
| | | info.getPort(), getLocalBroadCastIp()); |
| | | } |
| | | |
| | | } |
| | |
| | | // HDLLog.info("发出数据:"+sendData+"子网id:"+info.getDeviceSubnetID()+" 设备id:"+info.getDeviceDeviceID()); |
| | | cusSendCommand(command, |
| | | info.getDeviceSubnetID(), info.getDeviceDeviceID(), musicBytes, |
| | | info.getPort(), info.getIpAddress()); |
| | | info.getPort(), getLocalBroadCastIp()); |
| | | } |
| | | } |
| | | |
| | |
| | | // HDLLog.info("发出数据:"+sendData+"子网id:"+info.getDeviceSubnetID()+" 设备id:"+info.getDeviceDeviceID()); |
| | | cusSendCommand(command, |
| | | info.getDeviceSubnetID(), info.getDeviceDeviceID(), musicBytes, |
| | | info.getPort(), info.getIpAddress()); |
| | | info.getPort(), getLocalBroadCastIp()); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | private static void addSendData(final AppliancesInfo info, byte[] addBytes, final int type) { |
| | | |
| | | final Crc sendDatas = new Crc(info.getStateCommand(), info.getDeviceSubnetID(), info.getDeviceDeviceID(), addBytes, info.getPort(), info.getIpAddress()); |
| | | final Crc sendDatas = new Crc(info.getStateCommand(), info.getDeviceSubnetID(), info.getDeviceDeviceID(), addBytes, info.getPort(), getLocalBroadCastIp()); |
| | | sendDatas.count = 0; |
| | | |
| | | |
| | |
| | | // } |
| | | } |
| | | if (!sendDatas.isCtrlSuccess) { |
| | | cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes, info.getPort(), info.getIpAddress()); |
| | | cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes, info.getPort(), getLocalBroadCastIp()); |
| | | } else { |
| | | // HDLLog.info("控制已成功,停止"); |
| | | sendCycleTimer.cancel(); |