Gemalto is now part of the Thales Group, find out more.

You are here

Problems to stop a process with a pushbutton. | Thales IoT Developer Community

October 29, 2014 - 5:19pm, 2802 views

I have the TC65 terminal controlling two buttons through GPIO ports.One is connected into GPIO4 and the other into GPIO6 ^SCPOL: 5,1 ^SCPOL: 5,0 ^SCPOL: 3,1 ^SCPOL: 3,0 The application is simple 1) If the button --GPIO4-- is pushed the count with one second delay should be initiated and present the result which must be multiples of a reference value. 2) The count must stop when the button GPIO6 is pressed and shows the final value of the count. The main problem: I can 't stop the process by pressing the button controlled by the port GPIO6. The hardware if working OK.The main application is controlled by a timer that stops it after 30 seconds. Any suggestion? Regards, German F public class ATList implements ATCommandListener { public void RINGChanged(boolean arg0){} public void DCDChanged(boolean arg0) {} public void CONNChanged(boolean arg0) {} public void DSRChanged(boolean arg0) {} public void ATEvent(String arg0) { boolean state1=false; boolean state2=false; int ficha=3; int cont=0; int credits=0; while (true) { if ((arg0.indexOf("3,1")>0) || (arg0.indexOf("3,0")>0)) state1=checkInt(3); if ((arg0.indexOf("5,1")>0) || (arg0.indexOf("5,0")>0)) state2=checkInt(5); if (state1=true){ try { Thread.sleep(1000); cont++; if(cont%ficha==0){ credits=cont; System.out.println("Parcial credits:" + credits); } } catch (InterruptedException ex) { ex.printStackTrace(); } }else if (state2=true) {System.out.println("Total Credits:" + credits); break; } } } String sendAT(String str) { try { str = atc.send(str + "\r".toUpperCase()); } catch (ATCommandFailedException e) { } catch (IllegalArgumentException e) { } catch (IllegalStateException e) { } return str; } boolean checkInt(int NumGPIO) { String answerButton; boolean Flag=false; answerButton = sendAT("at^sgio="+ NumGPIO); if ((answerButton.indexOf("^SGIO:1")>0)&&(answerButton.indexOf("^SGIO:0")>0)) { Flag=true; } return Flag; }