| | |
| | | import com.core.common.Cools; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.MatDto; |
| | | import com.zy.common.utils.News; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | public LedThread(Slave slave) { |
| | | this.slave = slave; |
| | | try { |
| | | Bx5GEnv.initial(3000); |
| | | screen = new Bx5GScreenClient("my"); |
| | | // Bx5GEnv.initial(3000); |
| | | // screen = new Bx5GScreenClient("my"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.info("led连接构造器错误 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | News.info("led连接构造器错误 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @SuppressWarnings({"InfiniteLoopStatement", "unchecked"}) |
| | | public void run() { |
| | | connect(); |
| | | // connect(); |
| | | close(); |
| | | while (true) { |
| | | try { |
| | |
| | | case 6: |
| | | errorReset(); |
| | | break; |
| | | case 7: |
| | | write7((List<LedCommand>) task.getData()); |
| | | default: |
| | | break; |
| | | } |
| | |
| | | area.addPage(page); |
| | | pf.addArea(area); |
| | | if (pf.validate() != null) { |
| | | log.info("pf out of range"); |
| | | News.info("pf out of range"); |
| | | } else { |
| | | // 更新节目 |
| | | screen.writeProgram(pf); |
| | |
| | | pf.addArea(area); |
| | | // 更新节目 |
| | | if (pf.validate() != null) { |
| | | log.info("pf out of range"); |
| | | News.info("pf out of range"); |
| | | } else { |
| | | // 更新节目 |
| | | screen.writeProgram(pf); |
| | |
| | | close(); |
| | | } |
| | | private void write7(List<LedCommand> list) { |
| | | |
| | | commandList = list; |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | |
| | | boolean connRes = false; |
| | | try { |
| | | connRes = screen.connect(slave.getIp(),slave.getPort()); |
| | |
| | | } catch (Exception ignore) { |
| | | } |
| | | if (connRes) { |
| | | log.info("led连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | News.info(methodName + ":led连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } else { |
| | | log.error("led连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | News.error(methodName + ":led连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | return connRes; |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | screen.disconnect(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String strQty = "1234"; |
| | |
| | | // 更新节目 |
| | | if (pf.validate() != null) { |
| | | System.out.println("pf out of range"); |
| | | log.info("pf out of range"); |
| | | News.info("pf out of range"); |
| | | } else { |
| | | // 更新节目 |
| | | screen.writeProgram(pf); |
| | |
| | | // 继开与控制器之间的链接 |
| | | // screen.disconnect(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static void main1(String[] args) throws Exception { |
| | | Bx5GEnv.initial(3000); |