30 lines
593 B
C
30 lines
593 B
C
#ifndef NET_H
|
|
#define NET_H
|
|
|
|
// net.h
|
|
// Includes
|
|
#include <stdio.h>
|
|
#include "pico/stdlib.h"
|
|
#include "pico/cyw43_arch.h"
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
char ssid[32];
|
|
char password[64];
|
|
} net_creds_t;
|
|
|
|
typedef struct {
|
|
uint16_t port;
|
|
uint16_t maxClients;
|
|
void (*onConnect)(int clientId);
|
|
void (*onDisconnect)(int clientId);
|
|
void (*onData)(int clientId, const uint8_t* data, size_t len);
|
|
} net_server_t;
|
|
|
|
net_server_t* Net_Init(net_creds_t* creds);
|
|
bool Net_Listen(net_server_t* server);
|
|
void Net_Destroy(net_server_t* server);
|
|
|
|
#endif
|