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

MFToolkit - new release (VS2010 support / .NET MF 4.1)


  • Please log in to reply
10 replies to this topic

#1 Michael Schwarz

Michael Schwarz

    Member

  • Members
  • PipPip
  • 21 posts

Posted 05 November 2010 - 01:21 PM

Hi, because it was already requested several times I have published the changes concerning Visual Studio 2010 and .NET MF 4.1. You can download the latest release here (including the LE / BE files): http://mftoolkit.cod...ases/view/55143 There are some complaints how the project is organized. The initial projects are done for desktop .NET Framework. As there are only little changes necessary for the .NET Micro Framework I was using the same source code files for the desktop and .NET MF projects and added compiler switches MF to get rid of missing support in .NET MF. The .NET MF projects are prefixed with "Micro", if you want to use the MicroIO project in your .NET MF project you need MicroIO and IO, if using MicroHTTP you need MicroIO, IO and HTTP, too. Regards, Michael

#2 Michael Schwarz

Michael Schwarz

    Member

  • Members
  • PipPip
  • 21 posts

Posted 05 November 2010 - 01:36 PM

Hi,

because it was already requested several times I have published the changes concerning Visual Studio 2010 and .NET MF 4.1. You can download the latest release here (including the LE / BE files):

http://mftoolkit.cod...ases/view/55143


Here is a short example how to use the Web server to turn on the embedded LED on the Netduino Plus:

using ...

namespace NetduinoApplication1
{
    public class Program
    {
        public static void Main()
        {
            MFToolkit.Net.Web.HttpServer http = new MFToolkit.Net.Web.HttpServer(new MyWeb());
            http.Start();

            while(true)
            {
                Thread.Sleep(1000);
            }
        }
    }

    public class MyWeb : IHttpHandler
    {
        public OutputPort led1 = new OutputPort(Pins.ONBOARD_LED, false);

        public void ProcessRequest(HttpContext context)
        {
            switch (context.Request.RawUrl)
            {
                case "/":
                    context.Response.ContentType = "text/html";
                    context.Response.WriteLine("<html><head></head><body>Current Time: " + DateTime.Now + "<br/>");
                    context.Response.WriteLine("<a href=\"/led_on\">On</a> <a href=\"/led_off\">Off</a><br/<");
                    context.Response.WriteLine("</body></html>");
                    break;

                case "/led_on":
                    led1.Write(true); // turn on the LED
                    
                    context.Response.ContentType = "text/html";
                    context.Response.WriteLine("<html><head></head><body><a href=\"/\">Go home...</a></body></html>");
                    break;

                case "/led_off":
                    led1.Write(false); // turn off the LED
                    
                    context.Response.ContentType = "text/html";
                    context.Response.WriteLine("<html><head></head><body><a href=\"/\">Go home...</a></body></html>");
                    break;

                default:
                    context.Response.RaiseError(HttpStatusCode.NotFound);
                    break;
            }
        }
    }
}

Regards,
Michael

Attached Files



#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 November 2010 - 04:32 PM

Thanks, Michael! You have built one really useful toolkit! Chris

#4 James

James

    Advanced Member

  • Members
  • PipPipPip
  • 56 posts

Posted 05 November 2010 - 07:00 PM

Awesome stuff! Noob question - what libraries would I reference to use the WebServer on a Netduino or Netduino Plus? I'm not familiar with the meaning of the LE and BE folders. Thanks!

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 November 2010 - 07:50 PM

Awesome stuff! Noob question - what libraries would I reference to use the WebServer on a Netduino or Netduino Plus? I'm not familiar with the meaning of the LE and BE folders. Thanks!


James, use the DLLs in the main folder. The subfolders have "little-endian" and "big-endian" versions of the compact DLL.

"Little-endian" is used by Netduino's SAM7X microcontroller--but some other micros use "big endian". This refers to the order of bytes in a multi-byte data.

Chris

#6 Michael Schwarz

Michael Schwarz

    Member

  • Members
  • PipPip
  • 21 posts

Posted 06 November 2010 - 09:35 AM

Awesome stuff! Noob question - what libraries would I reference to use the WebServer on a Netduino or Netduino Plus? I'm not familiar with the meaning of the LE and BE folders. Thanks!



Hi James,

just reference the MicroHTTP\MicroHTTP.dll, that should copy automatically all references assemblies in your project.

Regards,
Michael

#7 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 07 November 2010 - 12:02 AM

Is there a link to just what exactly the above MFToolkit is? I was not able to find a site that stated a simple overview of what it is and why it exists. Thanks!

#8 Michael Schwarz

Michael Schwarz

    Member

  • Members
  • PipPip
  • 21 posts

Posted 07 November 2010 - 11:20 AM

Hi, well, I never had the time to write a documentation or summary. Following main features are available: 1) Multi-threaded http server with support for cookies and form values 2) DNS client to read A, MX, TXT,... records 3) Helper functions to work with bytes: ByteWriter, ByteReader used to implement all the protocols i.e. for DNS; BitHelper;... 4) NTP client (in .NET MF replaced by TimeService) 5) C6820, GM862, uALFAT drivers 6) XBee support: AT and API mode 7) Mail, POP3, SMTP support not yet compatible to .NET MF 8) several helper methods in MicroUtilities Regards, Michael

#9 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 07 November 2010 - 02:08 PM

Very awesome, thank you!

#10 mrxer

mrxer

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationAustralia

Posted 01 December 2010 - 01:35 PM

Very awesome, thank you!



Anyone use or have an example on ho to send Zigbee API packet using the toolkit libary?

            XBee oXbee = new XBee("COM1", 9600, ApiType.Enabled);

            oXbee.Open();

            oRequest.ApiID = XBeeApiType.TxRequest64;

            oXbee.ExecuteNonQuery(oRequest);

How do i assign the address and packet data...can't find any examples to use the libabry.

tony


#11 AndreaGobetti

AndreaGobetti

    New Member

  • Members
  • Pip
  • 6 posts
  • LocationItaly

Posted 09 May 2013 - 05:43 PM

Hi, I'm building an alarm system and I need to send informations to a server when anything happens to the system, now, how can I send a request (using POST or GET methods) from my Netduino Plus 2 to a server of which I know the IP address using your library? (the Netduino Plus 2 and the server are in the same LAN).

For example if a sensor recognise that a door is being opened, it will send a signal to the Netduino Plus 2 and then the Netduino Plus 2 should do something like 192.168.1.5?alarm=intrusion&sensor_code=2 I've finished all the software to manage the sensors and their control, now I've included HTTP.dll from your library (version 10.11.8.1) but I don't know where to start... Thanks!






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.