Skip to content

Commit

Permalink
Merge pull request #535 from doudar/ConfigApp
Browse files Browse the repository at this point in the history
Config app
  • Loading branch information
doudar authored Mar 16, 2024
2 parents e37747d + 3ad728f commit 6f72a14
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 238 deletions.
40 changes: 0 additions & 40 deletions .pre-commit-config.oldyaml

This file was deleted.

2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"iostream": "cpp",
"*.dontuse": "cpp"
},
"C_Cpp.errorSquiggles": "Disabled",
"cSpell.words": [
"Appender",
"Baranick",
Expand All @@ -83,5 +82,4 @@
"VERSIONFILE",
"WEBSERVER"
],
"cmake.configureOnOpen": true
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Many updates and bug fixes which enable the Config App to communicate with SmartSpin2k.
- Scanned devices no longer saved to filesystem. The new scanning method would keep snowballing them otherwise.
- increased MTU for android
- Updated WiFi connection setup.
- Firmware no longer updates if only the html files need to be loaded.

### Hardware
- added Yesoul S3
Expand Down
3 changes: 0 additions & 3 deletions CMakeLists.txt

This file was deleted.

30 changes: 0 additions & 30 deletions CPPLINT.cfg

This file was deleted.

107 changes: 33 additions & 74 deletions include/Version_Converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,86 +7,45 @@

#pragma once

#include <Arduino.h>

struct Version {
private:
// Define four member variables major, minor, revision and build.
// Here, we are saying it as version-tag
int major, minor, revision, build, commitCount;
char *branch, *commit;

public:
// Parameterized constructor. Pass string to it and it will
// extract version-tag from it.
//
// Use initializer list to assign version-tag variables
// Assign it by zero, otherwise std::scanf() will assign
// garbage value to the version-tag, if number of version-tag
// will be less than four.
explicit Version(const std::string& version) : major(0), minor(0), revision(0), build(0), commitCount(0), branch(const_cast<char*>("master")), commit(const_cast<char*>("")) {
if (sscanf(version.c_str(), "v%d.%d.%d.%d-%99s-%d-%99s", &major, &minor, &revision, &build, branch, &commitCount, commit) != 7) {
if (sscanf(version.c_str(), "v%d.%d.%d.%d", &major, &minor, &revision, &build) != 4) {
sscanf(version.c_str(), "%d.%d.%d.%d", &major, &minor, &revision, &build);
}
}

// version-tag must be >=0, if it is less than zero, then make it zero.
if (major < 0) major = 0;
if (minor < 0) minor = 0;
if (revision < 0) revision = 0;
if (build < 0) build = 0;
if (commitCount < 0) commitCount = 0;
}

// Overload greater than(>) operator to compare two version objects
bool operator>(const Version& other) {
// Start comparing version tag from left most.
// There are three relation between two number. It could be >, < or ==
// While comparing the version tag, if they are equal, then move to the
// next version-tag. If it could be greater then return true otherwise
// return false.
#pragma once

if (branch != other.branch) return false;
#include <string>
#include <sstream>

// Compare major version-tag
if (major > other.major)
return true;
else if (major < other.major)
return false;
class Version {
private:
int year, month, day;

// Compare moinor version-tag
// If control came here it means that above version-tag(s) are equal
if (minor > other.minor)
return true;
else if (minor < other.minor)
return false;
public:
// Parameterized constructor that extracts year, month, and day from the version string.
explicit Version(const std::string& versionStr) : year(0), month(0), day(0) {
std::istringstream versionStream(versionStr);
char dot; // Used to ignore the dots in the version string.

// Compare revision version-tag
// If control came here it means that above version-tag(s) are equal
if (revision > other.revision)
return true;
else if (revision < other.revision)
return false;
versionStream >> year >> dot >> month >> dot >> day;

// Compare build version-tag
// If control came here it means that above version-tag(s) are equal
if (build > other.build)
return true;
else if (build < other.build)
return false;
// Ensure all version components are non-negative.
if (year < 0) year = 0;
if (month < 0) month = 0;
if (day < 0) day = 0;
}

if (commitCount > other.commitCount)
return true;
else if (commitCount < other.commitCount)
return false;
// Overload the greater than (>) operator to compare two version objects.
bool operator>(const Version& other) const {
if (year != other.year)
return year > other.year;
if (month != other.month)
return month > other.month;
return day > other.day;
}

return false;
}
// Overload the equal to (==) operator to compare two version objects.
bool operator==(const Version& other) const {
return year == other.year && month == other.month && day == other.day;
}

// Overload equal to(==) operator to compare two version
bool operator==(const Version& other) {
return major == other.major && minor == other.minor && revision == other.revision && build == other.build && branch == other.branch && commitCount == other.commitCount &&
commit == other.commit;
}
// Overload the less than (<) operator for completeness (optional).
bool operator<(const Version& other) const {
return !(*this > other) && !(*this == other);
}
};
97 changes: 32 additions & 65 deletions include/cert.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,35 @@

#pragma once

const char* rootCACertificate =

/* DigiCert Assured ID Root CA
* ===========================*/
"-----BEGIN CERTIFICATE-----\n"
"MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG\n"
"EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw\n"
"IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx\n"
"MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL\n"
"ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew\n"
"ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO\n"
"9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy\n"
"UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW\n"
"/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy\n"
"oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ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EXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn\n"
"TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5\n"
"BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H\n"
"4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y\n"
"7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB\n"
"o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm\n"
"8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF\n"
"BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr\n"
"EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt\n"
"tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886\n"
"UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk\n"
"CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=\n"
"-----END CERTIFICATE-----\n"
/* DigiCert High Assurance EV Root CA
* ==================================*/
"-----BEGIN CERTIFICATE-----\n"
"MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG\n"
"EwJVUzEVMBMGA1UE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9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK\n"
"mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe\n"
"vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K\n"
"-----END CERTIFICATE-----\n";
// certificate for https://raw.githubusercontent.com
// DigiCert Global Root G2, valid until Sat Mar 29 2031, size: 1720 bytes
const char* rootCACertificate = \
"-----BEGIN CERTIFICATE-----\n" \
"MIIEyDCCA7CgAwIBAgIQDPW9BitWAvR6uFAsI8zwZjANBgkqhkiG9w0BAQsFADBh\n" \
"MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" \
"d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH\n" \
"MjAeFw0yMTAzMzAwMDAwMDBaFw0zMTAzMjkyMzU5NTlaMFkxCzAJBgNVBAYTAlVT\n" \
"MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxMzAxBgNVBAMTKkRpZ2lDZXJ0IEdsb2Jh\n" \
"bCBHMiBUTFMgUlNBIFNIQTI1NiAyMDIwIENBMTCCASIwDQYJKoZIhvcNAQEBBQAD\n" \
"ggEPADCCAQoCggEBAMz3EGJPprtjb+2QUlbFbSd7ehJWivH0+dbn4Y+9lavyYEEV\n" \
"cNsSAPonCrVXOFt9slGTcZUOakGUWzUb+nv6u8W+JDD+Vu/E832X4xT1FE3LpxDy\n" \
"FuqrIvAxIhFhaZAmunjZlx/jfWardUSVc8is/+9dCopZQ+GssjoP80j812s3wWPc\n" \
"3kbW20X+fSP9kOhRBx5Ro1/tSUZUfyyIxfQTnJcVPAPooTncaQwywa8WV0yUR0J8\n" \
"osicfebUTVSvQpmowQTCd5zWSOTOEe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J8HmA==\n" \
"-----END CERTIFICATE-----\n" \
"";
6 changes: 0 additions & 6 deletions src/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 6f72a14

Please sign in to comment.