Compare commits
10 Commits
a5805aceb2
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 598f1262d7 | |||
| 889523f0c8 | |||
| 8f0dbd4cbd | |||
| 9ebbedb04a | |||
| 04a8904cbe | |||
| 810264aa71 | |||
| 171a48eb71 | |||
| c13310d540 | |||
| 4e94d7ad78 | |||
| 500641a6e2 |
Vendored
+30
@@ -0,0 +1,30 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "GCC 14.3.0 x86_64-linux-gnu",
|
||||||
|
"compilers": {
|
||||||
|
"C": "/usr/bin/gcc-14",
|
||||||
|
"CXX": "/usr/bin/g++-14"
|
||||||
|
},
|
||||||
|
"isTrusted": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Host GCC",
|
||||||
|
"description": "GCC 15.2.0 x86_64-linux-gnu",
|
||||||
|
"compilers": {
|
||||||
|
"C": "/usr/bin/gcc",
|
||||||
|
"CXX": "/usr/bin/g++"
|
||||||
|
},
|
||||||
|
"cmakeSettings": {
|
||||||
|
"TgtEnv": "Host"
|
||||||
|
},
|
||||||
|
"isTrusted": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Esp32 Tests",
|
||||||
|
"environmentSetupScript": "/home/gustice/esp/v5.4.1/esp-idf/export.sh",
|
||||||
|
"cmakeSettings": {
|
||||||
|
"TgtEnv": "Target"
|
||||||
|
},
|
||||||
|
"isTrusted": true
|
||||||
|
}
|
||||||
|
]
|
||||||
Vendored
+33
@@ -10,6 +10,39 @@
|
|||||||
"type": "espidf",
|
"type": "espidf",
|
||||||
"name": "Launch",
|
"name": "Launch",
|
||||||
"request": "launch"
|
"request": "launch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "C/C++: g++.exe debug selected file",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
// "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
||||||
|
"program": "${workspaceFolder}/test/unitOnHost/build/watchFace/watchFaceTest.exe",
|
||||||
|
// "program": "${workspaceFolder}/core/test/unitOnHost/build/devHal/devHalTest.exe",
|
||||||
|
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${fileDirname}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"existing": false,
|
||||||
|
// "preLaunchTask": "C/C++: g++.exe build active file",
|
||||||
|
"detail": "preLaunchTask: C/C++: g++.exe build active file",
|
||||||
|
"taskDetail": "compiler: C:\\msys64\\ucrt64\\bin\\g++.exe",
|
||||||
|
"taskStatus": "Detected Task"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+22
-1
@@ -15,5 +15,26 @@
|
|||||||
"idf.toolsPathWin": "C:\\Tools\\ESP",
|
"idf.toolsPathWin": "C:\\Tools\\ESP",
|
||||||
"idf.flashType": "UART",
|
"idf.flashType": "UART",
|
||||||
"C_Cpp.autoAddFileAssociations": false,
|
"C_Cpp.autoAddFileAssociations": false,
|
||||||
"project.deviceIp": "172.16.17.56"
|
"project.deviceIp": "172.16.17.56",
|
||||||
|
"sonarlint.pathToCompileCommands": "${workspaceFolder}\\build\\compile_commands.json",
|
||||||
|
"idf.port": "/dev/ttyACM0",
|
||||||
|
"cmake.showSystemKits": false,
|
||||||
|
"cmake.defaultVariants": {
|
||||||
|
"buildType": {
|
||||||
|
"default": "debug",
|
||||||
|
"description": "The build type.",
|
||||||
|
"choices": {
|
||||||
|
"debug": {
|
||||||
|
"short": "Debug",
|
||||||
|
"long": "Disable optimizations - include debug information.",
|
||||||
|
"buildType": "Debug"
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"short": "Release",
|
||||||
|
"long": "Optimize for speed - exclude debug information.",
|
||||||
|
"buildType": "Release"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-7
@@ -1,9 +1,17 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
set(EXTRA_COMPONENT_DIRS
|
if(TgtEnv STREQUAL "Host")
|
||||||
"core/components"
|
message("Using Host-Branch")
|
||||||
"core/managed_components"
|
add_subdirectory("test/unitOnHost")
|
||||||
)
|
elseif(TgtEnv STREQUAL "Target")
|
||||||
|
# add_subdirectory("test/unitOnTarget")
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
add_subdirectory("core/test/unitOnTarget")
|
||||||
project(X_WatchController_FW)
|
else()
|
||||||
|
message("Using ESP-Branch")
|
||||||
|
set(EXTRA_COMPONENT_DIRS
|
||||||
|
"core/components"
|
||||||
|
"core/managed_components"
|
||||||
|
)
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(X_WatchController_FW)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
idf_component_register(
|
||||||
|
SRC_DIRS "src" "src/esp"
|
||||||
|
INCLUDE_DIRS "include"
|
||||||
|
REQUIRES esp_system esp_netif freeRtosApi
|
||||||
|
)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# SPIT
|
||||||
|
|
||||||
|
Original implementation from Hag seem to be not suited for Embedded devices.
|
||||||
|
|
||||||
|
- Supports IPv4 only
|
||||||
|
- Reduced Threads to a minimum
|
||||||
|
- Then reduced usage of Mutexes to a minimum
|
||||||
|
- Reduced Sockets to a minimum
|
||||||
|
- Introduced containers and removed plain new and delete
|
||||||
|
- Removed UUID-Generation because SPIT-Types never change on embedded devices
|
||||||
|
- Callbacks instead of interfaces where suitable
|
||||||
Binary file not shown.
@@ -0,0 +1,150 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class SAD_DetectedServer;
|
||||||
|
class I_SAD_Client {
|
||||||
|
public:
|
||||||
|
virtual void eventServerDetected(SAD_DetectedServer &server) = 0;
|
||||||
|
virtual void eventServerChanged(SAD_DetectedServer &server) = 0;
|
||||||
|
virtual void eventServerLost(SAD_DetectedServer &server) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SAD_DetectedServer {
|
||||||
|
public:
|
||||||
|
SAD_DetectedServer(string p_Name, string p_ID, string p_ComputerName,
|
||||||
|
string p_IP, string p_Port, string p_ClientIP,
|
||||||
|
string p_Additions, string projName)
|
||||||
|
: m_Name(p_Name),
|
||||||
|
m_ID(p_ID),
|
||||||
|
m_ComputerName(p_ComputerName),
|
||||||
|
m_IP(p_IP),
|
||||||
|
m_Port(p_Port),
|
||||||
|
m_ClientIP(p_ClientIP),
|
||||||
|
m_Additions(p_Additions),
|
||||||
|
m_ServerProjectName(projName) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_Name{};
|
||||||
|
string m_ID{};
|
||||||
|
string m_ComputerName{};
|
||||||
|
string m_IP{};
|
||||||
|
string m_Port{};
|
||||||
|
string m_ClientIP{};
|
||||||
|
string m_Additions{};
|
||||||
|
string m_ServerProjectName{};
|
||||||
|
bool m_New{true};
|
||||||
|
bool m_Changed{};
|
||||||
|
bool m_FoundAgain{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
string getID() const { return m_ID; }
|
||||||
|
string getName() const { return m_Name; }
|
||||||
|
string getComputerName() const { return m_ComputerName; }
|
||||||
|
string getIP() const { return m_IP; }
|
||||||
|
string getPort() const { return m_Port; }
|
||||||
|
string getClientIP() const { return m_ClientIP; }
|
||||||
|
string getAdditions() const { return m_Additions; }
|
||||||
|
string getProjectName() const { return m_ServerProjectName; }
|
||||||
|
bool getNew() const { return m_New; }
|
||||||
|
bool getChanged() const { return m_Changed; }
|
||||||
|
bool getFoundAgain() const { return m_FoundAgain; }
|
||||||
|
|
||||||
|
void setChanged() { m_Changed = true; }
|
||||||
|
void setKnown() { m_New = false; }
|
||||||
|
void setFoundAgain() { m_FoundAgain = true; }
|
||||||
|
void updateProjectName(string newProjectName) {
|
||||||
|
m_ServerProjectName = newProjectName;
|
||||||
|
if (m_ServerProjectName != newProjectName) {
|
||||||
|
m_Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SAD_Client m_ThreadSend will send to Multicast addresses
|
||||||
|
void resetFlags() {
|
||||||
|
m_Changed = false;
|
||||||
|
m_FoundAgain = false;
|
||||||
|
m_New = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static unordered_map<string, unique_ptr<SAD_DetectedServer>> sKnownServers;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static constexpr int PARAMINDEX_PRECODE = 0;
|
||||||
|
static constexpr int PARAMINDEX_SPITTASKID = 1;
|
||||||
|
static constexpr int PARAMINDEX_NAME = 2;
|
||||||
|
static constexpr int PARAMINDEX_ID = 3;
|
||||||
|
static constexpr int PARAMINDEX_COMPUTERNAME = 4;
|
||||||
|
static constexpr int PARAMINDEX_PORT = 5;
|
||||||
|
static constexpr int PARAMINDEX_CLIENTIP = 6;
|
||||||
|
static constexpr int PARAMINDEX_ADDITIONS = 7;
|
||||||
|
static constexpr int PARAMINDEX_SERVERPROJECTNAME = 8;
|
||||||
|
static constexpr int PARAMINDEX_IP = 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by SAD_Client to add a found SPITServer - don't use this manually
|
||||||
|
* @param id the id of the server, every instance of a SPITServer has an own id
|
||||||
|
* @param p_ServerParams the server's parameter
|
||||||
|
*/
|
||||||
|
static void addDetectedServer(unique_ptr<SAD_DetectedServer> detected) {
|
||||||
|
if (auto i = sKnownServers.find(detected->getID()); i != sKnownServers.end()) {
|
||||||
|
auto &known = *(i->second.get());
|
||||||
|
known.setFoundAgain();
|
||||||
|
if (detected->getProjectName() != known.getProjectName()) {
|
||||||
|
known.updateProjectName(detected->getProjectName());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sKnownServers[detected->getID()] = move(detected);
|
||||||
|
}
|
||||||
|
static void removeDetectedServer(SAD_DetectedServer &server) {
|
||||||
|
auto i = sKnownServers.find(server.getID());
|
||||||
|
if (i != sKnownServers.end()) {
|
||||||
|
sKnownServers.erase(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void clearDetectedServers() {
|
||||||
|
sKnownServers.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void resetServerFlags() {
|
||||||
|
for (auto &srv : sKnownServers) {
|
||||||
|
srv.second->resetFlags();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Used by SAD_Client internally -don't use this manually
|
||||||
|
* @param p_SADClientInterface
|
||||||
|
*/
|
||||||
|
static void evaluateDetectedServers(I_SAD_Client &sadClient) {
|
||||||
|
for (auto &srv : sKnownServers) {
|
||||||
|
SAD_DetectedServer &known = *srv.second;
|
||||||
|
if (known.getNew()) {
|
||||||
|
known.setKnown();
|
||||||
|
sadClient.eventServerDetected(known);
|
||||||
|
} else if (known.getChanged()) {
|
||||||
|
sadClient.eventServerChanged(known);
|
||||||
|
} else if (known.getFoundAgain() == false) {
|
||||||
|
sadClient.eventServerLost(known);
|
||||||
|
removeDetectedServer(known);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a reference of the DetectedServer with the id p_ServerID.<br>
|
||||||
|
* If no DetectedServer is found an eyception is thrown.
|
||||||
|
* @param p_ServerID the id of the SPITServer
|
||||||
|
* @return the reference of the SAD_DetectedServer instance with getID() == p_ServerID
|
||||||
|
*/
|
||||||
|
static const SAD_DetectedServer &getRefDetectedServer(const string &id) {
|
||||||
|
return *sKnownServers.at(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: SPITObject.h
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 9. April 2019, 12:11
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPITOBJECT_H
|
||||||
|
#define SPITOBJECT_H
|
||||||
|
|
||||||
|
#include "SPITType.h"
|
||||||
|
#include "SPIT_Message.h"
|
||||||
|
#include "SpitRepo.hpp"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class SPITObjectListener;
|
||||||
|
|
||||||
|
class SPITObject {
|
||||||
|
public:
|
||||||
|
static void clearUnconfirmedSPITObjects(SpitRepo<SPITObject> &repo);
|
||||||
|
static void setConfirmedFalse(SpitRepo<SPITObject> &repo);
|
||||||
|
static void eventProjectClosed(SpitRepo<SPITObject> &repo, SpitRepo<SPITObject> &remoteRepo);
|
||||||
|
|
||||||
|
SPITObject(string p_ID);
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ID;
|
||||||
|
string m_Name{};
|
||||||
|
string m_SPITTypeID{};
|
||||||
|
string m_ServerParams{};
|
||||||
|
string m_Remark{};
|
||||||
|
bool m_Confirmed{};
|
||||||
|
bool m_Fixed{};
|
||||||
|
bool m_CreatedByClient{};
|
||||||
|
bool m_ServerRemote{};
|
||||||
|
bool m_ActionAssigned{};
|
||||||
|
bool m_ActionAssignedType{}; // Virtual construct
|
||||||
|
long long m_FrameStart{};
|
||||||
|
long long m_FrameLength{};
|
||||||
|
long long m_FrameFadeInLength{};
|
||||||
|
long long m_FrameFadeOutLength{};
|
||||||
|
char m_ValueUse{0x01};
|
||||||
|
int m_ValueFactor{1000000}; // Values are given in ppm -> 1000000 = 1/1;
|
||||||
|
int m_Track{};
|
||||||
|
long long m_Delay{};
|
||||||
|
long long m_Duration{};
|
||||||
|
|
||||||
|
bool m_PlayPrePosition;
|
||||||
|
long long m_PlayTimeInsideFrames;
|
||||||
|
int m_PlayValue;
|
||||||
|
char m_PlayValueFlag;
|
||||||
|
|
||||||
|
public:
|
||||||
|
string getID() const { return m_ID; }
|
||||||
|
string getName() const { return m_Name; }
|
||||||
|
string getRemark() const { return m_Remark; }
|
||||||
|
string getSPITTypeID() const { return m_SPITTypeID; }
|
||||||
|
string getServerParams() const { return m_ServerParams; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the SPITType triggers an action on the Server or on the client.
|
||||||
|
* @return false = the action is triggered on the client The client waits for the server to play objects of this SPITType
|
||||||
|
* true = the action is triggered on the server. The server waits for the client to play objects of this SPITType.
|
||||||
|
*/
|
||||||
|
bool getServerRemote() const { return m_ServerRemote; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used by the server and client to tell if the other side has registered the changes.
|
||||||
|
* @return true = other side has registered the changes.
|
||||||
|
*/
|
||||||
|
bool getConfirmed() const { return m_Confirmed; }
|
||||||
|
bool getFixed() const { return m_Fixed; }
|
||||||
|
bool getCreatedByClient() const { return m_CreatedByClient; }
|
||||||
|
/**
|
||||||
|
* This is a virtual construct - ActionAssignedType is not implemented in the SPITProtocol.
|
||||||
|
* This is used when an action is associated with a SPITType.
|
||||||
|
* Then this action is done for every SPITObject with the SPITType.
|
||||||
|
* @return true = an action is assigned for the SPITType.
|
||||||
|
*/
|
||||||
|
bool getActionAssignedType() const { return m_ActionAssignedType; }
|
||||||
|
/** Returns if this SPITObject has an associated action or not.
|
||||||
|
* @return true = the user has asscociated an action with this SPITObject or
|
||||||
|
* the user has asscociated an action with the SPITType of this SPITObject
|
||||||
|
*/
|
||||||
|
bool getActionAssigned() const { return m_ActionAssigned || m_ActionAssignedType; }
|
||||||
|
|
||||||
|
long long getFrameStart() const { return m_FrameStart; }
|
||||||
|
// contains the length of the SPITObject
|
||||||
|
long long getFrameLength() const { return m_FrameLength; }
|
||||||
|
long long getFrameFadeInLength() const { return m_FrameFadeInLength; }
|
||||||
|
long long getFrameFadeOutLength() const { return m_FrameFadeOutLength; }
|
||||||
|
char getValueUse() const { return m_ValueUse; }
|
||||||
|
int getValueFactor() const { return m_ValueFactor; }
|
||||||
|
int getTrack() const { return m_Track; }
|
||||||
|
|
||||||
|
long long getDelay() const { return m_Delay; }
|
||||||
|
long long getDuration() const { return m_Duration; }
|
||||||
|
|
||||||
|
bool getProjectIndepended(SpitRepo<SPITType> &repo, SpitRepo<SPITType> &remoteRepo) const {
|
||||||
|
SPITType *ptrSPITType;
|
||||||
|
if (m_ServerRemote == false) {
|
||||||
|
ptrSPITType = repo.getEntry(m_SPITTypeID);
|
||||||
|
if (ptrSPITType == nullptr)
|
||||||
|
return true;
|
||||||
|
return ptrSPITType->getProjectIndepended();
|
||||||
|
} else {
|
||||||
|
ptrSPITType = remoteRepo.getEntry(m_SPITTypeID);
|
||||||
|
if (ptrSPITType == nullptr)
|
||||||
|
return true;
|
||||||
|
return ptrSPITType->getProjectIndepended();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool setConfirmed(bool p_Confirmed);
|
||||||
|
void setCreatedByClient(bool p_CreatedByClient) { m_CreatedByClient = p_CreatedByClient; }
|
||||||
|
bool setName(string p_Name);
|
||||||
|
bool setRemark(string p_Remark);
|
||||||
|
bool setServerParams(string p_ServerParams);
|
||||||
|
bool setSPITTypeID(string p_GroupName);
|
||||||
|
bool setServerRemote(bool p_BelongstoServer);
|
||||||
|
bool setActionAssignedType(bool p_ActionAssigned);
|
||||||
|
bool setActionAssigned(bool p_ActionAssigned);
|
||||||
|
bool setFixed(bool p_Fixed);
|
||||||
|
bool setFrameStart(long long p_FrameStart);
|
||||||
|
bool setFrameLength(long long p_FrameLength);
|
||||||
|
bool setFrameFadeInLength(long long p_FrameFadeInLength);
|
||||||
|
bool setFrameFadeOutLength(long long p_FrameFadeOutLength);
|
||||||
|
bool setValueUse(char p_ValueUse);
|
||||||
|
bool setValueFactor(int p_ValueFactor);
|
||||||
|
bool setTrack(int p_Track);
|
||||||
|
bool setDelay(long long p_Delay);
|
||||||
|
bool setDuration(long long p_Duration);
|
||||||
|
|
||||||
|
bool setMessageOP(SPIT_Message::ReportSPITObject *p_ReportSPITObject);
|
||||||
|
void fillMessageOP(SPIT_Message::ReportSPITObject &p_ReportSPITObject);
|
||||||
|
void fillMessageOP(SPIT_Message::RemoveSPITObject &p_RemoveSPITObject);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SPITOBJECT_H */
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: SPITPLayer.h
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 30. April 2019, 11:44
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPITPLAYER_H
|
||||||
|
#define SPITPLAYER_H
|
||||||
|
|
||||||
|
#include "SPITObject.h"
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
class SPITPlayer {
|
||||||
|
|
||||||
|
//----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------
|
||||||
|
public:
|
||||||
|
class PlaySPITType {
|
||||||
|
public:
|
||||||
|
PlaySPITType(SPITPlayer *p_SPITPlayer, string p_SPITObjectID);
|
||||||
|
PlaySPITType(const PlaySPITType &orig);
|
||||||
|
|
||||||
|
string getSPITTypeID() const { return m_SPITTypeID; }
|
||||||
|
|
||||||
|
void startPlaySequence();
|
||||||
|
bool getIsNew() const { return m_IsNew; }
|
||||||
|
void setIsNew(bool p_IsNew) { m_IsNew = p_IsNew; }
|
||||||
|
bool getIsPlayed() const { return m_IsPlayed; }
|
||||||
|
void setIsPlayed(bool p_IsFound) { m_IsPlayed = p_IsFound; }
|
||||||
|
string getPlayerID() const { return m_PlayerID; }
|
||||||
|
string getPlayerName() const { return m_PlayerName; }
|
||||||
|
bool getPlayerIsRunning() const { return m_PlayerRuns; }
|
||||||
|
void setPlayerIsRunning(bool p_PlayerRuns) { m_PlayerRuns = p_PlayerRuns; }
|
||||||
|
void setValue(double p_Value) { m_Value = p_Value; }
|
||||||
|
void addValue(double p_Value, double p_ValueFactor) { m_Value += (p_Value * p_ValueFactor); }
|
||||||
|
double getValue() const { return m_Value; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_PlayerID;
|
||||||
|
string m_PlayerName;
|
||||||
|
bool m_PlayerRuns;
|
||||||
|
string m_SPITTypeID;
|
||||||
|
bool m_IsPlayed;
|
||||||
|
bool m_IsNew;
|
||||||
|
double m_Value;
|
||||||
|
};
|
||||||
|
|
||||||
|
//----- SPITPlayer ------
|
||||||
|
public:
|
||||||
|
// list the SPITPlayers
|
||||||
|
static unordered_map<string, unique_ptr<SPITPlayer>> s_SPITPlayers; // all actual played objects
|
||||||
|
static SPITPlayer &getSPITPlayer(string p_PlayerID); // if a player does not exist creates a new one
|
||||||
|
static void clearPlayers() { s_SPITPlayers.clear(); }
|
||||||
|
|
||||||
|
SPITPlayer(string p_PlayerID);
|
||||||
|
virtual ~SPITPlayer();
|
||||||
|
|
||||||
|
void startPlaySequence(); // called by SPIT_Client::parsePlaySPITStart
|
||||||
|
PlaySPITType *addSPITType_Playing(string p_SPITTypeID); // called by SPIT_Client::parsePlaySPITStart
|
||||||
|
void endPlaySequence(); // called by SPIT_Client::parsePlaySPITEnd
|
||||||
|
|
||||||
|
string getID() {
|
||||||
|
return m_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
unordered_map<string, unique_ptr<PlaySPITType>> &getPlaySPITTypes() { return m_PlaySPITTypes; }
|
||||||
|
void setIsRunning(bool p_IsRunning) { m_IsRunning = p_IsRunning; }
|
||||||
|
void setName(string p_Name) { m_Name = p_Name; }
|
||||||
|
void setType(char p_Type) { m_Type = p_Type; }
|
||||||
|
void setTime(long long p_Frames) { m_TimeFrames = p_Frames; }
|
||||||
|
bool getIsRunning() const { return m_IsRunning; }
|
||||||
|
string getName() const { return m_Name; }
|
||||||
|
char getType() const { return m_Type; }
|
||||||
|
long long getTime() const { return m_TimeFrames; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ID;
|
||||||
|
string m_Name;
|
||||||
|
char m_Type;
|
||||||
|
unordered_map<string, unique_ptr<PlaySPITType>> m_PlaySPITTypes;
|
||||||
|
|
||||||
|
bool m_IsRunning;
|
||||||
|
long long m_TimeFrames;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SPITPLAYER_H */
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SPITSocket is the base class for WindowsSocket, UnixSocket,.
|
||||||
|
* Used by SPIT_Client and SAD_Client.
|
||||||
|
* File: SPITSocket.h
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 12. April 2019, 15:40
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPITSOCKET_H
|
||||||
|
#define SPITSOCKET_H
|
||||||
|
|
||||||
|
#include "Task.hpp"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_netif.h"
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/** Returns an guid */
|
||||||
|
string createGUID();
|
||||||
|
/** Returns the name of the client's host computer*/
|
||||||
|
string getClientHostName();
|
||||||
|
|
||||||
|
class SPITSocket {
|
||||||
|
public:
|
||||||
|
static const int FAMILY_IP4 = AF_INET;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IPAddress class is used to fetch all available IP addresses of the computer
|
||||||
|
* This is for internal usage
|
||||||
|
*/
|
||||||
|
struct IPAddress {
|
||||||
|
public:
|
||||||
|
IPAddress(const string &p_IPAddress, const string &p_SubnetMask)
|
||||||
|
: m_IPAddress(p_IPAddress), m_SubnetMask(p_SubnetMask) {}
|
||||||
|
const string m_IPAddress;
|
||||||
|
const string m_SubnetMask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the broadcast address from a ip4 address
|
||||||
|
* @param p_IPAddress the ip4 address
|
||||||
|
* @return returns the broadcast address
|
||||||
|
*/
|
||||||
|
string getBroadcastIP4() const {
|
||||||
|
struct in_addr broadcast;
|
||||||
|
unsigned long ulIPAddress;
|
||||||
|
unsigned long ulSubnetMask;
|
||||||
|
|
||||||
|
ulIPAddress = inet_addr(m_IPAddress.data());
|
||||||
|
ulSubnetMask = inet_addr(m_SubnetMask.data());
|
||||||
|
broadcast.s_addr = ulIPAddress | ~ulSubnetMask;
|
||||||
|
|
||||||
|
return inet_ntoa(broadcast);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const IPAddress mOwnIp;
|
||||||
|
static IPAddress getAdaptersInfo();
|
||||||
|
bool createSocket_UDP();
|
||||||
|
static const int INVALID_SOCKET = -1;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_UDPSocketIP4;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//-------- class --------------
|
||||||
|
SPITSocket(IPAddress ip) : mOwnIp(ip) {
|
||||||
|
m_UDPSocketIP4 = INVALID_SOCKET;
|
||||||
|
createSocket_UDP();
|
||||||
|
}
|
||||||
|
virtual ~SPITSocket() {
|
||||||
|
ESP_LOGD("UDP", "Shutting down ...");
|
||||||
|
|
||||||
|
if (m_UDPSocketIP4 != INVALID_SOCKET) {
|
||||||
|
shutdown(m_UDPSocketIP4, 2);
|
||||||
|
close(m_UDPSocketIP4);
|
||||||
|
m_UDPSocketIP4 = INVALID_SOCKET;
|
||||||
|
}
|
||||||
|
fos::Task::delayMs(100);
|
||||||
|
m_IsBound = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ServerIP{};
|
||||||
|
string m_ServerPort{};
|
||||||
|
string m_ClientIP{};
|
||||||
|
string m_ClientPort{}; // port given by the user maybe "0"
|
||||||
|
string m_BoundClientPort{}; // port set after bind
|
||||||
|
bool m_IsBound{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets the ip address and port for server and client.
|
||||||
|
void setConnectionParams(const string &serverIp, const string &serverPort, const string &clientIp, const string &clientPort) {
|
||||||
|
m_ServerIP = serverIp;
|
||||||
|
m_ServerPort = serverPort;
|
||||||
|
m_ClientIP = clientIp;
|
||||||
|
m_ClientPort = clientPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message to the server as set by setConnectionParams
|
||||||
|
* @param message byte buffer containing the message
|
||||||
|
* @param length length of the message
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int sendMessage(const char *message, int length) {
|
||||||
|
if (m_ServerPort.length() <= 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_IsBound == false) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int intResult = sendMessageTo(m_ServerIP, m_ServerPort, message, length);
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
int receiveMessage(char *p_Buffer, int p_BufferLength, string *serverIp) const;
|
||||||
|
int setBroadcast(bool p_Broadcast) const;
|
||||||
|
int bindSocket(string clientIp, string clientPort);
|
||||||
|
|
||||||
|
int sendMessageTo(const string &ip, const string &port, const char *message, int msgLength);
|
||||||
|
|
||||||
|
string getServerIP() const { return m_ServerIP; }
|
||||||
|
string getServerPort() const { return m_ServerPort; }
|
||||||
|
string getClientIP() const { return m_ClientIP; }
|
||||||
|
string getClientPort() const { return m_ClientPort; }
|
||||||
|
string getBoundClientPort() const { return m_BoundClientPort; }
|
||||||
|
void setBoundClientPort(const string &p_Port) { m_BoundClientPort = p_Port; }
|
||||||
|
void setIsBound(bool p_IsBound) { m_IsBound = p_IsBound; }
|
||||||
|
bool getIsBound() const { return m_IsBound; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SPITSOCKET_H */
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: SPITType.h
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 8. April 2019, 08:40
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPITTYPE_H
|
||||||
|
#define SPITTYPE_H
|
||||||
|
|
||||||
|
#include "SPITSocket.h"
|
||||||
|
#include "SPIT_Message.h"
|
||||||
|
#include "SpitRepo.hpp"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class SPITTypeListener;
|
||||||
|
|
||||||
|
class SPITType {
|
||||||
|
public:
|
||||||
|
static void setConfirmedFalse(SpitRepo<SPITType> &repo);
|
||||||
|
static void eventProjectClosed(SpitRepo<SPITType> &repo, SpitRepo<SPITType> &remoteRepo);
|
||||||
|
|
||||||
|
SPITType(string p_ID);
|
||||||
|
SPITType(string p_ID, string p_GroupName, string p_Name, bool p_Fixed, bool p_ProjectIndepended, long long p_DefaultDelay, long long p_DefaultDuration);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Confirmed{};
|
||||||
|
string m_ID;
|
||||||
|
bool m_Fixed{};
|
||||||
|
bool m_ServerRemote{};
|
||||||
|
bool m_ServerProjectIndepended{};
|
||||||
|
string m_GroupName{};
|
||||||
|
string m_Name{};
|
||||||
|
long long m_DefaultDelay{};
|
||||||
|
long long m_DefaultDuration{};
|
||||||
|
|
||||||
|
bool m_CreatedByClient; // flag true = the SPITTyype is created by the client
|
||||||
|
// false = the SPITType is received from the server
|
||||||
|
|
||||||
|
bool m_ActionAssigned; // This is a virtual flag if user associates an action with a SPITType.
|
||||||
|
// Can be used to setActionAssigned for all SPITObjects with this SPITType
|
||||||
|
|
||||||
|
public:
|
||||||
|
string getID() const { return m_ID; }
|
||||||
|
string getGroupName() const { return m_GroupName; }
|
||||||
|
string getName() const { return m_Name; }
|
||||||
|
/**
|
||||||
|
* Returns if the SPITType triggers an action on the Server or on the client.
|
||||||
|
* @return false = the action is triggered on the client The client waits for the server to play objects of this SPITType
|
||||||
|
* true = the action is triggered on the server. The server waits for the client to play objects of this SPITType.
|
||||||
|
*/
|
||||||
|
bool getServerRemote() const { return m_ServerRemote; }
|
||||||
|
bool getProjectIndepended() const { return m_ServerProjectIndepended; }
|
||||||
|
/**
|
||||||
|
* This is used by the server and client to tell if the other side has registered the changes.
|
||||||
|
* @return true = other side has registered the changes.
|
||||||
|
*/
|
||||||
|
bool getConfirmed() const { return m_Confirmed; }
|
||||||
|
bool getFixed() const { return m_Fixed; }
|
||||||
|
long long getDefaultDelay() const { return m_DefaultDelay; }
|
||||||
|
long long getDefaultDuration() const { return m_DefaultDuration; }
|
||||||
|
bool getCreatedByClient() const { return m_CreatedByClient; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual construct - means ActionAssigned for SPITTypes is is not implemented in SPITProtocol.
|
||||||
|
* This can used to setActionAssigned to all SPITObjects with this SPITType.
|
||||||
|
* This may be used in the case when the same action should be done for every SPITObject with this SPITType associated.
|
||||||
|
* @return true = the user has associated an action with this SPITType.
|
||||||
|
*/
|
||||||
|
bool getActionAssigned() const {
|
||||||
|
return m_ActionAssigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setGroupName(const string &p_GroupName);
|
||||||
|
bool setName(const string &p_Name);
|
||||||
|
bool setServerRemote(bool p_BelongstoServer);
|
||||||
|
bool setProjectIndepended(bool p_ProjectIndepeneded);
|
||||||
|
bool setConfirmed(bool p_Confirmed);
|
||||||
|
bool setFixed(bool p_Fixed);
|
||||||
|
bool setDefaultDelay(long long p_Delay);
|
||||||
|
bool setDefaultDuration(long long p_Duration);
|
||||||
|
void setCreatedByClient(bool p_CreatedByClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual construct - means ActionAssigned for SPITTypes is is not implemented in SPITProtocol.
|
||||||
|
* This can used to setActionAssigned to all SPITObjects with this SPITType.
|
||||||
|
* This may be used in the case when the same action should be done for every SPITObject with this SPITType associated.
|
||||||
|
* @return true = the m_ActionAssigned has changed.
|
||||||
|
*/
|
||||||
|
bool setActionAssigned(bool p_ActionAssigned);
|
||||||
|
|
||||||
|
bool setMessageOP(SPIT_Message::ReportSPITType &reportSpitType);
|
||||||
|
void fillMessageOP(SPIT_Message::ReportSPITType &smReportSpitType) const;
|
||||||
|
void fillMessageOP(SPIT_Message::RemoveSPITType &smRemoveSpitType) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SPITTYPE_H */
|
||||||
@@ -0,0 +1,349 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: SPIT_Client.h
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 7. April 2019, 08:50
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPIT_CLIENT_H
|
||||||
|
#define SPIT_CLIENT_H
|
||||||
|
|
||||||
|
#include "SAD_DetectedServer.hpp"
|
||||||
|
#include "SPITObject.h"
|
||||||
|
#include "SPITPlayer.h"
|
||||||
|
#include "SPITSocket.h"
|
||||||
|
#include "SPITType.h"
|
||||||
|
#include "SPIT_Message.h"
|
||||||
|
#include "SpitRepo.hpp"
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class SPIT_Client : I_SAD_Client {
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Maximal length of a SPITMessage*/
|
||||||
|
static const int MAXSPITMESSAGEBYTECOUNT = 512;
|
||||||
|
|
||||||
|
enum class ProjUpdate {
|
||||||
|
ServerLoaded,
|
||||||
|
StartTransfer,
|
||||||
|
EndTransfer,
|
||||||
|
ServerClosed,
|
||||||
|
};
|
||||||
|
enum class ServerEvent {
|
||||||
|
Detect,
|
||||||
|
Lost,
|
||||||
|
Changed,
|
||||||
|
};
|
||||||
|
enum class ObjectEvent {
|
||||||
|
Created,
|
||||||
|
Changed,
|
||||||
|
Deleted
|
||||||
|
};
|
||||||
|
enum class Connection {
|
||||||
|
None = 0, // No Connection established.<br>Either no connect tried or disconnected
|
||||||
|
NoneServer = 1, // Server has disconnected
|
||||||
|
Lost = 2, // The connection is lost<br>Either because of a network crash or because the server no longer responds.
|
||||||
|
Ok = 3, // Connection to the serv er is established.
|
||||||
|
TryConnection = 4, // A connection to the server is tried.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Callbacks {
|
||||||
|
void (*onServerEvent)(ServerEvent event, const SAD_DetectedServer &p_DetectedServer){};
|
||||||
|
void (*onConnectionStatus)(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, Connection p_ConnectionStatus, Connection p_OldConnectionStatus){};
|
||||||
|
void (*onProjectUpdate)(ProjUpdate state, string projectId){};
|
||||||
|
void (*onSpitType)(ObjectEvent event, bool isRemote, const SPITType &p_SPITType){};
|
||||||
|
void (*onSpitObject)(ObjectEvent event, bool isRemote, const SPITType &p_SPITType, const SPITObject &p_SPITObject){};
|
||||||
|
|
||||||
|
void (*onPlay)(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_PlayerIsRunning, long long p_TimeFrames){};
|
||||||
|
void (*onPlaySpitType)(string p_PlayerID, string p_SPITTypeID, bool p_PlayerIsRunning, bool p_Started, bool p_Ended, double p_Value){};
|
||||||
|
void (*onPlayRemoteObjectStatus)(const SPITType &p_SPITType, const SPITObject &p_SPITObject, long long p_FrameInsideObject, int p_Value){};
|
||||||
|
bool (*onCheckSpitTypeVeto)(bool knownType, bool createdByClient){};
|
||||||
|
bool (*onCheckSpitObjectVeto)(bool knownType){};
|
||||||
|
};
|
||||||
|
|
||||||
|
//------ PlayerType ------
|
||||||
|
public:
|
||||||
|
/** continous main player, time value can be used like a timecode.<br>The time value is the position in server's project.<br>A server should use only one main player.*/
|
||||||
|
static constexpr char PLAYERTYPE_MAIN = 0x02;
|
||||||
|
/** continous player. This player plays SPIT objects sometime during the project.*/
|
||||||
|
static constexpr char PLAYERTYPE_CONTINOUS = 0x01;
|
||||||
|
/** diescrete player. This player is used to transmit single discrete values.*/
|
||||||
|
static constexpr char PLAYERTYPE_DISCRETE = 0x00;
|
||||||
|
|
||||||
|
//------ Value Flag ------
|
||||||
|
//------ used by sendRemoteObject
|
||||||
|
public:
|
||||||
|
/**Set the given value directly*/
|
||||||
|
static constexpr char VALUEFLAG_DIRECT = 0x00;
|
||||||
|
/**Increase the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||||
|
static constexpr char VALUEFLAG_INCREASE = 0x01;
|
||||||
|
/**Decrease the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||||
|
static constexpr char VALUEFLAG_DECREASE = 0x02;
|
||||||
|
static constexpr int MAX_OVERTAKING_SPIT_MESSAGES = 10;
|
||||||
|
|
||||||
|
//----- SPIT_Client -----
|
||||||
|
public:
|
||||||
|
SPIT_Client(string name, string projName, Callbacks calls);
|
||||||
|
virtual ~SPIT_Client();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Callbacks mCallbacks;
|
||||||
|
|
||||||
|
fos::TaskT<SPIT_Client &> *m_ThreadReceive{};
|
||||||
|
bool m_StopReceiveSPITMessages{};
|
||||||
|
|
||||||
|
Connection m_ConnectionStatus{Connection::None};
|
||||||
|
bool m_DisconnectedByServer{}; // flag true = when server disconnects
|
||||||
|
string m_ID;
|
||||||
|
string m_Name;
|
||||||
|
string m_ProjName;
|
||||||
|
string m_ComputerName;
|
||||||
|
|
||||||
|
string m_ClientProjectName;
|
||||||
|
|
||||||
|
uint8_t m_MessageNumber_Send{1};
|
||||||
|
int m_MessageNumber_Received{-1}; // set to -1 because the first received message will set the number (1..255)
|
||||||
|
vector<unique_ptr<SPIT_Message>> m_OvertakingSPIT_Messages;
|
||||||
|
|
||||||
|
// Server's info filled by parseConnectAnswer
|
||||||
|
string m_ServerID{};
|
||||||
|
string m_ServerName{};
|
||||||
|
string m_ServerComputerName{};
|
||||||
|
int m_ServerStepTime{-1};
|
||||||
|
|
||||||
|
//--- Server Project ---
|
||||||
|
string m_ServerProjectID;
|
||||||
|
string m_ServerProjectName;
|
||||||
|
int m_ServerFramesPerSecond;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** The ID of the client.<br>Every client instance should set an unique id*/
|
||||||
|
string getID() { return m_ID; }
|
||||||
|
/** The name of the client, should be set by the user app*/
|
||||||
|
string getName() { return m_Name; }
|
||||||
|
//----- Computer Params -----
|
||||||
|
/** The name of the client's host computer*/
|
||||||
|
string getComputerName() { return m_ComputerName; }
|
||||||
|
void setClientProjectName(string p_ClientProjectName) { m_ClientProjectName = p_ClientProjectName; }
|
||||||
|
string getClientProjectName() { return m_ClientProjectName; }
|
||||||
|
|
||||||
|
// connected Server Infos
|
||||||
|
/** The ID of the connected SPITServer*/
|
||||||
|
string getServerID() { return m_ServerID; }
|
||||||
|
/** The host computername of the connected SPITServer*/
|
||||||
|
string getServerComputerName() { return m_ServerComputerName; }
|
||||||
|
/** The name of the connected SPITServer*/
|
||||||
|
string getServerName() { return m_ServerName; }
|
||||||
|
|
||||||
|
/** Expected Refreah Rate of the connectd SPITServer.<br>
|
||||||
|
* When the server plays objects, it will do so at discrete time steps.<br>
|
||||||
|
* Play events will take place in these time steps..
|
||||||
|
*/
|
||||||
|
int getServerStepTime() { return m_ServerStepTime; }
|
||||||
|
|
||||||
|
/** Should be called when the client wants to close his project*/
|
||||||
|
void clientProjectClose();
|
||||||
|
/**
|
||||||
|
* Should be called whenever the client has a project loaded
|
||||||
|
*/
|
||||||
|
void clientProjectLoaded();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param p_SPITTypeID
|
||||||
|
* @param p_ActionAssigned
|
||||||
|
*/
|
||||||
|
void setActionSPITType(string p_SPITTypeID, bool p_ActionAssigned);
|
||||||
|
void setActionSPITObject(string p_SPITObjectID, bool p_ActionAssigned);
|
||||||
|
|
||||||
|
//--------------- SPITMessage ---------------
|
||||||
|
private:
|
||||||
|
bool startReceiveSPITMessages();
|
||||||
|
void stopReceiveSPITMessages();
|
||||||
|
static void receiveSPITMessage(SPIT_Client &rM);
|
||||||
|
// Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected
|
||||||
|
bool _doReconnect{}; // true = on eventServerDetected connect to the server identified by m_ServerID
|
||||||
|
public:
|
||||||
|
int sendSPITMessage(SPIT_Message::OPPart & spitMessageOPPart);
|
||||||
|
|
||||||
|
//--------------- ServerAutoDetection SAD ---------------
|
||||||
|
public:
|
||||||
|
/** Starts the autodetection of SPITServers in the local network. If a connection is tried, the autodetection should be stopped before.*/
|
||||||
|
void startServerAutoDetect();
|
||||||
|
/** Stops the autodetection of SPITServers in the local network*/
|
||||||
|
void stopServerAutoDetect();
|
||||||
|
/** Called every time a new SPITServer is detetced in the local network */
|
||||||
|
void eventServerDetected(SAD_DetectedServer &server);
|
||||||
|
/** Called every time a prior detected SPITServer is is no longer found.*/
|
||||||
|
void eventServerLost(SAD_DetectedServer &server);
|
||||||
|
void eventServerChanged(SAD_DetectedServer &server);
|
||||||
|
|
||||||
|
//--------------- Connection ---------------
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Tries a connection to the SPITServer
|
||||||
|
* @param p_ServerIP ip address of the SPITServer
|
||||||
|
* @param p_ServerPort port of the SPITServer
|
||||||
|
* @param p_ClientIP IP of the client
|
||||||
|
* @param p_ClientPort if "0" any free port will be used
|
||||||
|
* @param p_LoginName maybe some SPITServer need a login - liveSHOWsoftware will not.
|
||||||
|
* @param p_LoginPassword maybe some SPITServer need a login - liveSHOWsoftware will not
|
||||||
|
* @return true = the connection try is ok, SPITServer will answer with COnnectAnswer and an eventConnectionStatus will occur.<br>
|
||||||
|
* false = something is going wrong. (client could not bind)
|
||||||
|
*/
|
||||||
|
bool connect(string p_ServerIP, string p_ServerPort, string p_ClientIP, string p_ClientPort, string p_LoginName = "", string p_LoginPassword = "");
|
||||||
|
/**
|
||||||
|
* Terminates the connection to the SPITServer.
|
||||||
|
*/
|
||||||
|
void disconnect();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void disconnectInternal(Connection p_Cause);
|
||||||
|
void resetMessageNumberReceived();
|
||||||
|
void parseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
|
||||||
|
void checkParseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
|
||||||
|
void addOvertakingSPIT_Message(unique_ptr<SPIT_Message> p_SPIT_Message);
|
||||||
|
void parseConnectAnswer(SPIT_Message::ConnectAnswer &p_ConnectAnswer);
|
||||||
|
void parseDisconnect(SPIT_Message::Disconnect &p_Disconnect);
|
||||||
|
void parseWatchdog(SPIT_Message::Watchdog &p_Watchdog);
|
||||||
|
void parseWatchdogAnswer(SPIT_Message::WatchdogAnswer &p_WatchdogAnswer);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Used internally*/
|
||||||
|
void sendWatchdog();
|
||||||
|
/** Used internally. When the connection to the SPITServer is lost an eventConnectionStatus will occur*/
|
||||||
|
void eventWatchdogLost();
|
||||||
|
//--------------- SPIT Project ---------------
|
||||||
|
private:
|
||||||
|
void parseReportSPITProject(SPIT_Message::ReportSPITProject &p_ReportSPITProject);
|
||||||
|
void parseCloseSPITProject(SPIT_Message::CloseSPITProject &p_CloseSPITProject);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Returns the SPITServer's project ID - may be the same as the project's name*/
|
||||||
|
string getServerProjectID();
|
||||||
|
/** Returns the SPITServer's project name*/
|
||||||
|
string getServerProjectName();
|
||||||
|
/** Returns frame rate per second. This is the time resolution in which the server transmits time data. The unit of time data is always frames.*/
|
||||||
|
int getServerFramesPerSecond();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void parseRequestProjectTransfer(SPIT_Message::RequestProjectTransfer &p_RequestProjectTransfer);
|
||||||
|
void parseStartProjectTransfer(SPIT_Message::StartProjectTransfer &p_StartProjectTransfer);
|
||||||
|
void parseEndProjectTransfer(SPIT_Message::EndProjectTransfer &p_EndProjectTransfer);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void sendProject(SPIT_Client *p_PtrSPIT_Client);
|
||||||
|
|
||||||
|
// --------------- SPIT Types ---------------
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a fixed SPITType for application actions that are always present and project independent.<br>
|
||||||
|
* Fixed SPIT types cannot be changed or deleted by the server.<br>
|
||||||
|
* These SPITTypes will be automatically added to the SPITType-List and sended to the server.
|
||||||
|
* @param p_ID an unique of the SPITType, these are always the same per client approach. Different client approaches should use different ids.
|
||||||
|
* @param p_GroupName a name which groups the actions/SPITTypes
|
||||||
|
* @param p_Name the name of the Action/SPITType
|
||||||
|
* @param p_DefaultDelay maybe there is an default delay until the action starts, this is only used for graphical representations, 0 is allowd
|
||||||
|
* @param p_DefaultDuration maybe the action has a default duration, this is only used for graphical representations, 0 is allowd
|
||||||
|
* @return the pointer to the new SPITType.
|
||||||
|
*/
|
||||||
|
SPITType *createSPITTypeFixed(string p_ID, string p_GroupName, string p_Name, long long p_DefaultDelay, long long p_DefaultDuration);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a SPITType for application actions.<br>
|
||||||
|
* These SPITTypes will be automatically added to the SPITType-List and sended to the server.
|
||||||
|
* @param p_ID an unique of the SPITType, these are always the same per client approach. Different client approaches should use different ids.
|
||||||
|
* @param p_GroupName a name which groups the actions/SPITTypes
|
||||||
|
* @param p_Name the name of the Action/SPITType
|
||||||
|
* @param p_DefaultDelay maybe there is an default delay until the action starts, this is only used for graphical representations, 0 is allowd
|
||||||
|
* @param p_DefaultDuration maybe the action has a default duration, this is only used for graphical representations, 0 is allowd
|
||||||
|
* @param p_Fixed true = the server is not allowed to change this SPITType, false = the server may change or delete this SPITType
|
||||||
|
* @param p_ProjectIndepended true = the SPITType belongs to a specific project, false = the SpitType always exists for every project
|
||||||
|
* @return the pointer to the new SPITType.
|
||||||
|
*/
|
||||||
|
SPITType *createSPITType(string p_ID, string p_GroupName, string p_Name, long long p_DefaultDelay, long long p_DefaultDuration, bool p_Fixed, bool p_ProjectIndepended);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// receive SPITTypes
|
||||||
|
void parseReportSPITType(SPIT_Message::ReportSPITType &p_ReportSPITType);
|
||||||
|
void parseRemoveSPITType(SPIT_Message::RemoveSPITType &p_RemoveSPITType);
|
||||||
|
int sendSPITTypeInternal(SPITType &p_SPITType);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* If a client wants to change a SPITType, he should send it to the server.<br>
|
||||||
|
* If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the change.<br>
|
||||||
|
* @param p_SPITTypeID the id of the SPITType to remove.
|
||||||
|
* @return 0 = is sended, -1 = is not sended
|
||||||
|
*/
|
||||||
|
bool changeSPITType(SPITType *p_SPITType);
|
||||||
|
/**
|
||||||
|
* If a client wants to remove a SPITType, he should send it to the server.<br>
|
||||||
|
* If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the deletion.<br>
|
||||||
|
* @param p_SPITTypeID the id of the SPITType to remove.
|
||||||
|
* @return 0 = is sended, -1 = is not sended
|
||||||
|
*/
|
||||||
|
int removeSPITType(string p_SPITTypeID);
|
||||||
|
|
||||||
|
public:
|
||||||
|
//--------------- SPIT Objects ---------------
|
||||||
|
private:
|
||||||
|
void parseReportSPITObject(SPIT_Message::ReportSPITObject &p_ReportSPITObject);
|
||||||
|
void parseRemoveSPITObject(SPIT_Message::RemoveSPITObject &p_RemoveSPITObject);
|
||||||
|
int sendSPITObjectInternal(SPITObject *ptrSPITObject);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* When the client changes a SPITObject (normally the client should not do this), then it should send the changes to the SPITServer.<br>
|
||||||
|
* The SPITServer may discard the changes and an eventSPITObject occurs.<br>
|
||||||
|
* @param p_SPITObject the pointer to the changed SPITObject.
|
||||||
|
* @return 0 = sended, -1 = not sended
|
||||||
|
*/
|
||||||
|
bool changeSPITObject(SPITObject *p_SPITObject);
|
||||||
|
/**
|
||||||
|
* When the client removes a SPITObject (normally the client should not do this), then he should send it to the SPITServer.<br>
|
||||||
|
* The SPITServer may discard the deletion and an eventSPITObject occurs.<br>
|
||||||
|
* @param p_SPITObjectID the id of the SPITObject to remove.
|
||||||
|
* @return 0 = sended, -1 = not sended
|
||||||
|
*/
|
||||||
|
int removeSPITObject(string p_SPITObjectID);
|
||||||
|
|
||||||
|
public:
|
||||||
|
//--------------- Play SPIT Objects ---------------
|
||||||
|
private:
|
||||||
|
void parsePlaySPITStart(SPIT_Message::PlaySPITStart &p_PlaySPITStart);
|
||||||
|
void parsePlaySPITObject(SPIT_Message::PlaySPITObject &p_PlaySPITObject);
|
||||||
|
void parsePlaySPITEnd(SPIT_Message::PlaySPITEnd &p_PlaySPITEnd);
|
||||||
|
void parseReportPlayStatus(SPIT_Message::ReportPlayStatus &p_ReportPlayStatus);
|
||||||
|
|
||||||
|
public:
|
||||||
|
//--------- Remote ----------
|
||||||
|
void sendRemoteObject(string p_SPITObjectID, int p_Valueppm = 0, char p_ValueFlag = 0x00);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void processSocketTask(SPIT_Client &instance);
|
||||||
|
fos::TaskT<SPIT_Client &> *sThread{};
|
||||||
|
bool mAbortSearch{};
|
||||||
|
bool sAnswered{};
|
||||||
|
static fos::Semaphore sStartSad;
|
||||||
|
SPITSocket *mSPITSocket;
|
||||||
|
void answerWatchdog() {
|
||||||
|
sAnswered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SpitRepo<SPITObject> mSpitObjects;
|
||||||
|
SpitRepo<SPITObject> mRemoteSpitObjects;
|
||||||
|
SpitRepo<SPITType> mSpitTypes;
|
||||||
|
SpitRepo<SPITType> mRemoteSpitTypes;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SPIT_CLIENT_H */
|
||||||
@@ -0,0 +1,728 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: SPIT_Message.h
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 3. April 2019, 08:51
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPIT_MESSAGE_H
|
||||||
|
#define SPIT_MESSAGE_H
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
static const string SPITID = "#spit#";
|
||||||
|
|
||||||
|
class SPIT_Message {
|
||||||
|
//----------- Header -----------
|
||||||
|
public:
|
||||||
|
class Header {
|
||||||
|
public:
|
||||||
|
static constexpr int BYTESLENGTH = 99;
|
||||||
|
Header(const Header &orig);
|
||||||
|
Header();
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_SPITID;
|
||||||
|
int m_SPITVersion{SPITVERSION};
|
||||||
|
unsigned char m_MessageNumber{};
|
||||||
|
int m_BytesCount{BYTESLENGTH};
|
||||||
|
string m_ServerID{};
|
||||||
|
string m_ClientID{};
|
||||||
|
int m_OPFlag{-1};
|
||||||
|
int m_ParseOffset{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
string getSPITID() const { return m_SPITID; }
|
||||||
|
int getSPITVersion() const { return m_SPITVersion; }
|
||||||
|
unsigned char getMessageNumber() const { return m_MessageNumber; }
|
||||||
|
int getBytesCount() const { return m_BytesCount; }
|
||||||
|
string getServerID() const { return m_ServerID; }
|
||||||
|
string getClientID() const { return m_ClientID; }
|
||||||
|
int getOPFlag() const { return m_OPFlag; }
|
||||||
|
|
||||||
|
// Receive
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
// Send
|
||||||
|
Header(int p_SPITVersion, int p_OPFlag);
|
||||||
|
void setMessageNumber(unsigned char p_MessageNumber) { m_MessageNumber = p_MessageNumber; }
|
||||||
|
void setServerID(string p_ID) { m_ServerID = p_ID; }
|
||||||
|
void setClientID(string p_ID) { m_ClientID = p_ID; }
|
||||||
|
void setOPFlag(int p_OPFlag) { m_OPFlag = p_OPFlag; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- OPPart -----------
|
||||||
|
public:
|
||||||
|
class OPPart {
|
||||||
|
|
||||||
|
// Members
|
||||||
|
protected:
|
||||||
|
unique_ptr<Header> m_Header{};
|
||||||
|
int m_ParseOffset{};
|
||||||
|
int m_BytesCount;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~OPPart();
|
||||||
|
|
||||||
|
Header *getHeader() const { return m_Header.get(); }
|
||||||
|
int getBytesCount() const { return m_BytesCount; }
|
||||||
|
void setServerInfoInHeader(string clientId, string serverId) {
|
||||||
|
if (!m_Header)
|
||||||
|
return;
|
||||||
|
m_Header->setClientID(clientId);
|
||||||
|
m_Header->setServerID(serverId);
|
||||||
|
}
|
||||||
|
void setMessageNumber(uint8_t no) {
|
||||||
|
if (!m_Header)
|
||||||
|
return;
|
||||||
|
m_Header->setMessageNumber(no);
|
||||||
|
}
|
||||||
|
|
||||||
|
const string getServerID() const {
|
||||||
|
if (!m_Header) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return m_Header->getServerID();
|
||||||
|
}
|
||||||
|
const string getClientID() const {
|
||||||
|
if (!m_Header) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return m_Header->getClientID();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getOPFlag() const {
|
||||||
|
if (!m_Header) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return m_Header->getOPFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Receive
|
||||||
|
OPPart(unique_ptr<Header> p_Header, int p_OPFlag, int size);
|
||||||
|
void setHeader(int opFlag);
|
||||||
|
virtual bool parse(const std::vector<char> &message) = 0;
|
||||||
|
|
||||||
|
// Send
|
||||||
|
OPPart(int size);
|
||||||
|
virtual bool fillBytes(std::vector<char> &message) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- SPIT_Message -----------
|
||||||
|
|
||||||
|
public:
|
||||||
|
static constexpr int SPITVERSION = 1;
|
||||||
|
|
||||||
|
// SPIT_Object value usage
|
||||||
|
static constexpr char VALUEUSE_DISCARD = 0x00; // value of SPITObejct is not used
|
||||||
|
static constexpr char VALUEUSE_INRANGE = 0x01; // value of SPITOBject in range 0 - 1000000ppm
|
||||||
|
static constexpr char VALUEUSE_OVERRIDE = 0x02; // value can be overridden
|
||||||
|
|
||||||
|
// SPIT Player type
|
||||||
|
static constexpr char PLAYERTYPE_MAIN = 0x02;
|
||||||
|
static constexpr char PLAYERTYPE_CONTINIOUS = 0x01;
|
||||||
|
static constexpr char PLAYERTYPE_DISCRETE = 0x00;
|
||||||
|
|
||||||
|
// PlayObject value usage
|
||||||
|
static constexpr char VALUEFLAG_DIRECT = 0x00; // use the vlue direct
|
||||||
|
static constexpr char VALUEFLAG_INCREASE = 0x01; // increase the value
|
||||||
|
static constexpr char VALUEFLAG_DECREASE = 0x02; // decrease the value
|
||||||
|
|
||||||
|
SPIT_Message() = default;
|
||||||
|
|
||||||
|
// Members
|
||||||
|
private:
|
||||||
|
unique_ptr<OPPart> m_OPPart{};
|
||||||
|
|
||||||
|
// Receive
|
||||||
|
public:
|
||||||
|
SPIT_Message(std::vector<char> message);
|
||||||
|
|
||||||
|
const Header *getHeader() const { return m_OPPart->getHeader(); }
|
||||||
|
int getOPFlag() const {
|
||||||
|
if (!m_OPPart || !m_OPPart->getHeader()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return m_OPPart->getHeader()->getOPFlag();
|
||||||
|
}
|
||||||
|
const OPPart *getOPPart() const { return m_OPPart.get(); }
|
||||||
|
template<typename T>
|
||||||
|
T &getOPPartAs() const { return *reinterpret_cast<T *>(m_OPPart.get()); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool parse(std::vector<char> message);
|
||||||
|
|
||||||
|
// Send
|
||||||
|
public:
|
||||||
|
static std::vector<char> createMessage(OPPart & p_OPPart);
|
||||||
|
|
||||||
|
//------------------------------ Connection ----------------------------------
|
||||||
|
|
||||||
|
//----------- Connect -----------
|
||||||
|
public:
|
||||||
|
class Connect : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 1;
|
||||||
|
static constexpr int BYTESLENGTH = 304;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ClientComputerName{};
|
||||||
|
string m_ClientName{};
|
||||||
|
string m_LoginName{};
|
||||||
|
string m_LoginPassword{};
|
||||||
|
string m_ServerIP{};
|
||||||
|
int m_ServerPort{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Receive
|
||||||
|
Connect(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
string getClientComputerName() const { return m_ClientComputerName; }
|
||||||
|
string getClientName() const { return m_ClientName; }
|
||||||
|
string getLoginName() const { return m_LoginName; }
|
||||||
|
string getLoginPassword() const { return m_LoginPassword; }
|
||||||
|
string getServerIP() const { return m_ServerIP; }
|
||||||
|
int getServerPort() const { return m_ServerPort; }
|
||||||
|
|
||||||
|
// Send
|
||||||
|
Connect(string p_ComputerName, string p_ClientName);
|
||||||
|
|
||||||
|
void setLoginName(string p_LoginName) { m_LoginName = p_LoginName; }
|
||||||
|
void setLoginPassword(string p_LoginPassword) { m_LoginPassword = p_LoginPassword; }
|
||||||
|
void setServerIP(string p_ServerIP) { m_ServerIP = p_ServerIP; }
|
||||||
|
void setServerPort(int p_ServerPort);
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- ConnectAnswer -----------
|
||||||
|
|
||||||
|
class ConnectAnswer : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 2;
|
||||||
|
static constexpr int BYTESLENGTH = 137;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ServerComputerName{};
|
||||||
|
string m_ServerName{};
|
||||||
|
bool m_Connected{};
|
||||||
|
int m_StepTime{40}; // ms step size the Server will send play sequences
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConnectAnswer(const ConnectAnswer &orig);
|
||||||
|
// Receive
|
||||||
|
ConnectAnswer(unique_ptr<Header> p_Header);
|
||||||
|
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
const string getServerComputerName() const { return m_ServerComputerName; }
|
||||||
|
const string getServerName() const { return m_ServerName; }
|
||||||
|
bool getConnected() const { return m_Connected; }
|
||||||
|
int getStepTime() const { return m_StepTime; }
|
||||||
|
|
||||||
|
// Send
|
||||||
|
ConnectAnswer();
|
||||||
|
void setServerComputerName(string p_ServerComputerName) { m_ServerComputerName = p_ServerComputerName; }
|
||||||
|
void setServerName(string p_ServerName) { m_ServerName = p_ServerName; }
|
||||||
|
void setConnected(bool p_Connected) { m_Connected = p_Connected; }
|
||||||
|
void setStepTime(int p_StepTime_ms);
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- Disconnect -----------
|
||||||
|
|
||||||
|
class Disconnect : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 3;
|
||||||
|
static constexpr int BYTESLENGTH = 4;
|
||||||
|
|
||||||
|
Disconnect(const Disconnect &orig);
|
||||||
|
// Receive
|
||||||
|
Disconnect(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
// Send
|
||||||
|
Disconnect();
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- Watchdog -----------
|
||||||
|
|
||||||
|
class Watchdog : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 8;
|
||||||
|
static constexpr int BYTESLENGTH = 4;
|
||||||
|
|
||||||
|
Watchdog(const Watchdog &orig);
|
||||||
|
// Receive
|
||||||
|
Watchdog(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
// Send
|
||||||
|
Watchdog();
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- WatchdogAnswer -----------
|
||||||
|
|
||||||
|
class WatchdogAnswer : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 9;
|
||||||
|
static constexpr int BYTESLENGTH = 4;
|
||||||
|
|
||||||
|
// Receive
|
||||||
|
WatchdogAnswer(const WatchdogAnswer &orig);
|
||||||
|
WatchdogAnswer(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
// Send
|
||||||
|
WatchdogAnswer();
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//------------------------------ SPITProject ----------------------------------
|
||||||
|
|
||||||
|
//----------- ReportSPITProject -----------
|
||||||
|
|
||||||
|
class ReportSPITProject : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 11;
|
||||||
|
static constexpr int BYTESLENGTH = 113;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ProjectID{};
|
||||||
|
string m_ProjectName{};
|
||||||
|
int m_FramesPerSecond{1000}; // Frames per second
|
||||||
|
|
||||||
|
// Receive
|
||||||
|
public:
|
||||||
|
ReportSPITProject(const ReportSPITProject &orig);
|
||||||
|
ReportSPITProject(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
const string getProjectID() const { return m_ProjectID; }
|
||||||
|
const string getProjectName() const { return m_ProjectName; }
|
||||||
|
int getFramesPerSecond() const { return m_FramesPerSecond; }
|
||||||
|
// Send
|
||||||
|
ReportSPITProject(string p_ProjectID, string p_ProjectName);
|
||||||
|
|
||||||
|
void setFramesPerSecond(const int p_FramesPerSecond) { m_FramesPerSecond = p_FramesPerSecond; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- CloseSPITProject -----------
|
||||||
|
|
||||||
|
class CloseSPITProject : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 13;
|
||||||
|
static constexpr int BYTESLENGTH = 45;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_ProjectID{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
CloseSPITProject(const CloseSPITProject &orig);
|
||||||
|
// Receive
|
||||||
|
CloseSPITProject(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
const string getProjectID() const {
|
||||||
|
return m_ProjectID;
|
||||||
|
}
|
||||||
|
// Send
|
||||||
|
CloseSPITProject(string projectID);
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- StartProjectTransfer -----------
|
||||||
|
class RequestProjectTransfer : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 15;
|
||||||
|
static constexpr int BYTESLENGTH = 4;
|
||||||
|
|
||||||
|
RequestProjectTransfer(const RequestProjectTransfer &orig);
|
||||||
|
// Receive
|
||||||
|
RequestProjectTransfer(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
// Send
|
||||||
|
RequestProjectTransfer();
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- StartProjectTransfer -----------
|
||||||
|
|
||||||
|
class StartProjectTransfer : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 16;
|
||||||
|
static constexpr int BYTESLENGTH = 4;
|
||||||
|
|
||||||
|
StartProjectTransfer(const StartProjectTransfer &orig);
|
||||||
|
// Receive
|
||||||
|
StartProjectTransfer(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
// Send
|
||||||
|
StartProjectTransfer();
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- EndProjectTransfer -----------
|
||||||
|
class EndProjectTransfer : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 17;
|
||||||
|
static constexpr int BYTESLENGTH = 4;
|
||||||
|
|
||||||
|
EndProjectTransfer(const EndProjectTransfer &orig);
|
||||||
|
// Receive
|
||||||
|
EndProjectTransfer(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
// Send
|
||||||
|
EndProjectTransfer();
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------- SPIT_Types ----------------------------------
|
||||||
|
|
||||||
|
//----------- ReportSPITType -----------
|
||||||
|
class ReportSPITType : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 21;
|
||||||
|
static constexpr int BYTESLENGTH = 168;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Confirmed{};
|
||||||
|
string m_SPITTypeID{};
|
||||||
|
bool m_Fixed{};
|
||||||
|
bool m_ServerRemote{};
|
||||||
|
bool m_ServerProjectIndepended{};
|
||||||
|
string m_SPITTypeGroupName{};
|
||||||
|
string m_SPITTypeName{};
|
||||||
|
long long m_Delay{};
|
||||||
|
long long m_Duration{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
ReportSPITType(const ReportSPITType &orig);
|
||||||
|
// Receive
|
||||||
|
ReportSPITType(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
bool getConfirmed() const { return m_Confirmed; }
|
||||||
|
const string getID() const { return m_SPITTypeID; }
|
||||||
|
bool getFixed() const { return m_Fixed; }
|
||||||
|
bool getServerRemote() const { return m_ServerRemote; }
|
||||||
|
bool getServerProjectIndepended() const { return m_ServerProjectIndepended; }
|
||||||
|
const string getGroupName() const { return m_SPITTypeGroupName; }
|
||||||
|
const string getName() const { return m_SPITTypeName; }
|
||||||
|
long long getDelay() const { return m_Delay; }
|
||||||
|
long long getDuration() const { return m_Duration; }
|
||||||
|
// Send
|
||||||
|
|
||||||
|
ReportSPITType();
|
||||||
|
void setConfirmed(bool p_Confirmed) { m_Confirmed = p_Confirmed; }
|
||||||
|
void setID(string p_ID) { m_SPITTypeID = p_ID; }
|
||||||
|
void setFixed(bool p_Fixed) { m_Fixed = p_Fixed; }
|
||||||
|
void setServerRemote(bool p_IsServerRemote) { m_ServerRemote = p_IsServerRemote; }
|
||||||
|
void setServerProjectIndepended(bool p_ProjectIndpended) { m_ServerProjectIndepended = p_ProjectIndpended; }
|
||||||
|
void setGroupName(string p_GroupName) { m_SPITTypeGroupName = p_GroupName; }
|
||||||
|
void setName(string p_Name) { m_SPITTypeName = p_Name; }
|
||||||
|
void setDelay(long long p_Delay) { m_Delay = p_Delay; }
|
||||||
|
void setDuration(long long p_Duration) { m_Duration = p_Duration; }
|
||||||
|
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- RemoveSPITType -----------
|
||||||
|
|
||||||
|
class RemoveSPITType : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 23;
|
||||||
|
static constexpr int BYTESLENGTH = 45;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_SPITTypeID{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
RemoveSPITType(const RemoveSPITType &orig);
|
||||||
|
// Receive
|
||||||
|
RemoveSPITType(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
const string getID() const { return m_SPITTypeID; }
|
||||||
|
|
||||||
|
// Send
|
||||||
|
RemoveSPITType();
|
||||||
|
void setID(string p_ID) { m_SPITTypeID = p_ID; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------- SPITObjects ----------------------------------
|
||||||
|
|
||||||
|
//----------- ReportSPITObject -----------
|
||||||
|
|
||||||
|
class ReportSPITObject : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 31;
|
||||||
|
static constexpr int BYTESLENGTH = 339;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Confirmed{};
|
||||||
|
string m_SPITObjectID{};
|
||||||
|
bool m_Fixed{};
|
||||||
|
bool m_ServerRemote{};
|
||||||
|
string m_SPITObjectName{};
|
||||||
|
string m_SPITTypeID{};
|
||||||
|
string m_ServerParams{};
|
||||||
|
long long m_FrameStart{};
|
||||||
|
long long m_FrameLength{};
|
||||||
|
long long m_FrameFadeInLength{};
|
||||||
|
long long m_FrameFadeOutLength{};
|
||||||
|
int m_ValueFactor{};
|
||||||
|
char m_ValueUse{VALUEUSE_DISCARD};
|
||||||
|
int m_Track{};
|
||||||
|
string m_Remark{};
|
||||||
|
long long m_Delay{};
|
||||||
|
long long m_Duration{};
|
||||||
|
bool m_ActionAssigned{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
ReportSPITObject(const ReportSPITObject &orig);
|
||||||
|
// Receive
|
||||||
|
ReportSPITObject(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
bool getConfirmed() const { return m_Confirmed; }
|
||||||
|
const string getID() const { return m_SPITObjectID; }
|
||||||
|
bool getFixed() const { return m_Fixed; }
|
||||||
|
bool getServerRemote() const { return m_ServerRemote; }
|
||||||
|
const string getName() const { return m_SPITObjectName; }
|
||||||
|
const string getSPITTypeID() const { return m_SPITTypeID; }
|
||||||
|
const string getServerParams() const { return m_ServerParams; }
|
||||||
|
long long getFrameStart() const { return m_FrameStart; }
|
||||||
|
long long getFrameLength() const { return m_FrameLength; }
|
||||||
|
long long getFrameFadeInLength() const { return m_FrameFadeInLength; }
|
||||||
|
long long getFrameFadeOutLength() const { return m_FrameFadeOutLength; }
|
||||||
|
int getValueFactor() const { return m_ValueFactor; }
|
||||||
|
char getValueUse() const { return m_ValueUse; }
|
||||||
|
int getTrack() const { return m_Track; }
|
||||||
|
const string getRemark() const { return m_Remark; }
|
||||||
|
long long getDelay() const { return m_Delay; }
|
||||||
|
long long getDuration() const { return m_Duration; }
|
||||||
|
bool getActionAssigned() const { return m_ActionAssigned; }
|
||||||
|
// Send
|
||||||
|
public:
|
||||||
|
ReportSPITObject();
|
||||||
|
|
||||||
|
void setConfirmed(bool p_Confirmed) { m_Confirmed = p_Confirmed; };
|
||||||
|
void setID(string p_ID) { m_SPITObjectID = p_ID; };
|
||||||
|
void setFixed(bool p_Fixed) { m_Fixed = p_Fixed; };
|
||||||
|
void setServerRemote(bool p_IsRemote) { m_ServerRemote = p_IsRemote; };
|
||||||
|
void setName(string p_Name) { m_SPITObjectName = p_Name; };
|
||||||
|
void setSPITTypeID(string p_ID) { m_SPITTypeID = p_ID; };
|
||||||
|
void setServerParams(string p_Parameters) { m_ServerParams = p_Parameters; };
|
||||||
|
void setFrameStart(long long p_StartTime) { m_FrameStart = p_StartTime; };
|
||||||
|
void setFrameLength(long long p_Length) { m_FrameLength = p_Length; };
|
||||||
|
void setFrameFadeInLength(long long p_FadeInTime) { m_FrameFadeInLength = p_FadeInTime; };
|
||||||
|
void setFrameFadeOutLength(long long p_FadeOutTime) { m_FrameFadeOutLength = p_FadeOutTime; };
|
||||||
|
void setValueFactor(int p_Volume) { m_ValueFactor = p_Volume; };
|
||||||
|
void setValueUse(char p_ValueUse) { m_ValueUse = p_ValueUse; };
|
||||||
|
void setTrack(int p_Track) { m_Track = p_Track; };
|
||||||
|
void setRemark(string p_Description) { m_Remark = p_Description; };
|
||||||
|
void setDelay(long long p_Delay);
|
||||||
|
void setDuration(long long p_Duration);
|
||||||
|
void setActionAssigned(bool p_ActionAssigned) { m_ActionAssigned = p_ActionAssigned; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- RemoveSPITObject -----------
|
||||||
|
|
||||||
|
class RemoveSPITObject : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 33;
|
||||||
|
static constexpr int BYTESLENGTH = 45;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_SPITObjectID{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
RemoveSPITObject(const RemoveSPITObject &orig);
|
||||||
|
// Receive
|
||||||
|
RemoveSPITObject(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
const string getID() const { return m_SPITObjectID; }
|
||||||
|
// Send
|
||||||
|
public:
|
||||||
|
RemoveSPITObject();
|
||||||
|
void setID(string p_ID) { m_SPITObjectID = p_ID; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------- SPITPlayer ----------------------------------
|
||||||
|
|
||||||
|
//----------- PlaySPITStart -----------
|
||||||
|
|
||||||
|
class PlaySPITStart : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 37;
|
||||||
|
static constexpr int BYTESLENGTH = 119;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_PlayerID{};
|
||||||
|
string m_PlayerName{};
|
||||||
|
char m_PlayerType{};
|
||||||
|
bool m_PlayerIsRunning{};
|
||||||
|
long long m_Time; // Frames
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlaySPITStart(const PlaySPITStart &orig);
|
||||||
|
// Receive
|
||||||
|
PlaySPITStart(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
const string getPlayerID() const { return m_PlayerID; }
|
||||||
|
const string getPlayerName() const { return m_PlayerName; }
|
||||||
|
char getPlayerType() const { return m_PlayerType; }
|
||||||
|
bool getPlayerIsRunning() const { return m_PlayerIsRunning; }
|
||||||
|
long long getTime() const { return m_Time; }
|
||||||
|
|
||||||
|
// Send
|
||||||
|
PlaySPITStart(string p_PlayerID, string p_PlayerName, char p_PlayerType);
|
||||||
|
void setPlayerIsRunning(bool p_IsPlaying) { m_PlayerIsRunning = p_IsPlaying; }
|
||||||
|
void setTime(long long p_Time) { m_Time = p_Time; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- PlaySPITObject -----------
|
||||||
|
|
||||||
|
class PlaySPITObject : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 38;
|
||||||
|
static constexpr int BYTESLENGTH = 100;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_PlayerID{};
|
||||||
|
string m_SPITObjectID{};
|
||||||
|
long long m_FrameInsideObject{}; // Frames
|
||||||
|
bool m_PlayPrePosition{};
|
||||||
|
int m_Value{};
|
||||||
|
char m_ValueFlag{VALUEFLAG_DIRECT};
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlaySPITObject(const PlaySPITObject &orig);
|
||||||
|
// Receive
|
||||||
|
PlaySPITObject(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
const string getPlayerID() const { return m_PlayerID; }
|
||||||
|
const string getSPITObjectID() const { return m_SPITObjectID; }
|
||||||
|
long long getFrameInsideObject() const { return m_FrameInsideObject; }
|
||||||
|
bool getPlayPrePosition() const { return m_PlayPrePosition; }
|
||||||
|
int getValue() const { return m_Value; }
|
||||||
|
char getValueFlag() const { return m_ValueFlag; }
|
||||||
|
// Send
|
||||||
|
PlaySPITObject();
|
||||||
|
|
||||||
|
void setPlayerID(string p_PlayerID) { m_PlayerID = p_PlayerID; }
|
||||||
|
void setID(string p_ID) { m_SPITObjectID = p_ID; }
|
||||||
|
void setFrameInsideObject(long long p_TimeInside) { m_FrameInsideObject = p_TimeInside; }
|
||||||
|
void setPlayPrePosition(bool p_PlayOldPosition) { m_PlayPrePosition = p_PlayOldPosition; }
|
||||||
|
void setValue(int p_Value) { m_Value = p_Value; }
|
||||||
|
void setValueFlag(char p_ValueFlag) { m_ValueFlag = p_ValueFlag; }
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- PlaySPITEnd -----------
|
||||||
|
class PlaySPITEnd : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 39;
|
||||||
|
static constexpr int BYTESLENGTH = 45;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_PlayerID{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlaySPITEnd(const PlaySPITEnd &orig);
|
||||||
|
// Receive
|
||||||
|
PlaySPITEnd(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
const string getPlayerID() const { return m_PlayerID; }
|
||||||
|
|
||||||
|
// Send
|
||||||
|
PlaySPITEnd(string p_PlayerID);
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------- ReportPlayStatus -----------
|
||||||
|
|
||||||
|
class ReportPlayStatus : public OPPart {
|
||||||
|
public:
|
||||||
|
static constexpr int OPFLAG = 40;
|
||||||
|
static constexpr int BYTESLENGTH = 57;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string m_SPITObjectID{};
|
||||||
|
long long m_FrameInsideObject{}; // Frames
|
||||||
|
int m_Value{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
ReportPlayStatus(const ReportPlayStatus &orig);
|
||||||
|
// Receive
|
||||||
|
ReportPlayStatus(unique_ptr<Header> p_Header);
|
||||||
|
bool parse(const std::vector<char> &message);
|
||||||
|
|
||||||
|
const string getID() const { return m_SPITObjectID; }
|
||||||
|
long long getFrameInsideObject() const { return m_FrameInsideObject; }
|
||||||
|
int getValue() const { return m_Value; }
|
||||||
|
// Send
|
||||||
|
ReportPlayStatus();
|
||||||
|
|
||||||
|
void setID(string p_ID);
|
||||||
|
void setFrameInsideObject(long long p_TimeInside);
|
||||||
|
void setValue(int p_Value);
|
||||||
|
bool fillBytes(std::vector<char> &message);
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------- static helper functions ----------------------------
|
||||||
|
public:
|
||||||
|
static bool isSystemLittleEndian();
|
||||||
|
static optional<int> getInt(const std::vector<char> &message, int &offset);
|
||||||
|
static optional<long long> getLong(const std::vector<char> &message, int &offset);
|
||||||
|
static optional<bool> getBoolean(const std::vector<char> &message, int &offset);
|
||||||
|
static optional<char> getByte(const std::vector<char> &message, int &offset);
|
||||||
|
static int setInt(int value, std::vector<char> &message, int offset);
|
||||||
|
static int setLong(long long value, std::vector<char> &message, int offset);
|
||||||
|
static int setBoolean(bool value, std::vector<char> &message, int offset);
|
||||||
|
static int setByte(int value, std::vector<char> &message, int offset);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the string char* of the part of the byte sequence (0x00 null terminated).
|
||||||
|
* @param p_Bytes the byte array
|
||||||
|
* @param offset the startposition of strings bytes
|
||||||
|
* @param p_Length the length of the string included the null terminate byte (0x00).
|
||||||
|
* The length of the string will be p_Length -1.
|
||||||
|
*/
|
||||||
|
static optional<string> getString(const std::vector<char> &message, int &offset, int maxLength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill the p_String in the byte array.
|
||||||
|
* If p_String length is greater than p_Length -1, the p_String will be truncated.
|
||||||
|
* CAUTION the return value should be freed after use.
|
||||||
|
* @param p_String the string
|
||||||
|
* @param p_Length the maximal length of the string included the null character.
|
||||||
|
* @throws Exception if p_String == nullptr, p_Bytes == nullptr
|
||||||
|
* p_Offset less than 0
|
||||||
|
* p_ByteCount less than p_Offset + p_Length
|
||||||
|
* @return p_Length
|
||||||
|
*/
|
||||||
|
static int setString(string p_String, std::vector<char> &message, int p_Offset, int p_Length);
|
||||||
|
};
|
||||||
|
#endif /* SPIT_MESSAGE_H */
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class SpitRepo {
|
||||||
|
public:
|
||||||
|
bool hasEntry(const string &id) {
|
||||||
|
return mEntries.contains(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
T *getEntry(const string &id) {
|
||||||
|
auto i = mEntries.find(id);
|
||||||
|
if (i == mEntries.end()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return i->second.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const T &getEntryRef(const string &id) {
|
||||||
|
return *mEntries.at(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
T *getEntry(int index) {
|
||||||
|
if (index >= 0 && index < mEntries.size()) {
|
||||||
|
return next(mEntries.begin(), index)->second.get();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
const T &getEntryRef(int index) {
|
||||||
|
if (index >= 0 && index < mEntries.size()) {
|
||||||
|
auto i = next(mEntries.begin(), index);
|
||||||
|
return *i->second;
|
||||||
|
} else {
|
||||||
|
throw "SPITObject index out of range";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addEntry(unique_ptr<T> entry) {
|
||||||
|
mEntries[entry->getID()] = move(entry);
|
||||||
|
}
|
||||||
|
bool removeEntry(const T &entry) {
|
||||||
|
return removeEntry(entry.getID());
|
||||||
|
}
|
||||||
|
bool removeEntry(const string &id) {
|
||||||
|
auto i = mEntries.find(id);
|
||||||
|
if (i == mEntries.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
mEntries.erase(i);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int getEntryCount() {
|
||||||
|
return mEntries.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
unordered_map<string, unique_ptr<T>> &getRepo() {
|
||||||
|
return mEntries;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearEntries() {
|
||||||
|
mEntries.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unordered_map<string, unique_ptr<T>> mEntries;
|
||||||
|
};
|
||||||
@@ -0,0 +1,364 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SPITObject describes a SPIT Object
|
||||||
|
* File: SPITObject.cpp
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 9. April 2019, 12:11
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SPITObject.h"
|
||||||
|
#include "SPITSocket.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clears all unconfirmed SPITObjects not created by this SPIT_Client.
|
||||||
|
*/
|
||||||
|
void SPITObject::clearUnconfirmedSPITObjects(SpitRepo<SPITObject> &repo) {
|
||||||
|
auto &entries = repo.getRepo();
|
||||||
|
for (auto i = entries.begin(); i != entries.end();) {
|
||||||
|
SPITObject *ptrSPITObject = i->second.get();
|
||||||
|
if (ptrSPITObject->getCreatedByClient() == false && ptrSPITObject->getConfirmed() == false) {
|
||||||
|
i = entries.erase(i);
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPITObject::eventProjectClosed(SpitRepo<SPITObject> &repo, SpitRepo<SPITObject> &remoteRepo) {
|
||||||
|
auto &entries = repo.getRepo();
|
||||||
|
for (auto i = entries.begin(); i != entries.end(); ) {
|
||||||
|
SPITObject *ptrSPITObject = i->second.get();
|
||||||
|
if (ptrSPITObject->getCreatedByClient() == true) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i = entries.erase(i);
|
||||||
|
}
|
||||||
|
// Remote
|
||||||
|
remoteRepo.clearEntries();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* sets confirmed = false for all SPITObjects.
|
||||||
|
* This should be called when the client has loaded a project.
|
||||||
|
*/
|
||||||
|
void SPITObject::setConfirmedFalse(SpitRepo<SPITObject> &repo) {
|
||||||
|
auto &entries = repo.getRepo();
|
||||||
|
for (auto i = entries.begin(); i != entries.end(); i++) {
|
||||||
|
i->second->setConfirmed(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITObject::SPITObject(string p_ID) {
|
||||||
|
m_ID = p_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SPITObject::setMessageOP(SPIT_Message::ReportSPITObject *p_ReportSPITObject) {
|
||||||
|
bool boolChangeAllowed;
|
||||||
|
bool boolChanged = false;
|
||||||
|
|
||||||
|
if (m_CreatedByClient == true && m_Fixed == true) {
|
||||||
|
boolChangeAllowed = false;
|
||||||
|
} else {
|
||||||
|
boolChangeAllowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirmation should be changable
|
||||||
|
if (m_CreatedByClient) {
|
||||||
|
// Server reports a client created SPITType -> the type is confirmed
|
||||||
|
m_Confirmed = true;
|
||||||
|
} else {
|
||||||
|
// type is NOT client created -> the client has to confirm the SPITtype
|
||||||
|
m_Confirmed = p_ReportSPITObject->getConfirmed();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Delay != p_ReportSPITObject->getDelay()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Delay = p_ReportSPITObject->getDelay();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Duration != p_ReportSPITObject->getDuration()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Duration = p_ReportSPITObject->getDuration();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Fixed != p_ReportSPITObject->getFixed()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Fixed = p_ReportSPITObject->getFixed();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_FrameFadeInLength != p_ReportSPITObject->getFrameFadeInLength()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_FrameFadeInLength = p_ReportSPITObject->getFrameFadeInLength();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_FrameFadeOutLength != p_ReportSPITObject->getFrameFadeOutLength()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_FrameFadeOutLength = p_ReportSPITObject->getFrameFadeOutLength();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_FrameLength != p_ReportSPITObject->getFrameLength()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_FrameLength = p_ReportSPITObject->getFrameLength();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_FrameStart != p_ReportSPITObject->getFrameStart()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_FrameStart = p_ReportSPITObject->getFrameStart();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Remark != p_ReportSPITObject->getRemark()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Remark = p_ReportSPITObject->getRemark();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ID != p_ReportSPITObject->getID()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ID = p_ReportSPITObject->getID();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Name != p_ReportSPITObject->getName()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Name = p_ReportSPITObject->getName();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_SPITTypeID != p_ReportSPITObject->getSPITTypeID()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_SPITTypeID = p_ReportSPITObject->getSPITTypeID();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ServerParams != p_ReportSPITObject->getServerParams()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ServerParams = p_ReportSPITObject->getServerParams();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ServerRemote != p_ReportSPITObject->getServerRemote()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ServerRemote = p_ReportSPITObject->getServerRemote();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Track != p_ReportSPITObject->getTrack()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Track = p_ReportSPITObject->getTrack();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ValueFactor != p_ReportSPITObject->getValueFactor()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ValueFactor = p_ReportSPITObject->getValueFactor();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ValueUse != p_ReportSPITObject->getValueUse()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ValueUse = p_ReportSPITObject->getValueUse();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
return boolChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPITObject::fillMessageOP(SPIT_Message::ReportSPITObject &p_ReportSPITObject) {
|
||||||
|
p_ReportSPITObject.setActionAssigned(getActionAssigned()); // Action can be assigned to type or to this object
|
||||||
|
p_ReportSPITObject.setConfirmed(m_Confirmed);
|
||||||
|
p_ReportSPITObject.setDelay(m_Delay);
|
||||||
|
p_ReportSPITObject.setDuration(m_Duration);
|
||||||
|
p_ReportSPITObject.setFixed(m_Fixed);
|
||||||
|
p_ReportSPITObject.setFrameFadeInLength(m_FrameFadeInLength);
|
||||||
|
p_ReportSPITObject.setFrameFadeOutLength(m_FrameFadeOutLength);
|
||||||
|
p_ReportSPITObject.setFrameLength(m_FrameLength);
|
||||||
|
p_ReportSPITObject.setFrameStart(m_FrameStart);
|
||||||
|
p_ReportSPITObject.setID(m_ID);
|
||||||
|
p_ReportSPITObject.setName(m_Name);
|
||||||
|
p_ReportSPITObject.setRemark(m_Remark);
|
||||||
|
p_ReportSPITObject.setSPITTypeID(m_SPITTypeID);
|
||||||
|
p_ReportSPITObject.setServerParams(m_ServerParams);
|
||||||
|
p_ReportSPITObject.setServerRemote(m_ServerRemote);
|
||||||
|
p_ReportSPITObject.setTrack(m_Track);
|
||||||
|
p_ReportSPITObject.setValueFactor(m_ValueFactor);
|
||||||
|
p_ReportSPITObject.setValueUse(m_ValueUse);
|
||||||
|
}
|
||||||
|
void SPITObject::fillMessageOP(SPIT_Message::RemoveSPITObject &p_RemoveSPITObject) {
|
||||||
|
p_RemoveSPITObject.setID(m_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used by the server and client to tell if the other side has registered the changes.
|
||||||
|
* @param p_Confirmed
|
||||||
|
* @return if m_Confirmed has changed
|
||||||
|
*/
|
||||||
|
bool SPITObject::setConfirmed(bool p_Confirmed) {
|
||||||
|
if (m_Confirmed == p_Confirmed)
|
||||||
|
return false;
|
||||||
|
m_Confirmed = p_Confirmed;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SPITObject::setName(string p_Name) {
|
||||||
|
if (m_Name == p_Name)
|
||||||
|
return false;
|
||||||
|
m_Name = p_Name;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setRemark(string p_Remark) {
|
||||||
|
if (m_Remark == p_Remark)
|
||||||
|
return false;
|
||||||
|
m_Remark = p_Remark;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setServerParams(string p_ServerParams) {
|
||||||
|
if (m_ServerParams == p_ServerParams)
|
||||||
|
return false;
|
||||||
|
m_ServerParams = p_ServerParams;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setSPITTypeID(string p_SPITTypeID) {
|
||||||
|
if (m_SPITTypeID == p_SPITTypeID)
|
||||||
|
return false;
|
||||||
|
m_SPITTypeID = p_SPITTypeID;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setServerRemote(bool p_BelongstoServer) {
|
||||||
|
if (m_ServerRemote == p_BelongstoServer)
|
||||||
|
return false;
|
||||||
|
m_ServerRemote = p_BelongstoServer;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is a virtual construct - ActionAssignedType is not implemented in the SPITProtocol.
|
||||||
|
* This is used when an action is associated with a SPITType.
|
||||||
|
* Then this action is done for every SPITObject with the SPITType.
|
||||||
|
* @return true = an action is assigned for the SPITType.
|
||||||
|
*/
|
||||||
|
bool SPITObject::setActionAssignedType(bool p_ActionAssigned) {
|
||||||
|
if (m_ActionAssignedType == p_ActionAssigned)
|
||||||
|
return false;
|
||||||
|
bool boolOldActionAssigend;
|
||||||
|
boolOldActionAssigend = getActionAssigned();
|
||||||
|
m_ActionAssignedType = p_ActionAssigned;
|
||||||
|
if (getActionAssigned() == boolOldActionAssigend)
|
||||||
|
return false;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setActionAssigned(bool p_ActionAssigned) {
|
||||||
|
if (m_ActionAssigned == p_ActionAssigned)
|
||||||
|
return false;
|
||||||
|
bool boolOldActionAssigend;
|
||||||
|
boolOldActionAssigend = getActionAssigned();
|
||||||
|
m_ActionAssigned = p_ActionAssigned;
|
||||||
|
if (getActionAssigned() == boolOldActionAssigend)
|
||||||
|
return false;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setFixed(bool p_Fixed) {
|
||||||
|
if (m_Fixed == p_Fixed)
|
||||||
|
return false;
|
||||||
|
m_Fixed = p_Fixed;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setFrameStart(long long p_FrameStart) {
|
||||||
|
if (m_FrameStart == p_FrameStart)
|
||||||
|
return false;
|
||||||
|
m_FrameStart = p_FrameStart;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setFrameLength(long long p_FrameLength) {
|
||||||
|
if (m_FrameLength == p_FrameLength)
|
||||||
|
return false;
|
||||||
|
m_FrameLength = p_FrameLength;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setFrameFadeInLength(long long p_FrameFadeInLength) {
|
||||||
|
if (m_FrameFadeInLength == p_FrameFadeInLength)
|
||||||
|
return false;
|
||||||
|
m_FrameFadeInLength = p_FrameFadeInLength;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setFrameFadeOutLength(long long p_FrameFadeOutLength) {
|
||||||
|
if (m_FrameFadeOutLength == p_FrameFadeOutLength)
|
||||||
|
return false;
|
||||||
|
m_FrameFadeOutLength = p_FrameFadeOutLength;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setValueUse(char p_ValueUse) {
|
||||||
|
if (m_ValueUse == p_ValueUse)
|
||||||
|
return false;
|
||||||
|
m_ValueUse = p_ValueUse;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setValueFactor(int p_ValueFactor) {
|
||||||
|
if (m_ValueFactor == p_ValueFactor)
|
||||||
|
return false;
|
||||||
|
m_ValueFactor = p_ValueFactor;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setTrack(int p_Track) {
|
||||||
|
if (m_Track == p_Track)
|
||||||
|
return false;
|
||||||
|
m_Track = p_Track;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setDelay(long long p_Delay) {
|
||||||
|
if (m_Delay == p_Delay)
|
||||||
|
return false;
|
||||||
|
m_Delay = p_Delay;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITObject::setDuration(long long p_Duration) {
|
||||||
|
if (m_Duration == p_Duration)
|
||||||
|
return false;
|
||||||
|
m_Duration = p_Duration;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SPITPlayer describes a virtual SPIT Player.
|
||||||
|
* File: SPITPLayer.cpp
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 30. April 2019, 11:44
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SPITPlayer.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
unordered_map<string, unique_ptr<SPITPlayer>> SPITPlayer::s_SPITPlayers;
|
||||||
|
|
||||||
|
SPITPlayer &SPITPlayer::getSPITPlayer(string p_PlayerID) {
|
||||||
|
auto i = s_SPITPlayers.find(p_PlayerID);
|
||||||
|
if (i == s_SPITPlayers.end()) {
|
||||||
|
s_SPITPlayers[p_PlayerID] = make_unique<SPITPlayer>(p_PlayerID);
|
||||||
|
}
|
||||||
|
return *s_SPITPlayers.at(p_PlayerID);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITPlayer::SPITPlayer(string p_PlayerID) {
|
||||||
|
m_ID = p_PlayerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITPlayer::~SPITPlayer() {
|
||||||
|
m_PlaySPITTypes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param p_SPITObjectID
|
||||||
|
* @return true = new PlayObject added<br>
|
||||||
|
* false = PlayObject exists
|
||||||
|
*/
|
||||||
|
SPITPlayer::PlaySPITType *SPITPlayer::addSPITType_Playing(string p_SPITTypeID) {
|
||||||
|
PlaySPITType *ptrPlaySPITType;
|
||||||
|
auto i = m_PlaySPITTypes.find(p_SPITTypeID);
|
||||||
|
if (i == m_PlaySPITTypes.end()) {
|
||||||
|
auto playSpitType = make_unique<PlaySPITType>(this, p_SPITTypeID);
|
||||||
|
ptrPlaySPITType = playSpitType.get();
|
||||||
|
m_PlaySPITTypes[p_SPITTypeID] = move(playSpitType);
|
||||||
|
} else {
|
||||||
|
ptrPlaySPITType = i->second.get();
|
||||||
|
}
|
||||||
|
ptrPlaySPITType->setIsPlayed(true);
|
||||||
|
return ptrPlaySPITType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPITPlayer::startPlaySequence() {
|
||||||
|
for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) {
|
||||||
|
PlaySPITType *ptrPlaySPITType = i->second.get();
|
||||||
|
ptrPlaySPITType->startPlaySequence();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPITPlayer::endPlaySequence() {
|
||||||
|
for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end();) {
|
||||||
|
if (i->second.get()->getIsPlayed() == false) {
|
||||||
|
i = m_PlaySPITTypes.erase(i);
|
||||||
|
} else {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITPlayer::PlaySPITType::PlaySPITType(SPITPlayer *p_SPITPlayer, string p_SPITTypeID) {
|
||||||
|
m_IsNew = true;
|
||||||
|
|
||||||
|
m_SPITTypeID = p_SPITTypeID;
|
||||||
|
m_PlayerID = p_SPITPlayer->getID();
|
||||||
|
m_PlayerName = p_SPITPlayer->getName();
|
||||||
|
startPlaySequence();
|
||||||
|
m_IsNew = true;
|
||||||
|
}
|
||||||
|
SPITPlayer::PlaySPITType::PlaySPITType(const PlaySPITType &orig) {
|
||||||
|
m_SPITTypeID = orig.getSPITTypeID();
|
||||||
|
m_IsPlayed = orig.getIsPlayed();
|
||||||
|
m_IsNew = orig.getIsNew();
|
||||||
|
|
||||||
|
m_PlayerID = orig.getPlayerID();
|
||||||
|
m_PlayerName = orig.getPlayerName();
|
||||||
|
m_PlayerRuns = orig.getPlayerIsRunning();
|
||||||
|
|
||||||
|
m_Value = orig.getValue();
|
||||||
|
}
|
||||||
|
void SPITPlayer::PlaySPITType::startPlaySequence() {
|
||||||
|
m_IsPlayed = false;
|
||||||
|
m_IsNew = false;
|
||||||
|
|
||||||
|
m_Value = 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,223 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unix implementation of a SPITSocket.
|
||||||
|
*
|
||||||
|
* File: UnixSocket.cpp
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 12. April 2019, 15:58
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SPITSocket.h"
|
||||||
|
#include "Task.hpp"
|
||||||
|
#include "esp/uuid.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_netif.h"
|
||||||
|
#include <string>
|
||||||
|
#include <unistd.h>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates socket. If there exist some, they will be closed.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool SPITSocket::createSocket_UDP() {
|
||||||
|
if (m_UDPSocketIP4 != INVALID_SOCKET) {
|
||||||
|
close(m_UDPSocketIP4);
|
||||||
|
m_UDPSocketIP4 = INVALID_SOCKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_UDPSocketIP4 = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
int intResult = -1;
|
||||||
|
bool success = true;
|
||||||
|
if (m_UDPSocketIP4 == INVALID_SOCKET) {
|
||||||
|
success = false;
|
||||||
|
} else {
|
||||||
|
int intOptionValue4 = 1;
|
||||||
|
intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_REUSEADDR, (void *)&intOptionValue4, sizeof(intOptionValue4));
|
||||||
|
}
|
||||||
|
if (intResult < 0) {
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success == true) {
|
||||||
|
struct timeval tv;
|
||||||
|
tv.tv_sec = 1; // seconds
|
||||||
|
tv.tv_usec = 0; // microseconds (0.0 sec)
|
||||||
|
// This sets the receive timeout
|
||||||
|
setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
|
||||||
|
|
||||||
|
// set the m_UDPSocketIP4 in NON BLOCKING mode because
|
||||||
|
// if the UDPSockets are in blocking mode the receiveMessage does not return in every constellation
|
||||||
|
// int intFlags;
|
||||||
|
// intFlags = fcntl(m_UDPSocketIP4, F_GETFL);
|
||||||
|
// fcntl(m_UDPSocketIP4, F_SETFL, intFlags | O_NONBLOCK);
|
||||||
|
|
||||||
|
// int intBufferSize = 2046 * 512;
|
||||||
|
// intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_RCVBUF, (void*)&intBufferSize, sizeof(intBufferSize));
|
||||||
|
// intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_SNDBUF, (void*)&intBufferSize, sizeof(intBufferSize));
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binds the socket to the client's ip address and port. The socket option SO_REUSEADDR is set to true.
|
||||||
|
* @param clientIp ip address of the client
|
||||||
|
* @param clientPort port of the client.
|
||||||
|
* if p_Port == "0" any free port will be used
|
||||||
|
* @return -1 id bind fails, o if bind is ok
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int SPITSocket::bindSocket(string clientIp, string clientPort) {
|
||||||
|
string stringClientPort;
|
||||||
|
if (clientPort.length() <= 0)
|
||||||
|
stringClientPort = "0";
|
||||||
|
else
|
||||||
|
stringClientPort = clientPort;
|
||||||
|
addrinfo *clientAI;
|
||||||
|
if (getaddrinfo(clientIp.data(), clientPort.data(), nullptr, &clientAI) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (m_UDPSocketIP4 == INVALID_SOCKET) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
auto *socketAdr = (sockaddr_in *)(clientAI->ai_addr);
|
||||||
|
int intSocklen = sizeof(*socketAdr);
|
||||||
|
// copy the socketAdr, may be not filled correct by getaddrinfo
|
||||||
|
sockaddr_in o_IP4SocketAddress;
|
||||||
|
memset(&o_IP4SocketAddress, 0, intSocklen);
|
||||||
|
o_IP4SocketAddress.sin_addr = socketAdr->sin_addr;
|
||||||
|
o_IP4SocketAddress.sin_family = socketAdr->sin_family;
|
||||||
|
o_IP4SocketAddress.sin_port = socketAdr->sin_port;
|
||||||
|
int intResult = bind(m_UDPSocketIP4, (const sockaddr *)(socketAdr), (socklen_t)intSocklen);
|
||||||
|
if (intResult < 0) {
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
if ((intResult == 0) &&
|
||||||
|
(getsockname(m_UDPSocketIP4, (sockaddr *)socketAdr, (socklen_t *)&intSocklen) != -1)) {
|
||||||
|
setBoundClientPort(to_string((int)socketAdr->sin_port));
|
||||||
|
}
|
||||||
|
freeaddrinfo(clientAI);
|
||||||
|
|
||||||
|
setIsBound(intResult != -1);
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the socket are broadcast sockets or not. Set the sockopt SO_BROADCAST to 0 or 1
|
||||||
|
* @param p_Broadcast true SO_BROADCAST is set
|
||||||
|
* false = SO_BROADCAST is not set
|
||||||
|
* @return 0 = ok, -1 = error
|
||||||
|
*/
|
||||||
|
int SPITSocket::setBroadcast(bool broadcast) const {
|
||||||
|
int intOptionValue = broadcast ? 1 : 0;
|
||||||
|
int intResult = setsockopt(m_UDPSocketIP4, SOL_SOCKET, SO_BROADCAST, &intOptionValue, sizeof(int));
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param ip the ip address of the server
|
||||||
|
* @param port the port of the server
|
||||||
|
* @param msg buffer containing the message
|
||||||
|
* @param msgLength the length of the message
|
||||||
|
* @return -1 send fails
|
||||||
|
* 0 send is done
|
||||||
|
*/
|
||||||
|
int SPITSocket::sendMessageTo(const string &ip, const string &port, const char *message, int msgLength) {
|
||||||
|
if (m_UDPSocketIP4 == INVALID_SOCKET) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepare AddressInfo
|
||||||
|
int intResult = -1;
|
||||||
|
addrinfo *ptrAddressInfo;
|
||||||
|
if (getaddrinfo(ip.data(), port.data(), nullptr, &ptrAddressInfo) != 0) {
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto *ptrIP4SocketAddress = (sockaddr_in *)(ptrAddressInfo->ai_addr);
|
||||||
|
int intSocklen = sizeof(*ptrIP4SocketAddress);
|
||||||
|
if (m_UDPSocketIP4 != INVALID_SOCKET) {
|
||||||
|
// copy the ptrIP4SocketAddress, may be not filled correct by getaddrinfo
|
||||||
|
sockaddr_in o_IP4SocketAddress;
|
||||||
|
memset(&o_IP4SocketAddress, 0, intSocklen);
|
||||||
|
o_IP4SocketAddress.sin_addr = ptrIP4SocketAddress->sin_addr;
|
||||||
|
o_IP4SocketAddress.sin_family = ptrIP4SocketAddress->sin_family;
|
||||||
|
o_IP4SocketAddress.sin_port = ptrIP4SocketAddress->sin_port;
|
||||||
|
intResult = sendto(m_UDPSocketIP4, message, msgLength, 0, (const sockaddr *)&o_IP4SocketAddress, (socklen_t)intSocklen);
|
||||||
|
if (intResult < 0) {
|
||||||
|
ESP_LOGE("SPIT", "sendMessageTo IP4 sendto %s FAILED %s\n", ip.data(), strerror(errno));
|
||||||
|
ESP_LOGE("SPIT", "sendMessageTo ret=%d %s / %s / %d\n", intResult, port.data(), message, msgLength);
|
||||||
|
}
|
||||||
|
freeaddrinfo(ptrAddressInfo);
|
||||||
|
}
|
||||||
|
if (intResult < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Call this for receiving a message
|
||||||
|
* This will block until a message is received or the underlying socket is closed
|
||||||
|
* @param p_Buffer the buffer containing the received message later.
|
||||||
|
* @param p_BufferLength the size of the buffer
|
||||||
|
* @param p_ServerIP a pointer to a string, when a messages is received the string will contain the ip address of the sender/server
|
||||||
|
* if p_ServerIP is NULL - no detection of the server will be done.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int SPITSocket::receiveMessage(char *p_Buffer, int p_BufferLength, string *serverIp) const {
|
||||||
|
int intResult = -1;
|
||||||
|
if (m_UDPSocketIP4 == INVALID_SOCKET) {
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
sockaddr_in o_IP4SocketAddress;
|
||||||
|
int intSocklen = sizeof(o_IP4SocketAddress);
|
||||||
|
memset(&o_IP4SocketAddress, 0, intSocklen);
|
||||||
|
intResult = recvfrom(m_UDPSocketIP4, (void *)p_Buffer, p_BufferLength, 0, (sockaddr *)&o_IP4SocketAddress, (socklen_t *)&intSocklen);
|
||||||
|
if (intResult >= 0 && serverIp != nullptr) {
|
||||||
|
char bufferIP4[INET_ADDRSTRLEN];
|
||||||
|
inet_ntop(AF_INET, &(o_IP4SocketAddress.sin_addr), bufferIP4, intSocklen);
|
||||||
|
*serverIp = bufferIP4;
|
||||||
|
}
|
||||||
|
return intResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITSocket::IPAddress SPITSocket::getAdaptersInfo() {
|
||||||
|
// iterate over active interfaces, and print out IPs
|
||||||
|
esp_netif_t *netif = nullptr;
|
||||||
|
if ((netif = esp_netif_next_unsafe(netif)) != nullptr) {
|
||||||
|
ESP_LOGI("SPIT", "Connected to %s", esp_netif_get_desc(netif));
|
||||||
|
esp_netif_ip_info_t ip;
|
||||||
|
ESP_ERROR_CHECK(esp_netif_get_ip_info(netif, &ip));
|
||||||
|
ESP_LOGI("SPIT", "- IPv4 address: " IPSTR ",", IP2STR(&ip.ip));
|
||||||
|
ESP_LOGI("SPIT", "- IPv4 netmask: " IPSTR ",", IP2STR(&ip.netmask));
|
||||||
|
char buffer[64];
|
||||||
|
sprintf(buffer, IPSTR, IP2STR(&ip.ip));
|
||||||
|
string stringIP4 = buffer;
|
||||||
|
sprintf(buffer, IPSTR, IP2STR(&ip.netmask));
|
||||||
|
string stringSubnet = buffer;
|
||||||
|
return {stringIP4, stringSubnet};
|
||||||
|
}
|
||||||
|
return {"0.0.0.0", "0.0.0.0"};
|
||||||
|
}
|
||||||
|
|
||||||
|
string createGUID() {
|
||||||
|
uuid_t uu;
|
||||||
|
uuid_generate(uu);
|
||||||
|
char uu_str[UUID_STR_LEN];
|
||||||
|
uuid_unparse(uu, uu_str);
|
||||||
|
return {uu_str};
|
||||||
|
}
|
||||||
|
|
||||||
|
string getClientHostName() {
|
||||||
|
const char *hostname;
|
||||||
|
esp_netif_get_hostname(esp_netif_get_default_netif(), &hostname);
|
||||||
|
if (hostname != nullptr) {
|
||||||
|
return {hostname};
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SPITType describes a SPIT Type
|
||||||
|
* File: SPITType.cpp
|
||||||
|
* Author: Hagi
|
||||||
|
*
|
||||||
|
* Created on 8. April 2019, 08:40
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SPITType.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
static const char *TAG = "SPIT";
|
||||||
|
|
||||||
|
void SPITType::eventProjectClosed(SpitRepo<SPITType> &repo, SpitRepo<SPITType> &remoteRepo) {
|
||||||
|
auto &entries = repo.getRepo();
|
||||||
|
for (auto i = entries.begin(); i != entries.end();) {
|
||||||
|
SPITType *ptrSPITType = i->second.get();
|
||||||
|
if (ptrSPITType->getCreatedByClient() == true) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i = entries.erase(i);
|
||||||
|
}
|
||||||
|
// Remote
|
||||||
|
remoteRepo.clearEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets confirmed = false for all SPITTypes.
|
||||||
|
* This should be called when the client has loaded a project.
|
||||||
|
*/
|
||||||
|
void SPITType::setConfirmedFalse(SpitRepo<SPITType> &repo) {
|
||||||
|
auto &entries = repo.getRepo();
|
||||||
|
for (auto i = entries.begin(); i != entries.end(); i++) {
|
||||||
|
i->second->setConfirmed(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITType::SPITType(string p_ID) {
|
||||||
|
m_ID = p_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPITType::SPITType(string id, string grpName, string name, bool fixed, bool projectIndependent, long long defaultDelay, long long defaultDuration) {
|
||||||
|
m_ActionAssigned = false;
|
||||||
|
m_Confirmed = false;
|
||||||
|
m_ID = id;
|
||||||
|
m_GroupName = grpName;
|
||||||
|
m_Name = name;
|
||||||
|
m_Fixed = fixed;
|
||||||
|
m_ServerProjectIndepended = projectIndependent;
|
||||||
|
m_DefaultDelay = defaultDelay;
|
||||||
|
m_DefaultDuration = defaultDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPITType::setCreatedByClient(bool p_CreatedByClient) {
|
||||||
|
m_CreatedByClient = p_CreatedByClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used by the server and client to tell if the other side has registered the changes.
|
||||||
|
* @param p_Confirmed
|
||||||
|
* @return if m_Confirmed has changed
|
||||||
|
*/
|
||||||
|
bool SPITType::setConfirmed(bool p_Confirmed) {
|
||||||
|
if (m_Confirmed == p_Confirmed)
|
||||||
|
return false;
|
||||||
|
m_Confirmed = p_Confirmed;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SPITType::setGroupName(const string &p_GroupName) {
|
||||||
|
if (m_GroupName == p_GroupName)
|
||||||
|
return false;
|
||||||
|
m_GroupName = p_GroupName;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITType::setName(const string &p_Name) {
|
||||||
|
if (m_Name == p_Name)
|
||||||
|
return false;
|
||||||
|
m_Name = p_Name;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITType::setServerRemote(bool p_BelongstoServer) {
|
||||||
|
if (m_ServerRemote == p_BelongstoServer)
|
||||||
|
return false;
|
||||||
|
m_ServerRemote = p_BelongstoServer;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITType::setProjectIndepended(bool p_ProjectIndepended) {
|
||||||
|
if (m_ServerProjectIndepended == p_ProjectIndepended)
|
||||||
|
return false;
|
||||||
|
m_ServerProjectIndepended = p_ProjectIndepended;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITType::setFixed(bool p_Fixed) {
|
||||||
|
if (m_Fixed == p_Fixed)
|
||||||
|
return false;
|
||||||
|
m_Fixed = p_Fixed;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITType::setDefaultDelay(long long p_Delay) {
|
||||||
|
if (m_DefaultDelay == p_Delay)
|
||||||
|
return false;
|
||||||
|
m_DefaultDelay = p_Delay;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool SPITType::setDefaultDuration(long long p_Duration) {
|
||||||
|
if (m_DefaultDuration == p_Duration)
|
||||||
|
return false;
|
||||||
|
m_DefaultDuration = p_Duration;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual construct - means ActionAssigned for SPITTypes is is not implemented in SPITProtocol.
|
||||||
|
* This can used to setActionAssigned to all SPITObjects with this SPITType.
|
||||||
|
* This may be used in the case when the same action should be done for every SPITObject with this SPITType associated.
|
||||||
|
* @return true = the m_ActionAssigned has changed.
|
||||||
|
*/
|
||||||
|
bool SPITType::setActionAssigned(bool p_ActionAssigned) {
|
||||||
|
if (m_ActionAssigned == p_ActionAssigned)
|
||||||
|
return false;
|
||||||
|
m_ActionAssigned = p_ActionAssigned;
|
||||||
|
m_Confirmed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the content of the SPITType as received from the server
|
||||||
|
* @param p_ReportSPITType
|
||||||
|
* @return true = the SPITType is changed
|
||||||
|
* false = the SPITType is NOT changed, because it is not allowed to change.
|
||||||
|
*/
|
||||||
|
bool SPITType::setMessageOP(SPIT_Message::ReportSPITType &reportSpitType) {
|
||||||
|
bool boolChangeAllowed;
|
||||||
|
bool boolChanged = false;
|
||||||
|
|
||||||
|
if (m_CreatedByClient == true && m_Fixed == true) {
|
||||||
|
boolChangeAllowed = false;
|
||||||
|
} else {
|
||||||
|
boolChangeAllowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirmation should be changeable
|
||||||
|
if (m_CreatedByClient) {
|
||||||
|
// Server reports a client created SPITType -> the type is confirmed
|
||||||
|
m_Confirmed = true;
|
||||||
|
} else {
|
||||||
|
// type is NOT client created -> the client has to confirm the SPITtype
|
||||||
|
m_Confirmed = reportSpitType.getConfirmed();
|
||||||
|
}
|
||||||
|
if (m_DefaultDelay != reportSpitType.getDelay()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_DefaultDelay = reportSpitType.getDelay();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_DefaultDuration != reportSpitType.getDuration()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_DefaultDuration = reportSpitType.getDuration();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Fixed != reportSpitType.getFixed()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Fixed = reportSpitType.getFixed();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_GroupName != reportSpitType.getGroupName()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_GroupName = reportSpitType.getGroupName();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ID != reportSpitType.getID()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ID = reportSpitType.getID();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_Name != reportSpitType.getName()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Name = reportSpitType.getName();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ServerProjectIndepended != reportSpitType.getServerProjectIndepended()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ServerProjectIndepended = reportSpitType.getServerProjectIndepended();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
if (m_ServerRemote != reportSpitType.getServerRemote()) {
|
||||||
|
if (boolChangeAllowed == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ServerRemote = reportSpitType.getServerRemote();
|
||||||
|
boolChanged = true;
|
||||||
|
}
|
||||||
|
return boolChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SPITType::fillMessageOP(SPIT_Message::ReportSPITType &smReportSpitType) const {
|
||||||
|
smReportSpitType.setConfirmed(m_Confirmed);
|
||||||
|
smReportSpitType.setDelay(m_DefaultDelay);
|
||||||
|
smReportSpitType.setDuration(m_DefaultDuration);
|
||||||
|
smReportSpitType.setFixed(m_Fixed);
|
||||||
|
smReportSpitType.setGroupName(m_GroupName);
|
||||||
|
smReportSpitType.setID(m_ID);
|
||||||
|
smReportSpitType.setName(m_Name);
|
||||||
|
smReportSpitType.setServerProjectIndepended(m_ServerProjectIndepended);
|
||||||
|
smReportSpitType.setServerRemote(m_ServerRemote);
|
||||||
|
}
|
||||||
|
void SPITType::fillMessageOP(SPIT_Message::RemoveSPITType &smRemoveSpitType) const {
|
||||||
|
smRemoveSpitType.setID(m_ID);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/typester/esp32-uuid/tree/master
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2019 Daisuke Murase (typester)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
#include "uuid.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "esp_random.h"
|
||||||
|
|
||||||
|
void uuid_generate(uuid_t out)
|
||||||
|
{
|
||||||
|
esp_fill_random(out, sizeof(uuid_t));
|
||||||
|
|
||||||
|
/* uuid version */
|
||||||
|
out[6] = 0x40 | (out[6] & 0xF);
|
||||||
|
|
||||||
|
/* uuid variant */
|
||||||
|
out[8] = (0x80 | out[8]) & ~0x40;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t unhex_char(unsigned char s)
|
||||||
|
{
|
||||||
|
if (0x30 <= s && s <= 0x39) { /* 0-9 */
|
||||||
|
return s - 0x30;
|
||||||
|
} else if (0x41 <= s && s <= 0x46) { /* A-F */
|
||||||
|
return s - 0x41 + 0xa;
|
||||||
|
} else if (0x61 <= s && s <= 0x69) { /* a-f */
|
||||||
|
return s - 0x61 + 0xa;
|
||||||
|
} else {
|
||||||
|
/* invalid string */
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unhex(unsigned char *s, size_t s_len, unsigned char *r)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < s_len; i += 2) {
|
||||||
|
uint8_t h = unhex_char(s[i]);
|
||||||
|
uint8_t l = unhex_char(s[i + 1]);
|
||||||
|
if (0xff == h || 0xff == l) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
r[i / 2] = (h << 4) | (l & 0xf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int uuid_parse(const char *in, uuid_t uu)
|
||||||
|
{
|
||||||
|
const char *p = in;
|
||||||
|
uint8_t *op = (uint8_t *)uu;
|
||||||
|
|
||||||
|
if (0 != unhex((unsigned char *)p, 8, op)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += 8;
|
||||||
|
op += 4;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if ('-' != *p++ || 0 != unhex((unsigned char *)p, 4, op)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += 4;
|
||||||
|
op += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('-' != *p++ || 0 != unhex((unsigned char *)p, 12, op)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += 12;
|
||||||
|
op += 6;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uuid_unparse(const uuid_t uu, char *out)
|
||||||
|
{
|
||||||
|
snprintf(out, UUID_STR_LEN,
|
||||||
|
"%02x%02x%02x%02x-%02x%02x-%02x%02x-"
|
||||||
|
"%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||||
|
uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7], uu[8], uu[9], uu[10], uu[11],
|
||||||
|
uu[12], uu[13], uu[14], uu[15]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef uint8_t uuid_t[16];
|
||||||
|
|
||||||
|
#define UUID_STR_LEN 37
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void uuid_generate(uuid_t out);
|
||||||
|
int uuid_parse(const char *in, uuid_t uu);
|
||||||
|
void uuid_unparse(const uuid_t uu, char *out);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,362 @@
|
|||||||
|
-- LiveShowSoftware SPIT-Protocol
|
||||||
|
spit_proto = Proto("spit", "LiveShowSoftware SPIT")
|
||||||
|
spit_sad_proto = Proto("spit_sad", "LiveShowSoftware SPIT SAD")
|
||||||
|
|
||||||
|
-- Define fields (add more as needed)
|
||||||
|
local f_hVer = ProtoField.uint32("spit.version", "Version")
|
||||||
|
local f_hNum = ProtoField.uint8("spit.msgCount", "MsgCount")
|
||||||
|
local f_hLen = ProtoField.uint32("spit.len", "Length")
|
||||||
|
local f_hSerId = ProtoField.string("spit.serverId", "ServerID")
|
||||||
|
local f_hCliId = ProtoField.string("spit.clientId", "ClientID")
|
||||||
|
local f_hType = ProtoField.uint8("spit.msgType", "MsgType")
|
||||||
|
local f_pLen = ProtoField.uint32("spit.paylen", "Length")
|
||||||
|
|
||||||
|
local f_pSession = ProtoField.string("spit.key", "Spit Session")
|
||||||
|
local f_pKey = ProtoField.string("spit.key", "Spit Key")
|
||||||
|
local f_pSadKey = ProtoField.string("spit.sadKey", "Spit SAD Key")
|
||||||
|
local f_pServerDevName = ProtoField.string("spit.serverDevName", "Server Device Name")
|
||||||
|
|
||||||
|
local f_pClientDevName = ProtoField.string("spit.clientDevName", "Client Device Name")
|
||||||
|
local f_pClientName = ProtoField.string("spit.clientName", "Client Name")
|
||||||
|
local f_pLoginName = ProtoField.string("spit.loginName", "Login Name")
|
||||||
|
local f_pLoginPassword = ProtoField.string("spit.loginPassword", "Login Password")
|
||||||
|
local f_pServerName = ProtoField.string("spit.serverName", "Server Name")
|
||||||
|
local f_pServerIp = ProtoField.string("spit.serverIp", "Server IP")
|
||||||
|
local f_pServerPort = ProtoField.uint16("spit.serverIp", "Server Port")
|
||||||
|
local f_pSrvParam = ProtoField.string("spit.serverParam", "Server Paramter")
|
||||||
|
local f_pStepTime = ProtoField.string("spit.stepTime", "Step Time")
|
||||||
|
local f_pConnected = ProtoField.string("spit.connected", "Connected")
|
||||||
|
local f_pProjectId = ProtoField.string("spit.projectId", "Project ID")
|
||||||
|
local f_pProjectName = ProtoField.string("spit.projectName", "Project Name")
|
||||||
|
|
||||||
|
local f_pObjectId = ProtoField.string("spit.ObjectId", "Object ID")
|
||||||
|
local f_pObjectName = ProtoField.string("spit.ObjectName", "Object Name")
|
||||||
|
local f_pTypeId = ProtoField.string("spit.TypeId", "Type ID")
|
||||||
|
local f_pTypeName = ProtoField.string("spit.TypeName", "Type Name")
|
||||||
|
local f_pTypeGroupName = ProtoField.string("spit.TypeGroupName", "Type Group Name")
|
||||||
|
local f_pObjectsFrames = ProtoField.uint64("spit.ObjectFrames", "Object Frames")
|
||||||
|
local f_pValue = ProtoField.uint64("spit.Value", "Value")
|
||||||
|
local f_pValueFlag = ProtoField.uint8("spit.ValueFlag", "ValueFlag")
|
||||||
|
|
||||||
|
local f_pConfirm = ProtoField.uint8("spit.confirmed", "Confirmation")
|
||||||
|
local f_pFixed = ProtoField.uint8("spit.fixed", "Fixed")
|
||||||
|
local f_pAssigned = ProtoField.uint8("spit.assigned", "Action assigned")
|
||||||
|
local f_pSrvRemote = ProtoField.uint8("spit.serverRemote", "Server Remote")
|
||||||
|
local f_pProjIndep = ProtoField.uint8("spit.projectIndipendent", "Project Indipendent")
|
||||||
|
local f_pValueUse = ProtoField.uint8("spit.valueUse", "Value Use")
|
||||||
|
|
||||||
|
local f_pFrameStart = ProtoField.uint64("spit.frameStart", "Frame Start")
|
||||||
|
local f_pFrameLength = ProtoField.uint64("spit.frameLength", "Frame Length")
|
||||||
|
local f_pFrameFadeIn = ProtoField.uint64("spit.fadeInLength", "Fade In Length")
|
||||||
|
local f_pFrameFadeOut = ProtoField.uint64("spit.fadeOutLength", "Fade Out Length")
|
||||||
|
local f_pValueFactor = ProtoField.uint32("spit.valueFactor", "Value Factor")
|
||||||
|
local f_pFramesPerSec = ProtoField.uint32("spit.framesPerSec", "Frames per second")
|
||||||
|
local f_pTrack = ProtoField.uint32("spit.track", "Track")
|
||||||
|
local f_pRemark = ProtoField.string("spit.remark", "Remack")
|
||||||
|
local f_pDelay = ProtoField.uint64("spit.delay", "Delay")
|
||||||
|
local f_pDuration = ProtoField.uint64("spit.duration", "Duration")
|
||||||
|
|
||||||
|
local f_pPlayerId = ProtoField.string("spit.PlayerId", "Player ID")
|
||||||
|
local f_pPlayerName = ProtoField.string("spit.PlayerName", "Player Name")
|
||||||
|
local f_pPlayerType = ProtoField.uint8("spit.PlayerType", "Player Type")
|
||||||
|
local f_pPlayerRunning = ProtoField.uint8("spit.PlayerRunning", "Player Running")
|
||||||
|
local f_pPlayerFrames = ProtoField.uint64("spit.PlayerFrame", "Player Frames")
|
||||||
|
local f_pPlayerPrePos = ProtoField.uint8("spit.PlayerPrePos", "Player Preposition")
|
||||||
|
|
||||||
|
local sessionInfos = {}
|
||||||
|
|
||||||
|
spit_proto.fields = {
|
||||||
|
f_pSession, f_pKey, f_pSadKey, f_pServerDevName,
|
||||||
|
f_hVer, f_hNum, f_hLen, f_hSerId, f_hCliId, f_hType, f_pLen,
|
||||||
|
f_pClientDevName, f_pClientName, f_pLoginName, f_pLoginPassword, f_pServerName, f_pServerIp, f_pServerPort, f_pSrvParam, f_pStepTime, f_pConnected, f_pProjectId, f_pProjectName,
|
||||||
|
f_pObjectId, f_pObjectName, f_pTypeId, f_pTypeName, f_pTypeGroupName, f_pObjectsFrames, f_pValue, f_pValueFlag,
|
||||||
|
f_pConfirm, f_pFixed, f_pAssigned, f_pSrvRemote, f_pProjIndep, f_pValueUse,
|
||||||
|
f_pFrameStart, f_pFrameLength, f_pFrameFadeIn, f_pFrameFadeOut, f_pValueFactor, f_pFramesPerSec, f_pTrack, f_pRemark, f_pDelay, f_pDuration,
|
||||||
|
f_pPlayerId, f_pPlayerName, f_pPlayerType, f_pPlayerRunning, f_pPlayerFrames, f_pPlayerPrePos
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractSession(buffer, pinfo)
|
||||||
|
local serverHash = buffer(16,41):string()
|
||||||
|
local clientHash = buffer(57,41):string()
|
||||||
|
return string.format("%s - %s", sessionInfos[serverHash], sessionInfos[clientHash])
|
||||||
|
end
|
||||||
|
|
||||||
|
function extractVersionString(buffer)
|
||||||
|
local vBytes = buffer(7,4):bytes()
|
||||||
|
local vStr = ""
|
||||||
|
for i = 0, 3 do
|
||||||
|
local byte = vBytes:get_index(i)
|
||||||
|
local high_nibble = bit.rshift(byte, 4)
|
||||||
|
local low_nibble = bit.band(byte, 0x0F)
|
||||||
|
vStr = vStr .. tostring(high_nibble) .. tostring(low_nibble)
|
||||||
|
end
|
||||||
|
return vStr
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Heuristic dissector function
|
||||||
|
function spit_proto.dissector(buffer, pinfo, tree)
|
||||||
|
if buffer:len() < 6 then return false end
|
||||||
|
if buffer(0,6):string() ~= "#spit#" then return false end
|
||||||
|
|
||||||
|
pinfo.cols.protocol = "SPIT"
|
||||||
|
local subtree = tree:add(spit_proto, buffer(), "SPIT Protocol Data")
|
||||||
|
|
||||||
|
local hTree = subtree:add("Header")
|
||||||
|
hTree:add(f_hVer, buffer(7,4)):set_text("Version: " .. extractVersionString(buffer))
|
||||||
|
hTree:add(f_hNum, buffer(11,1))
|
||||||
|
local hLen = buffer(12,4):le_uint()
|
||||||
|
subtree:add(f_hLen, buffer(12,4)):set_text("Length: " .. hLen)
|
||||||
|
hTree:add(f_hSerId, buffer(16,41))
|
||||||
|
hTree:add(f_hCliId, buffer(57,41))
|
||||||
|
|
||||||
|
local type = buffer(98,1):uint()
|
||||||
|
hTree:add(f_hType, buffer(98,1))
|
||||||
|
|
||||||
|
local pTree = subtree:add("Payload")
|
||||||
|
local pLen = buffer(99,4):le_uint()
|
||||||
|
pTree:add(f_pLen, buffer(99,4)):set_text("Pyload Length: " .. pLen)
|
||||||
|
|
||||||
|
local info_text = "Type: " .. type
|
||||||
|
if type == 1 then -- Connect
|
||||||
|
pTree:add(f_pClientDevName, buffer(103,64))
|
||||||
|
pTree:add(f_pClientName, buffer(167,64))
|
||||||
|
pTree:add(f_pLoginName, buffer(231,64))
|
||||||
|
pTree:add(f_pLoginPassword, buffer(295,64))
|
||||||
|
pTree:add(f_pServerIp, buffer(359,40))
|
||||||
|
pTree:add(f_pServerPort, buffer(399,2))
|
||||||
|
|
||||||
|
local clientName = buffer(167,64):string()
|
||||||
|
local clientHash = buffer(57,41):string()
|
||||||
|
sessionInfos[clientName] = clientHash -- e.g. 70866c9b-af1c-4765-a17e-8b45c93f3aca
|
||||||
|
sessionInfos[clientHash] = clientName --
|
||||||
|
sessionInfos[tostring(pinfo.src)] = clientName
|
||||||
|
|
||||||
|
info_text = string.format("Connect Req | Client: %s (%s) | ADDR: %s:%s",
|
||||||
|
clientName, clientHash, buffer(359,40):string(), buffer(399,2):uint())
|
||||||
|
|
||||||
|
elseif type == 2 then -- Connect Response
|
||||||
|
pTree:add(f_pServerDevName, buffer(103,64))
|
||||||
|
pTree:add(f_pServerName, buffer(167,64))
|
||||||
|
pTree:add(f_pStepTime, buffer(231,4))
|
||||||
|
pTree:add(f_pConnected, buffer(235,1))
|
||||||
|
|
||||||
|
local serverName = buffer(167,64):string()
|
||||||
|
local serverHash = buffer(16,41):string()
|
||||||
|
sessionInfos[serverName] = serverHash -- e.g. 405c7100-64e8-435d-8a7b-00c5629f9ccf
|
||||||
|
sessionInfos[serverHash] = serverName
|
||||||
|
sessionInfos[tostring(pinfo.src)] = serverName
|
||||||
|
|
||||||
|
info_text = string.format("Connect Res | Server: %s (%s) ",
|
||||||
|
serverName, serverHash)
|
||||||
|
|
||||||
|
elseif type == 3 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
info_text = string.format("Disconnect")
|
||||||
|
|
||||||
|
elseif type == 8 then
|
||||||
|
info_text = string.format("Watchdog")
|
||||||
|
|
||||||
|
elseif type == 9 then
|
||||||
|
info_text = string.format("Watchdog Ans")
|
||||||
|
|
||||||
|
elseif type == 11 then -- Report Porject
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pProjectId, buffer(103,41))
|
||||||
|
pTree:add(f_pProjectName, buffer(144,64))
|
||||||
|
pTree:add(f_pFramesPerSec, buffer(208,4))
|
||||||
|
info_text = string.format("%s -> %s | Report Project | Project: %s / %s",
|
||||||
|
sessionInfos[tostring(pinfo.src)], sessionInfos[tostring(pinfo.dst)], buffer(103,41):string(), buffer(144,64):string())
|
||||||
|
|
||||||
|
elseif type == 13 then -- Close Porject
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pProjectId, buffer(103,41))
|
||||||
|
info_text = string.format("Close Project | Project: %s",
|
||||||
|
buffer(103,64):string())
|
||||||
|
|
||||||
|
elseif type == 15 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
info_text = string.format("Request Project Transfer")
|
||||||
|
|
||||||
|
elseif type == 16 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
info_text = string.format("Start Project Transfer")
|
||||||
|
|
||||||
|
elseif type == 17 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
info_text = string.format("End Project Transfer")
|
||||||
|
|
||||||
|
elseif type == 21 then -- Report Type
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pConfirm, buffer(103,1))
|
||||||
|
pTree:add(f_pTypeId, buffer(104,41))
|
||||||
|
pTree:add(f_pFixed, buffer(145,1))
|
||||||
|
pTree:add(f_pSrvRemote, buffer(146,1))
|
||||||
|
pTree:add(f_pProjIndep, buffer(147,1))
|
||||||
|
pTree:add(f_pTypeGroupName, buffer(148,39))
|
||||||
|
pTree:add(f_pTypeName, buffer(187,64))
|
||||||
|
pTree:add(f_pDelay, buffer(251,8))
|
||||||
|
pTree:add(f_pDuration, buffer(259,8))
|
||||||
|
|
||||||
|
local group = buffer(148,39):string()
|
||||||
|
local name = buffer(187,64):string()
|
||||||
|
local id = buffer(104,41):string()
|
||||||
|
info_text = string.format("%s -> %s | Report SPIT Type: %s.%s (%s)", sessionInfos[tostring(pinfo.src)], sessionInfos[tostring(pinfo.dst)], group, name, id)
|
||||||
|
|
||||||
|
elseif type == 23 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pTypeId, buffer(103,41))
|
||||||
|
info_text = string.format("Remove SPIT Type")
|
||||||
|
|
||||||
|
elseif type == 31 then -- Report Object
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pConfirm, buffer(103,1))
|
||||||
|
pTree:add(f_pObjectId, buffer(104,41))
|
||||||
|
pTree:add(f_pFixed, buffer(145,1))
|
||||||
|
pTree:add(f_pSrvRemote, buffer(146,1))
|
||||||
|
pTree:add(f_pObjectName, buffer(147,64))
|
||||||
|
pTree:add(f_pTypeId, buffer(211,41))
|
||||||
|
pTree:add(f_pSrvParam, buffer(252,64))
|
||||||
|
pTree:add(f_pFrameStart, buffer(316,8))
|
||||||
|
pTree:add(f_pFrameLength, buffer(324,8))
|
||||||
|
pTree:add(f_pFrameFadeIn, buffer(332,8))
|
||||||
|
pTree:add(f_pFrameFadeOut, buffer(340,8))
|
||||||
|
local valueFactor = buffer(348,4):le_uint()
|
||||||
|
pTree:add(f_pValueFactor, buffer(348,4)):set_text("Value Factor" .. valueFactor)
|
||||||
|
pTree:add(f_pValueUse, buffer(349,1))
|
||||||
|
pTree:add(f_pTrack, buffer(350,4))
|
||||||
|
pTree:add(f_pRemark, buffer(354,64))
|
||||||
|
pTree:add(f_pDelay, buffer(418,8))
|
||||||
|
pTree:add(f_pDuration, buffer(426,8))
|
||||||
|
pTree:add(f_pAssigned, buffer(435,1))
|
||||||
|
|
||||||
|
local name = buffer(147,64):string()
|
||||||
|
local tId = buffer(211,41):string()
|
||||||
|
local oId = buffer(104,41):string()
|
||||||
|
info_text = string.format("%s -> %s | Report SPIT Object: %s (%s / %s)", sessionInfos[tostring(pinfo.src)], sessionInfos[tostring(pinfo.dst)], name, oId, tId)
|
||||||
|
|
||||||
|
elseif type == 33 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pObjectId, buffer(103,41))
|
||||||
|
info_text = string.format("Remove SPIT Object")
|
||||||
|
|
||||||
|
elseif type == 37 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pPlayerId, buffer(103,41))
|
||||||
|
pTree:add(f_pPlayerName, buffer(144,64))
|
||||||
|
pTree:add(f_pPlayerType, buffer(208,1))
|
||||||
|
pTree:add(f_pPlayerRunning, buffer(209,1))
|
||||||
|
pTree:add(f_pPlayerFrames, buffer(210,8))
|
||||||
|
info_text = string.format("Play SPIT Start")
|
||||||
|
|
||||||
|
elseif type == 38 then -- Play Spit object
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pPlayerId, buffer(103,41))
|
||||||
|
pTree:add(f_pObjectId, buffer(144,41))
|
||||||
|
pTree:add(f_pObjectsFrames, buffer(185,8))
|
||||||
|
pTree:add(f_pPlayerPrePos, buffer(193,1))
|
||||||
|
pTree:add(f_pValue, buffer(194,4))
|
||||||
|
pTree:add(f_pValueFlag, buffer(198,1))
|
||||||
|
|
||||||
|
local oId = buffer(144,41):string()
|
||||||
|
info_text = string.format("%s -> %s | Play SPIT Object: %s", sessionInfos[tostring(pinfo.src)], sessionInfos[tostring(pinfo.dst)], oId)
|
||||||
|
|
||||||
|
elseif type == 39 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pPlayerId, buffer(103,41))
|
||||||
|
info_text = string.format("Play SPIT End")
|
||||||
|
|
||||||
|
elseif type == 40 then
|
||||||
|
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||||
|
|
||||||
|
pTree:add(f_pObjectId, buffer(103,41))
|
||||||
|
pTree:add(f_pObjectsFrames, buffer(144,8))
|
||||||
|
pTree:add(f_pValue, buffer(152,4))
|
||||||
|
info_text = string.format("Report Play Status")
|
||||||
|
|
||||||
|
else
|
||||||
|
info_text = string.format("ERROR Unknown")
|
||||||
|
end
|
||||||
|
|
||||||
|
pinfo.cols['info'] = info_text
|
||||||
|
return true -- We handled this packet
|
||||||
|
end
|
||||||
|
|
||||||
|
function split(str, delim)
|
||||||
|
local result = {}
|
||||||
|
local delim_len = delim
|
||||||
|
local s = 1
|
||||||
|
while true do
|
||||||
|
local e, next_e = string.find(str, delim, s)
|
||||||
|
if not e then
|
||||||
|
table.insert(result, string.sub(str, s))
|
||||||
|
break
|
||||||
|
end
|
||||||
|
table.insert(result, string.sub(str, s, e - 1))
|
||||||
|
s = next_e + 1
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Heuristic dissector function
|
||||||
|
function spit_sad_proto.dissector(buffer, pinfo, tree)
|
||||||
|
if buffer:len() < 14 then return false end
|
||||||
|
if buffer(0,14):string() ~= "#SAD##,##spit#" then return false end
|
||||||
|
|
||||||
|
pinfo.cols.protocol = "SPIT-SAD"
|
||||||
|
|
||||||
|
local info_text = "SAD"
|
||||||
|
if buffer:len() > 16 then
|
||||||
|
local payload = buffer(0,buffer:len()):string()
|
||||||
|
local parts = split(payload, "#,#")
|
||||||
|
|
||||||
|
local subtree = tree:add(spit_sad_proto, buffer(), "Discovery Data")
|
||||||
|
subtree:add(f_pSadKey, parts[1]) -- 1 #SAD#
|
||||||
|
subtree:add(f_pKey, parts[2]) -- 2 #spit#
|
||||||
|
subtree:add(f_pServerName, parts[3]) -- 3 liveShowSPIT
|
||||||
|
subtree:add(f_hSerId , parts[4]) -- 4 405c7100-64e8-435d-8a7b-00c5629f9ccf
|
||||||
|
subtree:add(f_pServerDevName, parts[5]) -- 5 P17gen1
|
||||||
|
subtree:add(f_pServerPort, parts[6]) -- 6 15120
|
||||||
|
subtree:add(f_pServerIp, parts[7]) -- 7 172.16.17.56
|
||||||
|
subtree:add(f_pProjectName, parts[9]) -- 9 CatasWatchProject
|
||||||
|
|
||||||
|
info_text = string.format("SPIT-SAD Discover Data | Client: %s Porject: %s ",
|
||||||
|
parts[4], parts[9])
|
||||||
|
else
|
||||||
|
info_text = string.format("SPIT-SAD Discover")
|
||||||
|
end
|
||||||
|
|
||||||
|
pinfo.cols['info'] = info_text
|
||||||
|
return true -- We handled this packet
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register as a heuristic UDP dissector
|
||||||
|
spit_proto:register_heuristic("udp", spit_proto.dissector)
|
||||||
|
|
||||||
|
spit_sad_proto:register_heuristic("udp", spit_sad_proto.dissector)
|
||||||
|
|
||||||
|
|
||||||
|
-- local f_pFramesPerSec = ProtoField.uint32("spit.framesPerSec", "Frames per second")
|
||||||
|
-- local f_pTrack = ProtoField.uint32("spit.track", "Track")
|
||||||
|
-- local f_pObjectsFrames = ProtoField.uint64("spit.ObjectFrames", "Object Frames")
|
||||||
|
-- local f_pValue = ProtoField.uint64("spit.Value", "Value")
|
||||||
|
-- local f_pFrameStart = ProtoField.uint64("spit.frameStart", "Frame Start")
|
||||||
|
-- local f_pFrameLength = ProtoField.uint64("spit.frameLength", "Frame Length")
|
||||||
|
-- local f_pFrameFadeIn = ProtoField.uint64("spit.fadeInLength", "Fade In Length")
|
||||||
|
-- local f_pFrameFadeOut = ProtoField.uint64("spit.fadeOutLength", "Fade Out Length")
|
||||||
|
-- local f_pDelay = ProtoField.uint64("spit.delay", "Delay")
|
||||||
|
-- local f_pDuration = ProtoField.uint64("spit.duration", "Duration")
|
||||||
|
-- local f_pPlayerFrames = ProtoField.uint64("spit.PlayerFrame", "Player Frames")
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
idf_component_register(
|
||||||
|
INCLUDE_DIRS "include"
|
||||||
|
REQUIRES devHal
|
||||||
|
)
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "stepperDrv.hpp"
|
||||||
|
#include "stepperMotor.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
class WatchMotor {
|
||||||
|
static constexpr uint8_t Positions = 6;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using AllmostFinishedCb = void (*)(uint8_t newIdx);
|
||||||
|
WatchMotor(IStepperMotor &stepper, AllmostFinishedCb onDone)
|
||||||
|
: _stepper(stepper),
|
||||||
|
_onFinCb(onDone) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveTo(uint8_t position, uint8_t profile, int minJumps, float accel, float speed) {
|
||||||
|
auto sign = position % 6;
|
||||||
|
|
||||||
|
int minTurns = minJumps / 6;
|
||||||
|
|
||||||
|
float corr = 0.0F;
|
||||||
|
float currentPos = _stepper.getScaledPos() * 6;
|
||||||
|
if ((_currentIndex > 4) && (currentPos < 2)) {
|
||||||
|
corr = 6 - _currentIndex - currentPos;
|
||||||
|
} else if ((_currentIndex < 2) && (currentPos > 2)) {
|
||||||
|
corr = _currentIndex + 6 - currentPos;
|
||||||
|
} else {
|
||||||
|
corr = _currentIndex - currentPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
int steps = 0;
|
||||||
|
if (_currentIndex < sign) {
|
||||||
|
steps = (sign - _currentIndex);
|
||||||
|
} else if (_currentIndex >= sign) {
|
||||||
|
steps = (sign + 6 - _currentIndex);
|
||||||
|
}
|
||||||
|
steps += minTurns * 6;
|
||||||
|
if (steps < minJumps) {
|
||||||
|
steps += 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
float delta = 2.0F * std::numbers::pi / 6 * steps;
|
||||||
|
|
||||||
|
ESP_LOGD("MV", "Moving to %d by %.2f + %.2f", sign, delta, corr);
|
||||||
|
|
||||||
|
_stepper.moveBy(delta + corr, profile, accel, speed, [&]() {
|
||||||
|
if (_onFinCb) {
|
||||||
|
_onFinCb(position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_currentIndex = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getScaled() { return _stepper.getScaledPos() * 6; }
|
||||||
|
uint8_t getIndex() { return _currentIndex; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
IStepperMotor &_stepper;
|
||||||
|
uint8_t _currentIndex{};
|
||||||
|
AllmostFinishedCb _onFinCb{};
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
// Dummy file
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
UnitTestsFrame()
|
||||||
|
target_link_libraries(${moduleName} PUBLIC
|
||||||
|
devHal
|
||||||
|
)
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* @file TestableUTest.cpp
|
||||||
|
* @author Gustice
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2024
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||||
|
#include "doctest/doctest.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <numbers>
|
||||||
|
|
||||||
|
#include "watchFace.hpp"
|
||||||
|
|
||||||
|
class StepperMotorMock : public IStepperMotor {
|
||||||
|
public:
|
||||||
|
void moveBy(float angle, uint8_t profile = 0) override {
|
||||||
|
lastAngle = angle;
|
||||||
|
lastProfile = profile;
|
||||||
|
}
|
||||||
|
void moveBy(float angle, uint8_t profile, float accel, float speed, std::function<void()> profileDone = nullptr) override {
|
||||||
|
lastAngle = angle;
|
||||||
|
lastProfile = profile;
|
||||||
|
}
|
||||||
|
float getScaledPos() const override {
|
||||||
|
return nextPos;
|
||||||
|
}
|
||||||
|
uint16_t getQuanted() const override {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float lastAngle{};
|
||||||
|
uint8_t lastProfile{};
|
||||||
|
float lastAccel{};
|
||||||
|
float lastSpeed{};
|
||||||
|
float nextPos{};
|
||||||
|
};
|
||||||
|
|
||||||
|
void onFin(uint8_t idx) {
|
||||||
|
}
|
||||||
|
|
||||||
|
class WatchFaceFixture {
|
||||||
|
using PositionStore = StepperMotor::Position<50, 5>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
protected:
|
||||||
|
static constexpr int MicroSteps = 32;
|
||||||
|
StepperMotorMock motor;
|
||||||
|
WatchMotor sut{motor, onFin};
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_CASE_FIXTURE(WatchFaceFixture, "Moving simple steps") {
|
||||||
|
auto next = 0*std::numbers::pi/3;
|
||||||
|
motor.nextPos = next;
|
||||||
|
sut.moveTo(1, 0, 0, 1, 1);
|
||||||
|
auto delta = 1*std::numbers::pi/3;
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 1.0F/6;
|
||||||
|
sut.moveTo(2, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 2.0F/6;
|
||||||
|
sut.moveTo(3, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 3.0F/6;
|
||||||
|
sut.moveTo(4, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 4.0F/6;
|
||||||
|
sut.moveTo(5, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 5.0F/6;
|
||||||
|
sut.moveTo(6, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 6.0F/6;
|
||||||
|
sut.moveTo(1, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 1.0F/6;
|
||||||
|
sut.moveTo(2, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE_FIXTURE(WatchFaceFixture, "Moving multiple turns") {
|
||||||
|
auto next = 0*std::numbers::pi/3;
|
||||||
|
motor.nextPos = next;
|
||||||
|
sut.moveTo(1, 0, 0, 1, 1);
|
||||||
|
auto delta = 1*std::numbers::pi/3;
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 1.0F/6;
|
||||||
|
sut.moveTo(1, 0, 0, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(6*delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
|
||||||
|
motor.nextPos = 1.0F/6;
|
||||||
|
sut.moveTo(1, 0, 7, 1, 1);
|
||||||
|
CHECK(motor.lastAngle == doctest::Approx(12*delta).epsilon(0.000625)); // MicroStep tolerance
|
||||||
|
}
|
||||||
+1
-1
Submodule core updated: 3041a17851...02db420163
+8
-6
@@ -1,15 +1,17 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
ethernet_init:
|
ethernet_init:
|
||||||
component_hash: null
|
dependencies: []
|
||||||
source:
|
source:
|
||||||
path: C:\Tools\ESP-IDF\v5.3\esp-idf\examples\ethernet\basic\components\ethernet_init
|
path: /home/gustice/esp/v5.4.1/esp-idf/examples/ethernet/basic/components/ethernet_init
|
||||||
type: local
|
type: local
|
||||||
version: '*'
|
version: '*'
|
||||||
idf:
|
idf:
|
||||||
component_hash: null
|
|
||||||
source:
|
source:
|
||||||
type: idf
|
type: idf
|
||||||
version: 5.3.0
|
version: 5.4.1
|
||||||
manifest_hash: 736e193f01d8a1ca4afaed91b473283f46d56db468270aee2f055b9425257e7f
|
direct_dependencies:
|
||||||
|
- ethernet_init
|
||||||
|
- idf
|
||||||
|
manifest_hash: dfcb516d4bd1043fe7dbc63ade7e95173fcf2993c59d7108e7b96cb5af8f7ebd
|
||||||
target: esp32c6
|
target: esp32c6
|
||||||
version: 1.0.0
|
version: 2.0.0
|
||||||
|
|||||||
Binary file not shown.
+188
@@ -0,0 +1,188 @@
|
|||||||
|
I (23) boot: ESP-IDF v5.3 2nd stage bootloader
|
||||||
|
I (24) boot: compile time Feb 15 2025 17:51:30
|
||||||
|
I (24) boot: chip revision: v0.0
|
||||||
|
I (26) boot.esp32c6: SPI Speed : 80MHz
|
||||||
|
I (31) boot.esp32c6: SPI Mode : DIO
|
||||||
|
I (36) boot.esp32c6: SPI Flash Size : 8MB
|
||||||
|
I (41) boot: Enabling RNG early entropy source...
|
||||||
|
I (46) boot: Partition Table:
|
||||||
|
I (50) boot: ## Label Usage Type ST Offset Length
|
||||||
|
I (57) boot: 0 nvs WiFi data 01 02 00009000 00006000
|
||||||
|
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
|
||||||
|
I (72) boot: 2 factory factory app 00 00 00010000 00100000
|
||||||
|
I (79) boot: End of partition table
|
||||||
|
I (83) esp_image: segment 0: paddr=00010020 vaddr=42070020 size=2b2e0h (176864) map
|
||||||
|
I (128) esp_image: segment 1: paddr=0003b308 vaddr=40800000 size=04d10h ( 19728) load
|
||||||
|
I (134) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=6bfe0h (442336) map
|
||||||
|
I (226) esp_image: segment 3: paddr=000ac008 vaddr=40804d10 size=094b0h ( 38064) load
|
||||||
|
I (235) esp_image: segment 4: paddr=000b54c0 vaddr=4080e1c0 size=01bd0h ( 7120) load
|
||||||
|
I (241) boot: Loaded app from partition at offset 0x10000
|
||||||
|
I (242) boot: Disabling RNG early entropy source...
|
||||||
|
I (256) cpu_start: Unicore app
|
||||||
|
I (265) cpu_start: Pro cpu start user code
|
||||||
|
I (265) cpu_start: cpu freq: 160000000 Hz
|
||||||
|
I (265) app_init: Application information:
|
||||||
|
I (268) app_init: Project name: X_WatchController_FW
|
||||||
|
I (274) app_init: App version: 858b7d8-dirty
|
||||||
|
I (279) app_init: Compile time: Apr 8 2025 22:42:59
|
||||||
|
I (285) app_init: ELF file SHA256: ab11b461f...
|
||||||
|
I (290) app_init: ESP-IDF: v5.3
|
||||||
|
I (295) efuse_init: Min chip rev: v0.0
|
||||||
|
I (300) efuse_init: Max chip rev: v0.99
|
||||||
|
I (305) efuse_init: Chip rev: v0.0
|
||||||
|
I (309) heap_init: Initializing. RAM available for dynamic allocation:
|
||||||
|
I (317) heap_init: At 40812120 len 0006A4F0 (425 KiB): RAM
|
||||||
|
I (323) heap_init: At 4087C610 len 00002F54 (11 KiB): RAM
|
||||||
|
I (329) heap_init: At 50000000 len 00003FE8 (15 KiB): RTCRAM
|
||||||
|
I (336) spi_flash: detected chip: generic
|
||||||
|
I (340) spi_flash: flash io: dio
|
||||||
|
I (345) sleep: Configure to isolate all GPIO pins in sleep state
|
||||||
|
I (351) sleep: Enable automatic switching of GPIO sleep configuration
|
||||||
|
I (358) coexist: coex firmware version: dab85ae96
|
||||||
|
I (385) coexist: coexist rom version 5b8dcfa
|
||||||
|
I (386) main_task: Started on CPU0
|
||||||
|
I (386) main_task: Calling app_main()
|
||||||
|
I (396) esp_eth.netif.netif_glue: 42:4c:ca:ff:fe:4e
|
||||||
|
I (396) esp_eth.netif.netif_glue: ethernet attached to netif
|
||||||
|
I (406) Watch: Ethernet Started
|
||||||
|
I (406) Watch: Start Lighting
|
||||||
|
I (406) gpio: GPIO[10]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
|
||||||
|
I (416) gpio: GPIO[11]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
|
||||||
|
I (426) Watch: Start Stepper
|
||||||
|
I (426) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
|
||||||
|
I (436) gpio: GPIO[8]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
|
||||||
|
I (446) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
|
||||||
|
I (456) TMR: Create timer handle
|
||||||
|
I (456) TMR: Setup timer
|
||||||
|
I (456) Stepper: Find Home
|
||||||
|
I (466) Stepper: Homing ...
|
||||||
|
I (466) Stepper: Fast find right side of home sensor
|
||||||
|
I (486) gpio: GPIO[1]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
|
||||||
|
I (2206) Stepper: Find right side of home sensor
|
||||||
|
I (2376) Stepper: Find end of sensor
|
||||||
|
I (2406) Watch: Ethernet Link Up
|
||||||
|
I (2406) Watch: Ethernet Link Up
|
||||||
|
I (2406) Watch: Ethernet HW Addr 00:00:00:00:00:00
|
||||||
|
I (3406) esp_netif_handlers: eth ip: 172.16.17.56, mask: 255.255.0.0, gw: 172.16.0.1
|
||||||
|
I (3406) Watch: Ethernet Got IP Address
|
||||||
|
I (3406) Watch: ~~~~~~~~~~~
|
||||||
|
I (3406) Watch: ETHIP:172.16.17.56
|
||||||
|
I (3416) Watch: ETHMASK:255.255.0.0
|
||||||
|
I (3416) Watch: ETHGW:172.16.0.1
|
||||||
|
I (3416) Watch: ~~~~~~~~~~~
|
||||||
|
I (5186) Stepper: Find left side of home sensor
|
||||||
|
I (5646) Stepper: Move back to mid position 116
|
||||||
|
I (6806) Stepper: Reset position
|
||||||
|
I (7086) Stepper: Got to 1
|
||||||
|
I (7086) Watch: Fist Position is 0.03
|
||||||
|
I (7106) Watch: Changing picto-Illum to pos = 0
|
||||||
|
I (7106) Watch: Current color set r128 g128 b128
|
||||||
|
I (13426) Watch: Start net services
|
||||||
|
I (13426) Watch: Starting Telnet task
|
||||||
|
I (13426) TCP: Socket created
|
||||||
|
I (13426) Watch: Starting ArtNet task
|
||||||
|
I (13426) TCP: Socket bound, port 23
|
||||||
|
I (13426) Watch: Starting SPIT task
|
||||||
|
I (13426) UDP: Starting syslog session to 172.16.16.10
|
||||||
|
I (13426) UDP: Socket bound, port 6454
|
||||||
|
I (13436) Telnet: Socket waiting for connect
|
||||||
|
I (13436) SPIT: Connected to eth
|
||||||
|
I (13456) SPIT: - IPv4 address: 172.16.17.56,
|
||||||
|
I (13456) SPIT: - IPv4 netmask: 255.255.0.0,
|
||||||
|
I (13446) SysLog: Starting Syslog Task
|
||||||
|
I (13466) Watch: NEW SPIT-Type ID: ActionStartShuffle GroupName: CatasWatchMovement Name: ActionStartShuffle confirmed: 0
|
||||||
|
I (13466) UDP: Socket bound, port 514
|
||||||
|
I (13486) Watch: NEW SPIT-Type ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 0
|
||||||
|
I (13496) Watch: NEW SPIT-Type ID: ActionMoveTo2 GroupName: CatasWatchMovement Name: ActionMoveTo2 confirmed: 0
|
||||||
|
I (13506) Watch: NEW SPIT-Type ID: ActionMoveTo3 GroupName: CatasWatchMovement Name: ActionMoveTo3 confirmed: 0
|
||||||
|
I (13516) Watch: NEW SPIT-Type ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 0
|
||||||
|
I (13526) Watch: NEW SPIT-Type ID: ActionMoveTo5 GroupName: CatasWatchMovement Name: ActionMoveTo5 confirmed: 0
|
||||||
|
I (13536) Watch: NEW SPIT-Type ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 0
|
||||||
|
I (13546) SPIT: Starting Socket managing
|
||||||
|
I (17656) Watch: SERVER DETECTED
|
||||||
|
I (17656) Watch: Name: liveShowSPIT
|
||||||
|
I (17656) Watch: ID: 698a3e4f-1ae9-4dd8-9015-29332d29629e
|
||||||
|
I (17656) Watch: Computer: GgP17
|
||||||
|
I (17656) Watch: IP: 172.16.16.10
|
||||||
|
I (17666) Watch: Port: 15120
|
||||||
|
I (17666) Watch: Addition:
|
||||||
|
I (17666) Watch: ClientIP: 172.16.17.56
|
||||||
|
I (17676) SPIT: connect to 172.16.16.10 / 15120
|
||||||
|
I (17676) Watch: MySPITApp: eventConnectionStatus 0->0
|
||||||
|
I (17686) Watch: MySPITApp: eventConnectionStatus 0->4
|
||||||
|
I (18196) Watch: eventProjectReport ID: CatasWatchProject
|
||||||
|
I (18196) Watch: eventStartProjectTransfer
|
||||||
|
W (18306) SPIT: TypeVeto e019646a-4e24-4608-954e-da4ca6761bb6 / ToIgnore 43
|
||||||
|
I (18326) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002sb0va8bom Name: -> SPITType: ActionStartShuffle
|
||||||
|
I (18336) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002rd0va8bom Name: -> SPITType: ActionMoveTo1
|
||||||
|
I (18356) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002vl0va8bom Name: -> SPITType: ActionMoveTo2
|
||||||
|
I (18366) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002wh0va8bom Name: -> SPITType: ActionMoveTo3
|
||||||
|
I (18386) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002yl0va8bom Name: -> SPITType: ActionMoveTo4
|
||||||
|
I (18396) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002tc0va8bom Name: -> SPITType: ActionMoveTo5
|
||||||
|
I (18416) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000002zi0va8bom Name: -> SPITType: ActionMoveTo6
|
||||||
|
I (18446) Watch: Min heap size: 297568 / FreeHeap 299880
|
||||||
|
I (18446) Watch: NEW SPIT-REMOTE-Type ID: playControlStart GroupName: Playcontrol Name: start confirmed: 1
|
||||||
|
I (18466) Watch: NEW SPIT-REMOTE-Type ID: playControlPause GroupName: Playcontrol Name: pause confirmed: 1
|
||||||
|
I (18476) Watch: NEW SPIT-REMOTE-Type ID: nextSceneBridge GroupName: Playcontrol Name: next scene confirmed: 1
|
||||||
|
I (18496) Watch: NEW SPIT-REMOTE-Type ID: nextMainSceneBridge GroupName: Playcontrol Name: next main scene confirmed: 1
|
||||||
|
I (18506) Watch: NEW SPIT-REMOTE-Type ID: previuosSceneBridge GroupName: Playcontrol Name: previous scene confirmed: 1
|
||||||
|
I (18526) Watch: NEW SPIT-REMOTE-Type ID: previousMainSceneBridge GroupName: Playcontrol Name: previous main scene confirmed: 1
|
||||||
|
I (18546) Watch: NEW SPIT-REMOTE-Type ID: mainmixerSound_Volume00 GroupName: Main Mixer Name: Sound confirmed: 1
|
||||||
|
I (18556) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_Dimmer00 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18566) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB00 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18586) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB10 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18606) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB20 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18616) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB30 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18636) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB40 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18646) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB50 GroupName: Main Mixer Name: confirmed: 1
|
||||||
|
I (18666) Watch: NEW SPIT-REMOTE-Type ID: mainmixerMedia_SoundVolume00 GroupName: Main Mixer Name: Media confirmed: 1
|
||||||
|
I (18686) Watch: NEW SPIT-REMOTE-Type ID: mainmixerMedia_Transparency00 GroupName: Main Mixer Name: Media confirmed: 1
|
||||||
|
I (18696) Watch: NEW SPIT-REMOTE-Type ID: selectedJingles GroupName: Playcontrol Name: selected Jingles confirmed: 1
|
||||||
|
I (18716) Watch: NEW SPIT-REMOTE-Type ID: selectedJingleGroups GroupName: Playcontrol Name: selected Jinglegroups confirmed: 1
|
||||||
|
I (18726) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000lo0va8bom GroupName: MainScene Name: ChangingPositionScene confirmed: 1
|
||||||
|
I (18746) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000m70va8bom GroupName: MainScene Name: InPosition1Scene confirmed: 1
|
||||||
|
I (18756) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000mh0va8bom GroupName: MainScene Name: InPosition2Scene confirmed: 1
|
||||||
|
I (18776) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000mr0va8bom GroupName: MainScene Name: InPosition3Scene confirmed: 1
|
||||||
|
I (18786) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000nk0va8bom GroupName: MainScene Name: InPosition4Scene confirmed: 1
|
||||||
|
I (18806) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000nu0va8bom GroupName: MainScene Name: InPosition5Scene confirmed: 1
|
||||||
|
I (18826) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000o40va8bom GroupName: MainScene Name: InPosition6Scene confirmed: 1
|
||||||
|
I (18836) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000001au0va8bom GroupName: MainScene Name: StartShuffle confirmed: 1
|
||||||
|
I (18856) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000001fj0va8bom GroupName: MainScene Name: Fence confirmed: 1
|
||||||
|
I (18866) Watch: NEW SPIT-REMOTE-Object ID: playControlStart Name: start -> SPITType: start
|
||||||
|
I (18886) Watch: NEW SPIT-REMOTE-Object ID: playControlPause Name: pause -> SPITType: pause
|
||||||
|
I (18906) Watch: NEW SPIT-REMOTE-Object ID: nextSceneBridge Name: next scene -> SPITType: next scene
|
||||||
|
I (18916) Watch: NEW SPIT-REMOTE-Object ID: nextMainSceneBridge Name: next main scene -> SPITType: next main scene
|
||||||
|
I (18936) Watch: NEW SPIT-REMOTE-Object ID: previuosSceneBridge Name: previous scene -> SPITType: previous scene
|
||||||
|
I (18946) Watch: NEW SPIT-REMOTE-Object ID: previousMainSceneBridge Name: previous main scene -> SPITType: previous main scene
|
||||||
|
I (18966) Watch: NEW SPIT-REMOTE-Object ID: mainmixerSound_Volume00 Name: Sound Volume -> SPITType: Sound
|
||||||
|
I (18976) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_Dimmer00 Name: Dimmer -> SPITType:
|
||||||
|
I (18996) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB00 Name: Red -> SPITType:
|
||||||
|
I (19006) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB10 Name: Green -> SPITType:
|
||||||
|
I (19026) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB20 Name: Blue -> SPITType:
|
||||||
|
I (19036) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB30 Name: Cyan -> SPITType:
|
||||||
|
I (19056) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB40 Name: Magenta -> SPITType:
|
||||||
|
I (19076) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB50 Name: Yellow -> SPITType:
|
||||||
|
I (19086) Watch: NEW SPIT-REMOTE-Object ID: mainmixerMedia_SoundVolume00 Name: Sound Volume -> SPITType: Media
|
||||||
|
I (19106) Watch: NEW SPIT-REMOTE-Object ID: mainmixerMedia_Transparency00 Name: Media Transparency -> SPITType: Media
|
||||||
|
I (19116) Watch: NEW SPIT-REMOTE-Object ID: selectedJinglesps Name: Play / Stop -> SPITType: selected Jingles
|
||||||
|
I (19136) Watch: NEW SPIT-REMOTE-Object ID: selectedJinglespf Name: Play / Fade Out -> SPITType: selected Jingles
|
||||||
|
I (19146) Watch: NEW SPIT-REMOTE-Object ID: selectedJingleGroupsps Name: Play / Stop -> SPITType: selected Jinglegroups
|
||||||
|
I (19166) Watch: NEW SPIT-REMOTE-Object ID: selectedJingleGroupspf Name: Play / Fade Out -> SPITType: selected Jinglegroups
|
||||||
|
I (19176) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000lo0va8bom Name: play -> SPITType: ChangingPositionScene
|
||||||
|
W (19196) SPIT: Finished searching
|
||||||
|
W (19196) SPIT: Start working
|
||||||
|
I (19196) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000m70va8bom Name: play -> SPITType: InPosition1Scene
|
||||||
|
I (19216) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000mh0va8bom Name: play -> SPITType: InPosition2Scene
|
||||||
|
I (19226) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000mr0va8bom Name: play -> SPITType: InPosition3Scene
|
||||||
|
I (19246) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000nk0va8bom Name: play -> SPITType: InPosition4Scene
|
||||||
|
I (19256) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000nu0va8bom Name: play -> SPITType: InPosition5Scene
|
||||||
|
I (19276) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000o40va8bom Name: play -> SPITType: InPosition6Scene
|
||||||
|
I (19286) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000001au0va8bom Name: play -> SPITType: StartShuffle
|
||||||
|
I (19306) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000001fj0va8bom Name: play -> SPITType: Fence
|
||||||
|
I (19316) Watch: eventEndProjectTransfer
|
||||||
|
I (19316) Watch: eventProjectReport ID: CatasWatchProject Name: FramesPerSecond: 44100
|
||||||
|
I (23446) Watch: Min heap size: 278024 / FreeHeap 282460
|
||||||
|
I (28446) Watch: Min heap size: 278024 / FreeHeap 282460
|
||||||
|
I (33446) Watch: Min heap size: 278024 / FreeHeap 282460
|
||||||
|
I (38446) Watch: Min heap size: 278024 / FreeHeap 282460
|
||||||
|
I (43446) Watch: Min heap size: 278024 / FreeHeap 282460
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
{\rtf1\ansi
|
||||||
|
{\fonttbl\f0\fnil Monospaced;}
|
||||||
|
|
||||||
|
\par
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,119 +0,0 @@
|
|||||||
/* Ethernet Basic Example
|
|
||||||
|
|
||||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, this
|
|
||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
*/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "esp_netif.h"
|
|
||||||
#include "esp_eth.h"
|
|
||||||
#include "esp_event.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "ethernet_init.h"
|
|
||||||
#include "sdkconfig.h"
|
|
||||||
|
|
||||||
static const char *TAG = "eth_example";
|
|
||||||
|
|
||||||
/** Event handler for Ethernet events */
|
|
||||||
static void eth_event_handler(void *arg, esp_event_base_t event_base,
|
|
||||||
int32_t event_id, void *event_data)
|
|
||||||
{
|
|
||||||
uint8_t mac_addr[6] = {0};
|
|
||||||
/* we can get the ethernet driver handle from event data */
|
|
||||||
esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data;
|
|
||||||
|
|
||||||
switch (event_id) {
|
|
||||||
case ETHERNET_EVENT_CONNECTED:
|
|
||||||
esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr);
|
|
||||||
ESP_LOGI(TAG, "Ethernet Link Up");
|
|
||||||
ESP_LOGI(TAG, "Ethernet HW Addr %02x:%02x:%02x:%02x:%02x:%02x",
|
|
||||||
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
|
|
||||||
break;
|
|
||||||
case ETHERNET_EVENT_DISCONNECTED:
|
|
||||||
ESP_LOGI(TAG, "Ethernet Link Down");
|
|
||||||
break;
|
|
||||||
case ETHERNET_EVENT_START:
|
|
||||||
ESP_LOGI(TAG, "Ethernet Started");
|
|
||||||
break;
|
|
||||||
case ETHERNET_EVENT_STOP:
|
|
||||||
ESP_LOGI(TAG, "Ethernet Stopped");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Event handler for IP_EVENT_ETH_GOT_IP */
|
|
||||||
static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
|
|
||||||
int32_t event_id, void *event_data)
|
|
||||||
{
|
|
||||||
ip_event_got_ip_t *event = (ip_event_got_ip_t *) event_data;
|
|
||||||
const esp_netif_ip_info_t *ip_info = &event->ip_info;
|
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Ethernet Got IP Address");
|
|
||||||
ESP_LOGI(TAG, "~~~~~~~~~~~");
|
|
||||||
ESP_LOGI(TAG, "ETHIP:" IPSTR, IP2STR(&ip_info->ip));
|
|
||||||
ESP_LOGI(TAG, "ETHMASK:" IPSTR, IP2STR(&ip_info->netmask));
|
|
||||||
ESP_LOGI(TAG, "ETHGW:" IPSTR, IP2STR(&ip_info->gw));
|
|
||||||
ESP_LOGI(TAG, "~~~~~~~~~~~");
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_main(void)
|
|
||||||
{
|
|
||||||
// Initialize Ethernet driver
|
|
||||||
uint8_t eth_port_cnt = 0;
|
|
||||||
esp_eth_handle_t *eth_handles;
|
|
||||||
ESP_ERROR_CHECK(example_eth_init(ð_handles, ð_port_cnt));
|
|
||||||
|
|
||||||
// Initialize TCP/IP network interface aka the esp-netif (should be called only once in application)
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
|
||||||
// Create default event loop that running in background
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
||||||
|
|
||||||
// Create instance(s) of esp-netif for Ethernet(s)
|
|
||||||
if (eth_port_cnt == 1) {
|
|
||||||
// Use ESP_NETIF_DEFAULT_ETH when just one Ethernet interface is used and you don't need to modify
|
|
||||||
// default esp-netif configuration parameters.
|
|
||||||
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
|
|
||||||
esp_netif_t *eth_netif = esp_netif_new(&cfg);
|
|
||||||
// Attach Ethernet driver to TCP/IP stack
|
|
||||||
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handles[0])));
|
|
||||||
} else {
|
|
||||||
// Use ESP_NETIF_INHERENT_DEFAULT_ETH when multiple Ethernet interfaces are used and so you need to modify
|
|
||||||
// esp-netif configuration parameters for each interface (name, priority, etc.).
|
|
||||||
esp_netif_inherent_config_t esp_netif_config = ESP_NETIF_INHERENT_DEFAULT_ETH();
|
|
||||||
esp_netif_config_t cfg_spi = {
|
|
||||||
.base = &esp_netif_config,
|
|
||||||
.stack = ESP_NETIF_NETSTACK_DEFAULT_ETH
|
|
||||||
};
|
|
||||||
char if_key_str[10];
|
|
||||||
char if_desc_str[10];
|
|
||||||
char num_str[3];
|
|
||||||
for (int i = 0; i < eth_port_cnt; i++) {
|
|
||||||
itoa(i, num_str, 10);
|
|
||||||
strcat(strcpy(if_key_str, "ETH_"), num_str);
|
|
||||||
strcat(strcpy(if_desc_str, "eth"), num_str);
|
|
||||||
esp_netif_config.if_key = if_key_str;
|
|
||||||
esp_netif_config.if_desc = if_desc_str;
|
|
||||||
esp_netif_config.route_prio -= i*5;
|
|
||||||
esp_netif_t *eth_netif = esp_netif_new(&cfg_spi);
|
|
||||||
|
|
||||||
// Attach Ethernet driver to TCP/IP stack
|
|
||||||
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handles[i])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register user defined event handers
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, NULL));
|
|
||||||
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL));
|
|
||||||
|
|
||||||
// Start Ethernet driver state machine
|
|
||||||
for (int i = 0; i < eth_port_cnt; i++) {
|
|
||||||
ESP_ERROR_CHECK(esp_eth_start(eth_handles[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+417
-85
@@ -6,15 +6,18 @@
|
|||||||
* @copyright Copyright (c) 2024
|
* @copyright Copyright (c) 2024
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Conig-Key:
|
/* Watchface
|
||||||
//
|
6/
|
||||||
//
|
5 / 1
|
||||||
//
|
4 2
|
||||||
|
3
|
||||||
|
*/
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
const char *syslogDest = "syslogDst"; // example: "172.16.16.10"
|
const char *syslogDest = "syslogDst"; // example: "172.16.16.10"
|
||||||
const char *mqttBroker = "mqttBroker"; // example: "172.16.17.62"
|
const char *mqttBroker = "mqttBroker"; // example: "172.16.16.10"
|
||||||
const char *mqttPrefix = "mqttPrefix"; // example: "SomeTag"
|
const char *mqttPrefix = "mqttPrefix"; // example: "SomeTag"
|
||||||
|
const char *spitServer = "spitServer"; // example: "172.16.16.10"
|
||||||
} ConfigKeys;
|
} ConfigKeys;
|
||||||
|
|
||||||
// MQTT Topics
|
// MQTT Topics
|
||||||
@@ -27,6 +30,33 @@ struct {
|
|||||||
const char *changingPosition = /* <mqttPrefix>/ */ "watch/changingPosition";
|
const char *changingPosition = /* <mqttPrefix>/ */ "watch/changingPosition";
|
||||||
} MqttTopics;
|
} MqttTopics;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
const char *expectedServer = "";
|
||||||
|
struct {
|
||||||
|
const char *group = "CatasWatchMovement";
|
||||||
|
const char *startShuffle = "ActionStartShuffle";
|
||||||
|
const char *moveToX[6] = {
|
||||||
|
"ActionMoveTo1",
|
||||||
|
"ActionMoveTo2",
|
||||||
|
"ActionMoveTo3",
|
||||||
|
"ActionMoveTo4",
|
||||||
|
"ActionMoveTo5",
|
||||||
|
"ActionMoveTo6",
|
||||||
|
};
|
||||||
|
} Provided;
|
||||||
|
struct {
|
||||||
|
const char *changingPos = "ChangingPositionScene";
|
||||||
|
const char *inPosX[6] = {
|
||||||
|
"InPosition1Scene",
|
||||||
|
"InPosition2Scene",
|
||||||
|
"InPosition3Scene",
|
||||||
|
"InPosition4Scene",
|
||||||
|
"InPosition5Scene",
|
||||||
|
"InPosition6Scene",
|
||||||
|
};
|
||||||
|
} Expected;
|
||||||
|
} SpitTypes;
|
||||||
|
|
||||||
// ToDo:
|
// ToDo:
|
||||||
// - MQTT Integration
|
// - MQTT Integration
|
||||||
// - OTA
|
// - OTA
|
||||||
@@ -36,6 +66,9 @@ struct {
|
|||||||
|
|
||||||
#include "watchMain.hpp"
|
#include "watchMain.hpp"
|
||||||
|
|
||||||
|
string ClientName = "CatasWatchDev";
|
||||||
|
string ProjectName = "CatastrphicProj";
|
||||||
|
|
||||||
extern "C" { // This switch allows the ROS C-implementation to find this main
|
extern "C" { // This switch allows the ROS C-implementation to find this main
|
||||||
void app_main(void);
|
void app_main(void);
|
||||||
}
|
}
|
||||||
@@ -44,20 +77,29 @@ struct DeviceState {
|
|||||||
uint8_t minJumps{6};
|
uint8_t minJumps{6};
|
||||||
uint8_t maxJumps{32};
|
uint8_t maxJumps{32};
|
||||||
uint8_t profile{};
|
uint8_t profile{};
|
||||||
uint8_t restTime{};
|
uint8_t shuffleRate{};
|
||||||
float speed = 1.0; // Rad/sec
|
float speed = 1.0; // Rad/sec
|
||||||
float accel = 1.0; // Rad/sec^2
|
float accel = 1.0; // Rad/sec^2
|
||||||
Color color{0x80, 0x80, 0x80};
|
Color color{0x80, 0x80, 0x80};
|
||||||
uint8_t pictogram{}; // 0..5 active Pictogramm
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class MoveType {
|
enum class MoveType {
|
||||||
StepTo,
|
StepTo,
|
||||||
|
Demo,
|
||||||
Shuffle,
|
Shuffle,
|
||||||
Demo
|
};
|
||||||
|
enum class ResponseType {
|
||||||
|
StepAt,
|
||||||
|
StartMoving,
|
||||||
};
|
};
|
||||||
struct MoveCommand {
|
struct MoveCommand {
|
||||||
MoveType type;
|
MoveType type;
|
||||||
|
// 1..6
|
||||||
|
uint8_t pos;
|
||||||
|
};
|
||||||
|
struct WatchIndex {
|
||||||
|
ResponseType type;
|
||||||
|
// 1..6
|
||||||
uint8_t pos;
|
uint8_t pos;
|
||||||
};
|
};
|
||||||
struct PictoIllumCommand {
|
struct PictoIllumCommand {
|
||||||
@@ -65,6 +107,7 @@ struct PictoIllumCommand {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static fos::Queue<MoveCommand> commandQueue(8);
|
static fos::Queue<MoveCommand> commandQueue(8);
|
||||||
|
static fos::Queue<WatchIndex> responseQueue(8);
|
||||||
static fos::Queue<PictoIllumCommand> pictoIllumQue(2);
|
static fos::Queue<PictoIllumCommand> pictoIllumQue(2);
|
||||||
|
|
||||||
DeviceState activeState;
|
DeviceState activeState;
|
||||||
@@ -242,7 +285,7 @@ static void UniverseCallback(const uint8_t *data, const uint16_t size) {
|
|||||||
Syslog::logv(Syslog::Severity::Debug, "Got DMX: r%0x g%0x b%0x i%0x m%i M%i p%i a%i w%i r%i",
|
Syslog::logv(Syslog::Severity::Debug, "Got DMX: r%0x g%0x b%0x i%0x m%i M%i p%i a%i w%i r%i",
|
||||||
/* RGB*/ data[0], data[1], data[2], /*Intens*/ data[3],
|
/* RGB*/ data[0], data[1], data[2], /*Intens*/ data[3],
|
||||||
/* MinMaxJumps */ data[4], data[5], /*profile*/ data[6], /*accel/speed*/ data[7], data[8],
|
/* MinMaxJumps */ data[4], data[5], /*profile*/ data[6], /*accel/speed*/ data[7], data[8],
|
||||||
/*RestTime*/ data[9]);
|
/*shuffleRate*/ data[9]);
|
||||||
|
|
||||||
float intens = (float)data[3] / UINT8_MAX;
|
float intens = (float)data[3] / UINT8_MAX;
|
||||||
activeState.color = Color{
|
activeState.color = Color{
|
||||||
@@ -260,7 +303,7 @@ static void UniverseCallback(const uint8_t *data, const uint16_t size) {
|
|||||||
activeState.accel = (float)accel / 100 + 0.5; // min .5 / max 3
|
activeState.accel = (float)accel / 100 + 0.5; // min .5 / max 3
|
||||||
activeState.speed = (float)velo / 100 + 0.5; // min .5 / max 3
|
activeState.speed = (float)velo / 100 + 0.5; // min .5 / max 3
|
||||||
|
|
||||||
activeState.restTime = data[9];
|
activeState.shuffleRate = data[9];
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveToSubs(std::string data) {
|
void moveToSubs(std::string data) {
|
||||||
@@ -343,6 +386,7 @@ static void dmxSocketTask(int addrFamily) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fos::Semaphore etherActive;
|
fos::Semaphore etherActive;
|
||||||
|
fos::Semaphore spitProjectFinish;
|
||||||
|
|
||||||
/** Event handler for IP_EVENT_ETH_GOT_IP */
|
/** Event handler for IP_EVENT_ETH_GOT_IP */
|
||||||
static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
|
static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
|
||||||
@@ -434,7 +478,7 @@ namespace Effect {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Macro macDemoFlicker = {
|
const Macro macDemoFlicker = {
|
||||||
{64, 1, &InitSlopeWave, StateMachine::UpdateWave, 0xFF},
|
{16, 1, &InitSlopeWave, StateMachine::UpdateWave, 0xFF},
|
||||||
{32, 1, StateMachine::UpdateFlicker, 0xFF},
|
{32, 1, StateMachine::UpdateFlicker, 0xFF},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -442,9 +486,9 @@ namespace Effect {
|
|||||||
void LightingTask() {
|
void LightingTask() {
|
||||||
ESP_LOGI(TAG, "Start Lighting");
|
ESP_LOGI(TAG, "Start Lighting");
|
||||||
|
|
||||||
static I2cMaster master(I2C_NUM_0,
|
static I2cMaster master(I2C_NUM_0,
|
||||||
/*sda=*/GPIO_NUM_10,
|
{ /*sda=*/GPIO_NUM_10, /*scl=*/GPIO_NUM_11}
|
||||||
/*scl=*/GPIO_NUM_11);
|
);
|
||||||
// static PmwExpanderPca9685 pca9685(master);
|
// static PmwExpanderPca9685 pca9685(master);
|
||||||
static PmwExpanderPca9685 ledDriver1(master, /*iverted=*/false);
|
static PmwExpanderPca9685 ledDriver1(master, /*iverted=*/false);
|
||||||
static PmwExpanderPca9685 ledDriver2(master, /*iverted=*/false, 0x41);
|
static PmwExpanderPca9685 ledDriver2(master, /*iverted=*/false, 0x41);
|
||||||
@@ -469,14 +513,23 @@ void LightingTask() {
|
|||||||
processors[5].setEffect(Effect::macDark, &colorSource, 0);
|
processors[5].setEffect(Effect::macDark, &colorSource, 0);
|
||||||
|
|
||||||
const std::array<Effect::Macro, 6> PictoEffects{
|
const std::array<Effect::Macro, 6> PictoEffects{
|
||||||
|
Effect::macDemoPulse, // 1
|
||||||
Effect::macDemoPulse,
|
Effect::macDemoPulse,
|
||||||
Effect::macDemoPulse,
|
Effect::macDemoPulse,
|
||||||
Effect::macDemoPulse,
|
Effect::macDemoPulse,
|
||||||
Effect::macDemoPulse,
|
Effect::macStartFlicker,
|
||||||
Effect::macDemoPulse,
|
Effect::macDemoPulse}; // 6
|
||||||
Effect::macStartFlicker};
|
|
||||||
|
|
||||||
uint8_t lastPicto = 0;
|
uint8_t lastPicto = 1;
|
||||||
|
|
||||||
|
std::array<uint16_t *, 6> startPoints{
|
||||||
|
&(values[0][4]), // 1
|
||||||
|
&(values[1][12]),
|
||||||
|
&(values[1][8]),
|
||||||
|
&(values[1][4]),
|
||||||
|
&(values[0][12]),
|
||||||
|
&(values[0][8]), // 6
|
||||||
|
};
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
auto onPos = pictoIllumQue.dequeue(0);
|
auto onPos = pictoIllumQue.dequeue(0);
|
||||||
@@ -501,14 +554,6 @@ void LightingTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<uint16_t *, 6> startPoints{
|
|
||||||
&(values[0][4]),
|
|
||||||
&(values[0][8]),
|
|
||||||
&(values[0][12]),
|
|
||||||
&(values[1][4]),
|
|
||||||
&(values[1][8]),
|
|
||||||
&(values[1][12]),
|
|
||||||
};
|
|
||||||
for (size_t i = 0; i < processors.size(); i++) {
|
for (size_t i = 0; i < processors.size(); i++) {
|
||||||
auto col = processors[i].tick();
|
auto col = processors[i].tick();
|
||||||
auto sp = startPoints[i];
|
auto sp = startPoints[i];
|
||||||
@@ -518,8 +563,8 @@ void LightingTask() {
|
|||||||
sp[3] = (uint16_t)(col.getRed()) << 7;
|
sp[3] = (uint16_t)(col.getRed()) << 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
ledDriver1.sendImage(values[0]);
|
ledDriver1.send(values[0]);
|
||||||
ledDriver2.sendImage(values[1]);
|
ledDriver2.send(values[1]);
|
||||||
fos::Task::delayMs(40);
|
fos::Task::delayMs(40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,7 +575,7 @@ void MovementTask() {
|
|||||||
StepperDriverDrv8833::Pins stepperPins{
|
StepperDriverDrv8833::Pins stepperPins{
|
||||||
LEDC_TIMER_0,
|
LEDC_TIMER_0,
|
||||||
{LEDC_CHANNEL_0, LEDC_CHANNEL_1, LEDC_CHANNEL_2, LEDC_CHANNEL_3},
|
{LEDC_CHANNEL_0, LEDC_CHANNEL_1, LEDC_CHANNEL_2, LEDC_CHANNEL_3},
|
||||||
{GPIO_NUM_23, GPIO_NUM_22, GPIO_NUM_21, GPIO_NUM_20},
|
{GPIO_NUM_21, GPIO_NUM_20, GPIO_NUM_23, GPIO_NUM_22},
|
||||||
};
|
};
|
||||||
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps, 0.25F);
|
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps, 0.25F);
|
||||||
stepperDriver.setPos(0);
|
stepperDriver.setPos(0);
|
||||||
@@ -546,25 +591,37 @@ void MovementTask() {
|
|||||||
|
|
||||||
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
||||||
|
|
||||||
|
WatchMotor watch(stepper, [](uint8_t newPos) {
|
||||||
|
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos));
|
||||||
|
responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StepAt, newPos));
|
||||||
|
});
|
||||||
|
|
||||||
ESP_LOGI("Stepper", "Find Home");
|
ESP_LOGI("Stepper", "Find Home");
|
||||||
stepper.findRef();
|
stepper.findRef();
|
||||||
// Illum 1
|
// Todo Set by User-Interface
|
||||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(1));
|
for (size_t i = 0; i < 7; i++) {
|
||||||
|
stepper.fullStep(1);
|
||||||
|
fos::Task::delayMs(40);
|
||||||
|
}
|
||||||
|
(void)stepper.zeroPosition();
|
||||||
|
while (!stepper.isIdle()) {
|
||||||
|
fos::Task::delayMs(40);
|
||||||
|
}
|
||||||
|
// watch.moveTo(1, ProfileGenerator::Unitform);
|
||||||
|
ESP_LOGI("Stepper", "Got to 1");
|
||||||
|
// Illum 6
|
||||||
|
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(0));
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Fist Position is %f.2", stepper.getScaledPos() * 6);
|
ESP_LOGI(TAG, "Fist Position is %.2f", watch.getScaled());
|
||||||
fos::Task::delayMs(1000);
|
fos::Task::delayMs(1000);
|
||||||
|
|
||||||
activeState.pictogram = 0;
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ESP_LOGD(TAG, "Waiting for command");
|
ESP_LOGD(TAG, "Waiting for command");
|
||||||
auto cmd = commandQueue.dequeue();
|
auto cmd = commandQueue.dequeue();
|
||||||
if (cmd->type == MoveType::StepTo) {
|
if (cmd->type == MoveType::StepTo) {
|
||||||
if (stepper.isIdle()) {
|
if (stepper.isIdle()) {
|
||||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(0));
|
|
||||||
int newPos = cmd->pos;
|
int newPos = cmd->pos;
|
||||||
if ((newPos >= 1) && (newPos <= 6)) {
|
if ((newPos >= 1) && (newPos <= 6)) {
|
||||||
auto idx = newPos - 1;
|
|
||||||
Syslog::logv(Syslog::Severity::Informational,
|
Syslog::logv(Syslog::Severity::Informational,
|
||||||
"Triggered movement to picto pos:%i ", newPos);
|
"Triggered movement to picto pos:%i ", newPos);
|
||||||
} else {
|
} else {
|
||||||
@@ -572,67 +629,338 @@ void MovementTask() {
|
|||||||
"Got invalid index for illuminated pictogram =%i ", newPos);
|
"Got invalid index for illuminated pictogram =%i ", newPos);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int delta = newPos - activeState.pictogram;
|
|
||||||
if (delta <= 0) {
|
|
||||||
delta += 6;
|
|
||||||
}
|
|
||||||
delta = delta + (activeState.minJumps % 6) * 6;
|
|
||||||
if (delta < activeState.minJumps) {
|
|
||||||
delta += 6;
|
|
||||||
}
|
|
||||||
Syslog::logv(Syslog::Severity::Notice,
|
Syslog::logv(Syslog::Severity::Notice,
|
||||||
"Running Stepper by %i steps with prof=%i a=%.2f w=%.2f",
|
"Running Stepper by min%i steps with prof=%i a=%.2f w=%.2f",
|
||||||
delta, activeState.profile, activeState.accel, activeState.speed);
|
activeState.minJumps, activeState.profile, activeState.accel, activeState.speed);
|
||||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(0));
|
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(0));
|
||||||
stepper.moveBy(delta * std::numbers::pi / 3,
|
responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StartMoving, 0));
|
||||||
activeState.profile, activeState.accel, activeState.speed);
|
auto &as = activeState;
|
||||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos));
|
watch.moveTo(newPos, as.profile, as.minJumps, as.accel, as.speed);
|
||||||
activeState.pictogram = newPos;
|
// pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos));
|
||||||
|
// responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StepAt, newPos));
|
||||||
}
|
}
|
||||||
} else if (cmd->type == MoveType::Demo) {
|
} else if (cmd->type == MoveType::Demo) {
|
||||||
int i = 0;
|
ESP_LOGI(TAG, "Running Demo");
|
||||||
while (i++ < 80) {
|
for (size_t i = ProfileGenerator::Smooth; i < ProfileGenerator::NumProfiles; i++) {
|
||||||
stepperDriver.step(1);
|
ESP_LOGI(TAG, "Running Profile %d ", i);
|
||||||
stepperDriver.getSubPos();
|
fos::Task::delayMs(1000);
|
||||||
fos::Task::delayMs(100);
|
int steps[3]{4, 2, 0};
|
||||||
}
|
for (size_t j = 0; j < 3; j++) {
|
||||||
ESP_LOGI("Stepper", "Find Home");
|
watch.moveTo(steps[j], i, 1, 1, 1);
|
||||||
stepper.findRef();
|
fos::Task::delayMs(1000);
|
||||||
activeState.pictogram = -1;
|
|
||||||
stepper.findRef();
|
|
||||||
fos::Task::delayMs(1000);
|
|
||||||
for (size_t i = 0; i < 6; i++) {
|
|
||||||
stepper.moveBy(std::numbers::pi / 3);
|
|
||||||
while (!stepper.isIdle()) {
|
|
||||||
fos::Task::delayMs(100);
|
|
||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "Position is %f.2", stepper.getScaledPos() * 6);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fos::Task::delayMs(100);
|
fos::Task::delayMs(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
struct LocalSpitObj {
|
||||||
|
string iD;
|
||||||
|
string groupName;
|
||||||
|
string name;
|
||||||
|
};
|
||||||
|
std::map<string, MoveCommand> ProvidedSpitActions;
|
||||||
|
std::map<string, string> ExpectedObjects;
|
||||||
|
|
||||||
|
void onServerEvent(SPIT_Client::ServerEvent event, const SAD_DetectedServer &p_DetectedServer) {
|
||||||
|
switch (event) {
|
||||||
|
case SPIT_Client::ServerEvent::Detect:
|
||||||
|
ESP_LOGI(TAG, "SERVER DETECTED");
|
||||||
|
ESP_LOGI(TAG, " Name: %s", p_DetectedServer.getName().data());
|
||||||
|
ESP_LOGI(TAG, " ID: %s", p_DetectedServer.getID().data());
|
||||||
|
ESP_LOGI(TAG, " Computer: %s", p_DetectedServer.getComputerName().data());
|
||||||
|
ESP_LOGI(TAG, " IP: %s", p_DetectedServer.getIP().data());
|
||||||
|
ESP_LOGI(TAG, " Port: %s", p_DetectedServer.getPort().data());
|
||||||
|
ESP_LOGI(TAG, " Addition: %s", p_DetectedServer.getAdditions().data());
|
||||||
|
ESP_LOGI(TAG, " ClientIP: %s", p_DetectedServer.getClientIP().data());
|
||||||
|
break;
|
||||||
|
case SPIT_Client::ServerEvent::Lost:
|
||||||
|
ESP_LOGW(TAG, "Server lost Name: %s IP: %s", p_DetectedServer.getName().data(), p_DetectedServer.getIP().data());
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SPIT_Client::ServerEvent::Changed:
|
||||||
|
ESP_LOGW(TAG, "Server lost Name: %s IP: %s", p_DetectedServer.getName().data(), p_DetectedServer.getIP().data());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onConnectionStatus(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime,
|
||||||
|
SPIT_Client::Connection p_ConnectionStatus, SPIT_Client::Connection p_OldConnectionStatus) {
|
||||||
|
ESP_LOGI(TAG, "MySPITApp: eventConnectionStatus %d->%d ", (int)p_OldConnectionStatus, (int)p_ConnectionStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The transfer of the server's SPITTypes and SPITObjects is finished.
|
||||||
|
void onProjectUpdate(SPIT_Client::ProjUpdate state, string projectId) {
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case SPIT_Client::ProjUpdate::ServerLoaded:
|
||||||
|
ESP_LOGI(TAG, "eventProjectReport ID: %s ", projectId.data());
|
||||||
|
break;
|
||||||
|
case SPIT_Client::ProjUpdate::StartTransfer:
|
||||||
|
ESP_LOGI(TAG, "eventStartProjectTransfer");
|
||||||
|
break;
|
||||||
|
case SPIT_Client::ProjUpdate::EndTransfer:
|
||||||
|
ESP_LOGI(TAG, "eventEndProjectTransfer");
|
||||||
|
spitProjectFinish.give();
|
||||||
|
break;
|
||||||
|
case SPIT_Client::ProjUpdate::ServerClosed:
|
||||||
|
ESP_LOGI(TAG, "eventProjectClosed ID: %s", projectId.data());
|
||||||
|
// If we don't save SPITServer's project specific information
|
||||||
|
// perhaps close all SPITObjects and RemoteSPITObjects to avoid conflicts, when the SPITServer loads a new project
|
||||||
|
// SPITObject::clearSPITObjects();
|
||||||
|
// SPITObject::clearSPITObjectsRemote();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool onCheckSpitTypeVeto(bool knownType, bool createdByClient) {
|
||||||
|
if (!knownType || !createdByClient) { // Don't allow foreign SPITTypes
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool onCheckSpitObjectVeto(bool knownType) {
|
||||||
|
return true; // Bypass veto
|
||||||
|
if (!knownType) { // Don't allow objects of unregistered SPITTypes
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the server has created, loaded, changed or deleted a (Remote) SPITType.
|
||||||
|
// Remote SPITType are used in Remote SPITObjects. A Remote SPITObject is used to remote control the SPITServer.
|
||||||
|
// May also occur when the server confirms a SPITType created or changed by the client.
|
||||||
|
void onSpitType(SPIT_Client::ObjectEvent event, bool isRemote, const SPITType &p_SPITType) {
|
||||||
|
if (isRemote) {
|
||||||
|
if (event == SPIT_Client::ObjectEvent::Created) {
|
||||||
|
ESP_LOGI(TAG, "NEW SPIT-REMOTE-Type ID: %s GroupName: %s Name: %s confirmed: %d", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data(), p_SPITType.getConfirmed());
|
||||||
|
auto typeName = p_SPITType.getName();
|
||||||
|
if (ExpectedObjects.contains(typeName)) {
|
||||||
|
ExpectedObjects[typeName] = p_SPITType.getID();
|
||||||
|
}
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Changed) {
|
||||||
|
// we had to inform all Remote SPITObjects using the p_SPITType
|
||||||
|
// perhaps the SPITObject uses information from the SPITType
|
||||||
|
// SPITObject *ptrSPITObject;
|
||||||
|
// int intSPITObjectCount;
|
||||||
|
// intSPITObjectCount = SPITObject::getSPITObjectRemoteCount();
|
||||||
|
// for (int intObject = 0; intObject < intSPITObjectCount; intObject++) {
|
||||||
|
// ptrSPITObject = SPITObject::getSPITObjectRemote(intObject);
|
||||||
|
// if (ptrSPITObject == nullptr)
|
||||||
|
// continue;
|
||||||
|
// if (ptrSPITObject->getSPITTypeID() == p_SPITType.getID()) {
|
||||||
|
// // call ecentSPITObjectRemote
|
||||||
|
// // onSpitObjectRemote(SPIT_Client::ObjectEvent::Changed, p_SPITType, *ptrSPITObject);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
ESP_LOGI(TAG, "SPIT-REMOTE-Type CHANGED ID: %s GroupName: %s Name: %s confirmed: %d", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data(), p_SPITType.getConfirmed());
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Deleted) {
|
||||||
|
ESP_LOGD(TAG, "SPIT-REMOTE-Type Removed ID: %s GroupName: %s Name: %s\n", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (event == SPIT_Client::ObjectEvent::Created) {
|
||||||
|
// Whenever you provide an action for this SPITType take this over in your code.
|
||||||
|
// call _SpitClient.setActionSPITType(p_SPITType.getID(), true);
|
||||||
|
ESP_LOGI(TAG, "NEW SPIT-Type ID: %s GroupName: %s Name: %s confirmed: %d", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data(), p_SPITType.getConfirmed());
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Changed) {
|
||||||
|
ESP_LOGI(TAG, "SPIT-Type CHANGED ID: %s GroupName: %s Name: %s confirmed: %d", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data(), p_SPITType.getConfirmed());
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Deleted) {
|
||||||
|
ESP_LOGI(TAG, "SPIT-Type Removed ID: %s GroupName: %s Name: %s\n", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the server has created, loaded or changed a SPITObject.
|
||||||
|
// A Remote SPITObject is used to remote control the SPITServer.
|
||||||
|
// May also occur when the server confirms a SPITObject created by the client, what the client should never do!!.
|
||||||
|
// false = server changed a existing SPITObject
|
||||||
|
// @param p_SPITType a reference to a copy of the associated SPITType instance.
|
||||||
|
// @param p_SPITObject a reference to a copy of the SPITObject instance.
|
||||||
|
void onSpitObject(SPIT_Client::ObjectEvent event, bool isRemote, const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
|
||||||
|
if (isRemote) {
|
||||||
|
if (event == SPIT_Client::ObjectEvent::Created) {
|
||||||
|
ESP_LOGI(TAG, "NEW SPIT-REMOTE-Object ID: %s Name: %s -> SPITType: %s", p_SPITObject.getID().data(), p_SPITObject.getName().data(), p_SPITType.getName().data());
|
||||||
|
// This is a remote SPITObject which can be used to remote control the server.
|
||||||
|
// If you want you can list this for later use
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Changed) {
|
||||||
|
ESP_LOGI(TAG, "SPIT-REMOTE-Object CHANGED ID: %s Name: %s -> SPITType: %s", p_SPITObject.getID().data(), p_SPITObject.getName().data(), p_SPITType.getName().data());
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Deleted) {
|
||||||
|
ESP_LOGD(TAG, "SPIT-REMOTE-Object Removed ID: %s Name: %s\n", p_SPITObject.getID().data(), p_SPITObject.getName().data());
|
||||||
|
// This is a remote SPITObject
|
||||||
|
// If you have listet this prior you should remove it from the list
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (event == SPIT_Client::ObjectEvent::Created) {
|
||||||
|
ESP_LOGI(TAG, "NEW SPIT-Object ID: %s Name: %s -> SPITType: %s", p_SPITObject.getID().data(), p_SPITObject.getName().data(), p_SPITType.getName().data());
|
||||||
|
// check your actions
|
||||||
|
// Whenever you provide an action for this SPITObject take this over in your code.
|
||||||
|
// call _SpitClient.setActionSPITObject(p_SPITObject.getID(), true);
|
||||||
|
|
||||||
|
// for our little excample as described in loadClientProject:
|
||||||
|
// We have only actions for SPITTypes - means every SPITObject with the associated "Actionx"-SPITTypes will trigger the action when it is played
|
||||||
|
//-> no need to do something here, because setActionSPITType has been set prior and the SPITObject will automatically inherits this
|
||||||
|
// SPITObjects with other SPITTypes asscciated will trigger no actions
|
||||||
|
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Changed) {
|
||||||
|
ESP_LOGI(TAG, "SPIT-Object CHANGED ID: %s Name: %s -> SPITType: %s", p_SPITObject.getID().data(), p_SPITObject.getName().data(), p_SPITType.getName().data());
|
||||||
|
} else if (event == SPIT_Client::ObjectEvent::Deleted) {
|
||||||
|
ESP_LOGD(TAG, "SPIT-Object Removed ID: %s Name: %s\n", p_SPITObject.getID().data(), p_SPITObject.getName().data());
|
||||||
|
// Check your actions
|
||||||
|
// take the removal of the SPITObject over in your code
|
||||||
|
|
||||||
|
// CAUTION: Deleted SPITObjects can be added later again (perhaps per UNDO on the SPITServer)
|
||||||
|
//-> don't remove your assigned action immediately - keep it to reassign it later
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SPITServer may use several methods for playing SPITObjects.
|
||||||
|
// e.g. liveSHOWsoftware has the timeline and jingles which plays objects, where the timeline the main player is.
|
||||||
|
// SPIT distinguishes between the different players. All eventPlay... functions contain the information which player plays the SPIT object.
|
||||||
|
void onPlay(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_PlayerIsRunning, long long p_TimeFrames) {
|
||||||
|
ESP_LOGD(TAG, "eventPlay Player: %s Runs: %d Time: %lld", p_PlayerName.data(), p_PlayerIsRunning, p_TimeFrames);
|
||||||
|
|
||||||
|
switch (p_PlayerType) {
|
||||||
|
case SPIT_Client::PLAYERTYPE_MAIN:
|
||||||
|
// p_FrameTimes contains the position inside the server's project, we can use it like a timecode
|
||||||
|
// int intMilliseconds = (int)(((double)p_TimeFrames / (double)m_ServerFramesPerSecond) * 1000);
|
||||||
|
break;
|
||||||
|
case SPIT_Client::PLAYERTYPE_CONTINOUS:
|
||||||
|
// The olayer is playing only single Object sequences sometime during the project
|
||||||
|
break;
|
||||||
|
case SPIT_Client::PLAYERTYPE_DISCRETE:
|
||||||
|
// Only discrete values where submitted, e.g the fader position of remote faders.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the SPITServer plays a SPITObject. For every played SPITObject one eventPlayObject is called.
|
||||||
|
* You can decide here which action should be done or not.
|
||||||
|
*/
|
||||||
|
void onPlaySpitType(string p_PlayerID, string spitTypeId, bool p_PlayerIsRunning, bool p_Started, bool p_Ended, double p_Value) {
|
||||||
|
// double doubleValue = ((double)p_PlayObject.getValue() / 1000000) * ((double)p_PlayObject.getValueFactor() / 1000000);
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "eventPlayObject Player: %s is running: %d Object Started: %d Stopped: %d", p_PlayerID.data(), p_PlayerIsRunning, p_Started, p_Ended);
|
||||||
|
// ESP_LOGD(TAG, " SPITType: %s SPITObject: %s Position: %lld Value: %f\n", spitTypeId.data(), p_SPITObject.getName().data(), p_PlayObject.getFrameInside(), doubleValue);
|
||||||
|
ESP_LOGD(TAG, " SPITType: %s Value: %f\n", spitTypeId.data(), p_Value);
|
||||||
|
|
||||||
|
if (!ProvidedSpitActions.contains(spitTypeId)) {
|
||||||
|
ESP_LOGE(TAG, "SPIT ID %s is not accepted", spitTypeId.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (p_Started == true) {
|
||||||
|
auto command = ProvidedSpitActions[spitTypeId];
|
||||||
|
ESP_LOGI(TAG, "Player: %s is running: %s Object", p_PlayerID.data(), spitTypeId.c_str());
|
||||||
|
commandQueue.enqueue(std::make_unique<MoveCommand>(command));
|
||||||
|
Syslog::logv(Syslog::Severity::Informational, "Got SPIT command for move ot : r%d", command.pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a remote SpitObject which value function is changed by the server.
|
||||||
|
* This allows the Client to adjust its display for the remote command.
|
||||||
|
* @param p_SPITType the assigned remote SPITType of p_SPITObject
|
||||||
|
* @param p_SPITObject the remote SPITObject which is changed
|
||||||
|
* @param p_FrameInsideObject can be discarded
|
||||||
|
* @param p_Value the new value
|
||||||
|
*/
|
||||||
|
void onPlayRemoteObjectStatus(const SPITType &p_SPITType, const SPITObject &p_SPITObject, long long p_FrameInsideObject, int p_Value) {
|
||||||
|
ESP_EARLY_LOGD(TAG, "eventPlayRemoteObjectStatus RemoteSPITType: %s RemoteSPITObject: %s Position: %lld Value: %d", p_SPITType.getName().data(), p_SPITObject.getName().data(), p_FrameInsideObject, p_Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpitClientApp() {
|
||||||
|
ESP_LOGI(TAG, "Starting SPIT task");
|
||||||
|
|
||||||
|
auto &provided = SpitTypes.Provided;
|
||||||
|
auto &expected = SpitTypes.Expected;
|
||||||
|
std::vector<LocalSpitObj> ProvidedObj;
|
||||||
|
ProvidedSpitActions[provided.startShuffle] = MoveCommand{.type = MoveType::Shuffle, .pos = 0};
|
||||||
|
ProvidedObj.push_back(LocalSpitObj{.iD = provided.startShuffle, .groupName = provided.group, .name = provided.startShuffle});
|
||||||
|
ExpectedObjects[expected.changingPos] = "";
|
||||||
|
for (size_t i = 0; i < 6; i++) {
|
||||||
|
ProvidedObj.push_back(LocalSpitObj{.iD = provided.moveToX[i], .groupName = provided.group, .name = provided.moveToX[i]});
|
||||||
|
ProvidedSpitActions[provided.moveToX[i]] = MoveCommand{.type = MoveType::StepTo, .pos = (uint8_t)(i + 1)};
|
||||||
|
ExpectedObjects[expected.inPosX[i]] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIT_Client spitClient(ClientName, ProjectName,
|
||||||
|
{
|
||||||
|
.onServerEvent = onServerEvent,
|
||||||
|
.onConnectionStatus = onConnectionStatus,
|
||||||
|
.onProjectUpdate = onProjectUpdate,
|
||||||
|
.onSpitType = onSpitType,
|
||||||
|
.onSpitObject = onSpitObject,
|
||||||
|
.onPlay = onPlay,
|
||||||
|
.onPlaySpitType = onPlaySpitType,
|
||||||
|
.onPlayRemoteObjectStatus = onPlayRemoteObjectStatus,
|
||||||
|
.onCheckSpitTypeVeto = onCheckSpitTypeVeto,
|
||||||
|
.onCheckSpitObjectVeto = onCheckSpitObjectVeto,
|
||||||
|
});
|
||||||
|
|
||||||
|
for (auto &obj : ProvidedObj) {
|
||||||
|
SPITType *ptrSPITType1Fix = spitClient.createSPITTypeFixed(obj.iD, obj.groupName, obj.name, 0, 0);
|
||||||
|
spitClient.setActionSPITType(ptrSPITType1Fix->getID(), true); // should be executed whenever a SPITObject with this SPITType is played
|
||||||
|
}
|
||||||
|
spitClient.clientProjectLoaded();
|
||||||
|
spitClient.startServerAutoDetect();
|
||||||
|
|
||||||
|
spitProjectFinish.take();
|
||||||
|
string serverProjectID = spitClient.getServerProjectID();
|
||||||
|
string serverProjectName = spitClient.getClientProjectName();
|
||||||
|
int serverFramesPerSecond = spitClient.getServerFramesPerSecond(); // set when the server reports his project, see eventProjectReport
|
||||||
|
ESP_LOGI(TAG, "eventProjectReport ID: %s Name: %s FramesPerSecond: %d", serverProjectID.data(), serverProjectName.data(), serverFramesPerSecond);
|
||||||
|
|
||||||
|
for (auto &&obj : ExpectedObjects) {
|
||||||
|
if (obj.second == "") {
|
||||||
|
ESP_LOGE(TAG, "No matching Remote ID for %s", obj.first.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
auto res = responseQueue.dequeue();
|
||||||
|
if (res->type == ResponseType::StartMoving) {
|
||||||
|
spitClient.sendRemoteObject(ExpectedObjects[expected.changingPos]);
|
||||||
|
} else if (res->type == ResponseType::StepAt) {
|
||||||
|
spitClient.sendRemoteObject(ExpectedObjects[expected.inPosX[res->pos - 1]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
esp_err_t ret = nvs_flash_init();
|
// esp_err_t ret = nvs_flash_init();
|
||||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
// if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
// ESP_ERROR_CHECK(nvs_flash_erase());
|
||||||
ret = nvs_flash_init();
|
// ret = nvs_flash_init();
|
||||||
}
|
// }
|
||||||
ESP_ERROR_CHECK(ret);
|
// ESP_ERROR_CHECK(ret); // moved to NvsApi::init();
|
||||||
initialize_ethernet();
|
initialize_ethernet();
|
||||||
NvsApi::init();
|
NvsApi::init();
|
||||||
static fos::Task lightingTask(LightingTask, "Lights", 0x4000uL);
|
static fos::Task lightingTask(LightingTask, "Lights", 0x8000uL);
|
||||||
static fos::Task movementTask(MovementTask, "Motor", 0x4000uL);
|
static fos::Task movementTask(MovementTask, "Motor", 0x8000uL);
|
||||||
|
|
||||||
etherActive.take();
|
etherActive.take();
|
||||||
|
fos::Task::delayMs(10000);
|
||||||
ESP_LOGI(TAG, "Start net services");
|
ESP_LOGI(TAG, "Start net services");
|
||||||
|
|
||||||
|
// esp_log_level_set("SPIT", esp_log_level_t::ESP_LOG_DEBUG);
|
||||||
|
|
||||||
static int ipVersion = AF_INET;
|
static int ipVersion = AF_INET;
|
||||||
static fos::TaskT<int> telnetSocket(telnetSocketTask, ipVersion, "tcpServer", 4096);
|
static fos::TaskT<int> telnetSocket(telnetSocketTask, ipVersion, "tcpServer", 4096);
|
||||||
static fos::TaskT<int> dmxNode(dmxSocketTask, ipVersion, "dmxNode", 4096);
|
static fos::TaskT<int> dmxNode(dmxSocketTask, ipVersion, "dmxNode", 4096);
|
||||||
// static Task otaUpdate(SystemFunctions::OtaTaskEntry, "otaTask", 8192);
|
// static Task otaUpdate(SystemFunctions::OtaTaskEntry, "otaTask", 8192);
|
||||||
|
static fos::Task spit(SpitClientApp, "SpitClient");
|
||||||
|
|
||||||
auto &store = NvsApi::getInstance();
|
auto &store = NvsApi::getInstance();
|
||||||
auto logger = store.getValue(ConfigKeys.syslogDest);
|
auto logger = store.getValue(ConfigKeys.syslogDest);
|
||||||
@@ -640,21 +968,25 @@ void app_main(void) {
|
|||||||
Syslog::setupTask(IpAdr{logger, 0});
|
Syslog::setupTask(IpAdr{logger, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto broker = store.getValue(ConfigKeys.mqttBroker);
|
// auto broker = store.getValue(ConfigKeys.mqttBroker);
|
||||||
if (broker != "") {
|
// if (broker != "") {
|
||||||
ESP_LOGI(TAG, "Initializing MQTT");
|
// ESP_LOGI(TAG, "Initializing MQTT");
|
||||||
auto prefix = store.getValue(ConfigKeys.mqttPrefix);
|
// auto prefix = store.getValue(ConfigKeys.mqttPrefix);
|
||||||
auto &client = MqttClient::init(broker, prefix);
|
// auto &client = MqttClient::init(broker, prefix);
|
||||||
if (!client.isRunning()) {
|
// if (!client.isRunning()) {
|
||||||
client.addSubscription(MqttTopics.moveTo, [](std::string d) { moveToSubs(d); });
|
// client.addSubscription(MqttTopics.moveTo, [](std::string d) { moveToSubs(d); });
|
||||||
client.addSubscription(MqttTopics.startShuffle, [](std::string d) { startShuffle(d); });
|
// client.addSubscription(MqttTopics.startShuffle, [](std::string d) { startShuffle(d); });
|
||||||
client.start();
|
// client.start();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
fos::Task::delayMs(5000);
|
fos::Task::delayMs(5000);
|
||||||
// ToDo send
|
// ToDo send
|
||||||
Syslog::logv(Syslog::Severity::Notice, "Health state");
|
Syslog::logv(Syslog::Severity::Notice, "Health state");
|
||||||
|
// ESP_LOGI(TAG, "Min heap size: %" PRIu32 " / FreeHeap %" PRIu32 "\n",
|
||||||
|
// ESP_LOGI(TAG, "Min heap size: %u / FreeHeap %lu",
|
||||||
|
// heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT),
|
||||||
|
// esp_get_free_heap_size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-5
@@ -7,8 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
#include <cmath>
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@@ -22,8 +23,8 @@
|
|||||||
|
|
||||||
// Component header
|
// Component header
|
||||||
#include "Task.hpp"
|
#include "Task.hpp"
|
||||||
#include "PwmExpanderPca9685.hpp"
|
#include "pwmExpanderPca9685.hpp"
|
||||||
#include "StepperDrv8833.hpp"
|
#include "stepperDrv.hpp"
|
||||||
#include "stepperMotor.hpp"
|
#include "stepperMotor.hpp"
|
||||||
#include "cliWrapper.hpp"
|
#include "cliWrapper.hpp"
|
||||||
#include "udpSockets.hpp"
|
#include "udpSockets.hpp"
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
#include "Processor.hpp"
|
#include "Processor.hpp"
|
||||||
#include "nvsFunctions.hpp"
|
#include "nvsFunctions.hpp"
|
||||||
#include "mqttClient.hpp"
|
#include "mqttClient.hpp"
|
||||||
|
#include "watchFace.hpp"
|
||||||
|
|
||||||
// #include "esp_chip_info.h"
|
// #include "esp_chip_info.h"
|
||||||
// #include "esp_flash.h"
|
// #include "esp_flash.h"
|
||||||
@@ -50,4 +52,13 @@
|
|||||||
// #include "systemFunctions.hpp"
|
// #include "systemFunctions.hpp"
|
||||||
// #include <inttypes.h>
|
// #include <inttypes.h>
|
||||||
// #include <sys/param.h>
|
// #include <sys/param.h>
|
||||||
// #include <unistd.h>
|
// #include <unistd.h>
|
||||||
|
|
||||||
|
#include "SAD_DetectedServer.hpp"
|
||||||
|
#include "SPITObject.h"
|
||||||
|
#include "SPITPlayer.h"
|
||||||
|
#include "SPITType.h"
|
||||||
|
#include "SPIT_Client.h"
|
||||||
|
#include <chrono>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file. DO NOT EDIT.
|
# Automatically generated file. DO NOT EDIT.
|
||||||
# Espressif IoT Development Framework (ESP-IDF) 5.3.0 Project Configuration
|
# Espressif IoT Development Framework (ESP-IDF) 5.4.1 Project Configuration
|
||||||
#
|
#
|
||||||
CONFIG_SOC_ADC_SUPPORTED=y
|
CONFIG_SOC_ADC_SUPPORTED=y
|
||||||
CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y
|
CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y
|
||||||
@@ -104,6 +104,7 @@ CONFIG_SOC_CPU_WATCHPOINTS_NUM=4
|
|||||||
CONFIG_SOC_CPU_WATCHPOINT_MAX_REGION_SIZE=0x80000000
|
CONFIG_SOC_CPU_WATCHPOINT_MAX_REGION_SIZE=0x80000000
|
||||||
CONFIG_SOC_CPU_HAS_PMA=y
|
CONFIG_SOC_CPU_HAS_PMA=y
|
||||||
CONFIG_SOC_CPU_IDRAM_SPLIT_USING_PMP=y
|
CONFIG_SOC_CPU_IDRAM_SPLIT_USING_PMP=y
|
||||||
|
CONFIG_SOC_CPU_PMP_REGION_GRANULARITY=4
|
||||||
CONFIG_SOC_DS_SIGNATURE_MAX_BIT_LEN=3072
|
CONFIG_SOC_DS_SIGNATURE_MAX_BIT_LEN=3072
|
||||||
CONFIG_SOC_DS_KEY_PARAM_MD_IV_LENGTH=16
|
CONFIG_SOC_DS_KEY_PARAM_MD_IV_LENGTH=16
|
||||||
CONFIG_SOC_DS_KEY_CHECK_MAX_WAIT_US=1100
|
CONFIG_SOC_DS_KEY_CHECK_MAX_WAIT_US=1100
|
||||||
@@ -114,6 +115,7 @@ CONFIG_SOC_GDMA_SUPPORT_ETM=y
|
|||||||
CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION=y
|
CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_ETM_GROUPS=1
|
CONFIG_SOC_ETM_GROUPS=1
|
||||||
CONFIG_SOC_ETM_CHANNELS_PER_GROUP=50
|
CONFIG_SOC_ETM_CHANNELS_PER_GROUP=50
|
||||||
|
CONFIG_SOC_ETM_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_GPIO_PORT=1
|
CONFIG_SOC_GPIO_PORT=1
|
||||||
CONFIG_SOC_GPIO_PIN_COUNT=31
|
CONFIG_SOC_GPIO_PIN_COUNT=31
|
||||||
CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y
|
CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y
|
||||||
@@ -128,6 +130,7 @@ CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK=0
|
|||||||
CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT=8
|
CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT=8
|
||||||
CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x000000007FFFFF00
|
CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x000000007FFFFF00
|
||||||
CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y
|
CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y
|
||||||
|
CONFIG_SOC_GPIO_SUPPORT_HOLD_IO_IN_DSLP=y
|
||||||
CONFIG_SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP=y
|
CONFIG_SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP=y
|
||||||
CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX=y
|
CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX=y
|
||||||
CONFIG_SOC_CLOCKOUT_HAS_SOURCE_GATE=y
|
CONFIG_SOC_CLOCKOUT_HAS_SOURCE_GATE=y
|
||||||
@@ -136,7 +139,6 @@ CONFIG_SOC_RTCIO_PIN_COUNT=8
|
|||||||
CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y
|
CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y
|
||||||
CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y
|
CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y
|
||||||
CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y
|
CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y
|
||||||
CONFIG_SOC_RTCIO_VALID_RTCIO_MASK=0xFF
|
|
||||||
CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8
|
CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8
|
||||||
CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8
|
CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8
|
||||||
CONFIG_SOC_DEDIC_PERIPH_ALWAYS_ENABLE=y
|
CONFIG_SOC_DEDIC_PERIPH_ALWAYS_ENABLE=y
|
||||||
@@ -154,10 +156,12 @@ CONFIG_SOC_I2C_SLAVE_SUPPORT_BROADCAST=y
|
|||||||
CONFIG_SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE=y
|
CONFIG_SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE=y
|
||||||
CONFIG_SOC_I2C_SLAVE_SUPPORT_I2CRAM_ACCESS=y
|
CONFIG_SOC_I2C_SLAVE_SUPPORT_I2CRAM_ACCESS=y
|
||||||
CONFIG_SOC_I2C_SLAVE_SUPPORT_SLAVE_UNMATCH=y
|
CONFIG_SOC_I2C_SLAVE_SUPPORT_SLAVE_UNMATCH=y
|
||||||
|
CONFIG_SOC_I2C_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_LP_I2C_NUM=1
|
CONFIG_SOC_LP_I2C_NUM=1
|
||||||
CONFIG_SOC_LP_I2C_FIFO_LEN=16
|
CONFIG_SOC_LP_I2C_FIFO_LEN=16
|
||||||
CONFIG_SOC_I2S_NUM=1
|
CONFIG_SOC_I2S_NUM=1
|
||||||
CONFIG_SOC_I2S_HW_VERSION_2=y
|
CONFIG_SOC_I2S_HW_VERSION_2=y
|
||||||
|
CONFIG_SOC_I2S_SUPPORTS_ETM=y
|
||||||
CONFIG_SOC_I2S_SUPPORTS_XTAL=y
|
CONFIG_SOC_I2S_SUPPORTS_XTAL=y
|
||||||
CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y
|
CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y
|
||||||
CONFIG_SOC_I2S_SUPPORTS_PCM=y
|
CONFIG_SOC_I2S_SUPPORTS_PCM=y
|
||||||
@@ -165,15 +169,19 @@ CONFIG_SOC_I2S_SUPPORTS_PDM=y
|
|||||||
CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y
|
CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y
|
||||||
CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2
|
CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2
|
||||||
CONFIG_SOC_I2S_SUPPORTS_TDM=y
|
CONFIG_SOC_I2S_SUPPORTS_TDM=y
|
||||||
|
CONFIG_SOC_I2S_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_LEDC_SUPPORT_PLL_DIV_CLOCK=y
|
CONFIG_SOC_LEDC_SUPPORT_PLL_DIV_CLOCK=y
|
||||||
CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y
|
CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y
|
||||||
|
CONFIG_SOC_LEDC_TIMER_NUM=4
|
||||||
CONFIG_SOC_LEDC_CHANNEL_NUM=6
|
CONFIG_SOC_LEDC_CHANNEL_NUM=6
|
||||||
CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20
|
CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20
|
||||||
CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y
|
CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y
|
||||||
CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED=y
|
CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED=y
|
||||||
CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX=16
|
CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX=16
|
||||||
CONFIG_SOC_LEDC_FADE_PARAMS_BIT_WIDTH=10
|
CONFIG_SOC_LEDC_FADE_PARAMS_BIT_WIDTH=10
|
||||||
|
CONFIG_SOC_LEDC_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_MMU_PAGE_SIZE_CONFIGURABLE=y
|
CONFIG_SOC_MMU_PAGE_SIZE_CONFIGURABLE=y
|
||||||
|
CONFIG_SOC_MMU_PAGE_SIZE_8KB_SUPPORTED=y
|
||||||
CONFIG_SOC_MMU_PERIPH_NUM=1
|
CONFIG_SOC_MMU_PERIPH_NUM=1
|
||||||
CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=1
|
CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=1
|
||||||
CONFIG_SOC_MMU_DI_VADDR_SHARED=y
|
CONFIG_SOC_MMU_DI_VADDR_SHARED=y
|
||||||
@@ -184,6 +192,7 @@ CONFIG_SOC_PCNT_UNITS_PER_GROUP=4
|
|||||||
CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2
|
CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2
|
||||||
CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2
|
CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2
|
||||||
CONFIG_SOC_PCNT_SUPPORT_RUNTIME_THRES_UPDATE=y
|
CONFIG_SOC_PCNT_SUPPORT_RUNTIME_THRES_UPDATE=y
|
||||||
|
CONFIG_SOC_PCNT_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_RMT_GROUPS=1
|
CONFIG_SOC_RMT_GROUPS=1
|
||||||
CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=2
|
CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=2
|
||||||
CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=2
|
CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=2
|
||||||
@@ -198,6 +207,7 @@ CONFIG_SOC_RMT_SUPPORT_TX_SYNCHRO=y
|
|||||||
CONFIG_SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY=y
|
CONFIG_SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY=y
|
||||||
CONFIG_SOC_RMT_SUPPORT_XTAL=y
|
CONFIG_SOC_RMT_SUPPORT_XTAL=y
|
||||||
CONFIG_SOC_RMT_SUPPORT_RC_FAST=y
|
CONFIG_SOC_RMT_SUPPORT_RC_FAST=y
|
||||||
|
CONFIG_SOC_RMT_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_MCPWM_GROUPS=1
|
CONFIG_SOC_MCPWM_GROUPS=1
|
||||||
CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3
|
CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3
|
||||||
CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3
|
CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3
|
||||||
@@ -211,12 +221,14 @@ CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3
|
|||||||
CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y
|
CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y
|
||||||
CONFIG_SOC_MCPWM_SUPPORT_ETM=y
|
CONFIG_SOC_MCPWM_SUPPORT_ETM=y
|
||||||
CONFIG_SOC_MCPWM_CAPTURE_CLK_FROM_GROUP=y
|
CONFIG_SOC_MCPWM_CAPTURE_CLK_FROM_GROUP=y
|
||||||
|
CONFIG_SOC_MCPWM_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_PARLIO_GROUPS=1
|
CONFIG_SOC_PARLIO_GROUPS=1
|
||||||
CONFIG_SOC_PARLIO_TX_UNITS_PER_GROUP=1
|
CONFIG_SOC_PARLIO_TX_UNITS_PER_GROUP=1
|
||||||
CONFIG_SOC_PARLIO_RX_UNITS_PER_GROUP=1
|
CONFIG_SOC_PARLIO_RX_UNITS_PER_GROUP=1
|
||||||
CONFIG_SOC_PARLIO_TX_UNIT_MAX_DATA_WIDTH=16
|
CONFIG_SOC_PARLIO_TX_UNIT_MAX_DATA_WIDTH=16
|
||||||
CONFIG_SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH=16
|
CONFIG_SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH=16
|
||||||
CONFIG_SOC_PARLIO_TX_RX_SHARE_INTERRUPT=y
|
CONFIG_SOC_PARLIO_TX_RX_SHARE_INTERRUPT=y
|
||||||
|
CONFIG_SOC_PARLIO_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_MPI_MEM_BLOCKS_NUM=4
|
CONFIG_SOC_MPI_MEM_BLOCKS_NUM=4
|
||||||
CONFIG_SOC_MPI_OPERATIONS_NUM=3
|
CONFIG_SOC_MPI_OPERATIONS_NUM=3
|
||||||
CONFIG_SOC_RSA_MAX_BIT_LEN=3072
|
CONFIG_SOC_RSA_MAX_BIT_LEN=3072
|
||||||
@@ -239,6 +251,7 @@ CONFIG_SOC_SPI_SLAVE_SUPPORT_SEG_TRANS=y
|
|||||||
CONFIG_SOC_SPI_SUPPORT_CD_SIG=y
|
CONFIG_SOC_SPI_SUPPORT_CD_SIG=y
|
||||||
CONFIG_SOC_SPI_SUPPORT_CONTINUOUS_TRANS=y
|
CONFIG_SOC_SPI_SUPPORT_CONTINUOUS_TRANS=y
|
||||||
CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y
|
CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y
|
||||||
|
CONFIG_SOC_SPI_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_SPI_SUPPORT_CLK_XTAL=y
|
CONFIG_SOC_SPI_SUPPORT_CLK_XTAL=y
|
||||||
CONFIG_SOC_SPI_SUPPORT_CLK_PLL_F80M=y
|
CONFIG_SOC_SPI_SUPPORT_CLK_PLL_F80M=y
|
||||||
CONFIG_SOC_SPI_SUPPORT_CLK_RC_FAST=y
|
CONFIG_SOC_SPI_SUPPORT_CLK_RC_FAST=y
|
||||||
@@ -278,11 +291,13 @@ CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=2
|
|||||||
CONFIG_SOC_TIMER_SUPPORT_ETM=y
|
CONFIG_SOC_TIMER_SUPPORT_ETM=y
|
||||||
CONFIG_SOC_TIMER_SUPPORT_SLEEP_RETENTION=y
|
CONFIG_SOC_TIMER_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_MWDT_SUPPORT_XTAL=y
|
CONFIG_SOC_MWDT_SUPPORT_XTAL=y
|
||||||
|
CONFIG_SOC_MWDT_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_TWAI_CONTROLLER_NUM=2
|
CONFIG_SOC_TWAI_CONTROLLER_NUM=2
|
||||||
CONFIG_SOC_TWAI_CLK_SUPPORT_XTAL=y
|
CONFIG_SOC_TWAI_CLK_SUPPORT_XTAL=y
|
||||||
CONFIG_SOC_TWAI_BRP_MIN=2
|
CONFIG_SOC_TWAI_BRP_MIN=2
|
||||||
CONFIG_SOC_TWAI_BRP_MAX=32768
|
CONFIG_SOC_TWAI_BRP_MAX=32768
|
||||||
CONFIG_SOC_TWAI_SUPPORTS_RX_STATUS=y
|
CONFIG_SOC_TWAI_SUPPORTS_RX_STATUS=y
|
||||||
|
CONFIG_SOC_TWAI_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_EFUSE_DIS_DOWNLOAD_ICACHE=y
|
CONFIG_SOC_EFUSE_DIS_DOWNLOAD_ICACHE=y
|
||||||
CONFIG_SOC_EFUSE_DIS_PAD_JTAG=y
|
CONFIG_SOC_EFUSE_DIS_PAD_JTAG=y
|
||||||
CONFIG_SOC_EFUSE_DIS_USB_JTAG=y
|
CONFIG_SOC_EFUSE_DIS_USB_JTAG=y
|
||||||
@@ -298,6 +313,8 @@ CONFIG_SOC_SUPPORT_SECURE_BOOT_REVOKE_KEY=y
|
|||||||
CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=64
|
CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=64
|
||||||
CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES=y
|
CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES=y
|
||||||
CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128=y
|
CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128=y
|
||||||
|
CONFIG_SOC_APM_CTRL_FILTER_SUPPORTED=y
|
||||||
|
CONFIG_SOC_APM_LP_APM0_SUPPORTED=y
|
||||||
CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED=y
|
CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED=y
|
||||||
CONFIG_SOC_UART_NUM=3
|
CONFIG_SOC_UART_NUM=3
|
||||||
CONFIG_SOC_UART_HP_NUM=2
|
CONFIG_SOC_UART_HP_NUM=2
|
||||||
@@ -310,6 +327,7 @@ CONFIG_SOC_UART_SUPPORT_RTC_CLK=y
|
|||||||
CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y
|
CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y
|
||||||
CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y
|
CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y
|
||||||
CONFIG_SOC_UART_HAS_LP_UART=y
|
CONFIG_SOC_UART_HAS_LP_UART=y
|
||||||
|
CONFIG_SOC_UART_SUPPORT_SLEEP_RETENTION=y
|
||||||
CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y
|
CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y
|
||||||
CONFIG_SOC_COEX_HW_PTI=y
|
CONFIG_SOC_COEX_HW_PTI=y
|
||||||
CONFIG_SOC_EXTERNAL_COEX_ADVANCE=y
|
CONFIG_SOC_EXTERNAL_COEX_ADVANCE=y
|
||||||
@@ -335,7 +353,12 @@ CONFIG_SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY=y
|
|||||||
CONFIG_SOC_PM_CPU_RETENTION_BY_SW=y
|
CONFIG_SOC_PM_CPU_RETENTION_BY_SW=y
|
||||||
CONFIG_SOC_PM_MODEM_RETENTION_BY_REGDMA=y
|
CONFIG_SOC_PM_MODEM_RETENTION_BY_REGDMA=y
|
||||||
CONFIG_SOC_PM_RETENTION_HAS_CLOCK_BUG=y
|
CONFIG_SOC_PM_RETENTION_HAS_CLOCK_BUG=y
|
||||||
|
CONFIG_SOC_EXT_MEM_CACHE_TAG_IN_CPU_DOMAIN=y
|
||||||
CONFIG_SOC_PM_PAU_LINK_NUM=4
|
CONFIG_SOC_PM_PAU_LINK_NUM=4
|
||||||
|
CONFIG_SOC_PM_PAU_REGDMA_LINK_MULTI_ADDR=y
|
||||||
|
CONFIG_SOC_PM_PAU_REGDMA_LINK_WIFIMAC=y
|
||||||
|
CONFIG_SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE=y
|
||||||
|
CONFIG_SOC_PM_RETENTION_MODULE_NUM=32
|
||||||
CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y
|
CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y
|
||||||
CONFIG_SOC_MODEM_CLOCK_IS_INDEPENDENT=y
|
CONFIG_SOC_MODEM_CLOCK_IS_INDEPENDENT=y
|
||||||
CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y
|
CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y
|
||||||
@@ -346,6 +369,8 @@ CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC=y
|
|||||||
CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_XTAL=y
|
CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_XTAL=y
|
||||||
CONFIG_SOC_TEMPERATURE_SENSOR_INTR_SUPPORT=y
|
CONFIG_SOC_TEMPERATURE_SENSOR_INTR_SUPPORT=y
|
||||||
CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_ETM=y
|
CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_ETM=y
|
||||||
|
CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION=y
|
||||||
|
CONFIG_SOC_TEMPERATURE_SENSOR_UNDER_PD_TOP_DOMAIN=y
|
||||||
CONFIG_SOC_RNG_CLOCK_IS_INDEPENDENT=y
|
CONFIG_SOC_RNG_CLOCK_IS_INDEPENDENT=y
|
||||||
CONFIG_SOC_WIFI_HW_TSF=y
|
CONFIG_SOC_WIFI_HW_TSF=y
|
||||||
CONFIG_SOC_WIFI_FTM_SUPPORT=y
|
CONFIG_SOC_WIFI_FTM_SUPPORT=y
|
||||||
@@ -354,6 +379,7 @@ CONFIG_SOC_WIFI_WAPI_SUPPORT=y
|
|||||||
CONFIG_SOC_WIFI_CSI_SUPPORT=y
|
CONFIG_SOC_WIFI_CSI_SUPPORT=y
|
||||||
CONFIG_SOC_WIFI_MESH_SUPPORT=y
|
CONFIG_SOC_WIFI_MESH_SUPPORT=y
|
||||||
CONFIG_SOC_WIFI_HE_SUPPORT=y
|
CONFIG_SOC_WIFI_HE_SUPPORT=y
|
||||||
|
CONFIG_SOC_WIFI_MAC_VERSION_NUM=2
|
||||||
CONFIG_SOC_BLE_SUPPORTED=y
|
CONFIG_SOC_BLE_SUPPORTED=y
|
||||||
CONFIG_SOC_BLE_MESH_SUPPORTED=y
|
CONFIG_SOC_BLE_MESH_SUPPORTED=y
|
||||||
CONFIG_SOC_ESP_NIMBLE_CONTROLLER=y
|
CONFIG_SOC_ESP_NIMBLE_CONTROLLER=y
|
||||||
@@ -367,12 +393,15 @@ CONFIG_SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND=y
|
|||||||
CONFIG_SOC_PHY_COMBO_MODULE=y
|
CONFIG_SOC_PHY_COMBO_MODULE=y
|
||||||
CONFIG_SOC_CAPS_NO_RESET_BY_ANA_BOD=y
|
CONFIG_SOC_CAPS_NO_RESET_BY_ANA_BOD=y
|
||||||
CONFIG_SOC_LP_CORE_SINGLE_INTERRUPT_VECTOR=y
|
CONFIG_SOC_LP_CORE_SINGLE_INTERRUPT_VECTOR=y
|
||||||
|
CONFIG_SOC_LP_CORE_SUPPORT_ETM=y
|
||||||
|
CONFIG_SOC_DEBUG_HAVE_OCD_STUB_BINS=y
|
||||||
CONFIG_IDF_CMAKE=y
|
CONFIG_IDF_CMAKE=y
|
||||||
CONFIG_IDF_TOOLCHAIN="gcc"
|
CONFIG_IDF_TOOLCHAIN="gcc"
|
||||||
|
CONFIG_IDF_TOOLCHAIN_GCC=y
|
||||||
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
||||||
CONFIG_IDF_TARGET_ARCH="riscv"
|
CONFIG_IDF_TARGET_ARCH="riscv"
|
||||||
CONFIG_IDF_TARGET="esp32c6"
|
CONFIG_IDF_TARGET="esp32c6"
|
||||||
CONFIG_IDF_INIT_VERSION="5.3.0"
|
CONFIG_IDF_INIT_VERSION="5.4.1"
|
||||||
CONFIG_IDF_TARGET_ESP32C6=y
|
CONFIG_IDF_TARGET_ESP32C6=y
|
||||||
CONFIG_IDF_FIRMWARE_CHIP_ID=0x000D
|
CONFIG_IDF_FIRMWARE_CHIP_ID=0x000D
|
||||||
|
|
||||||
@@ -403,6 +432,10 @@ CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0
|
|||||||
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set
|
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set
|
||||||
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set
|
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Log
|
||||||
|
#
|
||||||
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
|
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
|
||||||
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
|
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
|
||||||
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
|
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
|
||||||
@@ -411,6 +444,14 @@ CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
|
|||||||
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
|
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
|
||||||
CONFIG_BOOTLOADER_LOG_LEVEL=3
|
CONFIG_BOOTLOADER_LOG_LEVEL=3
|
||||||
|
|
||||||
|
#
|
||||||
|
# Format
|
||||||
|
#
|
||||||
|
# CONFIG_BOOTLOADER_LOG_COLORS is not set
|
||||||
|
CONFIG_BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS=y
|
||||||
|
# end of Format
|
||||||
|
# end of Log
|
||||||
|
|
||||||
#
|
#
|
||||||
# Serial Flash Configurations
|
# Serial Flash Configurations
|
||||||
#
|
#
|
||||||
@@ -480,6 +521,7 @@ CONFIG_ESP_ROM_HAS_SW_FLOAT=y
|
|||||||
CONFIG_ESP_ROM_USB_OTG_NUM=-1
|
CONFIG_ESP_ROM_USB_OTG_NUM=-1
|
||||||
CONFIG_ESP_ROM_HAS_VERSION=y
|
CONFIG_ESP_ROM_HAS_VERSION=y
|
||||||
CONFIG_ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB=y
|
CONFIG_ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB=y
|
||||||
|
CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Boot ROM Behavior
|
# Boot ROM Behavior
|
||||||
@@ -503,7 +545,6 @@ CONFIG_ESPTOOLPY_FLASHMODE="dio"
|
|||||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||||
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
|
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
|
|
||||||
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
|
||||||
@@ -530,6 +571,7 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
|||||||
CONFIG_PARTITION_TABLE_SINGLE_APP=y
|
CONFIG_PARTITION_TABLE_SINGLE_APP=y
|
||||||
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
|
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
|
||||||
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
||||||
|
# CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set
|
||||||
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
|
||||||
@@ -553,6 +595,12 @@ CONFIG_ENV_GPIO_RANGE_MIN=0
|
|||||||
CONFIG_ENV_GPIO_RANGE_MAX=30
|
CONFIG_ENV_GPIO_RANGE_MAX=30
|
||||||
CONFIG_ENV_GPIO_IN_RANGE_MAX=30
|
CONFIG_ENV_GPIO_IN_RANGE_MAX=30
|
||||||
CONFIG_ENV_GPIO_OUT_RANGE_MAX=30
|
CONFIG_ENV_GPIO_OUT_RANGE_MAX=30
|
||||||
|
# CONFIG_USE_SPI_ETHERNET is not set
|
||||||
|
# end of Example Ethernet Configuration
|
||||||
|
|
||||||
|
#
|
||||||
|
# Example Ethernet Configuration
|
||||||
|
#
|
||||||
CONFIG_EXAMPLE_USE_SPI_ETHERNET=y
|
CONFIG_EXAMPLE_USE_SPI_ETHERNET=y
|
||||||
CONFIG_EXAMPLE_SPI_ETHERNETS_NUM=1
|
CONFIG_EXAMPLE_SPI_ETHERNETS_NUM=1
|
||||||
# CONFIG_EXAMPLE_USE_DM9051 is not set
|
# CONFIG_EXAMPLE_USE_DM9051 is not set
|
||||||
@@ -580,6 +628,7 @@ CONFIG_COMPILER_OPTIMIZATION_DEBUG=y
|
|||||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
||||||
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
|
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
|
||||||
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
|
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
|
||||||
|
CONFIG_COMPILER_ASSERT_NDEBUG_EVALUATE=y
|
||||||
# CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB is not set
|
# CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB is not set
|
||||||
CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y
|
CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y
|
||||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
|
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
|
||||||
@@ -592,15 +641,19 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
|
|||||||
# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set
|
# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set
|
||||||
# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set
|
# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set
|
||||||
# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set
|
# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set
|
||||||
|
# CONFIG_COMPILER_NO_MERGE_CONSTANTS is not set
|
||||||
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
|
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
|
||||||
# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set
|
# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set
|
||||||
|
CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y
|
||||||
# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set
|
# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set
|
||||||
# CONFIG_COMPILER_DISABLE_GCC13_WARNINGS is not set
|
# CONFIG_COMPILER_DISABLE_GCC13_WARNINGS is not set
|
||||||
|
# CONFIG_COMPILER_DISABLE_GCC14_WARNINGS is not set
|
||||||
# CONFIG_COMPILER_DUMP_RTL_FILES is not set
|
# CONFIG_COMPILER_DUMP_RTL_FILES is not set
|
||||||
CONFIG_COMPILER_RT_LIB_GCCLIB=y
|
CONFIG_COMPILER_RT_LIB_GCCLIB=y
|
||||||
CONFIG_COMPILER_RT_LIB_NAME="gcc"
|
CONFIG_COMPILER_RT_LIB_NAME="gcc"
|
||||||
# CONFIG_COMPILER_ORPHAN_SECTIONS_WARNING is not set
|
# CONFIG_COMPILER_ORPHAN_SECTIONS_WARNING is not set
|
||||||
CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y
|
CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y
|
||||||
|
# CONFIG_COMPILER_STATIC_ANALYZER is not set
|
||||||
# end of Compiler options
|
# end of Compiler options
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -646,6 +699,7 @@ CONFIG_BT_ALARM_MAX_NUM=50
|
|||||||
# Legacy ADC Driver Configuration
|
# Legacy ADC Driver Configuration
|
||||||
#
|
#
|
||||||
# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy ADC Calibration Configuration
|
# Legacy ADC Calibration Configuration
|
||||||
@@ -658,42 +712,49 @@ CONFIG_BT_ALARM_MAX_NUM=50
|
|||||||
# Legacy MCPWM Driver Configurations
|
# Legacy MCPWM Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy MCPWM Driver Configurations
|
# end of Legacy MCPWM Driver Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy Timer Group Driver Configurations
|
# Legacy Timer Group Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy Timer Group Driver Configurations
|
# end of Legacy Timer Group Driver Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy RMT Driver Configurations
|
# Legacy RMT Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy RMT Driver Configurations
|
# end of Legacy RMT Driver Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy I2S Driver Configurations
|
# Legacy I2S Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy I2S Driver Configurations
|
# end of Legacy I2S Driver Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy PCNT Driver Configurations
|
# Legacy PCNT Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy PCNT Driver Configurations
|
# end of Legacy PCNT Driver Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy SDM Driver Configurations
|
# Legacy SDM Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy SDM Driver Configurations
|
# end of Legacy SDM Driver Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Legacy Temperature Sensor Driver Configurations
|
# Legacy Temperature Sensor Driver Configurations
|
||||||
#
|
#
|
||||||
# CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN is not set
|
# CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN is not set
|
||||||
|
# CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||||
# end of Legacy Temperature Sensor Driver Configurations
|
# end of Legacy Temperature Sensor Driver Configurations
|
||||||
# end of Driver Configurations
|
# end of Driver Configurations
|
||||||
|
|
||||||
@@ -733,6 +794,7 @@ CONFIG_ESP_COEX_ENABLED=y
|
|||||||
CONFIG_ESP_COEX_SW_COEXIST_ENABLE=y
|
CONFIG_ESP_COEX_SW_COEXIST_ENABLE=y
|
||||||
# CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE is not set
|
# CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE is not set
|
||||||
# CONFIG_ESP_COEX_POWER_MANAGEMENT is not set
|
# CONFIG_ESP_COEX_POWER_MANAGEMENT is not set
|
||||||
|
# CONFIG_ESP_COEX_GPIO_DEBUG is not set
|
||||||
# end of Wireless Coexistence
|
# end of Wireless Coexistence
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -761,6 +823,7 @@ CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y
|
|||||||
#
|
#
|
||||||
# CONFIG_I2C_ISR_IRAM_SAFE is not set
|
# CONFIG_I2C_ISR_IRAM_SAFE is not set
|
||||||
# CONFIG_I2C_ENABLE_DEBUG_LOG is not set
|
# CONFIG_I2C_ENABLE_DEBUG_LOG is not set
|
||||||
|
# CONFIG_I2C_ENABLE_SLAVE_DRIVER_VERSION_2 is not set
|
||||||
# end of ESP-Driver:I2C Configurations
|
# end of ESP-Driver:I2C Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -871,6 +934,13 @@ CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y
|
|||||||
CONFIG_ESP_GDBSTUB_MAX_TASKS=32
|
CONFIG_ESP_GDBSTUB_MAX_TASKS=32
|
||||||
# end of GDB Stub
|
# end of GDB Stub
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP HID
|
||||||
|
#
|
||||||
|
CONFIG_ESPHID_TASK_SIZE_BT=2048
|
||||||
|
CONFIG_ESPHID_TASK_SIZE_BLE=4096
|
||||||
|
# end of ESP HID
|
||||||
|
|
||||||
#
|
#
|
||||||
# ESP HTTP client
|
# ESP HTTP client
|
||||||
#
|
#
|
||||||
@@ -878,6 +948,7 @@ CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
|
|||||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
|
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
|
||||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set
|
# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set
|
||||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_CUSTOM_TRANSPORT is not set
|
# CONFIG_ESP_HTTP_CLIENT_ENABLE_CUSTOM_TRANSPORT is not set
|
||||||
|
CONFIG_ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT=2000
|
||||||
# end of ESP HTTP client
|
# end of ESP HTTP client
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -890,6 +961,7 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
|
|||||||
# CONFIG_HTTPD_LOG_PURGE_DATA is not set
|
# CONFIG_HTTPD_LOG_PURGE_DATA is not set
|
||||||
# CONFIG_HTTPD_WS_SUPPORT is not set
|
# CONFIG_HTTPD_WS_SUPPORT is not set
|
||||||
# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set
|
# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set
|
||||||
|
CONFIG_HTTPD_SERVER_EVENT_POST_TIMEOUT=2000
|
||||||
# end of HTTP Server
|
# end of HTTP Server
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -897,12 +969,14 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
|
|||||||
#
|
#
|
||||||
# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set
|
# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set
|
||||||
# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set
|
# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set
|
||||||
|
CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000
|
||||||
# end of ESP HTTPS OTA
|
# end of ESP HTTPS OTA
|
||||||
|
|
||||||
#
|
#
|
||||||
# ESP HTTPS server
|
# ESP HTTPS server
|
||||||
#
|
#
|
||||||
# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set
|
# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set
|
||||||
|
CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT=2000
|
||||||
# end of ESP HTTPS server
|
# end of ESP HTTPS server
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -922,6 +996,12 @@ CONFIG_ESP_REV_MIN_FULL=0
|
|||||||
#
|
#
|
||||||
CONFIG_ESP32C6_REV_MAX_FULL=99
|
CONFIG_ESP32C6_REV_MAX_FULL=99
|
||||||
CONFIG_ESP_REV_MAX_FULL=99
|
CONFIG_ESP_REV_MAX_FULL=99
|
||||||
|
CONFIG_ESP_EFUSE_BLOCK_REV_MIN_FULL=0
|
||||||
|
CONFIG_ESP_EFUSE_BLOCK_REV_MAX_FULL=99
|
||||||
|
|
||||||
|
#
|
||||||
|
# Maximum Supported ESP32-C6 eFuse Block Revision (eFuse Block Rev v0.99)
|
||||||
|
#
|
||||||
# end of Chip revision
|
# end of Chip revision
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -959,7 +1039,7 @@ CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y
|
|||||||
CONFIG_RTC_CLK_SRC_INT_RC=y
|
CONFIG_RTC_CLK_SRC_INT_RC=y
|
||||||
# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set
|
# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set
|
||||||
# CONFIG_RTC_CLK_SRC_EXT_OSC is not set
|
# CONFIG_RTC_CLK_SRC_EXT_OSC is not set
|
||||||
# CONFIG_RTC_CLK_SRC_INT_RC32K is not set
|
# CONFIG_RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED is not set
|
||||||
CONFIG_RTC_CLK_CAL_CYCLES=1024
|
CONFIG_RTC_CLK_CAL_CYCLES=1024
|
||||||
# end of RTC Clock Config
|
# end of RTC Clock Config
|
||||||
|
|
||||||
@@ -990,44 +1070,33 @@ CONFIG_XTAL_FREQ_40=y
|
|||||||
CONFIG_XTAL_FREQ=40
|
CONFIG_XTAL_FREQ=40
|
||||||
# end of Main XTAL Config
|
# end of Main XTAL Config
|
||||||
|
|
||||||
#
|
|
||||||
# Crypto DPA Protection
|
|
||||||
#
|
|
||||||
CONFIG_ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP=y
|
|
||||||
CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW=y
|
|
||||||
# CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM is not set
|
|
||||||
# CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH is not set
|
|
||||||
CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL=1
|
|
||||||
# end of Crypto DPA Protection
|
|
||||||
|
|
||||||
CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y
|
CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y
|
||||||
# end of Hardware Settings
|
# end of Hardware Settings
|
||||||
|
|
||||||
#
|
#
|
||||||
# LCD and Touch Panel
|
# ESP-Driver:LCD Controller Configurations
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# LCD Touch Drivers are maintained in the IDF Component Registry
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# LCD Peripheral Configuration
|
|
||||||
#
|
#
|
||||||
# CONFIG_LCD_ENABLE_DEBUG_LOG is not set
|
# CONFIG_LCD_ENABLE_DEBUG_LOG is not set
|
||||||
# end of LCD Peripheral Configuration
|
# end of ESP-Driver:LCD Controller Configurations
|
||||||
# end of LCD and Touch Panel
|
|
||||||
|
#
|
||||||
|
# ESP-MM: Memory Management Configurations
|
||||||
|
#
|
||||||
|
# end of ESP-MM: Memory Management Configurations
|
||||||
|
|
||||||
#
|
#
|
||||||
# ESP NETIF Adapter
|
# ESP NETIF Adapter
|
||||||
#
|
#
|
||||||
CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120
|
CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120
|
||||||
|
# CONFIG_ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION is not set
|
||||||
CONFIG_ESP_NETIF_TCPIP_LWIP=y
|
CONFIG_ESP_NETIF_TCPIP_LWIP=y
|
||||||
# CONFIG_ESP_NETIF_LOOPBACK is not set
|
# CONFIG_ESP_NETIF_LOOPBACK is not set
|
||||||
CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y
|
CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y
|
||||||
|
CONFIG_ESP_NETIF_REPORT_DATA_TRAFFIC=y
|
||||||
# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set
|
# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set
|
||||||
# CONFIG_ESP_NETIF_L2_TAP is not set
|
# CONFIG_ESP_NETIF_L2_TAP is not set
|
||||||
# CONFIG_ESP_NETIF_BRIDGE_EN is not set
|
# CONFIG_ESP_NETIF_BRIDGE_EN is not set
|
||||||
|
# CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF is not set
|
||||||
# end of ESP NETIF Adapter
|
# end of ESP NETIF Adapter
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1044,17 +1113,20 @@ CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
|||||||
CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20
|
CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20
|
||||||
CONFIG_ESP_PHY_MAX_TX_POWER=20
|
CONFIG_ESP_PHY_MAX_TX_POWER=20
|
||||||
# CONFIG_ESP_PHY_REDUCE_TX_POWER is not set
|
# CONFIG_ESP_PHY_REDUCE_TX_POWER is not set
|
||||||
|
# CONFIG_ESP_PHY_ENABLE_CERT_TEST is not set
|
||||||
CONFIG_ESP_PHY_RF_CAL_PARTIAL=y
|
CONFIG_ESP_PHY_RF_CAL_PARTIAL=y
|
||||||
# CONFIG_ESP_PHY_RF_CAL_NONE is not set
|
# CONFIG_ESP_PHY_RF_CAL_NONE is not set
|
||||||
# CONFIG_ESP_PHY_RF_CAL_FULL is not set
|
# CONFIG_ESP_PHY_RF_CAL_FULL is not set
|
||||||
CONFIG_ESP_PHY_CALIBRATION_MODE=0
|
CONFIG_ESP_PHY_CALIBRATION_MODE=0
|
||||||
# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set
|
# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set
|
||||||
|
# CONFIG_ESP_PHY_RECORD_USED_TIME is not set
|
||||||
# end of PHY
|
# end of PHY
|
||||||
|
|
||||||
#
|
#
|
||||||
# Power Management
|
# Power Management
|
||||||
#
|
#
|
||||||
# CONFIG_PM_ENABLE is not set
|
# CONFIG_PM_ENABLE is not set
|
||||||
|
# CONFIG_PM_SLP_IRAM_OPT is not set
|
||||||
CONFIG_PM_SLP_DEFAULT_PARAMS_OPT=y
|
CONFIG_PM_SLP_DEFAULT_PARAMS_OPT=y
|
||||||
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
||||||
# CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP is not set
|
# CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP is not set
|
||||||
@@ -1070,6 +1142,21 @@ CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
|||||||
# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set
|
# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set
|
||||||
# end of ESP Ringbuf
|
# end of ESP Ringbuf
|
||||||
|
|
||||||
|
#
|
||||||
|
# ESP Security Specific
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Crypto DPA Protection
|
||||||
|
#
|
||||||
|
CONFIG_ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP=y
|
||||||
|
CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW=y
|
||||||
|
# CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM is not set
|
||||||
|
# CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH is not set
|
||||||
|
CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL=1
|
||||||
|
# end of Crypto DPA Protection
|
||||||
|
# end of ESP Security Specific
|
||||||
|
|
||||||
#
|
#
|
||||||
# ESP System Settings
|
# ESP System Settings
|
||||||
#
|
#
|
||||||
@@ -1091,6 +1178,7 @@ CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y
|
|||||||
# Memory protection
|
# Memory protection
|
||||||
#
|
#
|
||||||
CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=y
|
CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=y
|
||||||
|
# CONFIG_ESP_SYSTEM_PMP_LP_CORE_RESERVE_MEM_EXECUTABLE is not set
|
||||||
# end of Memory protection
|
# end of Memory protection
|
||||||
|
|
||||||
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
|
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
|
||||||
@@ -1120,6 +1208,7 @@ CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
|
|||||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||||
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
|
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
|
||||||
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
||||||
|
# CONFIG_ESP_DEBUG_INCLUDE_OCD_STUB_BINS is not set
|
||||||
CONFIG_ESP_DEBUG_OCDAWARE=y
|
CONFIG_ESP_DEBUG_OCDAWARE=y
|
||||||
CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y
|
CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y
|
||||||
|
|
||||||
@@ -1274,6 +1363,9 @@ CONFIG_FATFS_FS_LOCK=0
|
|||||||
CONFIG_FATFS_TIMEOUT_MS=10000
|
CONFIG_FATFS_TIMEOUT_MS=10000
|
||||||
CONFIG_FATFS_PER_FILE_CACHE=y
|
CONFIG_FATFS_PER_FILE_CACHE=y
|
||||||
# CONFIG_FATFS_USE_FASTSEEK is not set
|
# CONFIG_FATFS_USE_FASTSEEK is not set
|
||||||
|
CONFIG_FATFS_USE_STRFUNC_NONE=y
|
||||||
|
# CONFIG_FATFS_USE_STRFUNC_WITHOUT_CRLF_CONV is not set
|
||||||
|
# CONFIG_FATFS_USE_STRFUNC_WITH_CRLF_CONV is not set
|
||||||
CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0
|
CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0
|
||||||
# CONFIG_FATFS_IMMEDIATE_FSYNC is not set
|
# CONFIG_FATFS_IMMEDIATE_FSYNC is not set
|
||||||
# CONFIG_FATFS_USE_LABEL is not set
|
# CONFIG_FATFS_USE_LABEL is not set
|
||||||
@@ -1300,6 +1392,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536
|
|||||||
# CONFIG_FREERTOS_USE_TICK_HOOK is not set
|
# CONFIG_FREERTOS_USE_TICK_HOOK is not set
|
||||||
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
|
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
|
||||||
# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set
|
# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set
|
||||||
|
CONFIG_FREERTOS_USE_TIMERS=y
|
||||||
CONFIG_FREERTOS_TIMER_SERVICE_TASK_NAME="Tmr Svc"
|
CONFIG_FREERTOS_TIMER_SERVICE_TASK_NAME="Tmr Svc"
|
||||||
# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0 is not set
|
# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0 is not set
|
||||||
CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY=y
|
CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY=y
|
||||||
@@ -1334,6 +1427,11 @@ CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y
|
|||||||
# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
|
# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
|
||||||
# end of Port
|
# end of Port
|
||||||
|
|
||||||
|
#
|
||||||
|
# Extra
|
||||||
|
#
|
||||||
|
# end of Extra
|
||||||
|
|
||||||
CONFIG_FREERTOS_PORT=y
|
CONFIG_FREERTOS_PORT=y
|
||||||
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
|
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
|
||||||
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
||||||
@@ -1390,7 +1488,11 @@ CONFIG_IEEE802154_PENDING_TABLE_SIZE=20
|
|||||||
# end of IEEE 802.15.4
|
# end of IEEE 802.15.4
|
||||||
|
|
||||||
#
|
#
|
||||||
# Log output
|
# Log
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Log Level
|
||||||
#
|
#
|
||||||
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
|
||||||
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
|
||||||
@@ -1399,15 +1501,33 @@ CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
|||||||
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
|
||||||
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
|
||||||
CONFIG_LOG_DEFAULT_LEVEL=3
|
CONFIG_LOG_DEFAULT_LEVEL=3
|
||||||
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
|
# CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT is not set
|
||||||
# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set
|
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
||||||
# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set
|
# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set
|
||||||
CONFIG_LOG_MAXIMUM_LEVEL=3
|
CONFIG_LOG_MAXIMUM_LEVEL=4
|
||||||
|
|
||||||
|
#
|
||||||
|
# Level Settings
|
||||||
|
#
|
||||||
# CONFIG_LOG_MASTER_LEVEL is not set
|
# CONFIG_LOG_MASTER_LEVEL is not set
|
||||||
|
CONFIG_LOG_DYNAMIC_LEVEL_CONTROL=y
|
||||||
|
# CONFIG_LOG_TAG_LEVEL_IMPL_NONE is not set
|
||||||
|
# CONFIG_LOG_TAG_LEVEL_IMPL_LINKED_LIST is not set
|
||||||
|
CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_AND_LINKED_LIST=y
|
||||||
|
# CONFIG_LOG_TAG_LEVEL_CACHE_ARRAY is not set
|
||||||
|
CONFIG_LOG_TAG_LEVEL_CACHE_BINARY_MIN_HEAP=y
|
||||||
|
CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_SIZE=31
|
||||||
|
# end of Level Settings
|
||||||
|
# end of Log Level
|
||||||
|
|
||||||
|
#
|
||||||
|
# Format
|
||||||
|
#
|
||||||
CONFIG_LOG_COLORS=y
|
CONFIG_LOG_COLORS=y
|
||||||
CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
|
CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
|
||||||
# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set
|
# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set
|
||||||
# end of Log output
|
# end of Format
|
||||||
|
# end of Log
|
||||||
|
|
||||||
#
|
#
|
||||||
# LWIP
|
# LWIP
|
||||||
@@ -1446,6 +1566,8 @@ CONFIG_LWIP_ESP_MLDV6_REPORT=y
|
|||||||
CONFIG_LWIP_MLDV6_TMR_INTERVAL=40
|
CONFIG_LWIP_MLDV6_TMR_INTERVAL=40
|
||||||
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
|
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
|
||||||
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
||||||
|
# CONFIG_LWIP_DHCP_DOES_ACD_CHECK is not set
|
||||||
|
# CONFIG_LWIP_DHCP_DOES_NOT_CHECK_OFFERED_IP is not set
|
||||||
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
|
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
|
||||||
CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y
|
CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y
|
||||||
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
|
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
|
||||||
@@ -1460,6 +1582,7 @@ CONFIG_LWIP_DHCPS=y
|
|||||||
CONFIG_LWIP_DHCPS_LEASE_UNIT=60
|
CONFIG_LWIP_DHCPS_LEASE_UNIT=60
|
||||||
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
|
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
|
||||||
CONFIG_LWIP_DHCPS_STATIC_ENTRIES=y
|
CONFIG_LWIP_DHCPS_STATIC_ENTRIES=y
|
||||||
|
CONFIG_LWIP_DHCPS_ADD_DNS=y
|
||||||
# end of DHCP server
|
# end of DHCP server
|
||||||
|
|
||||||
# CONFIG_LWIP_AUTOIP is not set
|
# CONFIG_LWIP_AUTOIP is not set
|
||||||
@@ -1517,9 +1640,12 @@ CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072
|
|||||||
CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
|
CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
|
||||||
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set
|
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set
|
||||||
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
|
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
|
||||||
# CONFIG_LWIP_PPP_SUPPORT is not set
|
|
||||||
CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3
|
CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3
|
||||||
CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5
|
CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5
|
||||||
|
CONFIG_LWIP_IPV6_ND6_NUM_PREFIXES=5
|
||||||
|
CONFIG_LWIP_IPV6_ND6_NUM_ROUTERS=3
|
||||||
|
CONFIG_LWIP_IPV6_ND6_NUM_DESTINATIONS=10
|
||||||
|
# CONFIG_LWIP_PPP_SUPPORT is not set
|
||||||
# CONFIG_LWIP_SLIP_SUPPORT is not set
|
# CONFIG_LWIP_SLIP_SUPPORT is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1549,8 +1675,10 @@ CONFIG_LWIP_SNTP_MAXIMUM_STARTUP_DELAY=5000
|
|||||||
#
|
#
|
||||||
# DNS
|
# DNS
|
||||||
#
|
#
|
||||||
|
CONFIG_LWIP_DNS_MAX_HOST_IP=1
|
||||||
CONFIG_LWIP_DNS_MAX_SERVERS=3
|
CONFIG_LWIP_DNS_MAX_SERVERS=3
|
||||||
# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set
|
# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set
|
||||||
|
# CONFIG_LWIP_DNS_SETSERVER_WITH_NETIF is not set
|
||||||
# end of DNS
|
# end of DNS
|
||||||
|
|
||||||
CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7
|
CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7
|
||||||
@@ -1574,6 +1702,8 @@ CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y
|
|||||||
CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y
|
CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y
|
||||||
# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set
|
# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set
|
||||||
# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set
|
# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set
|
||||||
|
CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_NONE=y
|
||||||
|
# CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_CUSTOM is not set
|
||||||
CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y
|
CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y
|
||||||
# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set
|
# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set
|
||||||
# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set
|
# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set
|
||||||
@@ -1638,6 +1768,7 @@ CONFIG_MBEDTLS_HAVE_TIME=y
|
|||||||
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
|
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
|
||||||
CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y
|
CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y
|
||||||
CONFIG_MBEDTLS_SHA512_C=y
|
CONFIG_MBEDTLS_SHA512_C=y
|
||||||
|
# CONFIG_MBEDTLS_SHA3_C is not set
|
||||||
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
||||||
# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set
|
# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set
|
||||||
# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set
|
# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set
|
||||||
@@ -1691,6 +1822,8 @@ CONFIG_MBEDTLS_X509_CSR_PARSE_C=y
|
|||||||
# end of Certificates
|
# end of Certificates
|
||||||
|
|
||||||
CONFIG_MBEDTLS_ECP_C=y
|
CONFIG_MBEDTLS_ECP_C=y
|
||||||
|
CONFIG_MBEDTLS_PK_PARSE_EC_EXTENDED=y
|
||||||
|
CONFIG_MBEDTLS_PK_PARSE_EC_COMPRESSED=y
|
||||||
# CONFIG_MBEDTLS_DHM_C is not set
|
# CONFIG_MBEDTLS_DHM_C is not set
|
||||||
CONFIG_MBEDTLS_ECDH_C=y
|
CONFIG_MBEDTLS_ECDH_C=y
|
||||||
CONFIG_MBEDTLS_ECDSA_C=y
|
CONFIG_MBEDTLS_ECDSA_C=y
|
||||||
@@ -1714,6 +1847,7 @@ CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y
|
|||||||
# CONFIG_MBEDTLS_HKDF_C is not set
|
# CONFIG_MBEDTLS_HKDF_C is not set
|
||||||
# CONFIG_MBEDTLS_THREADING_C is not set
|
# CONFIG_MBEDTLS_THREADING_C is not set
|
||||||
CONFIG_MBEDTLS_ERROR_STRINGS=y
|
CONFIG_MBEDTLS_ERROR_STRINGS=y
|
||||||
|
CONFIG_MBEDTLS_FS_IO=y
|
||||||
# end of mbedTLS
|
# end of mbedTLS
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1762,25 +1896,10 @@ CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y
|
|||||||
# CONFIG_OPENTHREAD_ENABLED is not set
|
# CONFIG_OPENTHREAD_ENABLED is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Thread Operational Dataset
|
# OpenThread Spinel
|
||||||
#
|
#
|
||||||
CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP"
|
|
||||||
CONFIG_OPENTHREAD_MESH_LOCAL_PREFIX="fd00:db8:a0:0::/64"
|
|
||||||
CONFIG_OPENTHREAD_NETWORK_CHANNEL=15
|
|
||||||
CONFIG_OPENTHREAD_NETWORK_PANID=0x1234
|
|
||||||
CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe"
|
|
||||||
CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff"
|
|
||||||
CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53"
|
|
||||||
# end of Thread Operational Dataset
|
|
||||||
|
|
||||||
CONFIG_OPENTHREAD_XTAL_ACCURACY=130
|
|
||||||
# CONFIG_OPENTHREAD_SPINEL_ONLY is not set
|
# CONFIG_OPENTHREAD_SPINEL_ONLY is not set
|
||||||
# CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE is not set
|
# end of OpenThread Spinel
|
||||||
|
|
||||||
#
|
|
||||||
# Thread Address Query Config
|
|
||||||
#
|
|
||||||
# end of Thread Address Query Config
|
|
||||||
# end of OpenThread
|
# end of OpenThread
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1789,6 +1908,7 @@ CONFIG_OPENTHREAD_XTAL_ACCURACY=130
|
|||||||
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y
|
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y
|
||||||
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y
|
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y
|
||||||
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y
|
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y
|
||||||
|
CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_PATCH_VERSION=y
|
||||||
# end of Protocomm
|
# end of Protocomm
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1827,7 +1947,9 @@ CONFIG_SPI_FLASH_BROWNOUT_RESET=y
|
|||||||
#
|
#
|
||||||
# Features here require specific hardware (READ DOCS FIRST!)
|
# Features here require specific hardware (READ DOCS FIRST!)
|
||||||
#
|
#
|
||||||
|
# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set
|
||||||
CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50
|
CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50
|
||||||
|
# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set
|
||||||
# end of Optional and Experimental Features (READ DOCS FIRST)
|
# end of Optional and Experimental Features (READ DOCS FIRST)
|
||||||
# end of Main Flash configuration
|
# end of Main Flash configuration
|
||||||
|
|
||||||
@@ -1953,6 +2075,8 @@ CONFIG_VFS_MAX_COUNT=8
|
|||||||
#
|
#
|
||||||
CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1
|
CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1
|
||||||
# end of Host File System I/O (Semihosting)
|
# end of Host File System I/O (Semihosting)
|
||||||
|
|
||||||
|
CONFIG_VFS_INITIALIZE_DEV_NULL=y
|
||||||
# end of Virtual file system
|
# end of Virtual file system
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1968,7 +2092,6 @@ CONFIG_WL_SECTOR_SIZE=4096
|
|||||||
#
|
#
|
||||||
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
|
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
|
||||||
CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
|
CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
|
||||||
# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set
|
|
||||||
CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y
|
CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y
|
||||||
# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set
|
# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set
|
||||||
# end of Wi-Fi Provisioning Manager
|
# end of Wi-Fi Provisioning Manager
|
||||||
@@ -2127,8 +2250,6 @@ CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
|
|||||||
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
|
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_TX_BA_WIN=6
|
CONFIG_ESP32_WIFI_TX_BA_WIN=6
|
||||||
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
|
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
|
|
||||||
CONFIG_ESP32_WIFI_RX_BA_WIN=6
|
|
||||||
CONFIG_ESP32_WIFI_RX_BA_WIN=6
|
CONFIG_ESP32_WIFI_RX_BA_WIN=6
|
||||||
CONFIG_ESP32_WIFI_NVS_ENABLED=y
|
CONFIG_ESP32_WIFI_NVS_ENABLED=y
|
||||||
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
code --profile Embed-Esp ${SCRIPT_DIR}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# Unit Testing
|
|
||||||
|
|
||||||
Unit Test based on unity-library [Unity](https://github.com/ThrowTheSwitch/Unity).
|
|
||||||
|
|
||||||
* _Assertions_ (`TEST_ASSERT` and similar) are used when writing the test cases. See [the reference](https://github.com/ThrowTheSwitch/Unity/blob/master/docs/UnityAssertionsReference.md) for more information about assertions.
|
|
||||||
|
|
||||||
* `UNITY_BEGIN()` and `UNITY_END()` macros allow Unity to count the number of tests which have passed or failed, and display the summary.
|
|
||||||
|
|
||||||
In addition to features of Unity, _test registration_ feature of ESP-IDF is used. This feature works when unit test functions are declared using `TEST_CASE` macro. Such functions from all the object files in the program are automatically collected into a list, and run-time facilities are provided to run functions from this list.
|
|
||||||
|
|
||||||
Note testable components have a *test* subdirectory which is included in the *test project*
|
|
||||||
When the main application project is compiled, tests are not included.
|
|
||||||
Test project includes the tests by setting `TEST_COMPONENTS` variable in the project makefile.
|
|
||||||
|
|
||||||
## Build and flash production code
|
|
||||||
|
|
||||||
* Start an ESP-IDF-Terminal
|
|
||||||
* Run `idf.py -p PORT flash monitor` in the current directory (`unit_test`).
|
|
||||||
* Observe the output: a list of random numbers and their mean value.
|
|
||||||
To exit the serial monitor, type ``Ctrl-]``.
|
|
||||||
|
|
||||||
## Build and flash test code
|
|
||||||
|
|
||||||
* Start an ESP-IDF-Terminal
|
|
||||||
* Enter `test` directory (`unit_test/test`), and run `idf.py -p PORT flash monitor`.
|
|
||||||
To exit the serial monitor, type ``Ctrl-]``.
|
|
||||||
* Observe the output: results of test case execution.
|
|
||||||
|
|
||||||
This is the test menu, which is launched by `unity_run_menu` function in the test project. It allows running the tests in a few ways:
|
|
||||||
* Run specific test by its index: type the number and press ENTER.
|
|
||||||
* Run a group of tests with a certain tag: type the tag, including square brackets, and press ENTER.
|
|
||||||
* nRu all tests except the ones with a certain tag: press `!`, then type the tag, including the square brackets, then press ENTER.
|
|
||||||
* Run test with a specific name: type the name of the test, including quotes, and press ENTER.
|
|
||||||
* Run all the tests: press `*` and then ENTER.
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
set(EXTRA_COMPONENT_DIRS
|
||||||
|
"../../core/components"
|
||||||
|
"../../core/managed_components"
|
||||||
|
"../../components"
|
||||||
|
# "../../managed_components"
|
||||||
|
)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(INTEGRATION_TESTS_FW)
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
idf_component_register(SRCS "movementTests.cpp"
|
||||||
|
INCLUDE_DIRS ".")
|
||||||
@@ -0,0 +1,340 @@
|
|||||||
|
/**
|
||||||
|
* @file watchMain.cpp
|
||||||
|
* @author Gustice
|
||||||
|
* @brief ChaosWatch Application
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2024
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// NOTE: Create IDF shell navigate to directory ("test/integration")
|
||||||
|
// and run "idf.py -p COM9 flash monitor"
|
||||||
|
|
||||||
|
#include "Processor.hpp"
|
||||||
|
#include "PwmExpanderPca9685.hpp"
|
||||||
|
#include "Task.hpp"
|
||||||
|
#include "esp_event.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "stepperDrv.hpp"
|
||||||
|
#include "stepperMotor.hpp"
|
||||||
|
#include "watchFace.hpp"
|
||||||
|
#include <array>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
/* Watchface Indicies
|
||||||
|
6/ 5/
|
||||||
|
5 / 1 4 / 0
|
||||||
|
4 2 3 1
|
||||||
|
3 2
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern "C" { // This switch allows the ROS C-implementation to find this main
|
||||||
|
void app_main(void);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *TAG = "IT";
|
||||||
|
|
||||||
|
struct DeviceState {
|
||||||
|
uint8_t minJumps{6};
|
||||||
|
uint8_t maxJumps{32};
|
||||||
|
uint8_t profile{};
|
||||||
|
uint8_t restTime{};
|
||||||
|
float speed = 1.0; // Rad/sec
|
||||||
|
float accel = 1.0; // Rad/sec^2
|
||||||
|
Color color{0x80, 0x80, 0x80};
|
||||||
|
uint8_t pictogram{}; // 0..5 active Pictogramm
|
||||||
|
};
|
||||||
|
|
||||||
|
class IndexIllumination {
|
||||||
|
public:
|
||||||
|
IndexIllumination()
|
||||||
|
: master(I2C_NUM_0, /*sda=*/GPIO_NUM_10, /*scl=*/GPIO_NUM_11),
|
||||||
|
ledDriver1(master, /*iverted=*/false),
|
||||||
|
ledDriver2(master, /*iverted=*/false, 0x41),
|
||||||
|
pwmEnable(GPIO_NUM_1, GpioPort::Logic::Inverted),
|
||||||
|
RED{CRed.getColor<Color::Rgbw>()},
|
||||||
|
GREEN{CGreen.getColor<Color::Rgbw>()},
|
||||||
|
BLUE{CBlue.getColor<Color::Rgbw>()} {
|
||||||
|
pwmEnable.write(true);
|
||||||
|
clearColorData();
|
||||||
|
syncToDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearColorData() {
|
||||||
|
for (size_t i = 0; i < 2; i++) {
|
||||||
|
for (size_t j = 0; j < PmwExpanderPca9685::PwmChannels; j++) {
|
||||||
|
Values[i][j] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setColorOfIndexTo(uint8_t idx, Color::Rgbw color) {
|
||||||
|
if (idx >= 6) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto sp = LedStartPoints[idx];
|
||||||
|
sp[0] = (uint16_t)(color.white) << 5;
|
||||||
|
sp[1] = (uint16_t)(color.blue) << 5;
|
||||||
|
sp[2] = (uint16_t)(color.green) << 5;
|
||||||
|
sp[3] = (uint16_t)(color.red) << 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncToDevice() {
|
||||||
|
ledDriver1.sendImage(Values[0]);
|
||||||
|
ledDriver2.sendImage(Values[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void flashAll(Color::Rgbw color, int duration = 200) {
|
||||||
|
clearColorData();
|
||||||
|
for (size_t i = 0; i < 6; i++) {
|
||||||
|
setColorOfIndexTo(i, color);
|
||||||
|
}
|
||||||
|
syncToDevice();
|
||||||
|
fos::Task::delayMs(duration);
|
||||||
|
clearColorData();
|
||||||
|
syncToDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
PmwExpanderPca9685::GrayValues Values[2]{};
|
||||||
|
std::array<uint16_t *, 6> LedStartPoints{
|
||||||
|
&(Values[0][4]), // 1
|
||||||
|
&(Values[1][12]),
|
||||||
|
&(Values[1][8]),
|
||||||
|
&(Values[1][4]),
|
||||||
|
&(Values[0][12]),
|
||||||
|
&(Values[0][8]), // 6
|
||||||
|
};
|
||||||
|
|
||||||
|
I2cMaster master;
|
||||||
|
PmwExpanderPca9685 ledDriver1;
|
||||||
|
PmwExpanderPca9685 ledDriver2;
|
||||||
|
OutputPort pwmEnable;
|
||||||
|
const Color::Rgbw RED;
|
||||||
|
const Color::Rgbw GREEN;
|
||||||
|
const Color::Rgbw BLUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
DeviceState activeState;
|
||||||
|
|
||||||
|
void IndexColorSweep(IndexIllumination &illum) {
|
||||||
|
const auto RED = CRed.getColor<Color::Rgbw>();
|
||||||
|
const auto GREEN = CGreen.getColor<Color::Rgbw>();
|
||||||
|
const auto BLUE = CBlue.getColor<Color::Rgbw>();
|
||||||
|
|
||||||
|
illum.flashAll(RED);
|
||||||
|
fos::Task::delayMs(200);
|
||||||
|
illum.flashAll(GREEN);
|
||||||
|
fos::Task::delayMs(200);
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
fos::Task::delayMs(200);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(0, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(0, RED);
|
||||||
|
illum.setColorOfIndexTo(1, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(1, RED);
|
||||||
|
illum.setColorOfIndexTo(2, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(2, RED);
|
||||||
|
illum.setColorOfIndexTo(3, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(3, RED);
|
||||||
|
illum.setColorOfIndexTo(4, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(4, RED);
|
||||||
|
illum.setColorOfIndexTo(5, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(5, RED);
|
||||||
|
illum.syncToDevice();
|
||||||
|
fos::Task::delayMs(500);
|
||||||
|
|
||||||
|
illum.clearColorData();
|
||||||
|
illum.setColorOfIndexTo(0, GREEN);
|
||||||
|
illum.syncToDevice();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool DoFlushAtBeginning = false;
|
||||||
|
constexpr bool DoFullTurns = false;
|
||||||
|
constexpr bool DoTurnSteps = false;
|
||||||
|
constexpr bool DoTurnProfiles = true;
|
||||||
|
|
||||||
|
void AllmostDone(uint8_t newIdx) {
|
||||||
|
ESP_LOGW(TAG, "Done callback");
|
||||||
|
}
|
||||||
|
|
||||||
|
void testMovementTask() {
|
||||||
|
esp_log_level_set(TAG, ESP_LOG_DEBUG);
|
||||||
|
esp_log_level_set("STP", ESP_LOG_DEBUG);
|
||||||
|
ESP_LOGD(TAG, "Init Lights for signaling");
|
||||||
|
|
||||||
|
IndexIllumination illum;
|
||||||
|
|
||||||
|
if constexpr (DoFlushAtBeginning) {
|
||||||
|
IndexColorSweep(illum);
|
||||||
|
}
|
||||||
|
const auto BLUE = CBlue.getColor<Color::Rgbw>();
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Init Stepper");
|
||||||
|
|
||||||
|
constexpr int MicroSteps = 32;
|
||||||
|
constexpr float Intensity = 0.25;
|
||||||
|
constexpr float StepWidth = 1.8;
|
||||||
|
StepperDriverDrv8833::Pins stepperPins({LEDC_TIMER_0,
|
||||||
|
{LEDC_CHANNEL_0, LEDC_CHANNEL_1, LEDC_CHANNEL_2, LEDC_CHANNEL_3},
|
||||||
|
{GPIO_NUM_21, GPIO_NUM_20, GPIO_NUM_23, GPIO_NUM_22}});
|
||||||
|
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps, Intensity);
|
||||||
|
StepperConfig stepperCfg(StepWidth, MicroSteps);
|
||||||
|
InputPort initSens(GPIO_NUM_18);
|
||||||
|
OutputPort motorSleep(GPIO_NUM_15, GpioPort::Logic::Inverted);
|
||||||
|
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
||||||
|
|
||||||
|
WatchMotor watch(stepper, motorSleep, AllmostDone);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Full Turns with full steps
|
||||||
|
///
|
||||||
|
if constexpr (DoFullTurns) {
|
||||||
|
ESP_LOGD(TAG, "Find Home");
|
||||||
|
stepper.findRef();
|
||||||
|
ESP_LOGD(TAG, "Fist Position is %3d / %.2f / Micro %d", stepper.getQuanted(), stepper.getScaledPos() * 6, stepper.getSubPos());
|
||||||
|
fos::Task::delayMs(2000);
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Make one turns with full steps");
|
||||||
|
// stepper.setPos(0);
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Position at begin is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
while (i++ < 200) {
|
||||||
|
stepper.fullStep(1);
|
||||||
|
fos::Task::delayMs(100);
|
||||||
|
ESP_LOGD(TAG, "Position is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
}
|
||||||
|
fos::Task::delayMs(2000);
|
||||||
|
|
||||||
|
int spB = stepper.getSubPos();
|
||||||
|
stepper.demoFullTurn();
|
||||||
|
int spE = stepper.getSubPos();
|
||||||
|
ESP_LOGD(TAG, "Fullsteps SubPos begin %d / end %d", spB, spE);
|
||||||
|
fos::Task::delayMs(2000);
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Position at begin is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
i = 0;
|
||||||
|
while (i++ < 64) {
|
||||||
|
stepper.step(1);
|
||||||
|
fos::Task::delayMs(100);
|
||||||
|
ESP_LOGD(TAG, "Position is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Homing
|
||||||
|
///
|
||||||
|
ESP_LOGD(TAG, "Find Home");
|
||||||
|
stepper.findRef();
|
||||||
|
ESP_LOGD(TAG, "Fist Position is %3d / %.2f / Micro %d", stepper.getQuanted(), stepper.getScaledPos() * 6, stepper.getSubPos());
|
||||||
|
for (size_t i = 0; i < 7; i++) {
|
||||||
|
stepper.fullStep(1);
|
||||||
|
fos::Task::delayMs(40);
|
||||||
|
}
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
fos::Task::delayMs(1000);
|
||||||
|
|
||||||
|
auto ref = stepper.zeroPosition();
|
||||||
|
ESP_LOGD(TAG, "Reference saved at %.2f ", ref);
|
||||||
|
ESP_LOGD(TAG, "Correct Home");
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Multiple Turns continuous
|
||||||
|
///
|
||||||
|
if constexpr (DoTurnSteps) {
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Fist Position is %3d / %.2f / Micro %d", stepper.getQuanted(), stepper.getScaledPos() * 6, stepper.getSubPos());
|
||||||
|
fos::Task::delayMs(1000);
|
||||||
|
ESP_LOGI(TAG, "Move to each index multiple times");
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
for (size_t i = 1; i <= 2 * 3; i++) {
|
||||||
|
watch.moveTo(3 * i, 0, 0, 1, 1);
|
||||||
|
ESP_LOGD(TAG, "Position is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Move to each index multiple times");
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
for (size_t i = 1; i <= 6 * 3; i++) {
|
||||||
|
watch.moveTo(i, 0, 0, 1, 1);
|
||||||
|
ESP_LOGD(TAG, "Position is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// All other Profiles
|
||||||
|
///
|
||||||
|
if constexpr (DoTurnProfiles) {
|
||||||
|
for (size_t i = ProfileGenerator::Smooth; i < ProfileGenerator::NumProfiles; i++) {
|
||||||
|
// for (size_t i = ProfileGenerator::JumpIn; i < ProfileGenerator::NumProfiles; i++) { // If only part is needed
|
||||||
|
ESP_LOGI(TAG, "Running Profile %d ", i);
|
||||||
|
ESP_LOGD(TAG, "Fist Position is %3d / %.2f / Micro %d", stepper.getQuanted(), stepper.getScaledPos() * 6, stepper.getSubPos());
|
||||||
|
fos::Task::delayMs(1000);
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
int steps[3]{4, 2, 0};
|
||||||
|
for (size_t j = 0; j < 3; j++) {
|
||||||
|
watch.moveTo(steps[j], i, 0, 1, 1);
|
||||||
|
ESP_LOGI(TAG, "Last position is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
fos::Task::delayMs(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = ProfileGenerator::Smooth; i < ProfileGenerator::NumProfiles; i++) {
|
||||||
|
// for (size_t i = ProfileGenerator::JumpIn; i < ProfileGenerator::NumProfiles; i++) { // If only part is needed
|
||||||
|
ESP_LOGI(TAG, "Running Profile %d ", i);
|
||||||
|
ESP_LOGD(TAG, "Fist Position is %3d / %.2f / Micro %d", stepper.getQuanted(), stepper.getScaledPos() * 6, stepper.getSubPos());
|
||||||
|
fos::Task::delayMs(1000);
|
||||||
|
illum.flashAll(BLUE);
|
||||||
|
int steps[3]{4, 2, 0};
|
||||||
|
for (size_t j = 0; j < 3; j++) {
|
||||||
|
watch.moveTo(steps[j], i, 0, 3, 3);
|
||||||
|
ESP_LOGI(TAG, "Last position is %3d / %.2f", stepper.getQuanted(), stepper.getScaledPos() * 6);
|
||||||
|
fos::Task::delayMs(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
ESP_LOGI(TAG, "Finish");
|
||||||
|
fos::Task::delayMs(60000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_main(void) {
|
||||||
|
ESP_LOGI(TAG, "Start Movement Integration Tests");
|
||||||
|
|
||||||
|
static fos::Task movementTest(testMovementTask, "Move", fos::Task::DefaultStackSize * 8);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
fos::Task::delayMs(5000);
|
||||||
|
// ESP_LOGI(TAG, "Finish");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -506,14 +506,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
|||||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
|
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
|
||||||
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
|
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
|
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
|
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
|
||||||
# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set
|
# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set
|
||||||
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
||||||
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
||||||
@@ -1080,7 +1080,11 @@ CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM=0
|
|||||||
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||||
CONFIG_ESP_INT_WDT=y
|
CONFIG_ESP_INT_WDT=y
|
||||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
|
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
|
||||||
# CONFIG_ESP_TASK_WDT_EN is not set
|
CONFIG_ESP_TASK_WDT_EN=y
|
||||||
|
CONFIG_ESP_TASK_WDT_INIT=y
|
||||||
|
# CONFIG_ESP_TASK_WDT_PANIC is not set
|
||||||
|
CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
|
||||||
|
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||||
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
|
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
|
||||||
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
||||||
CONFIG_ESP_DEBUG_OCDAWARE=y
|
CONFIG_ESP_DEBUG_OCDAWARE=y
|
||||||
@@ -1362,10 +1366,10 @@ CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
|||||||
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
|
||||||
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
|
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
|
||||||
CONFIG_LOG_DEFAULT_LEVEL=3
|
CONFIG_LOG_DEFAULT_LEVEL=3
|
||||||
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
|
# CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT is not set
|
||||||
# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set
|
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
||||||
# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set
|
# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set
|
||||||
CONFIG_LOG_MAXIMUM_LEVEL=3
|
CONFIG_LOG_MAXIMUM_LEVEL=4
|
||||||
# CONFIG_LOG_MASTER_LEVEL is not set
|
# CONFIG_LOG_MASTER_LEVEL is not set
|
||||||
CONFIG_LOG_COLORS=y
|
CONFIG_LOG_COLORS=y
|
||||||
CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
|
CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
|
||||||
@@ -1767,9 +1771,9 @@ CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread"
|
|||||||
#
|
#
|
||||||
# MMU Config
|
# MMU Config
|
||||||
#
|
#
|
||||||
CONFIG_MMU_PAGE_SIZE_32KB=y
|
CONFIG_MMU_PAGE_SIZE_64KB=y
|
||||||
CONFIG_MMU_PAGE_MODE="32KB"
|
CONFIG_MMU_PAGE_MODE="64KB"
|
||||||
CONFIG_MMU_PAGE_SIZE=0x8000
|
CONFIG_MMU_PAGE_SIZE=0x10000
|
||||||
# end of MMU Config
|
# end of MMU Config
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2063,6 +2067,11 @@ CONFIG_CONSOLE_UART_NUM=0
|
|||||||
CONFIG_CONSOLE_UART_BAUDRATE=115200
|
CONFIG_CONSOLE_UART_BAUDRATE=115200
|
||||||
CONFIG_INT_WDT=y
|
CONFIG_INT_WDT=y
|
||||||
CONFIG_INT_WDT_TIMEOUT_MS=300
|
CONFIG_INT_WDT_TIMEOUT_MS=300
|
||||||
|
CONFIG_TASK_WDT=y
|
||||||
|
CONFIG_ESP_TASK_WDT=y
|
||||||
|
# CONFIG_TASK_WDT_PANIC is not set
|
||||||
|
CONFIG_TASK_WDT_TIMEOUT_S=5
|
||||||
|
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||||
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
||||||
CONFIG_BROWNOUT_DET=y
|
CONFIG_BROWNOUT_DET=y
|
||||||
CONFIG_BROWNOUT_DET_LVL_SEL_7=y
|
CONFIG_BROWNOUT_DET_LVL_SEL_7=y
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# Compiler options
|
||||||
|
#
|
||||||
|
CONFIG_COMPILER_CXX_EXCEPTIONS=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Serial flasher config
|
||||||
|
#
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Log output
|
||||||
|
#
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=3
|
||||||
|
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
||||||
|
CONFIG_LOG_MAXIMUM_LEVEL=4
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"cmake.cmakePath": "C:/msys64/usr/bin/cmake.exe"
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
include(../../core/test/unitOnHost/test_core.cmake)
|
||||||
|
|
||||||
|
UnitTestSetup()
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
project(UnitTests)
|
||||||
|
addSubDirs_ofRoot("${CMAKE_CURRENT_LIST_DIR}/../../components")
|
||||||
|
addSubDirs_ofRoot("${CMAKE_CURRENT_LIST_DIR}/../../core/components")
|
||||||
|
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../../core/test/unitOnHost/hwMock" hwMock)
|
||||||
@@ -3,7 +3,11 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
|
|
||||||
# Include the components directory of the main application:
|
# Include the components directory of the main application:
|
||||||
#
|
#
|
||||||
set(EXTRA_COMPONENT_DIRS "../components ../managed_components")
|
set(EXTRA_COMPONENT_DIRS
|
||||||
|
"../../components"
|
||||||
|
"../../core/components"
|
||||||
|
"../../core/managed_components"
|
||||||
|
)
|
||||||
|
|
||||||
# Set the components to include the tests for.
|
# Set the components to include the tests for.
|
||||||
# This can be overriden from CMake cache:
|
# This can be overriden from CMake cache:
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Unit Testing
|
||||||
|
|
||||||
|
see Redme in `Project/core/test/unitOnTarget/ReadMe.md`
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
dependencies:
|
||||||
|
idf:
|
||||||
|
source:
|
||||||
|
type: idf
|
||||||
|
version: 5.4.1
|
||||||
|
direct_dependencies:
|
||||||
|
- idf
|
||||||
|
manifest_hash: 00d8efc8e59d9f2cc6a576ada310175e19e6f7506dd0b59211849f065dadccae
|
||||||
|
target: esp32c6
|
||||||
|
version: 2.0.0
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Run Exportport Script first
|
||||||
|
|
||||||
|
build:
|
||||||
|
idf.py build
|
||||||
|
|
||||||
|
run:
|
||||||
|
idf.py -p /dev/ttyUSB0 flash monitor
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
|
|
||||||
set(DEF_UTESTDIR "uTest")
|
|
||||||
set(DEF_SRCDIR "src")
|
|
||||||
set(DEF_INCLUDEDIR "include")
|
|
||||||
|
|
||||||
# use just host compilers for this one
|
|
||||||
set(CMAKE_C_COMPILER "gcc")
|
|
||||||
set(CMAKE_CXX_COMPILER "g++")
|
|
||||||
set(CMAKE_GENERATOR "Ninja")
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
|
||||||
|
|
||||||
include(test_core.cmake)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
project(UnitTests)
|
|
||||||
|
|
||||||
find_package(doctest REQUIRED PATHS "/mingw64/lib/cmake")
|
|
||||||
# target_link_libraries(${PROJECT_NAME} PRIVATE doctest::doctest)
|
|
||||||
|
|
||||||
addSubDirs_ofRoot("${CMAKE_CURRENT_LIST_DIR}/../components")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Unit Testing - Software
|
|
||||||
|
|
||||||
In contrast to *test*-directory this module demonstrates how unit tests can also be run on host.
|
|
||||||
These unit tests aim to test freestanding software modules with more convenient methods and tools
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
make sure you have following packages installed on your host syste
|
|
||||||
- gnu compiler
|
|
||||||
- cmake
|
|
||||||
- generator
|
|
||||||
- doctest-dev
|
|
||||||
|
|
||||||
## Build and test code
|
|
||||||
|
|
||||||
* Start some terminal in *uTest*-directory that has access to all needed tools (i.e. on windows a mingw environment or WSL)
|
|
||||||
|
|
||||||
Run following commands
|
|
||||||
```sh
|
|
||||||
# run cmake configuration
|
|
||||||
cmake -S . -B build
|
|
||||||
# run cmake build
|
|
||||||
cmake --build build
|
|
||||||
# run tests
|
|
||||||
./build/<testprog>
|
|
||||||
# run all tests with
|
|
||||||
cd build && ctest
|
|
||||||
```
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
function(addSubDirs_ofRoot anchorPath)
|
|
||||||
message("scanning: ${anchorPath}")
|
|
||||||
file(GLOB targetModules RELATIVE "${anchorPath}" "${anchorPath}/*")
|
|
||||||
foreach(module ${targetModules})
|
|
||||||
message("checking: ${module}")
|
|
||||||
get_filename_component(moduleName ${module} NAME)
|
|
||||||
set(modulePath "${anchorPath}/${moduleName}")
|
|
||||||
if (NOT IS_DIRECTORY "${modulePath}")
|
|
||||||
# skip files
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
if (${moduleName} MATCHES "^_.*")
|
|
||||||
# skip ignored component
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS "${modulePath}/${DEF_UTESTDIR}")
|
|
||||||
message("Found unit-test: ${moduleName}")
|
|
||||||
add_subdirectory("${modulePath}/${DEF_UTESTDIR}" ${moduleName})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
macro(unitTestsFrame)
|
|
||||||
if (CMAKE_TESTING_ENABLED)
|
|
||||||
# get_filename_component(moduleName "${CMAKE_CURRENT_LIST_DIR}/.." NAME)
|
|
||||||
file(GLOB_RECURSE targetSources "../${DEF_SRCDIR}/*.cpp" "../${DEF_SRCDIR}/*.c")
|
|
||||||
add_library(${moduleName} ${targetSources})
|
|
||||||
target_include_directories(${moduleName} PUBLIC "../${DEF_INCLUDEDIR}")
|
|
||||||
|
|
||||||
set(moduleTestName "${moduleName}Test")
|
|
||||||
file(GLOB_RECURSE testSource "*.cpp")
|
|
||||||
add_executable(${moduleTestName} ${testSource})
|
|
||||||
target_link_libraries(${moduleTestName} PRIVATE ${moduleName} doctest::doctest)
|
|
||||||
target_include_directories(${moduleTestName} PRIVATE "../${DEF_SRCDIR}")
|
|
||||||
|
|
||||||
add_test (TEST-${moduleName} ${moduleTestName})
|
|
||||||
|
|
||||||
# gtest_discover_tests(${moduleTestName}
|
|
||||||
# PROPERTIES TIMEOUT 30 LABELS ${moduleName} LABELS "all"
|
|
||||||
# )
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
Reference in New Issue
Block a user