Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void configGPIO()
- {
- System.out.println("Config start.");
- ATCommand m_Cmd;
- CommConnection commConn;
- InputStream inStream;
- OutputStream outStream;
- System.out.println("Available COM-Ports: " + System.getProperty("microedition.commports"));
- String strCOM = "comm:COM1;blocking=on;baudrate=115200";
- try {
- m_Cmd = new ATCommand(false);
- String Response = m_Cmd.send("AT^SSPI=\r");
- System.out.println("Response: " + Response);
- commConn = (CommConnection)Connector.open(strCOM);
- System.out.println("CommConnection(" + strCOM + ") opened");
- System.out.println("Real baud rate: " + commConn.getBaudRate());
- inStream = commConn.openInputStream();
- outStream = commConn.openOutputStream();
- System.out.println("InputStream and OutputStream opened");
- Thread.sleep(2000);
- outStream.write(new String("<aD41800>\r").getBytes());
- Thread.sleep(2000);
- outStream.write(new String("<aD41900>\r").getBytes());
- Thread.sleep(2000);
- outStream.write(new String("#\r").getBytes());
- System.out.println("End of data stream");
- Thread.sleep(2000);
- outStream.close();
- commConn.close();
- Response = m_Cmd.send("AT+CFUN=1,1\r");
- System.out.println("Response: " + Response);
- Thread.sleep(10000);
- } catch (ATCommandFailedException ex) {
- ex.printStackTrace();
- } catch (IllegalStateException ex) {
- ex.printStackTrace();
- } catch (IOException ex) {
- ex.printStackTrace();
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement