 
 int req[CHANNELS];
 char buff[BUFFER_SIZE+1];
+
+#define MAX_APNAME 64
+typedef struct NParams {
+  char APNAME[MAX_APNAME+1]="";
+  char APIP[3*4+3+1]="";
+  char JAPNAME[MAX_APNAME+1]="";
+  char STAIP[3*4+3+1]="";
+};
 
 const char PROGMEM headers_A[BUFFER_SIZE] = "Content-Type: text/html\r\nCache-Control: no-cache, no-store, must-revalidate\r\n";
 const char PROGMEM headers_B[BUFFER_SIZE] = "Pragma: no-cache\r\nExpires: -1\r\n\r\n";

    //netsend(n, buff);
  } else if (req[n] == 2) {
    char wifilist[CWLAP_MAX_LEN] = "";
    commandWaitCallback_P(PSTR("AT+CWLAP\r\n"), 10000, 1000, &callbackCWLAP, (void*)wifilist);
    while(waitData(100)) {
      readLine();
    }
    netsend_P(n, STATUS_200);
    netsend_P(n, headers_A);
    netsend_P(n, headers_B);
    netsend_P(n, HTML_PART_A);
    netsend_P(n, PSTR("Arduino httpd"));
    netsend_P(n, HTML_PART_B);
    netsend_P(n, PSTR("<label>WiFi networks:</label>\r\n<ul>"));
    char* token = strtok(wifilist, "\t");
    while (token != NULL) {
      buff[0] = 0;

          //DEBUG_SERIAL.println("CWLAP char at");
          //DEBUG_SERIAL.println(i);
        }
      }
    }
  }
}

void callbackIP(char* line, void* context) {
  NParams* p = (NParams*)context;
  int o = 0;
  int max = 0;
  char* dst = NULL;
  if (memcmp_P(line, PSTR("+CWSAP_CUR:\""), 12)==0) {
    o = 12;
    max = MAX_APNAME;
    dst = p->APNAME;
  } else if (memcmp_P(line, PSTR("+CWJAP_CUR:\""), 12)==0) {
    o = 12;
    max = MAX_APNAME;
    dst = p->JAPNAME;
  } else if (memcmp_P(line, PSTR("+CIFSR:APIP,\""), 13)==0) {
    o = 13;
    max = 3*4+3+1;
    dst = p->APIP;
  } else if (memcmp_P(line, PSTR("+CIFSR:STAIP,\""), 14)==0) {
    o = 14;
    max = 3*4+3+1;
    dst = p->STAIP;
  }
  if (dst != NULL) {
    for (int i = o; i-o < max; i++) {
      if (line[i] == '"') {
        break;
      } else {
        dst[i-o]=line[i];
        dst[i-o+1]=0;
      }
    }
  }
