| | |
| | | private JSONObject fakeStatusDemo = JSONObject.parseObject("{\"mode\":1,\"extend\":{\"countQuantity\":400,\"suspendState\":0,\"minCellVoltage\":3279,\"chargeCycleTimes\":0,\"maxCellVoltage\":3281,\"surplusQuantity\":204,\"voltage\":5248},\"hasLift\":false,\"hasPallet\":false,\"batteryVoltage\":5248,\"runDirection\":\"2\",\"currentCode\":\"{\\\"x\\\":19,\\\"y\\\":11,\\\"z\\\":2}\",\"errorCode\":\"0\",\"hasCharge\":false,\"batteryPower\":\"51\",\"speed\":0,\"deviceStatus\":1}"); |
| | | private ServerSocket serverSocket; |
| | | private Integer gatewayPort; |
| | | private boolean enableFakeAndDeviceThread; |
| | | private ConcurrentHashMap<String, Thread> fakeThreadMap = new ConcurrentHashMap(); |
| | | private ConcurrentHashMap<String, Socket> fakeServerMap = new ConcurrentHashMap(); |
| | | private ConcurrentHashMap<String, JSONObject> fakeStatusMap = new ConcurrentHashMap(); |
| | |
| | | |
| | | private boolean fake = false; |
| | | |
| | | public FakeNyShuttleThread(RedisUtil redisUtil, Integer gatewayPort) { |
| | | public FakeNyShuttleThread(RedisUtil redisUtil, Integer gatewayPort, boolean enableFakeAndDeviceThread) { |
| | | this.redisUtil = redisUtil; |
| | | this.gatewayPort = gatewayPort; |
| | | this.enableFakeAndDeviceThread = enableFakeAndDeviceThread; |
| | | } |
| | | |
| | | @Override |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (enableFakeAndDeviceThread) { |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); |
| | | if (shuttleThread == null) { |
| | | // init |
| | |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | log.info("{}:device is run,devices:{}", device.getDeviceNo(),JSON.toJSONString(fakeServerMap)); |
| | | |