Go Down

Topic: How can we work with AT+SDATASTATUS (Read 460 times) previous topic - next topic

pierrot10

Good evening,

I searched a lot on internet (sorry I ma a beginner) to know how to get a value of
Quote
AT+SDATASTATUS


My goal is to know the status of the connection in order to create a condition

if connection is good => continue
id connection is'nt => reconnect and execute AT' commands

Could you provide me an exemple of AT+SDATASTATUS with the Serial.print() of the retunr value/data?

Thank for your help
Il ne suffit pas de tout savoir, la persévérance, c'est déjà presque tout!

marco_c

Arduino libraries http://arduinocode.codeplex.com
Parola for Arduino http://parola.codeplex.com

pierrot10

Hello Thank for your answer,
I already read that document. it help me, but in spite of this I still block, specialy to display teh result of SDATASTATUS.
It would better help if I can have an exemple in that way I can better understand that copying.

Thank
Il ne suffit pas de tout savoir, la persévérance, c'est déjà presque tout!

PaulS

Quote
specialy to display teh result of SDATASTATUS.

Displaying the response to that AT command is the same as displaying the response to any AT command. How are you doing it for other AT commands?

pierrot10

It still does not work.

I wish to display the result or status of each command, in order to make sure that all of them return me an OK.

Here is my code. Each command ate followed by status() function. I also add
Code: [Select]
cell.print("+SOCKSTATUS");, but it does not show/display anythink

Code: [Select]

   Serial.println(F("Setting up PDP Context"));
     cell.println("AT+CGDCONT=1,\"IP\",\"internet\"");
     status();
     delay(1000);
     
     Serial.println(F("Activating PDP Context"));
     cell.println("AT+CGACT=1,1");
     status();
     delay(1000);
     
     Serial.println(F("Configuring TCP connection to TCP Server"));
     cell.println("AT+SDATACONF=1,\"TCP\",\"92.104.69.134\",81");
     status();
     delay(1000);
     
     Serial.println(F("Starting TCP Connection\n"));
     cell.println("AT+SDATASTART=1,1");
     status();
     delay(1000);
     
     Serial.println(F("Getting status"));
     cell.print("AT+SDATASTATUS=1");
     status();
   
    Serial.println(F("Display status"));
     cell.print("+SOCKSTATUS");
     status();


Here is my status() command
Code: [Select]

static void status(){
   
     while(cell.available()){
        incoming_status=cell.read();
        Serial.print(incoming_status);
      }
}


Please, help with exemple, it would be very nice from you.

Have a nice day.
Il ne suffit pas de tout savoir, la persévérance, c'est déjà presque tout!

PaulS

Code: [Select]
     cell.println("AT+CGDCONT=1,\"IP\",\"internet\"");
     status();

Send a command. Expect an instantaneous response. What world do you live in? Serial data transmission is ssslllooowww. You are allowing NO time for that to happen, for the other device to get, parse, react to, and respond to the data, or for the response to arrive back at the Arduino.

pierrot10

Hello,
Ok I understand what you means, but I could get the result I want to have
The first question which come to my mind, how long should I wait until I can get a respond. I tryed with 5sec

Taking inconsideration this

Code: [Select]
cell.println("AT+CGDCONT=1,\"IP\",\"internet\"");
delay();
     status();


I add delay(5000); just before status().
I also tried to add delay(5000);
here
Code: [Select]

static void status(){
   
     while(cell.available()){
        incoming_status=cell.read();
        delay(5000);
        Serial.print(incoming_status);
      }

}

But in all case, I have not a result for

Code: [Select]
cell.println("AT+CGDCONT=1,\"IP\",\"internet\"")

Cheers
Il ne suffit pas de tout savoir, la persévérance, c'est déjà presque tout!

PaulS

Waiting 5 seconds between bytes, when you KNOW there is data to read is silly.

Does the AT+CGDCONT command return a response? I would expect all commands to, but it might take more than 5 seconds for that command to return a response.

Go Up