Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected Void call() throws InterruptedException, IOException {
- //connect
- while(!Thread.currentThread().isInterrupted()) {
- do {
- try {
- plcc.connect();
- getInstance().updateCommunicationStatus("polaczono");
- Thread.sleep(5000);
- } catch(IOException ioe) {
- //System.out.println("ponawiam");
- getInstance().updateCommunicationStatus("ponawiam");
- }
- } while (!plcc.isConnected() && !Thread.currentThread().isInterrupted());
- //send request
- while(plcc.isConnected() && !plcc.isClosed() && !Thread.currentThread().isInterrupted()) {
- try {
- plcc.sendPosRequest();
- } catch (IOException ioe) {
- //System.out.println("error readera - nie zdarza sie");
- getInstance().updateCommunicationStatus("error readera");
- } catch (HandshakeException he) {
- //System.out.println("brak odpowiedzi");
- plcc.close();
- getInstance().updateCommunicationStatus("brak handshake'a");
- Thread.sleep(5000);
- }
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement