Skip to content

jsebgiraldo/ESP32-SMB-API

Repository files navigation


SMB Client ESP32

Server Message Block in ShareFolder!
View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact

About The Project

This project demonstrates the use of the SMB protocol to extract information from a shared folder on the network using the Windows or Linux OS

The main functions of this demo are the use of OTA via SMB, performing "ls" and "cat" functions, and the possibility to extract a file from the share folder and place it in a SPIFFS partition inside the ESP32.

(back to top)

How to Use Example

Hardware Required

This example can be executed on any ESP32 board, the only required interface is WiFi and connection to internet or a local server.

Build and Flash

This section the main frameworks and components used in the repository are listed.

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

(back to top)

Getting Started

This demo shows how to use the SMB service to read, upload data to local memory and perform the OTA function via a shared folder.

Prerequisites

Make sure you have an SMB server configured on any operating system. Here is a guide for windwos 10.

Usage

Through an STA enters the server's AP.

These are the default settings of the wifi network, they are located in the file main/APIs/WIFI_API/wifi_app.h line 18-32

// WiFi application settings
#define WIFI_AP_SSID				"smb_api"			// AP name
#define WIFI_AP_PASSWORD			"123456789"			// AP password
#define WIFI_AP_CHANNEL				1					// AP channel
#define WIFI_AP_SSID_HIDDEN			0					// AP visibility
#define WIFI_AP_MAX_CONNECTIONS			5					// AP max clients
#define WIFI_AP_BEACON_INTERVAL			100					// AP beacon: 100 milliseconds recommended
#define WIFI_AP_IP				"192.168.5.1"		// AP default IP
#define WIFI_AP_GATEWAY				"192.168.5.1"		// AP default Gateway (should be the same as the IP)
#define WIFI_AP_NETMASK				"255.255.255.0"		// AP netmask
#define WIFI_AP_BANDWIDTH			WIFI_BW_HT20		// AP bandwidth 20 MHz (40 MHz is the other option)
#define WIFI_STA_POWER_SAVE			WIFI_PS_NONE		// Power save not used
#define MAX_SSID_LENGTH				32					// IEEE standard maximum
#define MAX_PASSWORD_LENGTH			64					// IEEE standard maximum
#define MAX_CONNECTION_RETRIES			5					// Retry number on disconnect

Once the code is running, enter the AP generated by the ESP, in order to access the end points via HTTP.

This demo has 3 html pages,

  • Index page: this page provides the OTA functionality via HTTP and a form to connect the ESP to an STA.
// register index.html handler
httpd_uri_t index_html = {
		.uri = "/",
		.method = HTTP_GET,
		.handler = http_server_index_html_handler,
		.user_ctx = NULL
};
httpd_register_uri_handler(http_server_handle, &index_html);

index

  • SMB Dashboard: This page has a form for using the SMB API.
// register smb.html handler
httpd_uri_t smb_html = {
    .uri = "/smb",
    .method = HTTP_GET,
    .handler = http_server_smb_html_handler,
    .user_ctx = NULL
};
httpd_register_uri_handler(http_server_handle, &smb_html);

smb

  • File Server: This page provides all the tools to manage the SPIFFS partition contained in the ESP
// register wifiConnectInfo.json handler
httpd_uri_t spiffs_view = {
    .uri = "/spiffs/",
    .method = HTTP_GET,
    .handler = view_get_handler,
    .user_ctx = server_data
};
httpd_register_uri_handler(http_server_handle, &spiffs_view);

spiffs

(back to top)

Contact

Juan Sebastian Giraldo Duque - jsgiraldod@hotmail.com

Linkedin contact: https://www.linkedin.com/in/juan-sebastian-giraldo-duque-25301718b/

Project Link: https://github.com/jsebgiraldo/ESP32-SMB-API/tree/main

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published