Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

fritzE's Content

There have been 10 items by fritzE (Search limited from 28-April 23)


By content type

See this member's

Sort by                Order  

#50598 Seeduino GPRS / GSM shield

Posted by fritzE on 18 June 2013 - 12:36 AM in Netduino 2 (and Netduino 1)

Hi.

I've been working with Seeduino GSM shield also, and have been getting +CMS ERROR: PS busy error as well.  I have a TMobile sim card and just refilled it, but it had run out.  TMobile says it is active.  Can anyone shed some light on the meaning of PS busy?  I'd love to get this shield working.

 

code is from seedStudioGSM class:

 

 

public void SendSMS(string msisdn, string message)

{

PrintLine("");

PrintLine("AT+CSCS="GSM"");

Thread.Sleep(1000);

PrintLine("AT+CMGF=1");

Thread.Sleep(500);

PrintLine("AT+CMGS="" + msisdn + "",145");

PrintLine(message,

true, 10000);

Thread.Sleep(500);

PrintEnd();

}

 

 

 

 




#32431 Wifly rn-xv + XBee shield

Posted by fritzE on 21 July 2012 - 04:51 PM in Netduino 2 (and Netduino 1)

OK. Will work on that... Question: The default baud is 9600. have you tested higher rates?? Do you think that is a bottleneck?



#32209 Wifly rn-xv + XBee shield

Posted by fritzE on 18 July 2012 - 04:59 PM in Netduino 2 (and Netduino 1)

OK. Can you point me to where I could learn about how to do the socket listener? I want to remote control a vehicle so can live with one connection, but the http client approach is too slow (polling, etc.).



#32201 Wifly rn-xv + XBee shield

Posted by fritzE on 18 July 2012 - 02:44 PM in Netduino 2 (and Netduino 1)

Stefan, do you happen to have an HTTP server for this Wifly? or point me to one? I'd like to use it as a straight socket, HTTP server or relay (yaler) server. Any suggestions? thanks.



#31119 Wifly rn-xv + XBee shield

Posted by fritzE on 23 June 2012 - 01:19 AM in Netduino 2 (and Netduino 1)

Though I feel like I'm masking symptoms, this seems to correct that particular problem:

private void _SerialPort_LineReceived(string Text)
        {
            _DebugPrint('I', Text + "\r\n");

            

            // Did we enter command mode?
            if (Text == "CMD" && this._Mode == Modes.Idle)
            {
                this._Mode = Modes.CommandMode;
                _DebugPrint('D', "Successfully enterred the command mode");
                return;
            }
            else
            {
                if (Text.IndexOf("CMD") >= 0)
                {
                    Debug.Print("FOUND CMD IN STRING: " + Text);
                    this._Mode = Modes.CommandMode;
                    _DebugPrint('D', "Pretending to Successfully enterred the command mode");
                    return;
                }
            }

There are couple other issues... I'll post when i have more to say about..
thx

Hi.
2 issues, first it appeared there was a race condition that sometimes truncated the last string, if you set Mode to idle before setting the _SerialPort_StreamBuffer. Here the code:
private void _SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            if (this._SerialPort.BytesToRead == 0) return;

            // Reads out the data and converts it to a string
            byte[] ReadBytes = new byte[this._SerialPort.BytesToRead];
            this._SerialPort.Read(ReadBytes, 0, ReadBytes.Length);
            string ReadBuffer = new string(Tools.Bytes2Chars(ReadBytes));

            // While in Streaming mode, we need to handle the data differently
            if (this._Mode == Modes.StreamingMode)
            {
                bool newModeIdle = false;
                _DebugPrint('I', ReadBuffer);
                string NewBuffer = this._SerialPort_StreamBuffer + ReadBuffer;

                // Fixes the "*CLOS*" issue as described below
                this._SerialPort_EndStreamCheck += ReadBuffer;
                if (this._SerialPort_EndStreamCheck.Length > this._SocketCloseString.Length)
                    this._SerialPort_EndStreamCheck = this._SerialPort_EndStreamCheck.Substring(this._SerialPort_EndStreamCheck.Length - this._SocketCloseString.Length);

                // Do we need to leave Streaming Mode?
                int CheckPos = NewBuffer.IndexOf(this._SocketCloseString);
                if (CheckPos >= 0)
                {
                    this._SerialPort_TextBuffer = NewBuffer.Substring(CheckPos + this._SocketCloseString.Length);
                    NewBuffer = NewBuffer.Substring(0, CheckPos);
                    //this._Mode = Modes.Idle;
                    newModeIdle = true;
                    _DebugPrint('D', "1 Left streaming mode");
                    _DebugPrint('D', NewBuffer);
                }
                // The closing string (default: "*CLOS*") is many times sent in multiple packets.
                // This causes annoying issues of connections not shutting down well.
                // This fixes that issue, but it's possible the last few bytes of the stream contain something like "*CL" or something.
                else if (_SerialPort_EndStreamCheck == this._SocketCloseString)
                {
                    //this._Mode = Modes.Idle;
                    newModeIdle = true;
                    _DebugPrint('D', "2 Left streaming mode");
                    NewBuffer = "";
                }
                this._SerialPort_StreamBuffer = NewBuffer;
                if (newModeIdle)
                    this._Mode = Modes.Idle;
                return;
            }
The other thing is just a nicety to remove extraneous *CLOS from the last string (assuming that's not really part of the message).
In HTTP_Client
private HTTP_Response _DoRequest(string RequestData)
        {

            // Opens the connection
            this._Socket.Connect();
            // Sends out the request
            this._Socket.Send(RequestData);
            // Fetches the returned data
            string ResponseData = "";
            string tmp = "";
            while (this._Socket.IsConnected || this._Socket.BytesAvailable > 0)
            {
                tmp = this._Socket.Receive();
                if (tmp.IndexOf("HTTP/1.1 200 OK") >= 0)
                {
                    Debug.Print("found OK HEADER at " + tmp.IndexOf("HTTP/1.1 200 OK") + ", resetting input string");
                    ResponseData = tmp;
                }
                else
                    ResponseData += tmp;
            }
            // Closes the connection
            this._Socket.Close();
            Debug.Print("RESPONSE: " + ResponseData[ResponseData.Length-1]);
            string ending = ResponseData.Substring(ResponseData.Length-5);
            string foo = ending.Substring(1, 4);
            string foo2 = ending.Substring(2, 3);
            string foo3 = ending.Substring(3, 2);
            if (ending == "*CLOS") ResponseData = ResponseData.Substring(0, ResponseData.Length - 5);
            else if (ending.Substring(1, 4) == "*CLO") ResponseData = ResponseData.Substring(0, ResponseData.Length - 4);
            else if (ending.Substring(2, 3) == "*CL") ResponseData = ResponseData.Substring(0, ResponseData.Length - 3);
            else if (ending.Substring(3, 2) == "*C") ResponseData = ResponseData.Substring(0, ResponseData.Length - 2);
            else if (ending.Substring(4, 1) == "*") ResponseData = ResponseData.Substring(0, ResponseData.Length - 1);
            // Parses the response data
            HTTP_Response RetVal = new HTTP_Response(ResponseData);
            // Parses cookies and such
            this._ParseHeaders(RetVal.GetAllHeaders());

            return RetVal;
        }
looks OK now, but cursory checks.. will do more checking
Fritz



#31117 Wifly rn-xv + XBee shield

Posted by fritzE on 22 June 2012 - 11:51 PM in Netduino 2 (and Netduino 1)

Very interesting! As I said, I'm short in time currently, and the toolbox is 'just a hobby project', so it doesn't have high priority for now. But as soon as I have some free time, I'll look into it.

If you find a solution, please let me know, I'll add it in and give you proper credits for it of course! :)

Though I feel like I'm masking symptoms, this seems to correct that particular problem:
private void _SerialPort_LineReceived(string Text)
        {
            _DebugPrint('I', Text + "\r\n");

            

            // Did we enter command mode?
            if (Text == "CMD" && this._Mode == Modes.Idle)
            {
                this._Mode = Modes.CommandMode;
                _DebugPrint('D', "Successfully enterred the command mode");
                return;
            }
            else
            {
                if (Text.IndexOf("CMD") >= 0)
                {
                    Debug.Print("FOUND CMD IN STRING: " + Text);
                    this._Mode = Modes.CommandMode;
                    _DebugPrint('D', "Pretending to Successfully enterred the command mode");
                    return;
                }
            }
There are couple other issues... I'll post when i have more to say about..
thx



#31086 Wifly rn-xv + XBee shield

Posted by fritzE on 22 June 2012 - 03:53 PM in Netduino 2 (and Netduino 1)

The <2.32> is the prompt of the wifly module. It's not really ment to be just a wifi module, it's ment as a serial to wifi socket bridge. I just abuse it to be able to do other stuff.
The closing of a stream was somewhat buggy. Not sure if you noticed this comment?

// The closing string (default: "*CLOS*") is many times sent in multiple packets.
                // This causes annoying issues of connections not shutting down well.
                // This fixes that issue, but it's possible the last few bytes of the stream contain something like "*CL" or something.

Yes, I did. the reason i brought it up is that the WiFly is hanging after i get that response. my guess was that it wasn't finding CMD in response to $$$, but didn't get that far. I'm trying to do 100 loops of HTTP Get from Cosm. it gets to 10-15 before failing....



#31077 Wifly rn-xv + XBee shield

Posted by fritzE on 22 June 2012 - 02:45 PM in Netduino 2 (and Netduino 1)

quick other issue... in the _SerialPort_DataReceived routine, the *CLOS* issue is confusing my WiFly.
in this case:
else if (_SerialPort_EndStreamCheck == this._SocketCloseString)
                {
                    this._Mode = Modes.Idle;
                    _DebugPrint('D', "2 Left streaming mode");
                    NewBuffer = "";
                }
                this._SerialPort_StreamBuffer = NewBuffer;
when the new $$$ is sent, the response has an extra <2.32>... any ideas here? see below:
I: 2.401906Z,93\nG
I: O,2012-06-21
I: T02:14:12.40
I: 1906Z,0*CLOS
I: *
D: 2 Left streaming mode


30,2012-06-21T01:03:54.979682Z,38
60,2012-06-21T01:03:54.979682Z,90
90,2012-06-21T01:03:54.979682Z,6
120,2012-06-21T01:03:54.979682Z,61
150,2012-06-21T01:03:54.979682Z,53
GO,2012-06-21T01:03:54.979682Z,1
30,2012-06-21T02:14:12.401906Z,58
60,2012-06-21T02:14:12.401906Z,91
90,2012-06-21T02:14:12.401906Z,69
120,2012-06-21T02:14:12.401906Z,75
150,2012-06-21T02:14:12.401906Z,93
GO,2012-06-21T02:14:12.401906Z,0*CLOS
O: $$$
I: <2.32> CMD\r\n

Thanks!



#31071 Wifly rn-xv + XBee shield

Posted by fritzE on 22 June 2012 - 02:18 PM in Netduino 2 (and Netduino 1)

Hi Stefan,
that works. Thanks. I cat do a HTTP put to cosm. i tried your http_client class to get from cosm, and got some funny behaviors. Looks like the connection is retrying a couple of times. the symptom is that the cookies gets scrogged because it is taking the first header info, not the latest which is corect. here is a trace of the ResponseData in _doRequest:
HTTP/1.1 200 OK
Date: Fri, 22 Jun 2012 12:42:55 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Last-Modified: Thu, 21 Jun 2012 02:14:12 GMT
X-Runtime: 65
X-Pachube-Logging-Key: logging.pxLV3knPodCwvjx73Nis
Content-Length: 408
X-PachubeRequestId: d4537ff8cf384d60c00283b4fee6c080492e0222
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlZjBjNmFkZDU4ZTFmZWJlNWEHTTP/1.1 200 OK
Date: Fri, 22 Jun 2012 12:42:55 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Last-Modified: Thu, 21 Jun 2012 02:14:12 GMT
X-Runtime: 65
X-Pachube-Logging-Key: logging.pxLV3knPodCwvjx73Nis
Content-Length: 408
X-PachubeRequestId: d4537ff8cf384d60c00283b4fee6c080492e0222
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlZjBjNmFkZDU4ZTFmZWJlNWE5YmEzNWJiNmExZDUxN2M%3D--596913f0ea16c484f53571bc02d23b6083b62416; domain=.cosm.com; path=/; expires=Fri, 06-Jul-2012 12HTTP/1.1 200 OK
Date: Fri, 22 Jun 2012 12:42:55 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Last-Modified: Thu, 21 Jun 2012 02:14:12 GMT
X-Runtime: 65
X-Pachube-Logging-Key: logging.pxLV3knPodCwvjx73Nis
Content-Length: 408
X-PachubeRequestId: d4537ff8cf384d60c00283b4fee6c080492e0222
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlZjBjNmFkZDU4ZTFmZWJlNWE5YmEzNWJiNmExZDUxN2M%3D--596913f0ea16c484f53571bc02d23b6083b62416; domain=.cosm.com; path=/; expires=Fri, 06-Jul-2012 12:42:52 GMT; HttpOnly
Age: 3
Cache-Control: max-age=86400
Vary: Accept-Encoding

30,2012-06-21T01:03:54.979682Z,38
60,2012-06-21T01:03:54.979682Z,90
90,2012-06-21T01:03:54.979682Z,6
120,2012-06-21T01:03:54.979682Z,61
150,2012-06-21T01:03:54.979682Z,53
GO,2012-06-21T01:03:54.979682Z,1
30,2012-06-21T02:14:12.401906Z,58
60,2012-06-21T02:14:12.401906Z,91
90,2012-06-21T02:14:12.401906Z,69
120,2012-06-21T02:14:12.401906Z,75
150,2012-06-21T02:14:12.401906Z,93
GO,2012-06-21T02:14:12.401906Z,0

ANy ideas?? Thanks.

This seemed to have fixed it:
private HTTP_Response _DoRequest(string RequestData)
        {

            // Opens the connection
            this._Socket.Connect();
            // Sends out the request
            this._Socket.Send(RequestData);
            // Fetches the returned data
            string ResponseData = "";
            string tmp = "";
            while (this._Socket.IsConnected || this._Socket.BytesAvailable > 0)
            {
                tmp = this._Socket.Receive();
                if (tmp.IndexOf("HTTP/1.1 200 OK") >= 0)
                {
                    Debug.Print("found OK HEADER at " + tmp.IndexOf("HTTP/1.1 200 OK") + ", resetting input string");
                    ResponseData = tmp;
                }
                else
                    ResponseData += tmp;
            }
            // Closes the connection
            this._Socket.Close();

            // Parses the response data
            HTTP_Response RetVal = new HTTP_Response(ResponseData);
            // Parses cookies and such
            this._ParseHeaders(RetVal.GetAllHeaders());

            return RetVal;
        }



#31066 Wifly rn-xv + XBee shield

Posted by fritzE on 22 June 2012 - 12:53 PM in Netduino 2 (and Netduino 1)

HI fritzE and welcome to the forums :)


Depends on the type.
Many proxy servers would work like this:

HTTP_Client WebSession = new HTTP_Client(new IntegratedSocket("proxyhost", 8080));

// Requests the latest source
HTTP_Client.HTTP_Response Response = WebSession.Get("http://www.netmftoolbox.com/helloworld/");

Hi Stefan,
that works. Thanks. I cat do a HTTP put to cosm. i tried your http_client class to get from cosm, and got some funny behaviors. Looks like the connection is retrying a couple of times. the symptom is that the cookies gets scrogged because it is taking the first header info, not the latest which is corect. here is a trace of the ResponseData in _doRequest:
HTTP/1.1 200 OK
Date: Fri, 22 Jun 2012 12:42:55 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Last-Modified: Thu, 21 Jun 2012 02:14:12 GMT
X-Runtime: 65
X-Pachube-Logging-Key: logging.pxLV3knPodCwvjx73Nis
Content-Length: 408
X-PachubeRequestId: d4537ff8cf384d60c00283b4fee6c080492e0222
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlZjBjNmFkZDU4ZTFmZWJlNWEHTTP/1.1 200 OK
Date: Fri, 22 Jun 2012 12:42:55 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Last-Modified: Thu, 21 Jun 2012 02:14:12 GMT
X-Runtime: 65
X-Pachube-Logging-Key: logging.pxLV3knPodCwvjx73Nis
Content-Length: 408
X-PachubeRequestId: d4537ff8cf384d60c00283b4fee6c080492e0222
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlZjBjNmFkZDU4ZTFmZWJlNWE5YmEzNWJiNmExZDUxN2M%3D--596913f0ea16c484f53571bc02d23b6083b62416; domain=.cosm.com; path=/; expires=Fri, 06-Jul-2012 12HTTP/1.1 200 OK
Date: Fri, 22 Jun 2012 12:42:55 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Last-Modified: Thu, 21 Jun 2012 02:14:12 GMT
X-Runtime: 65
X-Pachube-Logging-Key: logging.pxLV3knPodCwvjx73Nis
Content-Length: 408
X-PachubeRequestId: d4537ff8cf384d60c00283b4fee6c080492e0222
Set-Cookie: _pachcore_app_session=BAh7BjoPc2Vzc2lvbl9pZCIlZjBjNmFkZDU4ZTFmZWJlNWE5YmEzNWJiNmExZDUxN2M%3D--596913f0ea16c484f53571bc02d23b6083b62416; domain=.cosm.com; path=/; expires=Fri, 06-Jul-2012 12:42:52 GMT; HttpOnly
Age: 3
Cache-Control: max-age=86400
Vary: Accept-Encoding

30,2012-06-21T01:03:54.979682Z,38
60,2012-06-21T01:03:54.979682Z,90
90,2012-06-21T01:03:54.979682Z,6
120,2012-06-21T01:03:54.979682Z,61
150,2012-06-21T01:03:54.979682Z,53
GO,2012-06-21T01:03:54.979682Z,1
30,2012-06-21T02:14:12.401906Z,58
60,2012-06-21T02:14:12.401906Z,91
90,2012-06-21T02:14:12.401906Z,69
120,2012-06-21T02:14:12.401906Z,75
150,2012-06-21T02:14:12.401906Z,93
GO,2012-06-21T02:14:12.401906Z,0

ANy ideas?? Thanks.




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.