Skip to content

Commit

Permalink
format lib, add makedir, change dir, delete and list
Browse files Browse the repository at this point in the history
  • Loading branch information
ldab committed Jul 12, 2019
1 parent b5cd8d4 commit 84f4ab4
Show file tree
Hide file tree
Showing 11 changed files with 3,516 additions and 74 deletions.
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# PlatformIO
.pio
.pioenvs
.piolibdeps
.vscode
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < https://docs.platformio.org/page/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < https://docs.platformio.org/page/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
#

language: python
python:
- "2.7"

sudo: false
cache:
directories:
- "~/.platformio"

env:
- PLATFORMIO_CI_SRC=examples/upload_image/upload_image.ino

install:
- pip install -U platformio
- platformio update

script:
- platformio ci --lib="." --board=esp32cam
47 changes: 0 additions & 47 deletions ESP32_FTPClient.ino

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 colakugel
Copyright (c) 2019 ldab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# FTP Client for the ESP32
An FTP-Client for the ESP32

At the moment it is only possible to upload data via FTP, because
this was my main usecase.
I used this client to write sensordata into a log file and to upload
images for my rabbit-webcam.
A FTP-Client for the ESP32

You can create files or append data to files on your FTP-Server.
[![GitHub version](https://img.shields.io/github/release/ldab/ESP32_FTPClient.svg)](https://github.com/ldab/ESP32_FTPClient/releases/latest)
[![Build Status](https://travis-ci.org/ldab/ESP32_FTPClient.svg?branch=master)](https://travis-ci.org/ldab/ESP32_FTPClient)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/ldab/ESP32_FTPClient/blob/master/LICENSE)

[![GitHub last commit](https://img.shields.io/github/last-commit/ldab/ESP32_FTPClient.svg?style=social)](https://github.com/ldab/ESP32_FTPClient)

* The main purpose of this library was to upload pictures from ESP32-CAM to a website making the picture available on a http url, as seen here [https://github.com/ldab/ESP32-CAM-Picture-Sharing](https://github.com/ldab/ESP32-CAM-Picture-Sharing), making it usuable on `Blynk` or on your webiste.

## TODO

[ ] - List Dir contents test with different serves;
[ ] - Implement download;

* For the uploading example we will use the GitHub Octocat, which binary file is [here](./src/octocat.h):
![GitHub Octocat](https://github.githubassets.com/images/modules/logos_page/Octocat.png)

* Originally forked from [https://github.com/blackcodetavern/ESP32_FTPClient](https://github.com/blackcodetavern/ESP32_FTPClient)
75 changes: 75 additions & 0 deletions examples/upload_image/upload_image.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/******************************************************************************
ESP32-CAM remote image access via FTP. Take pictures with ESP32 and upload it via FTP making it accessible for the outisde network.
Leonardo Bispo
July - 2019
https://github.com/ldab/ESP32_FTPClient
Distributed as-is; no warranty is given.
******************************************************************************/

#include <WiFi.h>
#include <WiFiClient.h>
#include <ESP32_FTPClient.h>
#include "octocat.h"

#define WIFI_SSID ""
#define WIFI_PASS ""

char ftp_server[] = "ftp.drivehq.com";
char ftp_user[] = "";
char ftp_pass[] = "";

ESP32_FTPClient ftp (ftp_server,ftp_user,ftp_pass);

void setup()
{
Serial.begin( 115200 );

WiFi.begin( WIFI_SSID, WIFI_PASS );

Serial.println("Connecting Wifi...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

ftp.OpenConnection();

// Get directory contentx
ftp.InitFile("Type A");
char list[256];
ftp.ContentList("/My Pictures/", list);
Serial.print("\nDirectory info: ");
Serial.println(list);
ftp.CloseFile();

// Make a new directory
ftp.InitFile("Type A");
ftp.MakeDir("/jagua");
ftp.CloseFile();

// Create the new file and send the image
ftp.InitFile("Type A");
ftp.ChangeWorkDir("/wwwhome/images");
ftp.NewFile("octocat.png");
ftp.WriteData( octocat_pic, sizeof(octocat_pic) );
ftp.CloseFile();

// Create the file new and write a string into it
ftp.InitFile("Type A");
ftp.NewFile("hello_world.txt");
ftp.Write("Hello World");
ftp.CloseFile();

ftp.CloseConnection();
}

void loop()
{

}
27 changes: 27 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "esp32_ftpclient",
"version": "0.0.1",
"description": "A FTP-Client for the ESP32",
"keywords": "sensors, low power, mobile, ftp, web, cloud, iot, esp32, espressif",
"authors":
{
"name": "Leonardo Bispo",
"url": "https://github.com/ldab",
"maintainer": true
},
"repository":
{
"type": "git",
"url": "https://github.com/ldab/ESP32_FTPClient.git"
},
"homepage": "https://github.com/ldab/ESP32_FTPClient",
"export": {
"exclude": [
"linux",
"extras"
]
},
"frameworks": "arduino",
"platforms": "espressif32",
"examples": "examples/*/*.ino"
}
30 changes: 30 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
env_default = esp32
src_dir = ./examples/upload_image
lib_dir = ./

[env:esp32]
platform = [email protected]
board = esp32cam
framework = arduino

monitor_speed = 115200

board_build.f_cpu = 240000000L

#board_build.partitions = partitions_custom.csv

#upload_port = COM36

lib_deps =
octocat
Loading

0 comments on commit 84f4ab4

Please sign in to comment.