这篇教程C++ wifi_get_macaddr函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wifi_get_macaddr函数的典型用法代码示例。如果您正苦于以下问题:C++ wifi_get_macaddr函数的具体用法?C++ wifi_get_macaddr怎么用?C++ wifi_get_macaddr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wifi_get_macaddr函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: printWifiInfo// print various Wifi information into json bufferint ICACHE_FLASH_ATTR printWifiInfo(char *buff) { int len; //struct station_config stconf; wifi_station_get_config(&stconf); //struct softap_config apconf; wifi_softap_get_config(&apconf); uint8_t op = wifi_get_opmode() & 0x3; char *mode = wifiMode[op]; char *status = "unknown"; int st = wifi_station_get_connect_status(); if (st >= 0 && st < sizeof(connStatuses)) status = connStatuses[st]; int p = wifi_get_phy_mode(); char *phy = wifiPhy[p&3]; char *warn = wifiWarn[op]; if (op == 3) op = 4; // Done to let user switch to AP only mode from Soft-AP settings page, using only one set of warnings char *apwarn = wifiWarn[op]; char *apauth = apAuthMode[apconf.authmode]; sint8 rssi = wifi_station_get_rssi(); if (rssi > 0) rssi = 0; uint8 mac_addr[6]; uint8 apmac_addr[6]; wifi_get_macaddr(0, mac_addr); wifi_get_macaddr(1, apmac_addr); uint8_t chan = wifi_get_channel(); len = os_sprintf(buff, "/"mode/": /"%s/", /"modechange/": /"%s/", /"ssid/": /"%s/", /"status/": /"%s/", " "/"phy/": /"%s/", /"rssi/": /"%ddB/", /"warn/": /"%s/", /"apwarn/": /"%s/", " "/"mac/":/"%02x:%02x:%02x:%02x:%02x:%02x/", /"chan/":/"%d/", /"apssid/": /"%s/", " "/"appass/": /"%s/", /"apchan/": /"%d/", /"apmaxc/": /"%d/", /"aphidd/": /"%s/", " "/"apbeac/": /"%d/", /"apauth/": /"%s/",/"apmac/":/"%02x:%02x:%02x:%02x:%02x:%02x/"", mode, MODECHANGE, (char*)stconf.ssid, status, phy, rssi, warn, apwarn, mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], chan, (char*)apconf.ssid, (char*)apconf.password, apconf.channel, apconf.max_connection, apconf.ssid_hidden?"enabled":"disabled", apconf.beacon_interval, apauth,apmac_addr[0], apmac_addr[1], apmac_addr[2], apmac_addr[3], apmac_addr[4], apmac_addr[5]); struct ip_info info; if (wifi_get_ip_info(0, &info)) { len += os_sprintf(buff+len, ", /"ip/": /"%d.%d.%d.%d/"", IP2STR(&info.ip.addr)); len += os_sprintf(buff+len, ", /"netmask/": /"%d.%d.%d.%d/"", IP2STR(&info.netmask.addr)); len += os_sprintf(buff+len, ", /"gateway/": /"%d.%d.%d.%d/"", IP2STR(&info.gw.addr)); len += os_sprintf(buff+len, ", /"hostname/": /"%s/"", flashConfig.hostname); } else { len += os_sprintf(buff+len, ", /"ip/": /"-none-/""); } len += os_sprintf(buff+len, ", /"staticip/": /"%d.%d.%d.%d/"", IP2STR(&flashConfig.staticip)); len += os_sprintf(buff+len, ", /"dhcp/": /"%s/"", flashConfig.staticip > 0 ? "off" : "on"); return len;}
开发者ID:mroavi,项目名称:esp-link,代码行数:54,
示例2: user_udp_recvLOCAL void ICACHE_FLASH_ATTRuser_udp_recv(void *arg, char *pusrdata, unsigned short length){ char DeviceBuffer[40] = { 0 }; char Device_mac_buffer[60] = { 0 }; char hwaddr[6]; struct ip_info ipconfig; if (wifi_get_opmode() != STATION_MODE) { wifi_get_ip_info(SOFTAP_IF, &ipconfig); wifi_get_macaddr(SOFTAP_IF, hwaddr); if (!ip_addr_netcmp ((struct ip_addr *)ptrespconn.proto.udp->remote_ip, &ipconfig.ip, &ipconfig.netmask)) { //udp packet is received from ESP8266 station wifi_get_ip_info(STATION_IF, &ipconfig); wifi_get_macaddr(STATION_IF, hwaddr); } else { //udp packet is received from ESP8266 softAP } } else { //udp packet is received from ESP8266 station wifi_get_ip_info(STATION_IF, &ipconfig); wifi_get_macaddr(STATION_IF, hwaddr); } if (pusrdata == NULL) return; if (length == os_strlen(device_find_request) && os_strncmp(pusrdata, device_find_request, os_strlen(device_find_request)) == 0) { //received device find message os_sprintf(DeviceBuffer, "%s" MACSTR " " IPSTR, device_find_response_ok, MAC2STR(hwaddr), IP2STR(&ipconfig.ip)); os_printf("%s/n", DeviceBuffer); length = os_strlen(DeviceBuffer); //if received "Are You ESP8266 ?" , //response "Yes,I'm ESP8266!" + ESP8266 mac + ESP8266 ip espconn_sent(&ptrespconn, DeviceBuffer, length); } else { //received some other data }}
开发者ID:fernandomorse,项目名称:noduino-sdk,代码行数:53,
示例3: udhcp_read_interfaceint ICACHE_FLASH_ATTR udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac){ struct ip_info info; if (wifi_get_opmode() == NULL_MODE) { UDHCP_DEBUG("wifi's opmode is invalid/n"); return 1; } if (nip) { wifi_get_ip_info(SOFTAP_IF,&info); *nip = info.ip.addr; UDHCP_DEBUG("IP %s/n", inet_ntoa(info.ip)); } if (ifindex) { if (wifi_get_opmode() == SOFTAP_MODE || wifi_get_opmode() == STATIONAP_MODE) { *ifindex = SOFTAP_IF; } else { *ifindex = STATION_IF; } } if (mac) { if (wifi_get_opmode() == SOFTAP_MODE || wifi_get_opmode() == STATIONAP_MODE) { wifi_get_macaddr(SOFTAP_IF, mac); } UDHCP_DEBUG("MAC %02x:%02x:%02x:%02x:%02x:%02x/n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } return 0;}
开发者ID:MrBuddyCasino,项目名称:ESP8266_MP3_DECODER,代码行数:34,
示例4: alink_fill_deviceinfo/* fill device info 这里设备信息需要修改对应宏定义,其中DEV_MAC和DEV_CHIPID 需要用户自己实现接口函数*/void ICACHE_FLASH_ATTR alink_fill_deviceinfo(struct device_info *deviceinfo){ uint8 macaddr[6]; //fill main device info here strcpy(deviceinfo->name, DEV_NAME); strcpy(deviceinfo->sn, DEV_SN); strcpy(deviceinfo->key, ALINK_KEY); strcpy(deviceinfo->model, DEV_MODEL); strcpy(deviceinfo->secret, ALINK_SECRET); strcpy(deviceinfo->type, DEV_TYPE); strcpy(deviceinfo->version, DEV_VERSION); strcpy(deviceinfo->category, DEV_CATEGORY); strcpy(deviceinfo->manufacturer, DEV_MANUFACTURE); strcpy(deviceinfo->key_sandbox, ALINK_KEY_SANDBOX); strcpy(deviceinfo->secret_sandbox, ALINK_SECRET_SANDBOX); if (wifi_get_macaddr(0, macaddr)) { wsf_deb("macaddr=%02x:%02x:%02x:%02x:%02x:%02x/n", MAC2STR(macaddr)); snprintf(deviceinfo->mac, sizeof(deviceinfo->mac), "%02x:%02x:%02x:%02x:%02x:%02x", MAC2STR(macaddr)); } else strcpy(deviceinfo->mac, DEV_MAC); // if ((macaddr[4] == 0xc7) && (macaddr[5] == 0x18)) // the mac 18:fe:34:a2:c7:18 binding CHIPID "3D0044000F47333139373030" // { // strcpy(deviceinfo->cid, DEV_CHIPID); // } else { snprintf(deviceinfo->cid, sizeof(deviceinfo->cid), "%024d", system_get_chip_id()); // } wsf_deb("DEV_MODEL:%s /n", DEV_MODEL);}
开发者ID:hwwr,项目名称:test,代码行数:31,
示例5: sp_LightPairRequestPermissionvoid ICACHE_FLASH_ATTRsp_LightPairRequestPermission(){#if 1 char data_body[200]; os_bzero(data_body,sizeof(data_body)); uint8 mac_sta[6] = {0}; wifi_get_macaddr(STATION_IF, mac_sta); os_sprintf(data_body,"{/"device_mac/":/"%02X%02X%02X%02X%02X%02X/",/"button_mac/":/"%02X%02X%02X%02X%02X%02X/",/"path/":/"%s/"}",MAC2STR(mac_sta),MAC2STR(buttonPairingInfo.button_mac),PAIR_FOUND_REQUEST); if (!mesh_json_add_elem(data_body, sizeof(data_body), pair_sip, ESP_MESH_JSON_IP_ELEM_LEN)) { return; } if (!mesh_json_add_elem(data_body, sizeof(data_body), pair_sport, ESP_MESH_JSON_PORT_ELEM_LEN)) { return; } char* dev_mac = (char*)mesh_GetMdevMac(); if (!mesh_json_add_elem(data_body, sizeof(data_body), dev_mac, ESP_MESH_JSON_DEV_MAC_ELEM_LEN)) { return; } #if ESP_MESH_SUPPORT response_send_str((struct espconn*)user_GetUserPConn(),true,data_body,os_strlen(data_body),NULL,0,0,0); #else response_send_str((struct espconn*)user_GetWebPConn(),true,data_body,os_strlen(data_body),NULL,0,0,0); #endif#endif}
开发者ID:StephanHaag,项目名称:esp8266-devkit,代码行数:27,
示例6: printWifiInfo// print various Wifi information into json bufferint ICACHE_FLASH_ATTR printWifiInfo(char *buff) { int len; struct station_config stconf; wifi_station_get_config(&stconf); uint8_t op = wifi_get_opmode() & 0x3; char *mode = wifiMode[op]; char *status = "unknown"; int st = wifi_station_get_connect_status(); if (st > 0 && st < sizeof(connStatuses)) status = connStatuses[st]; int p = wifi_get_phy_mode(); char *phy = wifiPhy[p&3]; char *warn = wifiWarn[op]; sint8 rssi = wifi_station_get_rssi(); if (rssi > 0) rssi = 0; uint8 mac_addr[6]; wifi_get_macaddr(0, mac_addr); len = os_sprintf(buff, "/"mode/": /"%s/", /"ssid/": /"%s/", /"status/": /"%s/", /"phy/": /"%s/", " "/"rssi/": /"%ddB/", /"warn/": /"%s/", /"passwd/": /"%s/", " "/"mac/":/"%02x:%02x:%02x:%02x:%02x:%02x/"", mode, (char*)stconf.ssid, status, phy, rssi, warn, (char*)stconf.password, mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); struct ip_info info; if (wifi_get_ip_info(0, &info)) { len += os_sprintf(buff+len, ", /"ip/": /"%d.%d.%d.%d/"", (info.ip.addr>>0)&0xff, (info.ip.addr>>8)&0xff, (info.ip.addr>>16)&0xff, (info.ip.addr>>24)&0xff); } else {
开发者ID:alonewolfx2,项目名称:esp-link,代码行数:33,
示例7: get_wifi2_mesh_ap_statusvoid ICACHE_FLASH_ATTR get_wifi2_mesh_ap_status(const int8_t cid, const GetWifi2MeshAPStatus *data) { uint8_t mac[6]; struct ip_info info_ipv4; struct softap_config config_ap; os_bzero(&gw2masr.header, sizeof(gw2masr.header)); gw2masr.header = data->header; gw2masr.header.length = sizeof(GetWifi2MeshAPStatusReturn); if((wifi_softap_get_config(&config_ap)) && (wifi_get_ip_info(SOFTAP_IF, &info_ipv4)) / && (wifi_get_macaddr(SOFTAP_IF, mac))) { os_bzero(gw2masr.ssid, sizeof(gw2masr.ssid)); os_memcpy(gw2masr.ssid, config_ap.ssid, sizeof(config_ap.ssid)); os_bzero(gw2masr.ip, sizeof(gw2masr.ip)); os_memcpy(gw2masr.ip, (uint8_t *)&info_ipv4.ip.addr, sizeof(info_ipv4.ip.addr)); os_bzero(gw2masr.sub, sizeof(gw2masr.sub)); os_memcpy(gw2masr.sub, (uint8_t *)&info_ipv4.netmask.addr, sizeof(info_ipv4.ip.addr)); os_bzero(gw2masr.gw, sizeof(gw2masr.gw)); os_memcpy(gw2masr.gw, (uint8_t *)&info_ipv4.gw.addr, sizeof(info_ipv4.ip.addr)); os_bzero(gw2masr.mac, sizeof(gw2masr.mac)); os_memcpy(gw2masr.mac, mac, sizeof(mac)); } com_send(&gw2masr, sizeof(GetWifi2MeshAPStatusReturn), cid);}
开发者ID:Tinkerforge,项目名称:wifi-v2-extension,代码行数:31,
示例8: get_wifi2_mesh_station_statusvoid ICACHE_FLASH_ATTR get_wifi2_mesh_station_status(const int8_t cid, const GetWifi2MeshStationStatus *data) { uint8_t mac[6]; char *hostname_ptr; struct ip_info info_ipv4; struct station_config *config_st; os_bzero(&gw2mssr.header, sizeof(gw2mssr.header)); gw2mssr.header = data->header; gw2mssr.header.length = sizeof(GetWifi2MeshStationStatusReturn); if((wifi_get_ip_info(STATION_IF, &info_ipv4)) && (wifi_get_macaddr(STATION_IF, mac))) { hostname_ptr = wifi_station_get_hostname(); os_bzero(gw2mssr.hostname, sizeof(gw2mssr.hostname)); os_memcpy(gw2mssr.hostname, hostname_ptr, sizeof(gw2mssr.hostname)); os_bzero(gw2mssr.ip, sizeof(gw2mssr.ip)); os_memcpy(gw2mssr.ip, (uint8_t *)&info_ipv4.ip.addr, sizeof(info_ipv4.ip.addr)); os_bzero(gw2mssr.sub, sizeof(gw2mssr.sub)); os_memcpy(gw2mssr.sub, (uint8_t *)&info_ipv4.netmask.addr, sizeof(info_ipv4.netmask.addr)); os_bzero(gw2mssr.gw, sizeof(gw2mssr.gw)); os_memcpy(gw2mssr.gw, (uint8_t *)&info_ipv4.gw.addr, sizeof(info_ipv4.gw.addr)); os_bzero(gw2mssr.mac, sizeof(gw2mssr.mac)); os_memcpy(gw2mssr.mac, mac, sizeof(mac)); } com_send(&gw2mssr, sizeof(GetWifi2MeshStationStatusReturn), cid);}
开发者ID:Tinkerforge,项目名称:wifi-v2-extension,代码行数:33,
示例9: sp_LightPairReportResultvoid ICACHE_FLASH_ATTRsp_LightPairReportResult(bool res){#if 1 os_printf("sp_LightPairReportResult %d /r/n",res); char data_body[300]; os_bzero(data_body,sizeof(data_body)); uint8 mac_sta[6] = {0}; wifi_get_macaddr(STATION_IF, mac_sta); os_sprintf(data_body,"{/"device_mac/":/"%02X%02X%02X%02X%02X%02X/",/"button_mac/":/"%02X%02X%02X%02X%02X%02X/",/"result/":%d,/"path/":/"%s/"}",MAC2STR(mac_sta),MAC2STR(buttonPairingInfo.button_mac),res,PAIR_RESULT); //{"device_mac":"...","result":1,"path":"/device/button/pair/result"} if (!mesh_json_add_elem(data_body, sizeof(data_body), pair_sip, ESP_MESH_JSON_IP_ELEM_LEN)) { return; } if (!mesh_json_add_elem(data_body, sizeof(data_body), pair_sport, ESP_MESH_JSON_PORT_ELEM_LEN)) { return; } char* dev_mac = (char*)mesh_GetMdevMac(); if (!mesh_json_add_elem(data_body, sizeof(data_body), dev_mac, ESP_MESH_JSON_DEV_MAC_ELEM_LEN)) { return; } #if ESP_MESH_SUPPORT response_send_str((struct espconn*)user_GetUserPConn(),true,data_body,os_strlen(data_body),NULL,0,0,0); #else response_send_str((struct espconn*)user_GetWebPConn(),true,data_body,os_strlen(data_body),NULL,0,0,0); #endif#endif}
开发者ID:StephanHaag,项目名称:esp8266-devkit,代码行数:28,
示例10: get_wifi2_statusvoid ICACHE_FLASH_ATTR get_wifi2_status(const int8_t cid, const GetWifi2Status *data) { gw2sr.header = data->header; gw2sr.header.length = sizeof(GetWifi2StatusReturn); struct ip_info info; wifi_get_ip_info(STATION_IF, &info); gw2sr.client_ip[0] = ip4_addr1(&info.ip); gw2sr.client_ip[1] = ip4_addr2(&info.ip); gw2sr.client_ip[2] = ip4_addr3(&info.ip); gw2sr.client_ip[3] = ip4_addr4(&info.ip); gw2sr.client_subnet_mask[0] = ip4_addr1(&info.netmask); gw2sr.client_subnet_mask[1] = ip4_addr2(&info.netmask); gw2sr.client_subnet_mask[2] = ip4_addr3(&info.netmask); gw2sr.client_subnet_mask[3] = ip4_addr4(&info.netmask); gw2sr.client_gateway[0] = ip4_addr1(&info.gw); gw2sr.client_gateway[1] = ip4_addr2(&info.gw); gw2sr.client_gateway[2] = ip4_addr3(&info.gw); gw2sr.client_gateway[3] = ip4_addr4(&info.gw); wifi_get_ip_info(SOFTAP_IF, &info); gw2sr.ap_ip[0] = ip4_addr1(&info.ip); gw2sr.ap_ip[1] = ip4_addr2(&info.ip); gw2sr.ap_ip[2] = ip4_addr3(&info.ip); gw2sr.ap_ip[3] = ip4_addr4(&info.ip); gw2sr.ap_subnet_mask[0] = ip4_addr1(&info.netmask); gw2sr.ap_subnet_mask[1] = ip4_addr2(&info.netmask); gw2sr.ap_subnet_mask[2] = ip4_addr3(&info.netmask); gw2sr.ap_subnet_mask[3] = ip4_addr4(&info.netmask); gw2sr.ap_gateway[0] = ip4_addr1(&info.gw); gw2sr.ap_gateway[1] = ip4_addr2(&info.gw); gw2sr.ap_gateway[2] = ip4_addr3(&info.gw); gw2sr.ap_gateway[3] = ip4_addr4(&info.gw); wifi_get_macaddr(STATION_IF, gw2sr.client_mac_address); wifi_get_macaddr(SOFTAP_IF, gw2sr.ap_mac_address); gw2sr.client_enabled = configuration_current.client_enable; gw2sr.ap_enabled = configuration_current.ap_enable; gw2sr.client_rssi = wifi_station_get_rssi(); gw2sr.client_status = wifi_station_get_connect_status(); gw2sr.ap_connected_count = wifi_softap_get_station_num(); com_send(&gw2sr, sizeof(GetWifi2StatusReturn), cid);}
开发者ID:Tinkerforge,项目名称:wifi-v2-extension,代码行数:47,
示例11: jshGetSerialNumber// esp8266 chips don't have a serial number but they do have a MAC addressint jshGetSerialNumber(unsigned char *data, int maxChars) { uint8_t mac_addr[6]; wifi_get_macaddr(0, mac_addr); // 0->MAC of STA interface char buf[16]; int len = os_sprintf(buf, MACSTR, MAC2STR(mac_addr)); strncpy((char *)data, buf, maxChars); return len > maxChars ? maxChars : len;} // End of jshSerialNumber
开发者ID:RobinLin,项目名称:Espruino,代码行数:9,
示例12: wifi_get_macaddr/** * Get the station interface MAC address. * @return String mac */String ESP8266WiFiSTAClass::macAddress(void) { uint8_t mac[6]; char macStr[18] = { 0 }; wifi_get_macaddr(STATION_IF, mac); sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return String(macStr);}
开发者ID:Makuna,项目名称:Arduino,代码行数:12,
示例13: wifi_getmac// Lua: mac = wifi.xx.getmac()static int wifi_getmac( lua_State* L, uint8_t mode ){ char temp[64]; uint8_t mac[6]; wifi_get_macaddr(mode, mac); c_sprintf(temp, "%02X-%02X-%02X-%02X-%02X-%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] ); lua_pushstring( L, temp ); return 1; }
开发者ID:aeickho,项目名称:nodemcu-firmware,代码行数:10,
示例14: wifi_getmac// Lua: mac = wifi.xx.getmac()static int wifi_getmac( lua_State* L, uint8_t mode ){ char temp[64]; uint8_t mac[6]; wifi_get_macaddr(mode, mac); c_sprintf(temp, MACSTR, MAC2STR(mac)); lua_pushstring( L, temp ); return 1; }
开发者ID:tjclement,项目名称:nodemcu-firmware,代码行数:10,
示例15: show_macvoidshow_mac ( void ){ unsigned char mac[6]; wifi_get_macaddr ( STATION_IF, mac ); os_printf ( "MAC: %02x:%02x:%02x:%02x:%02x:%02x/n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );}
开发者ID:jonshouse1,项目名称:esp8266-jahttp,代码行数:9,
示例16: changeDlgvoid WifiClass::handleEvent(System_Event_t *e){ int event = e->event; if (event == EVENT_STAMODE_GOT_IP) { Debug.printf("Wifi client got IP/n"); if (!haveIp && changeDlg) changeDlg(true); haveIp = true; if (!AppSettings.portalUrl.equals("")) { String mac; uint8 hwaddr[6] = {0}; wifi_get_macaddr(STATION_IF, hwaddr); for (int i = 0; i < 6; i++) { if (hwaddr[i] < 0x10) mac += "0"; mac += String(hwaddr[i], HEX); if (i < 5) mac += ":"; } String body = AppSettings.portalData; body.replace("{ip}", WifiStation.getIP().toString()); body.replace("{mac}", mac); portalLogin.setPostBody(body.c_str()); String url = AppSettings.portalUrl; url.replace("{ip}", WifiStation.getIP().toString()); url.replace("{mac}", mac); portalLogin.downloadString( url, HttpClientCompletedDelegate(&WifiClass::portalLoginHandler, this)); } } else if (event == EVENT_STAMODE_CONNECTED) { if (!connected) Debug.printf("Wifi client got connected/n"); connected = true; } else if (event == EVENT_STAMODE_DISCONNECTED) { if (connected) Debug.printf("Wifi client got disconnected/n"); connected = false; if (changeDlg) changeDlg(false); } else { Debug.printf("Unknown wifi event %d !/n", event); }}
开发者ID:sim0njo,项目名称:MySensorsGateway,代码行数:54,
示例17: wifi_get_macaddrString AccessPointClass::getMAC(){ String mac; uint8 hwaddr[6] = {0}; wifi_get_macaddr(SOFTAP_IF, hwaddr); for (int i = 0; i < 6; i++) { if (hwaddr[i] < 0x10) mac += "0"; mac += String(hwaddr[i], HEX); } return mac;}
开发者ID:alon24,项目名称:SmingRTOS,代码行数:12,
示例18: ESP8266info_MACidsbool ESP8266info_MACids(){ uint8_t mac[6]; if(!Serial) { return false; } Serial.print(cmsg2); if(wifi_get_macaddr(STATION_IF,mac)) { Serial.print("Station MAC: "); infomac(mac); } if(wifi_get_macaddr(SOFTAP_IF,mac)) { Serial.print("SoftAP MAC: "); infomac(mac); } return true;}
开发者ID:boseji,项目名称:ESP8266Info,代码行数:21,
示例19: wifi_get_macaddrString StationClass::getMAC(){ String mac; uint8 hwaddr[6] = {0}; wifi_get_macaddr(STATION_IF, hwaddr); for (int i = 0; i < 6; i++) { if (hwaddr[i] < 0x10) mac += "0"; mac += String(hwaddr[i], HEX); } return mac;}
开发者ID:0xPIT,项目名称:Sming,代码行数:12,
示例20: setup_apvoid ICACHE_FLASH_ATTR setup_ap() { setup_ap_ip(); // Set STATION+AP mode wifi_set_opmode(STATIONAP_MODE); // Store MAC address wifi_get_macaddr(SOFTAP_IF, macaddr); char macstr[255]; os_sprintf(macstr, MACSTR, MAC2STR(macaddr)); //ets_uart_printf("Got mac addr %s/r/n", macstr); // Set AP info char ssid[32]; os_sprintf(ssid, "Maia Setup 0x%x", DEVICE_ID); char password[64] = "heyamaia"; // Create config struct struct softap_config apConfig; wifi_softap_get_config(&apConfig); // Set SSID in struct os_memset(apConfig.ssid, 0, sizeof(apConfig.ssid)); os_memcpy(apConfig.ssid, ssid, os_strlen(ssid)); // Set Password in struct os_memset(apConfig.password, 0, sizeof(apConfig.password)); os_memcpy(apConfig.password, password, os_strlen(password)); // Set AP options apConfig.authmode = AUTH_WPA_WPA2_PSK; apConfig.channel = 7; apConfig.ssid_hidden = 0; apConfig.ssid_len = 0; apConfig.max_connection = 255; // Use config struct wifi_softap_set_config(&apConfig); //print("Set AP info"); /* char info[1024]; */ /* os_sprintf(info,"OPMODE: %u, SSID: %s, PASSWORD: %s, CHANNEL: %d, AUTHMODE: %d, MACADDRESS: %s/r/n", */ /* wifi_get_opmode(), */ /* apConfig.ssid, */ /* apConfig.password, */ /* apConfig.channel, */ /* apConfig.authmode, */ /* macstr); */ //ets_uart_printf(info); wifi_station_scan(NULL, wifi_scan_done); mode = MODE_AP;}
开发者ID:withmaia,项目名称:maia-attinytemp,代码行数:53,
示例21: SYSTEM_Handleruint32_t ICACHE_FLASH_ATTR SYSTEM_Handler(PACKET_CMD *cmd){ enum system_event event; REQUEST req; uint8_t mac[6]; uint16_t crc; CMD_Request(&req, cmd); if (CMD_GetArgc(&req) != 1) { return 0; } CMD_PopArgs(&req, (uint8_t*)&event); switch (event) { case GET_STATION_MAC: case GET_AP_MAC: if (event == GET_STATION_MAC) { wifi_get_macaddr(STATION_IF, mac); } else { wifi_get_macaddr(SOFTAP_IF, mac); } crc = CMD_ResponseStart(CMD_SYSTEM, cmd->callback, 0, 2); crc = CMD_ResponseBody(crc, (uint8_t*)&event, sizeof(event)); crc = CMD_ResponseBody(crc, mac, 6); CMD_ResponseEnd(crc); break; default: break; } return 0;}
开发者ID:xiaogan-Studio,项目名称:esp_bridge,代码行数:40,
示例22: mesh_MacIdInitvoid ICACHE_FLASH_ATTRmesh_MacIdInit(){ if(mdev_mac){ os_printf("Mesh mdev_mac: %s /r/n",mdev_mac); return; } mdev_mac = (char*)os_zalloc(ESP_MESH_JSON_DEV_MAC_ELEM_LEN+1); //uint32 MAC_FLG = READ_PERI_REG(0x3ff00054); uint8 mac_sta[6] = {0}; wifi_get_macaddr(STATION_IF, mac_sta); os_sprintf(mdev_mac,"/"mdev_mac/":/"%02X%02X%02X%02X%02X%02X/"",MAC2STR(mac_sta)); os_printf("Disp mdev_mac: %s/r/n",mdev_mac);}
开发者ID:koanpl,项目名称:ESP8266_LIGHT_WITH_MESH,代码行数:14,
示例23: load_configvoid ICACHE_FLASH_ATTR load_config(){ os_printf("size of config=%d 0x%08x/n",sizeof(config), sizeof(config)); spi_flash_read(CONFIG_ADDR, (uint32*)&config, sizeof(config)); if (config.magic != CONFIG_MAGIC) { os_memset(&config,0,sizeof(config)); } if (!config.myname[0]) { uint8 mac[6]; wifi_get_macaddr(STATION_IF, mac); os_sprintf(config.myname,"esp8266-%02x%02x%02x",mac[3],mac[4],mac[5]); }}
开发者ID:n0bel,项目名称:ESPrinkler,代码行数:15,
示例24: debug_UploadExceptionInfo//upload debug info to esp-servervoid ICACHE_FLASH_ATTR debug_UploadExceptionInfo(void* arg){ struct espconn *pespconn = (struct espconn *)arg; ESP_DBG("reset reason: %x/n", rtc_info_dbg.reason); uint8 debug_upload_buf[DEBUG_UPLOAD_BUF_LEN]; uint8* pInfo = debug_upload_buf; os_memset(debug_upload_buf,0,DEBUG_UPLOAD_BUF_LEN); uint8 devkey[41]; os_memset(devkey,0,sizeof(devkey)); user_esp_platform_get_devkey(devkey); if (rtc_info_dbg.reason == REASON_WDT_RST || rtc_info_dbg.reason == REASON_EXCEPTION_RST || rtc_info_dbg.reason == REASON_SOFT_WDT_RST) { os_sprintf(pInfo,UPLOAD_DEBUG_LOG,rtc_info_dbg.reason,rtc_info_dbg.exccause,rtc_info_dbg.epc1, rtc_info_dbg.epc2,rtc_info_dbg.epc3,rtc_info_dbg.excvaddr, rtc_info_dbg.depc,FlashDebugBufParam.DebugVersion ,devkey); }else{ return; } #if ESP_MESH_SUPPORT mesh_json_add_elem(pInfo, sizeof(pInfo), (char*)mesh_GetMdevMac(), ESP_MESH_JSON_DEV_MAC_ELEM_LEN); #endif uint8 *dst = NULL,*src = NULL; #if ESP_MESH_SUPPORT uint8 dst_t[6],src_t[6]; if(pespconn && pespconn->proto.tcp){ os_memcpy(dst_t,pespconn->proto.tcp->remote_ip,4); os_memcpy(dst_t+4,&pespconn->proto.tcp->remote_port,2); } wifi_get_macaddr(STATION_IF,src_t); dst = dst_t; src = src_t; #endif ESP_DBG("debug Info: %s /r/n",pInfo); if(0 == user_JsonDataSend(pespconn, pInfo, os_strlen(pInfo),0,src,dst)){ debug_DropExceptionInfo(); ESP_DBG("upload success.../r/n"); }else{ ESP_DBG("upload fail.../r/n"); }}
开发者ID:Zhang-Jia,项目名称:ESP8266_LIGHT_WITH_MESH,代码行数:49,
示例25: user_init/************************************************* name: user_init* parameters: none* return value: none* purpose: main logic************************************************/void user_init(void){ /* initialization */ struct softap_config tWifiSettings = { 0 }; uint8 puMacAddress[6] = { 0 }; os_memset((void *)&tWifiSettings, 0, sizeof(tWifiSettings)); wifi_softap_get_config(&tWifiSettings); /* retrieve mac address */ wifi_get_macaddr(1, puMacAddress); /* append to ssid name */ memcpy(tWifiSettings.ssid, HOTSPOT_SSID_STRING, sizeof(HOTSPOT_SSID_STRING)); os_sprintf(tWifiSettings.ssid + sizeof(HOTSPOT_SSID_STRING) - 1, "%x%x%x%x%x%x", puMacAddress[0], puMacAddress[1], puMacAddress[2], puMacAddress[3], puMacAddress[4], puMacAddress[5]); /* set password */ memcpy(tWifiSettings.password, HOTSPOT_PASSWORD_STRING, os_strlen(HOTSPOT_PASSWORD_STRING)); /* update other settings */ tWifiSettings.authmode = AUTH_WPA_WPA2_PSK; tWifiSettings.ssid_len = 0; tWifiSettings.channel = 6; tWifiSettings.max_connection = 4; /* update wifi configuration */ wifi_softap_set_config(&tWifiSettings); /* initialize stdout */ stdoutInit(); /* initialize IOs */ ioInit(); /* initialize server */ httpdInit(g_ptSupportedUrls, 80); #ifdef USER_MAIN_DEBUG os_printf("user_init: ready; partition %d/n", system_upgrade_userbin_check());#endif}
开发者ID:koltegirish,项目名称:esphttpd-1,代码行数:53,
示例26: setup_ap_modeLOCAL void ICACHE_FLASH_ATTR setup_ap_mode() { wifi_station_disconnect(); wifi_station_dhcpc_stop(); wifi_set_opmode(SOFTAP_MODE); struct softap_config apconfig; if (wifi_softap_get_config(&apconfig)) { wifi_softap_dhcps_stop(); char macaddr[6]; wifi_get_macaddr(SOFTAP_IF, macaddr); os_memset(apconfig.ssid, 0, sizeof(apconfig.ssid)); os_memset(apconfig.password, 0, sizeof(apconfig.password)); apconfig.ssid_len = os_sprintf(apconfig.ssid, "MacGyver-IoT_%02x%02x%02x%02x%02x%02x", MAC2STR(macaddr)); //os_sprintf(apconfig.password, "%02x%02x%02x%02x%02x%02x", MAC2STR(macaddr)); // 18fe349bc6b6 //os_sprintf(apconfig.password, "test"); // 18fe349bc6b6 //apconfig.authmode = AUTH_WPA_WPA2_PSK; // AUTH_OPEN apconfig.authmode = AUTH_OPEN; apconfig.ssid_hidden = 0; apconfig.channel = 7; apconfig.max_connection = 10; if (!wifi_softap_set_config(&apconfig)) { // CTRL not set AP config! } struct ip_info ipinfo; if (wifi_get_ip_info(SOFTAP_IF, &ipinfo)) { IP4_ADDR(&ipinfo.ip, 192, 168, 4, 1); IP4_ADDR(&ipinfo.gw, 192, 168, 4, 1); IP4_ADDR(&ipinfo.netmask, 255, 255, 255, 0); if (!wifi_set_ip_info(SOFTAP_IF, &ipinfo)) { // CTRL not set IP config! } } wifi_softap_dhcps_start(); } if (wifi_get_phy_mode() != PHY_MODE_11N) wifi_set_phy_mode(PHY_MODE_11N);}
开发者ID:koltegirish,项目名称:esp8266-mqtt-iot,代码行数:46,
示例27: createHostMetavoid CP_ICACHE_FLASH_ATTR createHostMeta(){#ifdef ESP8266 if ( hostMeta.status == 0 ) { char buffer2[HOSTNAME_MAX_LENGTH] = {0}; wifi_get_macaddr(STATION_IF, hostMeta.hwaddr); os_sprintf(buffer2, "%s-%02x%02x:%02x%02x:%02x%02x", "cf", MAC2STR(hostMeta.hwaddr) ); int len = strlen (buffer2) + 1; hostMeta.hostname = (char*)malloc(len*sizeof(char)); bzero(hostMeta.hostname, len*sizeof(char)); os_memcpy(hostMeta.hostname, &buffer2, len); hostMeta.status = 1; CHATFABRIC_DEBUG_FMT(_GLOBAL_DEBUG, "Setting hostMeta Name: %s ", hostMeta.hostname ); }#else #endif}
开发者ID:daviddpd,项目名称:dpdChatFabric,代码行数:21,
示例28: printWifiInfo// print various Wifi information into json bufferint ICACHE_FLASH_ATTR printWifiInfo(char *buff) { int len; struct station_config stconf; wifi_station_get_config(&stconf); uint8_t op = wifi_get_opmode() & 0x3; char *mode = wifiMode[op]; char *status = "unknown"; int st = wifi_station_get_connect_status(); if (st >= 0 && st < sizeof(connStatuses)) status = connStatuses[st]; int p = wifi_get_phy_mode(); char *phy = wifiPhy[p&3]; char *warn = wifiWarn[op]; sint8 rssi = wifi_station_get_rssi(); if (rssi > 0) rssi = 0; uint8 mac_addr[6]; wifi_get_macaddr(0, mac_addr); uint8_t chan = wifi_get_channel(); len = os_sprintf(buff, "/"mode/": /"%s/", /"modechange/": /"%s/", /"ssid/": /"%s/", /"status/": /"%s/", /"phy/": /"%s/", " "/"rssi/": /"%ddB/", /"warn/": /"%s/", /"mac/":/"%02x:%02x:%02x:%02x:%02x:%02x/", /"chan/":%d", mode, MODECHANGE, (char*)stconf.ssid, status, phy, rssi, warn, mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], chan); struct ip_info info; if (wifi_get_ip_info(0, &info)) { len += os_sprintf(buff+len, ", /"ip/": /"%d.%d.%d.%d/"", IP2STR(&info.ip.addr)); len += os_sprintf(buff+len, ", /"netmask/": /"%d.%d.%d.%d/"", IP2STR(&info.netmask.addr)); len += os_sprintf(buff+len, ", /"gateway/": /"%d.%d.%d.%d/"", IP2STR(&info.gw.addr)); len += os_sprintf(buff+len, ", /"hostname/": /"%s/"", flashConfig.hostname); } else { len += os_sprintf(buff+len, ", /"ip/": /"-none-/""); } len += os_sprintf(buff+len, ", /"staticip/": /"%d.%d.%d.%d/"", IP2STR(&flashConfig.staticip)); len += os_sprintf(buff+len, ", /"dhcp/": /"%s/"", flashConfig.staticip > 0 ? "off" : "on"); return len;}
开发者ID:seco,项目名称:esp-link,代码行数:41,
示例29: ap_startvoid ap_start( void ){ if (wifi_get_opmode()<0x03) { wifi_set_opmode_current( STATIONAP_MODE ); struct softap_config softapConf; char* apssid[32]; char sta_mac[6] = {0}; wifi_get_macaddr(STATION_IF, sta_mac); os_sprintf(apssid, "%s_%x%x%x", DEFAULT_AP_SSID, sta_mac[3], sta_mac[4], sta_mac[5]); os_memcpy( &softapConf.ssid, apssid, 32 ); os_memcpy( &softapConf.password, "", 64 ); softapConf.ssid_len=os_strlen( &apssid ); //softapConf.channel= 6; softapConf.authmode= AUTH_OPEN; softapConf.max_connection= 2; softapConf.ssid_hidden= false; wifi_softap_set_config_current(&softapConf); wifi_softap_dhcps_start(); os_printf("Setup network is enabled./n/r"); board_statusLed2(1); }}
开发者ID:Duality4Y,项目名称:esp8266-firmware,代码行数:22,
示例30: user_init/****************************************************************************** * FunctionName : user_init * Description : entry of user application, init user function here * Parameters : none * Returns : none*******************************************************************************/void user_init(void){ printf("SDK version:%s/n", system_get_sdk_version()); memset(hilink_dev_mac, 0, 32); memset(hilink_dev_sn, 0, 32); char esp_mac_get[6] = {0}; wifi_get_macaddr(STATION_IF, esp_mac_get); sprintf(hilink_dev_mac, MACSTR, MAC2STR(esp_mac_get)); sprintf(hilink_dev_sn, SNSTR, MAC2STR(esp_mac_get)); dev_info_t product_aircon = { .sn = hilink_dev_sn, /**<设备唯一标识,比如sn号,长度范围(0,40]*/ .prodId = "9001", /**<设备HiLink认证号,长度范围(0,5]*/ .model = "airCondition", /**<设备型号,长度范围(0,32]*/ .dev_t = "012", /**<设备类型,长度范围(0,4]*/ .manu = "001", /**<设备制造商,长度范围(0,4]*/ .mac = hilink_dev_mac, /**<设备MAC地址,固定32字节*/ .hiv = "1.0", /**<设备Hilink协议版本,长度范围(0,32]*/ .fwv = "1.30", /**<设备固件版本,长度范围[0,64]*/ .hwv = "20000", /**<设备硬件版本,长度范围[0,64]*/ .swv = "1.0.3", /**<设备软件版本,长度范围[0,64] it's HILINK SDK version,now use hilink sdk 1.0.3*/ .prot_t = 1, /**<设备协议类型,取值范围[1,3]*/ }; /*init service info as huawei profile*/ svc_info_t svc_aircon[6] = { {"binarySwitch", "switch"}, {"airConditioner", "airConditioner"}, {"temperature", "temperature"}, {"wind", "wind"}, {"devOta", "devOta"}, {"faultDetection", "faultDetection"} }; hilink_init_device_info(&product_aircon, &svc_aircon, 6); hilink_esp_smtlink_main();}
开发者ID:FangDongbin,项目名称:esp8266-hilink,代码行数:45,
注:本文中的wifi_get_macaddr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wifi_get_opmode函数代码示例 C++ widthChanged函数代码示例 |