Hi Guys,
I was trying to write a code to send AT command to a GSM modem. But i am facing problem while sending the AT command from UI.
Below is the code:
SEND.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Thread runThread = new Thread(new Runnable() {
@Override
public void run() {
try{
sp.getOutputStream().write((textField.toString()+"\r\n").getBytes());
System.out.println("Written..........");
}catch (IOException e1) {
e1.printStackTrace();
}
}
});
runThread.start();
}
});
sp is a Serialport intialized with a particular portID and it is opened. Code to write AT command is correct since i have checked it in non-UI application and it is working. But only in UI app it does not work. Please help me resolve this.