Netduino home hardware projects downloads community

Jump to content


Photo

NeonMika.Webserver

webserver web server neonmika internet web server http sd xml json

  • Please log in to reply
213 replies to this topic

#21 AJB2K3

AJB2K3

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts

Posted 30 November 2011 - 05:05 PM

Thanks for the work, If I can find a 2 gig card I'll add try so tests (still on the 2 gig max firmware) I have a SVG image and basic code wipped up for my project but everytime I go to a pc or electronics shop I forget to buy a card :blink: :blink:

"Maybe it's because you're a crap programmer"


#22 Coding Smackdown

Coding Smackdown

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationLewisville, TX USA

Posted 30 November 2011 - 05:29 PM

Thanks for updating the code stream. I'll be pulling down the updates and testing it out.
Brewing Award Winning Beer with a Netduino!
http://diybrewery.com

#23 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 30 November 2011 - 05:44 PM

Thanks for the work, If I can find a 2 gig card I'll add try so tests (still on the 2 gig max firmware)I have a SVG image and basic code wipped up for my project but everytime I go to a pc or electronics shop I forget to buy a card :blink: :blink:


Yeah, I also don't have a card. Best qualification for developing a web server :D But Jim said it works, so I'm satisfied :D

To come back on your PWM question: To start PWM, just us
ip/pwm?pin=5&period=20000&duration=12000
to set Pin 5 to a 20ms perid with 12ms on :)
Had no time to code a slider for the index page. Also I'm no good web developer, never used Javascript or CSS before :P

Thanks for updating the code stream. I'll be pulling down the updates and testing it out.


Thank you, I hope it works :)

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#24 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 01 December 2011 - 09:01 AM

Had no time to code a slider for the index page.


Try HTML5's range input type. Nice and easy.

#25 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 01 December 2011 - 09:01 AM

duplicate post - no option to delete the posts?

#26 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 01 December 2011 - 06:29 PM

Try HTML5's range input type. Nice and easy.


Saw this just some hours before you posted it :P
Tanks.

duplicate post - no option to delete the posts?


No, I also did this mistake several times...

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#27 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 13 December 2011 - 04:19 AM

just downloaded the source code off of codeplex and took a quick peek at the project. Does the JSONResponse follow the same pattern as the XMLResponse?

So below instead of:

WebServer.AddResponse(new XMLResponse("wave", new XMLResponseMethod(WebserverXMLMethods.Wave)));

I would have
WebServer.AddResponse(new JSONResponse("getTemps",new XMLResponseMethod(MyJSONClassName.MethodName)));

??

and I stick whatever method implementation in MyJSONClassName.MethodName?

what is the syntax like for building the actual JSON response? I'm trying to find an example in the Executable folder but just see the XML version.

Thanks so much for putting this out there for others to use, makes building projects easier when you don't have to re-invent the wheel each time!

#28 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 14 December 2011 - 07:44 AM

just downloaded the source code off of codeplex and took a quick peek at the project. Does the JSONResponse follow the same pattern as the XMLResponse?

So below instead of:

WebServer.AddResponse(new XMLResponse("wave", new XMLResponseMethod(WebserverXMLMethods.Wave)));

I would have
WebServer.AddResponse(new JSONResponse("getTemps",new XMLResponseMethod(MyJSONClassName.MethodName)));

??

and I stick whatever method implementation in MyJSONClassName.MethodName?

what is the syntax like for building the actual JSON response? I'm trying to find an example in the Executable folder but just see the XML version.

Thanks so much for putting this out there for others to use, makes building projects easier when you don't have to re-invent the wheel each time!





you need to use jsonresponsemethod instead of xmlresponsemethod. For an example have a look on the framework folder, in which you find Server.cs

there you find the standard implemented methods like setPin etc. ... And one of this methods is JsonMethodList or something like that. It returns all methods implemented as json and can be used as example for json responses. You use JsonObject and JsonArray instead of hashtable.

sry, i'm at work and writing with my smartphone, if you need more infos i can help you when i get home :)

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#29 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 14 December 2011 - 05:53 PM

you need to use jsonresponsemethod instead of xmlresponsemethod. For an example have a look on the framework folder, in which you find Server.cs

there you find the standard implemented methods like setPin etc. ... And one of this methods is JsonMethodList or something like that. It returns all methods implemented as json and can be used as example for json responses. You use JsonObject and JsonArray instead of hashtable.

sry, i'm at work and writing with my smartphone, if you need more infos i can help you when i get home :)



Thanks for the post, I took a look at that server class and think i have my head wrapped around it now. I'll give this a try once finals are over and i have a bit more time. Thanks!
Chris

#30 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 17 December 2011 - 04:47 AM

downloaded and installed this tonight on my netduino. Works well so far. Thanks so much for sharing! When will MVC3 be supported? ;)

#31 testhack

testhack

    New Member

  • Members
  • Pip
  • 5 posts

Posted 28 December 2011 - 08:52 PM

markus, thanks so much for contributing your code... when you have a minute, can you update the current codeplex repository to include the Responses\ResponseErrorType.cs file? the current version will not compile due to this missing file. thanks!

#32 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 02 January 2012 - 10:27 AM

It should work now. If you wonder about the consumed ROM: I am working on a index.html page (learning some HTML and CSS). You can delete this page (and free the consumed space) in the properties of the Webserver project. (Rightclick on the webservice project -> Properties -> I think it's "Embedded ressources" -> delete the value for the indexHTML string property) If your code doesn't exceed the maximum ROM, you don't have to do this :) Greets, Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#33 testhack

testhack

    New Member

  • Members
  • Pip
  • 5 posts

Posted 02 January 2012 - 03:14 PM

Thanks for the file update. Do you know if there is a way to automatically deploy a file to the sd card from a visual studio project? I don't want to use the rom embedded resource and I don't like ejecting the sd card every time I want to make a change to my html files. Any thoughts/suggestions?

#34 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 03 January 2012 - 08:31 AM

Not from Visual Studio. But you could write a little webserver method for file upload (I think it wouldn't be more than 20 lines). I have to mention that I still havn't finnished POST parameter splitting, so only GET is possible to send data ATM. Your URL could look something like this: http://netduinoip/fileUpload?data=[bytessss] Just write the method "fileUpload" in which you read the "data"-parameter and write it to the SD. As i write this, I see that this could end in an OutOfMemoryException. I will look into that when I have time again, 50h work a work don't leave that much time. :P Greets, Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#35 CT1

CT1

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts

Posted 10 January 2012 - 12:18 AM

This is a fantastic project. I have so much to learn but with this as an example I'll be flying in no time. Can you give a newBee a little more instructions on how to get this deployed. I downloaded it to My Documents but can't seem to get it to load out. Do I need to download it to a specfic folder in Visual Studios? Do I need any additional reference files? Here's a sample of my errors. Thanks for your help C:\Users\T2\AppData\Local\Temp\Temp3_neonmikawebserver-77241c65b943.zip\neonmikawebserver_77241c65b943\Executeable\NETMF\NeonMikaWebserver\NeonMikaWebserver\NeonMikaWebserver.csproj : error : Unable to read the project file 'NeonMikaWebserver.csproj'. C:\Users\T2\AppData\Local\Temp\Temp3_neonmikawebserver-77241c65b943.zip\neonmikawebserver_77241c65b943\Executeable\NETMF\NeonMikaWebserver\NeonMikaWebserver\NeonMikaWebserver.csproj: The project file could not be loaded. Could not find a part of the path 'C:\Users\T2\AppData\Local\Temp\Temp3_neonmikawebserver-77241c65b943.zip\neonmikawebserver_77241c65b943\Executeable\NETMF\NeonMikaWebserver\NeonMikaWebserver\NeonMikaWebserver.csproj'.

#36 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 10 January 2012 - 05:15 AM

that is no coding error. You just didnt unzip your project ;) do this and then just go to the "executeable" folder. Greets markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#37 CT1

CT1

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts

Posted 10 January 2012 - 12:10 PM

Markus, thanks for the reply. That was too easy.

#38 Guest_Ahmed Osman_*

Guest_Ahmed Osman_*
  • Guests

Posted 31 January 2012 - 11:30 AM

I'm kind a nope so could you tell me how to update the code for file response method

I've a html file on the SD and want to show it up.

WebServer.AddResponse(new FileResponse("main",--what I should put here--));

Thanks

#39 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 31 January 2012 - 04:51 PM

You don't have to do anything...
Just use it the following way:
http://ipnetduino:port/\SD\file.txt
If you want to leave the \SD\, go to the Settings.cs and change ROOT_PATH to
public const string ROOT_PATH = @"\SD\";
Then you should be able to use your file like
[code=auto:0]http://ipnetduino:port/file.txt[/code

I was never able to test it because i don't have a SD card... But it SHOULD work that way ;)

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#40 CT1

CT1

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts

Posted 11 February 2012 - 12:31 PM

Hey Markus, I've been studying all the pieces that went into your project and learning how it all fits together. This is a great learning tool for me. I am having a problem with the webpage when I press either SET PIN or SWITCH PIN. It returns a Http 404 Not Found. The address looks like this http://192.168.0.77:...switchPin?pin=1 I am using IE9 Is it something I'm not doing? Thanks





Also tagged with one or more of these keywords: webserver, web server, neonmika, internet, web, server, http, sd, xml, json

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.