Compare commits

...

2 commits

Author SHA1 Message Date
Angus Gratton
384cae324f access_point example: Print parts of station_info output to telnet client
See #51 for relevant discussions
2015-10-28 10:31:37 +11:00
Angus Gratton
83cb660915 Add prototypes for existing softap_xxx_station_info SDK functions 2015-10-28 10:30:40 +11:00
3 changed files with 43 additions and 3 deletions

View file

@ -81,8 +81,8 @@ struct sdk_g_ic_volatile_st {
void *_unknown180;
void *_unknown184;
struct station_info *station_info_head;
struct station_info *station_info_tail;
struct sdk_station_info *station_info_head;
struct sdk_station_info *station_info_tail;
uint32_t _unknown190;
uint32_t _unknown194;

View file

@ -10,6 +10,7 @@
#include <espressif/esp_common.h>
#include <espressif/sdk_private.h>
#include <sdk_internal.h>
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
@ -88,10 +89,36 @@ static void telnetTask(void *pvParameters)
netconn_write(client, buf, strlen(buf), NETCONN_COPY);
snprintf(buf, sizeof(buf), "Free heap %d bytes\r\n", (int)xPortGetFreeHeapSize());
netconn_write(client, buf, strlen(buf), NETCONN_COPY);
snprintf(buf, sizeof(buf), "Your address is %d.%d.%d.%d\r\n\r\n",
snprintf(buf, sizeof(buf), "Your address is %d.%d.%d.%d\n\n",
ip4_addr1(&client_addr), ip4_addr2(&client_addr),
ip4_addr3(&client_addr), ip4_addr4(&client_addr));
netconn_write(client, buf, strlen(buf), NETCONN_COPY);
snprintf(buf, sizeof(buf), "Structures head %p tail %p \n",
sdk_g_ic.v.station_info_head, sdk_g_ic.v.station_info_tail);
netconn_write(client, buf, strlen(buf), NETCONN_COPY);
if(sdk_g_ic.v.station_info_tail) {
snprintf(buf, sizeof(buf), "Tail BSSID %02x:%02x:%02x IP %d NEXT %p\n",
sdk_g_ic.v.station_info_tail->bssid[0],
sdk_g_ic.v.station_info_tail->bssid[1],
sdk_g_ic.v.station_info_tail->bssid[2],
ip4_addr1(&sdk_g_ic.v.station_info_tail->ip),
STAILQ_NEXT(sdk_g_ic.v.station_info_tail, next));
netconn_write(client, buf, strlen(buf), NETCONN_COPY);
}
struct sdk_station_info *station = sdk_wifi_softap_get_station_info();
while(station) {
snprintf(buf, sizeof(buf), "Client %02x:%02x:%02x:%02x:%02x:%02x IP %d.%d.%d.%d\n",
station->bssid[0], station->bssid[1], station->bssid[2],
station->bssid[3], station->bssid[4], station->bssid[5],
ip4_addr1(&station->ip), ip4_addr2(&station->ip),
ip4_addr3(&station->ip), ip4_addr4(&station->ip));
netconn_write(client, buf, strlen(buf), NETCONN_COPY);
station = STAILQ_NEXT(station, next);
}
netconn_delete(client);
}
}

View file

@ -6,6 +6,10 @@
#ifndef __ESP_SOFTAP_H__
#define __ESP_SOFTAP_H__
#include <stdint.h>
#include "lwip/ip_addr.h"
#include "espressif/queue.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -24,6 +28,15 @@ struct sdk_softap_config {
bool sdk_wifi_softap_get_config(struct sdk_softap_config *config);
bool sdk_wifi_softap_set_config(struct sdk_softap_config *config);
struct sdk_station_info {
STAILQ_ENTRY(sdk_station_info) next;
uint8_t bssid[6];
struct ip_addr ip;
};
struct sdk_station_info* sdk_wifi_softap_get_station_info();
bool sdk_wifi_softap_free_station_info();
#ifdef __cplusplus
}
#endif