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.
Photo

RN-XV WiFly Module driver


  • Please log in to reply
98 replies to this topic

#81 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 19 February 2013 - 10:00 AM

Hi,

 

test.sino.org/WCF1/Service1 isn't a valid hostname. "test.sino.org" is, but the "/WCF1/Service1" is just a path.

 

You could also try to use the HTTP class I wrote; http://netmftoolbox....NET.HTTP_Client


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#82 winton

winton

    New Member

  • Members
  • Pip
  • 5 posts

Posted 20 February 2013 - 02:21 AM

Thanks Stefan

 

The Get method is work. Now could you tell me how to post data? Could you show me an example?

 

I simply change the word "GET" to "POST", but it is not work.

 

Below is debug output

 

I: HTTP/1.1
I:  41
I: 1 
I: L
I: en
I: g
I: th
I:  R
I: eq
I: u
I: ir
I: ed
I: rn
I: C
I: on
I: te
I: nt
I: -
I: Ty
I: pe
I: : 
I: t
I: ex
I: t/
I: ht
I: m
I: lr
I: nD
I: at
I: e
I: : 
I: We
I: d,
I:  
I: 20
I:  F
HTTP/1.1 411 Length Required
Content-Type: text/html
Date: Wed, 20 F
I: eb 2013 02:14:15 GM
I: TrnCo
I: nn
I: ec
I: t
I: io
I: n:
I:  c
eb 2013 02:14:15 GMT
Connection: c
I: losernContent-Lengt
I: h: 24
I: rnrn
I: <
I: h1
I: >L
I: en
I: g
lose
Content-Length: 24
 
<h1>Leng
I: th Required</h1>*CLO
I: S*
D: Left streaming mode

th Required</h1>

 

On the other hand, I test your HttpClient class but can't work. It show a error 

 

An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll

 

By the way, I was using the Gadgeteer to test your ToolBox.

 

Thank you very much.



#83 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 20 February 2013 - 07:47 AM

> An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll

Appairently you're still using the onboard networking solution.

Try this:

 

HTTP_Client WebSession = [color=#0000FF;]new[/color] HTTP_Client([color=#0000FF;]new[/color] WiFlySocket([color=rgb(163,21,21);]"www.netmftoolbox.com"[/color], 80, WifiModule));


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#84 winton

winton

    New Member

  • Members
  • Pip
  • 5 posts

Posted 20 February 2013 - 07:56 AM

Thank you, solved.



#85 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 09 March 2013 - 08:57 PM

Thanks a ton for this WiFly driver.  I am pretty new to C#, and totally new to sockets and that sort of thing... but I have manged to get a basic Windows Form Server running and sending commands to my netmf device.

 

What I'd really like to do is implement a WiFly in my embedded system as a socket server rather than a client.  I'd also like to have my NETMF device talk to multiple clients.

 

Is this something that is possible?  If so, is there a route you'd recommend I take to get started?  I'm totally willing to learn and will be trying to understand this better as a whole... but any direction would be greatly appreciated!  



#86 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 10 March 2013 - 02:46 PM

It is possible, but since the wifi module can only handle one connection at the time I didn't built it in in the driver.


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#87 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 10 March 2013 - 06:00 PM

Thanks for the reply... yeaaaaah I figured out last night that WiFly can only do one socket at a time... I'd still like it to be the server for one reason.  I want to write an Android app to control the device... and it seems like having the netmf device being the socket server with a static IP and set port would make it so any phone running the app could easily connect.

 

Right now it is the client and expects a certain server address, meaning the phone has to have a static IP.  Or is there maybe an example somewhere that might show me how to make this process work intuitively another way?  The only examples I've seen so far involve manual IP entry or a set IP.  



#88 Jack Chidley

Jack Chidley

    Advanced Member

  • Members
  • PipPipPip
  • 99 posts

Posted 23 March 2013 - 01:49 PM

Stefan, I've just used your module on a netduino 2, netmf 4.3.

 

Recompiled it for 4.3, soldered some wires to 1,2,3,10 (Power, Rx, Tx, Ground) - I don't have an XBee adapter.

 

Worked perfectly, after I had added a delay to allow for a proper connection to my network.  I added the code below which directly follows the WifiModule.JoinNetwork. 

 

while (WifiModule.LocalIP == "0.0.0.0"){Debug.Print(WifiModule.LocalIP);Thread.Sleep(1000);} 

 

 

Thanks for writing this module.  Very, very helpful.

Jack



#89 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 24 March 2013 - 01:14 PM

Nice to hear!

 

Currently I'm modifying the driver so it can use (optional!) hardware control.

That way, an interrupt will tell if there's a network connection and a tcp connection.


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#90 Jack Chidley

Jack Chidley

    Advanced Member

  • Members
  • PipPipPip
  • 99 posts

Posted 24 March 2013 - 04:58 PM

+1 to get server functionality, for the same reasons as above...



#91 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 24 March 2013 - 05:01 PM

+1 to get server functionality, for the same reasons as above...

 

That, or I am starting to think UDP might be pretty nice to have.  The WiFly module supports it, and I've seen Arduino drivers that support it on the WiFly.  I started looking at Stefan's excellent source code... but it is all still a little much for me.  



#92 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 03 April 2013 - 09:27 PM

No thoughts on UDP or Server mode?  Don't want to be greedy.... I just thought since maybe you were working on the driver already  :P



#93 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 12 April 2013 - 08:56 PM

Hey Stefan!  I totally understand if you don't want to do more free work on the WiFly driver... but you seem to be the expert on working with it and NETMF so I'd really love to get your opinion on the server and UDP capability of the module.

 

I'm in the process of laying out a PCB that uses the WiFly and I'm going to need those capabilities in the future.  I'm a total newb at network programming, but I plan to take a crack at extending your driver to cover those modes.  Do you know of any show-stopper issues that will prevent me from doing this?  I just want one NETMF based UDP server that will send simple string formatted commands to several clients that may or may not be online at any given time.

 

Again, thanks for your work on writing it in the first place.



#94 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 13 April 2013 - 12:46 PM

Hi,

 

It's not that I don't want to do free work, I love to do this! It's just that currently, I lack the time that's required to keep things going.

I hope in a few months I have a bit more time to work on this, but for now, I'm sorry.


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#95 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 15 April 2013 - 03:45 AM

Yup I understand... but I'm still wondering if you know of any reason that we can't get UDP server running on this thing?  Not asking you to put any time into it right now, just want to know if I shouldn't waste my time trying.  



#96 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 15 April 2013 - 10:32 AM

Yup I understand... but I'm still wondering if you know of any reason that we can't get UDP server running on this thing?  Not asking you to put any time into it right now, just want to know if I shouldn't waste my time trying.  

 

Well, it's not really a network adapter, it's a serial to wifi module. I tricked it so I can use sockets, but for UDP, I haven't looked into it.

According to the manual (http://www.netmftool...yGSX-Manual.pdf chapter 11) it should be possible though.


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#97 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 15 April 2013 - 07:38 PM

Cool thanks.  I did read the manual, and also looked at an Arduino driver that supposedly supports UDP.  Couldn't find any code examples though, and heard mixed speculation.  

 

I've also skimmed over your driver source, and your socket trickery is probably where I got confused lol.  I've been mainly pushing to get this pcb designed... as soon as I send the gerber files off I'll start trying to get UDP working.



#98 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 15 April 2013 - 08:55 PM

well, for many apps, it's not wise to use such a generic driver. the module has a lot of support built-in that my driver doesn't use yet.

 

I've got ideas of making plugins, but thats still too much an idea...


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#99 FireyFate

FireyFate

    New Member

  • Members
  • Pip
  • 8 posts

Posted 20 April 2013 - 01:09 AM

Finally got a couple hours to play with this.  My main goal is to have one NETMF device act as a server that sends simple string commands over UDP to several clients, and then also receive commands from an Android app.

 

Looks like it should be pretty doable!  Here is a the method to enable UDP I added to the WiFlyGSX driver.

 

public void EnableUDP(string hostIP, string hostPort, string localPort){    // Enterring command mode    this._CommandMode_Start();    if (!this._CommandMode_Exec("set ip proto 1")) throw new SystemException(this._CommandMode_Response);    if (!this._CommandMode_Exec("set ip host " + hostIP)) throw new SystemException(this._CommandMode_Response);    if (!this._CommandMode_Exec("set ip remote " + hostPort)) throw new SystemException(this._CommandMode_Response);    if (!this._CommandMode_Exec("set ip local " + localPort)) throw new SystemException(this._CommandMode_Response);    this._CommandMode_Stop();}


After that anything sent to the serial port is broadcasted.  Here is a console program on my computer receiving messages from the WiFly.

 

Posted Image






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.