-
-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from cyberman54/development
v1.4.35
- Loading branch information
Showing
31 changed files
with
1,075 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
.clang_complete | ||
.gcc-flags.json | ||
src/loraconf.h | ||
src/ota.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# build.py | ||
# pre-build script, setting up build environment | ||
|
||
import sys | ||
import os | ||
import os.path | ||
import requests | ||
from os.path import basename | ||
from platformio import util | ||
|
||
Import("env") | ||
|
||
# get platformio environment variables | ||
project_config = util.load_project_config() | ||
|
||
# check if file loraconf.h is present in source directory | ||
keyfile = str(env.get("PROJECTSRC_DIR")) + "/loraconf.h" | ||
if os.path.isfile(keyfile) and os.access(keyfile, os.R_OK): | ||
print "Parsing LORAWAN keys from " + keyfile | ||
else: | ||
sys.exit("Missing file loraconf.h, please create it using template loraconf.sample.h! Aborting.") | ||
|
||
# check if file ota.conf is present in source directory | ||
keyfile = str(env.get("PROJECTSRC_DIR")) + "/" + project_config.get("common", "keyfile") | ||
if os.path.isfile(keyfile) and os.access(keyfile, os.R_OK): | ||
print "Parsing OTA keys from " + keyfile | ||
else: | ||
sys.exit("Missing file ota.conf, please create it using template ota.sample.conf! Aborting.") | ||
|
||
# parse file ota.conf | ||
mykeys = {} | ||
with open(keyfile) as myfile: | ||
for line in myfile: | ||
key, value = line.partition("=")[::2] | ||
mykeys[key.strip()] = str(value).strip() | ||
|
||
# get bintray user credentials | ||
user = mykeys["BINTRAY_USER"] | ||
repository = mykeys["BINTRAY_REPO"] | ||
apitoken = mykeys["BINTRAY_API_TOKEN"] | ||
|
||
# get bintray upload parameters | ||
version = project_config.get("common", "release_version") | ||
package = str(env.get("PIOENV")) | ||
|
||
# put bintray user credentials to platformio environment | ||
env.Replace(BINTRAY_USER=user) | ||
env.Replace(BINTRAY_REPO=repository) | ||
env.Replace(BINTRAY_API_TOKEN=apitoken) | ||
|
||
# get runtime credentials and put them to compiler directive | ||
env.Replace(CPPDEFINES=[ | ||
('WIFI_SSID', '\\"' + mykeys["OTA_WIFI_SSID"] + '\\"'), | ||
('WIFI_PASS', '\\"' + mykeys["OTA_WIFI_PASS"] + '\\"'), | ||
('BINTRAY_USER', '\\"' + mykeys["BINTRAY_USER"] + '\\"'), | ||
('BINTRAY_REPO', '\\"' + mykeys["BINTRAY_REPO"] + '\\"'), | ||
]) | ||
|
||
# function for pushing new firmware to bintray storage using API | ||
def publish_bintray(source, target, env): | ||
firmware_path = str(source[0]) | ||
firmware_name = basename(firmware_path) | ||
url = "/".join([ | ||
"https://api.bintray.com", "content", | ||
user, repository, package, version, firmware_name | ||
]) | ||
|
||
print("Uploading {0} to Bintray. Version: {1}".format( | ||
firmware_name, version)) | ||
print(url) | ||
|
||
headers = { | ||
"Content-type": "application/octet-stream", | ||
"X-Bintray-Publish": "1", | ||
"X-Bintray-Override": "1" | ||
} | ||
|
||
r = requests.put( | ||
url, | ||
data=open(firmware_path, "rb"), | ||
headers=headers, | ||
auth=(user, apitoken)) | ||
|
||
if r.status_code != 201: | ||
print("Failed to submit package: {0}\n{1}".format( | ||
r.status_code, r.text)) | ||
else: | ||
print("The firmware has been successfuly published at Bintray.com!") | ||
|
||
# put build file name and upload command to platformio environment | ||
env.Replace( | ||
PROGNAME="firmware_" + package + "_v%s" % version, | ||
UPLOADCMD=publish_bintray | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "BintrayClient", | ||
"keywords": "bintray, ota, cdn, storage", | ||
"description": "A BintrayClient to connect to a JFrog Bintray.", | ||
"authors": [ | ||
{ | ||
"name": "PlatformIO", | ||
"url": "https://platformio.org/" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/platformio/platformio-examples" | ||
}, | ||
"export": { | ||
"include": "bintray-secure-ota/lib/BintrayClient" | ||
}, | ||
"dependencies": { | ||
"ArduinoJson": "^5.13.1" | ||
}, | ||
"version": "1.0.0", | ||
"frameworks": "arduino", | ||
"platforms": "espressif32" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
Parts of this file | ||
Copyright (c) 2014-present PlatformIO <contact@platformio.org> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
**/ | ||
|
||
#ifndef BINTRAY_CERTIFICATES_H | ||
#define BINTRAY_CERTIFICATES_H | ||
|
||
const char* BINTRAY_API_ROOT_CA = \ | ||
"-----BEGIN CERTIFICATE-----\n" | ||
"MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh\n" | ||
"MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRG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P6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF\n" | ||
"PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls\n" | ||
"YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk\n" | ||
"CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=\n" | ||
"-----END CERTIFICATE-----\n"; | ||
|
||
const char* BINTRAY_AKAMAI_ROOT_CA = \ | ||
"-----BEGIN CERTIFICATE-----\n"\ | ||
"MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh\n"\ | ||
"MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n"\ | ||
"d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD\n"\ | ||
"QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaME0xCzAJBgNVBAYTAlVT\n"\ | ||
"MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJzAlBgNVBAMTHkRpZ2lDZXJ0IFNIQTIg\n"\ | ||
"U2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n"\ | ||
"ANyuWJBNwcQwFZA1W248ghX1LFy949v/cUP6ZCWA1O4Yok3wZtAKc24RmDYXZK83\n"\ | ||
"nf36QYSvx6+M/hpzTc8zl5CilodTgyu5pnVILR1WN3vaMTIa16yrBvSqXUu3R0bd\n"\ | ||
"KpPDkC55gIDvEwRqFDu1m5K+wgdlTvza/P96rtxcflUxDOg5B6TXvi/TC2rSsd9f\n"\ | ||
"/ld0Uzs1gN2ujkSYs58O09rg1/RrKatEp0tYhG2SS4HD2nOLEpdIkARFdRrdNzGX\n"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