Por WIFI-DIrect quieres decir (no se porque hablas de simular) que dos dispositivos se comuniquen Peer to Peer.
He visto un ejemplo con nodemcu que lo hace.
Ya lo busco y te lo paso.
Para sorpresa hay un ejemplo en ambiente Arduino.
Peer to Peer communications
Not only can the ESP8266 connect to a WiFi network and interact with the Internet, but it can also set up a network of its own, allowing other devices to connect directly to it. This example demonstrates how to turn the ESP8266 into an access point (AP) also called a server, and serve up data to any connected client also called a station.
Server (Access Point) First we will look at the server:
/* Server
* We write the server first because we need its IP address
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
const char* ssid = "Meyer"; // ssid of server (Access Point (AP))
const char* password = ""; // password of server (Access Point (AP))
WiFiServer server(80); //Service Port
int ledPin = 2; // GPIO2 of Server ESP8266
void setup()
{
delay(1000);
Serial.begin(115200); // to use tools->serial monitor
pinMode(ledPin, OUTPUT); // set GPIO 2 as an output
WiFi.mode(WIFI_AP_STA); // Set WiFi to AP and station mode
// Connect to the WiFi network
Serial.println();
Serial.print("Connecting to: "); Serial.println(ssid);
WiFi.softAP(ssid, password);
// Display the server address
Serial.print("Connected, My address: ");
Serial.print("http://");
Serial.print(WiFi.softAPIP());
Serial.println("/");
// Tell the server to begin listening for incoming connections
server.begin();
Serial.println("Server listening for incoming connections");
}
void loop()
{
// Check if a client has connected
WiFiClient client = server.available();
if (!client) // if not available, return
{
return;
}
// Wait until the client sends some data
Serial.println();
Serial.println("Client connected");
while(!client.available())
{
delay(1);
}
// Read the request
String request = client.readStringUntil('\r');
Serial.print("Request = "); Serial.println(request);
if (request.indexOf("/ON/") != -1)
{
digitalWrite(ledPin, LOW); // turn LED on
}
if (request.indexOf("/OFF/") != -1)
{
digitalWrite(ledPin, HIGH); // turn LED off
}
client.flush();
Serial.println("Client disconnected");
}
Client (Station) Next we will look at the client:
Estacion Cliente. Aca vemos el cliente:
/* Client
* This client will turn the LED on or off every 5 seconds
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
const char* ssid = "Meyer"; // ssid of access point (Server)
const char* password = ""; // password of access point (Server)
int port = 80; // port number
byte ip[]= {192,168,4,1};
int LEDstatus = 0;
WiFiClient client; // Declare client
void setup()
{
Serial.begin(115200);
delay(10);
WiFi.mode(WIFI_STA); // set mode to station (client)
// Connect to wiFi
Serial.println(); Serial.println();
Serial.println("CONNECTING TO WiFi");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print("."); // print dots until connection
}
Serial.println();
Serial.println("WiFi CONNECTED");
}
void loop()
{
// Connect client to server
Serial.println("CONNECTING CLIENT TO SERVER");
if (client.connect(ip, port))
{
Serial.println("CONNECTED");
}
else
{
Serial.println("CONNECTION FAILED");
}
// Send message to control the LED
if (LEDstatus == 0)
{
client.println("/OFF/");
Serial.println("LED OFF");
LEDstatus = 1;
}
else
{
client.println("/ON/");
Serial.println("LED ON");
LEDstatus = 0;
}
client.println();
client.flush();
delay(1);
Serial.println("CLIENT DISCONNECTED");
Serial.println();
delay(5000); // delay 5 seconds
}
Bueno evidentemente desde que lo vi hasta hoy se ha trabajado mucho y encuentro muchos ejemplos de esto mismo en ambiente Arduino.
ARDUINO WIFI MODULE ESP8266 NODEMCU TUTORIAL | WIRELESS MESSAGINGl