DNS lookup of a configurable site?

 If I may ask for advice,

I am using the EtherCard library on my NaNode and I want to build customizable settings thru HTTP web site on the nanode itself. One of the settings is user configurable NTP server (as a site, not IP).

It turns out that the EtherCard ether.dnsLookup fuction expects a progmem string.. so I can't just lookup an EEPROM saved configuration for NTP server.

Is there any way to work around this?

Thanks

mharizanov's picture

Re: DNS lookup of a configurable site?

 ok, I figured it out.

I had to modify the EtherCard library, dns.cpp so it takes regular char* instead of progmem. 

 

 

 

glyn.hudson's picture

Re: DNS lookup of a configurable site?

 This sounds interesting, please post up an example when you get it working. 

 

mharizanov's picture

Re: DNS lookup of a configurable site?

This whole project is about a NaNode controlling my Daikin air conditioner via IR codes (I decoded the protocol). 

As for the EtherCard modifications, quite simple indeed:

Just edit dns.cpp and modify the line:

 

//static void dnsRequest (const prog_char *progmem_hostname) {

static void dnsRequest (char  *hostname) {
 
...............................

 

    for(;;) {

      // originally  c = pgm_read_byte(progmem_hostname++);

      c = *hostname++;

      if (c == '.' || c == 0)

 

........

//bool EtherCard::dnsLookup (prog_char* name) {

bool EtherCard::dnsLookup (char* name) {

 

 

and of course modify the EtherCard.h

static bool dnsLookup (char* name);

 

Here is a glance of the UI, I use jquery mobile and it is optimized for use via phone.

 

 

My nanode finds its external IP and publishes it to DynDNS (still no UI, this is my next  todo).

I have also implemented Basic HTTP authentication security scheme so if someone accidentally lands on the page, he doesn't mess with my Air Conditioner

 Please don't ask for the code, I intend to sell these gadgets in the future.

 

jeroen94704's picture

Re: DNS lookup of a configurable site?

>  Please don't ask for the code, I intend to sell these gadgets in the future.

The Ethercard library is GPL-code, so if you end up selling your product, you are obliged to release the source code.

mharizanov's picture

Re: DNS lookup of a configurable site?

so I did; check my previous post where I explain the modifications needed in Ethercard library so that this works.

If anyone uses GPL code they are required to make available their modifications under the same conditions of the license. In that sense I am only obliged to release the modified EtherCard library code, nothing more.

 

glyn.hudson's picture

Re: DNS lookup of a configurable site?

People on this forum are not interested in steeling your idea, you will get a lot more help, ideas and development contributions from people by making your project open source. Your screen shots looks awesome, I know there are lots of people here who would love to have a play with the code, these people are not your target customers and would not pay for such a system, especially if it was closed source. 

OpenEnergyMonitor is an open-source collaborative project, we release everything under open-source and expect other members to do the same. If I and other members are going to put our time into answering questions and helping people on this forum we would expect the resultant code to be released under open-source. I certainly am not interested in answering questions to benefit closed source projects. 

mharizanov's picture

Re: DNS lookup of a configurable site?

Glyn,

I fully agree with your statement, contrary to jeroen94704's that I am "obliged' to release the code (that almost sounds like a threat). 

The code is quite dirty, I had to crunch all this in 30K of code, so I will do some cleanup before releasing

 

mharizanov's picture

Re: DNS lookup of a configurable site?

TrystanLea's picture

Re: DNS lookup of a configurable site?

Thanks a lot mharizanov for releasing your code, it is much appreciated, awesome work! It does look really nice!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.