mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
compile native on OSX
This commit is contained in:
@@ -47,7 +47,7 @@ the LICENSE file.
|
|||||||
#include <mutex> // NOLINT [build/c++11]
|
#include <mutex> // NOLINT [build/c++11]
|
||||||
#define EMC_SEMAPHORE_TAKE() mtx.lock();
|
#define EMC_SEMAPHORE_TAKE() mtx.lock();
|
||||||
#define EMC_SEMAPHORE_GIVE() mtx.unlock();
|
#define EMC_SEMAPHORE_GIVE() mtx.unlock();
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32) || defined(__APPLE__)
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#define EMC_SEMAPHORE_TAKE()
|
#define EMC_SEMAPHORE_TAKE()
|
||||||
#define EMC_SEMAPHORE_GIVE()
|
#define EMC_SEMAPHORE_GIVE()
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ For a copy, see <https://opensource.org/licenses/MIT> or
|
|||||||
the LICENSE file.
|
the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__linux__) || defined(_WIN32)
|
|
||||||
|
|
||||||
#include "ClientPosixIPAddress.h"
|
#include "ClientPosixIPAddress.h"
|
||||||
|
|
||||||
IPAddress::IPAddress()
|
IPAddress::IPAddress()
|
||||||
@@ -28,5 +26,3 @@ IPAddress::IPAddress(uint32_t address)
|
|||||||
IPAddress::operator uint32_t() {
|
IPAddress::operator uint32_t() {
|
||||||
return _address;
|
return _address;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ espMqttClient::espMqttClient()
|
|||||||
, _client() {
|
, _client() {
|
||||||
_transport = &_client;
|
_transport = &_client;
|
||||||
}
|
}
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32) || defined(__APPLE__)
|
||||||
// Windows
|
// Windows
|
||||||
espMqttClient::espMqttClient()
|
espMqttClient::espMqttClient()
|
||||||
: MqttClientSetup(espMqttClientTypes::UseInternalTask::NO) {
|
: MqttClientSetup(espMqttClientTypes::UseInternalTask::NO) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class espMqttClient : public MqttClientSetup<espMqttClient> {
|
|||||||
protected:
|
protected:
|
||||||
espMqttClientInternals::ClientPosix _client;
|
espMqttClientInternals::ClientPosix _client;
|
||||||
};
|
};
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32) || defined(__APPLE__)
|
||||||
class espMqttClient : public MqttClientSetup<espMqttClient> {
|
class espMqttClient : public MqttClientSetup<espMqttClient> {
|
||||||
public:
|
public:
|
||||||
espMqttClient();
|
espMqttClient();
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ lib_ignore = Module EMS-ESP-Modules
|
|||||||
|
|
||||||
; unit tests
|
; unit tests
|
||||||
; pio run -e native-test -t exec
|
; pio run -e native-test -t exec
|
||||||
; works on Linux and Windows
|
; works on Linux, Windows, and MacOS
|
||||||
[env:native-test]
|
[env:native-test]
|
||||||
platform = native
|
platform = native
|
||||||
test_build_src = true
|
test_build_src = true
|
||||||
|
|||||||
@@ -532,7 +532,8 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
|
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
int8_t id = -1;
|
int8_t id = -1;
|
||||||
const char * cmd = Helpers::toLower(arguments[1]).c_str();
|
auto arg = Helpers::toLower(arguments[1]);
|
||||||
|
const char * cmd = arg.c_str(); // prevent loosing pointer after object destruction
|
||||||
uint8_t return_code = CommandRet::OK;
|
uint8_t return_code = CommandRet::OK;
|
||||||
JsonObject json = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
bool has_data = false;
|
bool has_data = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user