Skip to content

Commit

Permalink
Merge pull request #6 from mathieucarbou/pr/A76xx
Browse files Browse the repository at this point in the history
A76xx: Rewrote https_post_file
  • Loading branch information
lewisxhe authored Mar 18, 2024
2 parents 41c0d0a + 6e05aef commit b3ee8dc
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 21 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/build_examples_platformio.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build Examples with PlatformIO

# Triggers the workflow on push or pull request events
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down Expand Up @@ -34,14 +38,20 @@ jobs:
TINY_GSM_MODEM_SIM7000,
TINY_GSM_MODEM_SIM7000SSL,
TINY_GSM_MODEM_SIM7070,
TINY_GSM_MODEM_A7670,
TINY_GSM_MODEM_UBLOX,
TINY_GSM_MODEM_SARAR4,
TINY_GSM_MODEM_XBEE,
TINY_GSM_MODEM_SEQUANS_MONARCH,
# added in this fork
TINY_GSM_MODEM_A7608,
TINY_GSM_MODEM_A7670,
TINY_GSM_MODEM_SIM7020,
TINY_GSM_MODEM_SIM7672
]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set variables
run: |
Expand All @@ -54,7 +64,7 @@ jobs:
fi
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand All @@ -65,7 +75,7 @@ jobs:
pip install --upgrade platformio
- name: Restore or Cache Platforms and Libraries
uses: actions/cache@v3.3.1
uses: actions/cache@v4
id: cache_pio
with:
path: ~/.platformio
Expand All @@ -87,5 +97,5 @@ jobs:
echo "${{ env.LIBRARY_INSTALL_SOURCE }}"
pio lib --global install ${{ env.LIBRARY_INSTALL_SOURCE }}
sed -i 's/\/\/ #define TINY_GSM_MODEM_SIM800/#define TINY_GSM_MODEM_SIM800/g' ${{ matrix.example }}/*
platformio ci --project-option='build_flags=-D ${{ env.TINYGSM_MODEM_TO_USE }}' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev
platformio ci --project-option='build_flags=-D ${{ env.TINYGSM_MODEM_TO_USE }}' --project-option='framework=arduino' --board=esp32dev --board=esp32s3box
pio lib --global uninstall TinyGSM
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
.pio/*
.clang_complete
.gcc-flags.json
platformio.ini
extra_envs.ini
lib/readme.txt
include/readme.txt
Expand Down
6 changes: 4 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"examples/*"
]
},
"frameworks": ["arduino", "energia", "wiringpi"],
"platforms": "*",
"frameworks": "arduino",
"platforms": [
"espressif32"
],
"headers": "TinyGsmClient.h"
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ sentence=A small Arduino library for GPRS modules, that just works.
paragraph=Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.
category=Communication
url=https://github.com/vshymanskyy/TinyGSM
architectures=*
architectures=esp32
includes=TinyGsmClient.h
26 changes: 26 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

[platformio]
lib_dir = .
src_dir = tools/test_build

[env]
framework = arduino
upload_protocol = esptool
monitor_speed = 115200
monitor_filters = esp32_exception_decoder, log2file
build_flags =
-Wall -Wextra -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference
; -D TINY_GSM_MODEM_SIM7000
; -D TINY_GSM_MODEM_SIM7020
; -D TINY_GSM_MODEM_SIM7600
; -D TINY_GSM_MODEM_A7608
-D TINY_GSM_MODEM_A7670
; -D TINY_GSM_MODEM_SIM7672

[env:esp32dev]
platform = espressif32
board = esp32dev

[env:esp32s3box]
platform = espressif32
board = esp32s3box
1 change: 1 addition & 0 deletions src/TinyGsmClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef TinyGsmSim7000::GsmClientSim7000 TinyGsmClient;
#include "TinyGsmClientSIM7020.h"
typedef TinyGsmSim7020 TinyGsm;
typedef TinyGsmSim7020::GsmClientSim7020 TinyGsmClient;
typedef TinyGsmSim7020::GsmClientSecureSim7020 TinyGsmClientSecure;

#elif defined(TINY_GSM_MODEM_SIM7000SSL)
#include "TinyGsmClientSIM7000SSL.h"
Expand Down
2 changes: 1 addition & 1 deletion src/TinyGsmClientA7670.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ class TinyGsmA7670 : public TinyGsmModem<TinyGsmA7670>,
waitResponse();
}
sendAT(GF("+CGNSSPWR=1"));
if (waitResponse(10000UL,"+CGNSSPWR: READY!") != 1) { return false; }
if (waitResponse(10000UL, GF("+CGNSSPWR: READY!")) != 1) { return false; }
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/TinyGsmClientSIM7600.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
}
sendAT(GF("+CGPS=0"));
if (waitResponse() != 1) { return false; }
return waitResponse(30000UL,"+CGPS: 0") == 1;
return waitResponse(30000UL,GF("+CGPS: 0")) == 1;
}

bool isEnableGPSImpl(){
Expand Down
14 changes: 6 additions & 8 deletions src/TinyGsmHttpsA76xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,19 @@ class TinyGsmHttpsA76xx
/**
* @brief POSTFile
* @note Send file to server
* @param *filepath:File path and file name, full path required
* @param *filepath:File path and file name, full path required. C:/file for local storage and D:/file for SD card
* @param method: 0 = GET 1 = POST 2 = HEAD 3 = DELETE
* @param sendFileAsBody: 0 = Send file as HTTP header and body , 1 = Send file as Body
* @retval httpCode, -1 = failed
*/
int https_post_file(const char *filepath, uint8_t method = 1, bool sendFileAsBody = 1)
{
// A76XX Series_AT Command Manual_V1.09, Page 363
// AT+HTTPPOSTFILE=<filename>[,<path>[,<method>[,<send_header>]]]
uint8_t path = 1;
if (!filepath)return -1;
if (&filepath[3] == NULL)return -1;
if (filepath[0] == 'd' || filepath[0] == 'D') {
path = 2;
}
thisModem().sendAT("+HTTPPOSTFILE=\"", &filepath[3], "\",", path, ',', method, ',', sendFileAsBody);
// filename: full path required. C:/file for local storage and D:/file for SD card
if (!filepath || strlen(filepath) < 4) return -1; // no file
uint8_t path = filepath[0] == 'd' || filepath[0] == 'D' ? 2 : 1; // storage (2 for SD or 1 for local)
thisModem().sendAT("+HTTPPOSTFILE=\"", filepath[3], "\",", path, ',', method, ',', sendFileAsBody);
if (thisModem().waitResponse(120000UL) != 1) {
return -1;
}
Expand Down
5 changes: 3 additions & 2 deletions tools/test_build/test_build.ino
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ void loop() {
int hour = 0;
int minute = 0;
int second = 0;
modem.getGPS(&latitude, &longitude);
modem.getGPS(&latitude, &longitude, &speed, &alt, &vsat, &usat, &acc, &year,
uint8_t status = 0;
modem.getGPS(&status, &latitude, &longitude);
modem.getGPS(&status, &latitude, &longitude, &speed, &alt, &vsat, &usat, &acc, &year,
&month, &day, &hour, &minute, &second);
modem.disableGPS();
#endif
Expand Down

0 comments on commit b3ee8dc

Please sign in to comment.