コード例 #1
0
ファイル: cgiwifi.c プロジェクト: seco/esp-link
// cannot allocate the info struct on the stack, it crashes!
static ICACHE_FLASH_ATTR
void wifiStartMDNS(struct ip_addr ip) {
  if (!mdns_started) {
    os_memset(&mdns_info, 0, sizeof(struct mdns_info));
    mdns_info.host_name = flashConfig.hostname;
    mdns_info.server_name = "http", // service name
    mdns_info.server_port = 80,     // service port
    mdns_info.ipAddr = ip.addr,
    espconn_mdns_init(&mdns_info);
    mdns_started = true;
  }
}
コード例 #2
0
ファイル: user_main.c プロジェクト: n0bel/ESPrinkler
void minit(void)
{
	struct ip_info ipconfig;
    wifi_get_ip_info(STATION_IF, &ipconfig);

	m.host_name = config.myname;
	m.server_name = "sprinkler";
	m.server_port = 80;
	m.ipAddr = ipconfig.ip.addr;
	//m.txt_data[0] = "test=test";
	espconn_mdns_init(&m);
}
コード例 #3
0
void startmDNS() {

struct mdns_info info;

 struct ip_info ipconfig;
 wifi_get_ip_info(STATION_IF, &ipconfig);
 info.host_name = (char*)"music";
info.ipAddr = ipconfig.ip.addr; //ESP8266 station IP
info.server_name = (char*)"iot";
info.server_port = 80;
info.txt_data[0] = (char*)"version = now";
info.txt_data[1] = (char*)"user1 = data1";
info.txt_data[2] = (char*)"user2 = data2";
espconn_mdns_init(&info);
}
コード例 #4
0
ファイル: cgiwifi.c プロジェクト: Drummondh/esp-link
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));
    mdns_info->host_name = flashConfig.hostname;
    mdns_info->server_name = flashConfig.mdns_servername;
    mdns_info->server_port = 80;
    mdns_info->ipAddr = ip.addr;
    espconn_mdns_init(mdns_info);    
  }
  else {    
    espconn_mdns_server_unregister();
    espconn_mdns_close();
  }
  mdns_started = true;
}