Skip to content

Commit

Permalink
add mdns txt record for arduino per #184
Browse files Browse the repository at this point in the history
  • Loading branch information
tve committed Oct 23, 2016
1 parent 68fd831 commit aa5759d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion esp-link/cgiwifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,28 @@ void ICACHE_FLASH_ATTR wifiAddStateChangeCb(WifiStateChangeCb cb) {
DBG("WIFI: max state change cb count exceeded\n");
}

static struct mdns_info *mdns_info;
static char* mdns_txt = "upload_ssh=no";

void ICACHE_FLASH_ATTR wifiStartMDNS(struct ip_addr ip) {
if (flashConfig.mdns_enable) {
struct mdns_info *mdns_info = (struct mdns_info *)os_zalloc(sizeof(struct mdns_info));
if (mdns_info == NULL)
mdns_info = (struct mdns_info *)os_zalloc(sizeof(struct mdns_info));

mdns_info->host_name = flashConfig.hostname;
mdns_info->server_name = flashConfig.mdns_servername;
mdns_info->server_port = 80;
mdns_info->ipAddr = ip.addr;
mdns_info->txt_data[0] = mdns_txt;
espconn_mdns_init(mdns_info);
}
else {
espconn_mdns_server_unregister();
espconn_mdns_close();
if (mdns_info != NULL) {
os_free(mdns_info);
mdns_info = NULL;
}
}
mdns_started = true;
}
Expand Down

0 comments on commit aa5759d

Please sign in to comment.