Reading response of AT command

I am using this code. I should get OK as output. But I only get few squares as output. Please help me fix this code. Thanks.
import javax.comm.*;
import java.io.*;
import java.util.*;
public class try1 {
public static void main(String args[]) {
InputStream input = null;
OutputStream output = null;
SerialPort serialPort = null;
try {
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM1");
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
System.out.println("sdiosdfdsf");
String f=null;int n;
input = serialPort.getInputStream();
output = serialPort.getOutputStream();
Thread readThread;
serialPort.notifyOnDataAvailable(true);
try {
serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}
output.write("AT\r\n".getBytes());
Thread.sleep(20000);
byte[] readBuffer = new byte[120];
try {
while (input.available() > 0) {
int numBytes = input.read(readBuffer);
System.out.print(new String(readBuffer));
} catch (IOException e) {}
// output.flush();
// int y;
//y=input.available();
// System.out.println("df"+y);
} catch (NoSuchPortException e) {
System.out.println("Exception in Adding Listener" + e);
} catch (PortInUseException e) {
System.out.println("Exception in Adding Listener" + e);
} catch (IOException e) {
System.out.println("Exception in Adding Listener" + e);
catch (InterruptedException e) {
System.out.println("Exception in Adding Listener" + e);
}

Hi Friends,
I have also similar kind of query.
How we can interact with SIM using AT commands?
I know few details about AT commands interaction with modem in native development(Using C).
But i dont have any idea in Java card applet. I am quite new to java card development.
Any response/suggestion will bi highly appreciated and will be of great help.
Thanks in advance for the help.
Best Regards,
Sunil K

Similar Messages

  • Reading response from AT command

    Hi,
    I'm trying to send AT commands from an STK applet to the phone, and then read the response, for example to use AT+CREG? to get the cell ID.
    Sending the commands seems to work, but I'm not sure exactly how to use the ProactiveResponseHandler to get the result back.
    If anyone has done this and could provide a short code sample, or pointers to more information, it would be really great!
    Thanks in advance!
    Henrik Arro

    Hi Friends,
    I have also similar kind of query.
    How we can interact with SIM using AT commands?
    I know few details about AT commands interaction with modem in native development(Using C).
    But i dont have any idea in Java card applet. I am quite new to java card development.
    Any response/suggestion will bi highly appreciated and will be of great help.
    Thanks in advance for the help.
    Best Regards,
    Sunil K

  • Siri works, but no longer reads responses.  I have turned the volume up, but nothing.  Any ideas?

    Hi All,
    I have not had much opportunity to use Siri until last night and when I did, it worked, but Siri would not verbally read responses, only display them on screen.  I visited the forums and have the volume turned up on Siri and have tried the enable/disable phone off/phone on trick, but to no avail.  Voice is set to "always".  Any thoughts?

    Ask siri what can you do siri always talks at this command if not then i would go to a apple store

  • Using VI Example Basic Serial Write Read to send AT commands to Cell phone modem error 1073807360

    I am using the NI Example VI: Basic Serial Write and Read to send AT commands to a Cell phone acting as a Modem.  I can send AT commands to this phone using Hyperterm when I select the modem driver by name in the hypert port selection field but not as com 7 which it occupies according to device manager modem properties. The basic serial vi does not show the modem driver as a selection, only ports by comX are shown. I get error 1073807360.

    Have you tried to put the name you enter in Hyperterminal in the VISA resource control? If Com 7 doesn't show, you can simply type "COM 7" in the VISA resource control. Or use "ASRL::INSTR 7".
    Also, make sure the connection in hyperterminal is closed, before you open the port in LabVIEW.
    Hope it helps,
    Wiebe.

  • I have a Windows 8.1 machine.  I used a projecteor a while back in a Power Point presentation.  Now my menus for Adobe are very small and hard to read.  The print command is so compressed that I cannot read or use it.  How do I fix this problem?

    I used a projecteor a while back in a Power Point presentation.  Now my menus for Adobe are very small and hard to read.  The print command is so compressed that I cannot read or use it.  How do I fix this problem?

    There is no application called "Adobe" - you are either working with Adobe Acrobat or the free Adobe Reader. Open up the preferences for the application (Edit>Preferences), then go to the "General" category and modify the settings for "Scale for screen resolution". You will have to restart the application after you do that. Does that fix your problems?

  • Hi, I am using USB 8476s to communicat​e to a slave unit in LIN network using LabVIEW7.1​. Can anyone tell me how i can send a header file plus 1 byte of data to the slave in a LIN network. or how do i use ldf file. i want to read responses from the slave

    Hi,   I am using USB 8476s to communicate to a slave unit in LIN network. Can anyone tell me how i can send a header frame plus 1 byte of data to the slave in a LIN network. or how do I communictae with slave using LabVIEW7.1.
    I want to read responses from the slave. When i tried with labview exapmle programs or even using MAX also, while doing some switching action in my slave, i am getting response as Device inactive with timestamp but there is no data format. 
    And I have Lin Description File. Can you suggest me how to use ldf file.
    I am at customer place and It would be great help from you if you can suggest me at the earliest. Thank you

    you may use the LDF Starter Kit to use LDF informations in your application
    http://joule.ni.com/nidu/cds/view/p/id/665/lang/en

  • Make System.in read input from a command prompt

    How can i make System.in read input from a command prompt which is opened after program
    is started. Please note that program starts without commad promt. Can u plz help?
    sharmila

    System.in DOES read from the command shell that you start the app in.
    What you don't have is a prompt.
    You should know about Java Almanac. There are code samples for simple things like I/O that everyone should know about. There's an example there to help you.
    MOD

  • "Reader Extensions ES" in Command Prompt.

    Is it possible to use the "Reader Extensions ES" through command prompt. Kindly advice me.
    Thanks,
    Prabudass

    Ah, this is the first mention you have made of an Adobe product. Now,
    LiveCycle Designer does not open in a browser, so I assume you are
    doing one of these
    * Opening Acrobat in a browser
    * Opening Adobe Reader in a browser
    * Opening a preview in Designer
    * Something else?
    If you can describe in detail what you are doing with Adobe products
    it may help to focus. HOWEVER, you have added to message topics which
    seem to have NOTHING to do with your question. Does your question
    connect to "Reader Extensions ES in Command Prompt" in some way that
    isn't clear? If not, please post ONE new message with a suitable title
    in the specific forum for the Adobe product involved. Thanks and good
    luck,
    Aandi Inston

  • Reading response headers on HttpService response

    I'm trying to figure out if there is a way to read response headers on a response from a request to an HTTPService.  I've been scouring the internet for any indication that it might be possible to read them without any luck so I'm guessing its not possible but I figured it would be worth asking here.  I've noticed that ResultEvent.headers is set to null but maybe there is some way to activate them?
    Another possible solution for me would exist if there is any way within an AIR application to read all of the cookies that have been set.  So, if there is any call to query the AIR runtime for all of its cookies that would also be extremely helpful.

    Hello Sir,
    Plese guide me how to access data from other server by using
    http request

  • Read responses from a form

    How do I read responses from a completed PDF form?
    I used adobe acrobat pro extended 9 to create a form. Was confused at the end as all the methods for publishing the form and collecting responses were more involved than I wanted.  I selected the email option.
    As a test I made a copy of the blank form.  Then completed it, saved the resulting document.  How do I read the responses from a completed PDF form document?
    I want to manually distrubute the PDF form document. Then manually receive the completed form document back. ( copy it to an "in box" folder ). Then use a program of some sorts ( the adobe SDK? ) to automatically pull the response data out of the completed form.
    thanks,

    Thanks a lot.   I understand better now. I opened the completed PDF with acrobat and the response data was automatically associated with the original document.
    Very nice.

  • DEBUG SMTP: exception reading response

    Hello,
    I am coding a background process to send e-mails. It uses Threads so each Thread opens a connection with a local smtp server and send a configured amount of e-mails.
    It goes well when there aren't too many Threads, but in opposite to that i receive the following message :
    DEBUG SMTP: useEhlo true, useAuth false
    DEBUG SMTP: starting protocol to host "localhost", port 25
    DEBUG SMTP: exception reading response: java.net.SocketException: Connection reset
    MessagingException - Exception reading response; nested exception is: java.net.SocketException: Connection reset
    Considering that it is happening initially because the smtp server got overload because the amount of connections i did the following:
    Transport t = mailSession.getTransport("smtp");
    while(t.isConnected() != true) {
         try {
              t.connect();
         } catch (MessagingException me){
              try {
                   Thread.sleep(rand.nextInt(n));
              } catch (InterruptedException ie){
                   Log.info("Thread Name/ID: " + jobObj.getName() + " / " + jobObj.getId() + " - " + "Exception : InterruptedException - " + ie.getMessage());                         
              Log.info("Connect: Thread Name/ID: " + jobObj.getName() + " / " + jobObj.getId() + " - " + "Exception : MessagingException - " + me.getMessage());               
    Then i do send the respective e-mails for each Thread using :
    t.sendMessage();
    and i do close the connection after all the e-mails were sent with
    t.close();
    This is just a small snippet of the code, but represents the loop i am trying to create to solve my problem, which is smtp connections overload. So when the connection is not really established i put the Thread to sleep and then it tries again latter until the success of the connection. It seems to work for some Threads but others keep returning the same error and don't work well.
    Can anyone help me on this ?
    Thx in advance

    Hi,
    I face similar problem with same error message. Have you found the solution yet? Could you share with me?
    Thanks,
    Lngo

  • Slow response from SAR command

    Hi,
    I see slow response from SAR command on M5000 series server.
    SunOS prod452 5.10 Generic_144488-09 sun4u 01/03/2012
    sar 1 100
    14:25:43 %usr %sys %wio %idle
    14:25:45 1 1 0 98
    14:25:46 1 0 0 99
    14:25:48 1 1 0 98
    14:25:50 1 2 0 97
    14:25:52 1 1 0 98
    14:25:54 1 1 0 98
    14:25:56 1 2 0 97
    14:25:58 1 2 0 98
    14:26:00 1 2 0 97
    14:26:01 1 2 0 97
    Ideally i should have output at every one second, but it shows at every 2 seconds. Even i have tried to increase the interval but still i see it takes extra 1 sec. to give output.
    These are the pretty newly configured Machine, do you think something to do with server perf./config/ etc ? Does this impacts perf. to my running workload on this machine ?
    REgards
    Tilok

    Well, you could simply have a gigazillion fonts on your system that mess with the text engine. in that case some serious weeding out of fonts that you never use would help immensely. Otherwise you can always turn off hardware acceleration in the preferences, assuming the issue is related to that...
    Mylenium

  • Passing values with HttpsURLconnection and reading response back

    i need to communicate with a server url using HttpsURLConnection and pass 2 strings and read the response back.
    how can i make this using HttpsURLConnection object.
    HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext
                        .getSocketFactory());
    HttpsURLConnection https = null;
    https = (HttpsURLConnection) new URL(host).openConnection();// host url of the server program
    https.setRequestMethod("POST");
    https.setDoInput(true);
    https.setDoOutput(true);
    https.setRequestProperty("IP", "10.900.10.2");// i am not sure how to pass two strings.
    https.connect();
    // have to read response back from a server program
    please help,
    thanks in advance.

    You can get around this by using javascript. That way your parent document is not getting refreshed.
    Create form inputs in the parent document for each of the variables you want to gather from the popups.
    You can then fire a function in the parent window when the user clicks a button in each popup that sends the values to the parent window. Just use:opener.funcname(var1, var2, var3...);Create the function funcname() in the parent window that takes each value to be added and sets the form inputs appropriately. You may want to use a different function for each popup window, like submitPopup1, submitPopup2 and so on.
    You can then make the last popup submit the form in the parent window:
    opener.document.FORMNAME.submit();Where FORMNAME is the name of your form.

  • ITunes Version 10 runs slow; response to mouise commands lag

    ITunes version 10 has never run smoothly on my computer. There is a annoying lag between the time you initiate a mouse command and a response from the program. I tried to uninstall and reinstall a while back, but that did not fix the problem. Never had this problem with earlier ITune versions. Does anyone know what is causing the problem and how to fix it?

    Hello,
    I just bought a new 27'mac w/ 4gb of ram and a Tb of memory. while i use it (with no other progams on) my itunes is slow. meaning that when i scroll or hit play it will be slow to respond. Even when i go to edit my tags sometimes. Now the problem is not constant, but it is annoying enough for me to post about it. Have you solved this issue? Now i will say that i have well over 200gbs of music on my computer (im a dj). Any help would be great.

  • Probably a stupid question - what does '256' mean in response to a command

    Hi,
    I.m just learning PHP (I mean at the very beginning). The tutorial I'm following was running through how to start and stop the apache server via terminal.
    When I entered the commands, I received the following error"
    /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
    So I poked around and found out that I needed to modify the apachectl script to remove "ulimit -S -n `ulimit -H -n`" from the line ULIMITMAXFILES="ulimit -S -n `ulimit -H -n`"
    So created a backup, opened nano and modifed the script. So far so good. So I went to try the command again and....
    sudo apachectl graceful
    256
    Can someone please enlighten this poor beginner as to what I've done?
    Many thanks

    Can someone please enlighten this poor beginner as to what I've done?
    Sure. You edited the file incorrectly (or, at least, pointlessly )
    modify the apachectl script to remove "ulimit -S -n `ulimit -H -n`" from the line ULIMITMAXFILES="ulimit -S -n `ulimit -H -n`"
    Well, sorta, kinda.
    To understand what is happening now it's useful to understand what the original command did.
    ULIMITMAXFILES="ulimit -S -n `ulimit -H -n`"
    This command has three components:
    ULIMITMAXFILES=
    "ulimit -S -n "
    and
    `ulimit -H -n`
    Note that the last component is surrounded by back ticks. This indicates that it's a subcommand that should be executed and the result of which inserted in its place.
    So in effect, this line tells the shell to first go away and run `limit -H -n`.
    This command determines the maximum limits available for a process and would normally return the string 'unlimited'.
    This has the effect of turning the full line into:
    ULIMITMAXFILES="ulimit -S -n unlimited"
    (since the subcommand has been executed and its result inserted in the command).
    So now the shell can run the command 'ulimit -S -n unlimited', the result of which is stuffed into ULIMITMAXFILES
    Your mistake is that you simply omitted the subcommand that determines the maximum process limit on this system so now the command looks like:
    ULIMITMAXFILES="ulimit -S -n"
    which simply determines the current process limit (which is normally 256).
    In other words, since you nixed the last parameter to the command you're now just asking it for the current limits (256) rather than setting a new limit value.
    That's why you get '256' - it's what you asked for.
    As for what to do about it? Well, nothing would be one option - it shouldn't prevent apache from running, you just get additional output when you run apachectl. If it bothers you, delete (or comment out) the entire line rather than just the subcommand. Unless I'm mistaken it's not going to make and significant difference to Apache's operation either way.

Maybe you are looking for

  • My center button is not working on my ipad2

    The center button on my ipad2 stopped working.  Any ideas---please I need help

  • How do I adjust audio levels at various points on timeline??

    How do I make volume level adjustments in a single clip on the FCP-X timeline?  I have a music bed and need to adjust audio levels at various points in the song.  In past Final Cut programs.  This should be very easy but I can't find how to do it in

  • Apple tv has no power

    My apple tv has no power, worked fine yesterday, today there is no status light, tried unplugging, tried menu+down buttons

  • Itunes wont pop up

    i have vista on my computer. My itunes won't open but just on my username. the My Music folder on my username wont open either. When i try to open itunes this message comes up: The folder itunes cannot be found or created and is required. The default

  • Hi Guys I am new to this, need a hand

    Okay so I have a video that is about 40 minutes long. I am making a short 3-4 minute movie. I transfered the video to the college's computer and then transfered it to an external HD and then transfered it to my computer. Now the video is 40 minutes l