Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fa1d9639a | |||
| 7edc57784c |
Vendored
+1
-3
@@ -54,7 +54,5 @@
|
||||
"text": "skip namespace std"
|
||||
}
|
||||
]
|
||||
},
|
||||
"idf.currentSetup": "C:\\esp\\v5.4.3\\esp-idf",
|
||||
"idf.portWin": "COM6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(TgtEnv STREQUAL "Host")
|
||||
message("Using Host-Branch")
|
||||
enable_testing()
|
||||
add_subdirectory("test/unitOnHost")
|
||||
elseif(TgtEnv STREQUAL "Target")
|
||||
# add_subdirectory("test/unitOnTarget")
|
||||
@@ -15,7 +14,6 @@ else()
|
||||
else()
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
"core/components"
|
||||
"core/components_extern"
|
||||
"core/managed_components"
|
||||
)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "sad_DetectedServer.hpp"
|
||||
#include "spit_message.hpp"
|
||||
#include "spit_object.hpp"
|
||||
#include "spit_player.hpp"
|
||||
#include "spit_processor.hpp"
|
||||
#include "spit_repo.hpp"
|
||||
#include "spit_socket.hpp"
|
||||
#include "spit_type.hpp"
|
||||
#include <functional>
|
||||
#include "spit_message.hpp"
|
||||
#include "spit_repo.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -18,34 +18,60 @@ namespace spit {
|
||||
|
||||
class SClient : ISadClient {
|
||||
public:
|
||||
/** Maximal length of a SPITMessage*/
|
||||
static const int MAXSPITMESSAGEBYTECOUNT = 512;
|
||||
|
||||
using Callbacks = SProcessor::Callbacks;
|
||||
using ProjUpdate = SProcessor::ProjUpdate;
|
||||
using ServerEvent = SProcessor::ServerEvent;
|
||||
using ObjectEvent = SProcessor::ObjectEvent;
|
||||
using Connection = SProcessor::Connection;
|
||||
|
||||
using PlayerType = SPlayer::PTypes;
|
||||
using ValueFlags = SPlayer::VFlags;
|
||||
//------ 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;
|
||||
|
||||
//----- SClient -----
|
||||
public:
|
||||
SClient(string name, string projName, ISocket &socket, Callbacks calls);
|
||||
virtual ~SClient();
|
||||
|
||||
|
||||
private:
|
||||
Callbacks mCallbacks;
|
||||
|
||||
fos::TaskT<SClient &> *mThreadReceive{};
|
||||
fos::TaskT<SClient &> *mThreadProcess{};
|
||||
bool mStopReceiveMessages{};
|
||||
|
||||
Connection mConnectionStatus{Connection::None};
|
||||
bool mDisconnectedByServer{}; // flag true = when server disconnects
|
||||
|
||||
string mID;
|
||||
string mName;
|
||||
string mProjName;
|
||||
string mComputerName;
|
||||
SProcessor mProcessor;
|
||||
|
||||
string mClientProjectName;
|
||||
|
||||
uint8_t mMessageNumberSend{1};
|
||||
int mMessageNumberReceived{-1}; // set to -1 because the first received message will set the number (1..255)
|
||||
vector<unique_ptr<Message>> mOvertakingMessages;
|
||||
|
||||
// Server's info filled by parseConnectAnswer
|
||||
string mServerID{};
|
||||
@@ -55,11 +81,12 @@ class SClient : ISadClient {
|
||||
|
||||
public:
|
||||
/** The ID of the client.<br>Every client instance should set an unique id*/
|
||||
string getID() { return mProcessor.getID(); }
|
||||
string getID() { return mID; }
|
||||
/** The name of the client, should be set by the user app*/
|
||||
string getName() { return mProcessor.getName(); }
|
||||
string getName() { return mName; }
|
||||
//----- Computer Params -----
|
||||
/** The name of the client's host computer*/
|
||||
string getComputerName() { return mProcessor.getComputerName(); }
|
||||
string getComputerName() { return mComputerName; }
|
||||
void setClientProjectName(string clientProjectName) { mClientProjectName = clientProjectName; }
|
||||
string getClientProjectName() { return mClientProjectName; }
|
||||
|
||||
@@ -84,12 +111,8 @@ class SClient : ISadClient {
|
||||
*/
|
||||
void clientProjectLoaded();
|
||||
|
||||
void setActionType(string spitypeID, bool actionAssigned) {
|
||||
mProcessor.setActionType(spitypeID, actionAssigned);
|
||||
}
|
||||
void setActionObject(string objectID, bool actionAssigned) {
|
||||
mProcessor.setActionObject(objectID, actionAssigned);
|
||||
}
|
||||
void setActionSPITType(string spitypeID, bool actionAssigned);
|
||||
void setActionSPITObject(string objectID, bool actionAssigned);
|
||||
|
||||
//--------------- SPITMessage ---------------
|
||||
private:
|
||||
@@ -136,7 +159,7 @@ class SClient : ISadClient {
|
||||
private:
|
||||
void disconnectInternal(Connection cause);
|
||||
void resetMessageNumberReceived();
|
||||
void parseMessage(Message& message);
|
||||
void parseMessage(unique_ptr<Message> message);
|
||||
void checkParseMessage(unique_ptr<Message> message);
|
||||
void addOvertakingMessage(unique_ptr<Message> message);
|
||||
void parseConnectAnswer(Message::ConnectAnswer &message);
|
||||
@@ -152,11 +175,11 @@ class SClient : ISadClient {
|
||||
//--------------- SPIT Project ---------------
|
||||
|
||||
/** Returns the SPITServer's project ID - may be the same as the project's name*/
|
||||
string getServerProjectID() { return mProcessor.getServerProjectID(); }
|
||||
string getServerProjectID();
|
||||
/** Returns the SPITServer's project name*/
|
||||
string getServerProjectName() { return mProcessor.getServerProjectName(); }
|
||||
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() { return mProcessor.getServerFramesPerSecond(); }
|
||||
int getServerFramesPerSecond();
|
||||
|
||||
public:
|
||||
static void sendProject(SClient *p_PtrSClient);
|
||||
@@ -176,17 +199,46 @@ class SClient : ISadClient {
|
||||
*/
|
||||
SType *createTypeFixed(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t 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.
|
||||
*/
|
||||
SType *createType(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration, bool fixed, bool projectIndepended);
|
||||
|
||||
private:
|
||||
// receive SPIT-Types
|
||||
void parseReportType(Message::ReportType &message);
|
||||
int sendTypeInternal(SType &spitType);
|
||||
|
||||
public:
|
||||
bool changeType(SType *spitType) { return mProcessor.changeType(spitType); }
|
||||
int removeType(string spitypeID) { return mProcessor.removeType(spitypeID); }
|
||||
|
||||
public:
|
||||
//--------------- SPIT Objects ---------------
|
||||
private:
|
||||
int sendObjectInternal(SObject *sObject);
|
||||
|
||||
public:
|
||||
bool changeObject(SObject *sObject) { return mProcessor.changeObject(sObject); }
|
||||
void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00) {
|
||||
mProcessor.sendRemoteObject(objectID, valuePpm, valueFlag);
|
||||
}
|
||||
/**
|
||||
* 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 spitObject the pointer to the changed SPITObject.
|
||||
* @return 0 = sended, -1 = not sended
|
||||
*/
|
||||
bool changeSPITObject(SObject *spitObject);
|
||||
|
||||
public:
|
||||
//--------- Remote ----------
|
||||
void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00);
|
||||
|
||||
private:
|
||||
static void processSocketTask(SClient &instance);
|
||||
@@ -200,4 +252,4 @@ class SClient : ISadClient {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace spit
|
||||
}
|
||||
@@ -14,9 +14,6 @@ namespace spit {
|
||||
class Message {
|
||||
//----------- Header -----------
|
||||
public:
|
||||
/** Maximal length of a SPITMessage*/
|
||||
static const int MAX_MESSAGE_SIZE = 512;
|
||||
|
||||
class Header {
|
||||
public:
|
||||
static constexpr int BYTESLENGTH = 99;
|
||||
|
||||
@@ -9,24 +9,6 @@ class SPlayer {
|
||||
|
||||
//----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------
|
||||
public:
|
||||
enum PTypes {
|
||||
// diescrete player: This player is used to transmit single discrete values.
|
||||
PTYPE_DISCRETE = 0x00,
|
||||
// continous player: This player plays SPIT objects sometime during the project.
|
||||
PTYPE_CONTINOUS = 0x01,
|
||||
// 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.
|
||||
PTYPE_MAIN = 0x02,
|
||||
};
|
||||
|
||||
enum VFlags {
|
||||
// Set the given value directly
|
||||
VFLAG_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*/
|
||||
VFLAG_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*/
|
||||
VFLAG_DECREASE = 0x02,
|
||||
};
|
||||
|
||||
class PlayType {
|
||||
public:
|
||||
PlayType(SPlayer *spitPlayer, string spitObjectID);
|
||||
@@ -95,4 +77,4 @@ class SPlayer {
|
||||
uint64_t mTimeFrames;
|
||||
};
|
||||
|
||||
} // namespace spit
|
||||
}
|
||||
@@ -16,6 +16,9 @@ namespace spit {
|
||||
|
||||
class SProcessor {
|
||||
public:
|
||||
// /** Maximal length of a SPITMessage*/
|
||||
// static const int MAXSPITMESSAGEBYTECOUNT = 512;
|
||||
|
||||
enum class ProjUpdate {
|
||||
ServerLoaded,
|
||||
StartTransfer,
|
||||
@@ -56,10 +59,29 @@ class SProcessor {
|
||||
struct InternalCallbacks {
|
||||
function<void(int ms)> delay;
|
||||
function<int(Message::OPPart &msg)> sendMessage;
|
||||
function<void(Message &msg)> parseMessage;
|
||||
function<int(SType &sType)> sendTypeInternal;
|
||||
function<int(SObject *sObject)> sendObjectInternal;
|
||||
};
|
||||
|
||||
static constexpr int MAX_OVERTAKING_SPIT_MESSAGES = 10;
|
||||
// //------ 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;
|
||||
|
||||
//----- SProcessor -----
|
||||
public:
|
||||
@@ -71,40 +93,153 @@ class SProcessor {
|
||||
Callbacks mCallbacks;
|
||||
InternalCallbacks mInternCallbacks;
|
||||
|
||||
string mName;
|
||||
// Connection mConnectionStatus{Connection::None};
|
||||
// bool mDisconnectedByServer{}; // flag true = when server disconnects
|
||||
string mGuid;
|
||||
string mName;
|
||||
string mProjName;
|
||||
string mComputerName;
|
||||
|
||||
// string mClientProjectName;
|
||||
|
||||
uint8_t mMessageNumberSend{1};
|
||||
int mMessageNumberReceived{-1}; // set to -1 because the first received message will set the number (1..255)
|
||||
vector<unique_ptr<Message>> mOvertakingMessages;
|
||||
|
||||
// // Server's info filled by parseConnectAnswer
|
||||
string mServerID{};
|
||||
// string mServerName{};
|
||||
// string mServerComputerName{};
|
||||
// int mServerStepTime{-1};
|
||||
|
||||
// //--- Server Project ---
|
||||
string mServerProjectID;
|
||||
string mServerProjectName;
|
||||
int mServerFramesPerSecond;
|
||||
|
||||
// public:
|
||||
// /** The ID of the client.<br>Every client instance should set an unique id*/
|
||||
// string getID() { return mGuid; }
|
||||
// /** The name of the client, should be set by the user app*/
|
||||
// string getName() { return mName; }
|
||||
// //----- Computer Params -----
|
||||
// /** The name of the client's host computer*/
|
||||
// string getComputerName() { return mComputerName; }
|
||||
// void setClientProjectName(string clientProjectName) { mClientProjectName = clientProjectName; }
|
||||
// string getClientProjectName() { return mClientProjectName; }
|
||||
|
||||
// // connected Server Infos
|
||||
// /** The ID of the connected SPITServer*/
|
||||
// string getServerID() { return mServerID; }
|
||||
// /** The host computername of the connected SPITServer*/
|
||||
// string getServerComputerName() { return mServerComputerName; }
|
||||
// /** The name of the connected SPITServer*/
|
||||
// string getServerName() { return mServerName; }
|
||||
|
||||
// /** 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 mServerStepTime; }
|
||||
|
||||
// /** 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();
|
||||
|
||||
// void setActionSPITType(string spitypeID, bool actionAssigned);
|
||||
// void setActionSPITObject(string objectID, bool actionAssigned);
|
||||
|
||||
// //--------------- SPITMessage ---------------
|
||||
// private:
|
||||
// // Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected
|
||||
// bool _doReconnect{}; // true = on eventServerDetected connect to the server identified by mServerID
|
||||
public:
|
||||
string getID() { return mGuid; }
|
||||
string getName() { return mName; }
|
||||
string getProjName() { return mProjName; }
|
||||
string getComputerName() { return mComputerName; }
|
||||
void setActionType(string spitypeID, bool actionAssigned);
|
||||
void setActionObject(string objectID, bool actionAssigned);
|
||||
std::vector<char> createMessage(Message::OPPart & spitMessageOPPart);
|
||||
void checkParseMessageData(vector<char> data);
|
||||
|
||||
unique_ptr<Message::Connect> createConnectMessage(string serverIP, string serverPort, string loginName, string loginPassword);
|
||||
// //--------------- 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(SadDetectedServer &server);
|
||||
// /** Called every time a prior detected SPITServer is is no longer found.*/
|
||||
// void eventServerLost(SadDetectedServer &server);
|
||||
// void eventServerChanged(SadDetectedServer &server);
|
||||
|
||||
std::vector<char> createMessage(Message::OPPart &spitMessageOPPart);
|
||||
// //--------------- 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 serverIP, string serverPort, string clientIP, string clientPort, string loginName = "", string loginPassword = "");
|
||||
// /**
|
||||
// * Terminates the connection to the SPITServer.
|
||||
// */
|
||||
// void disconnect();
|
||||
|
||||
// private:
|
||||
// void disconnectInternal(Connection cause);
|
||||
// void resetMessageNumberReceived();
|
||||
void parseMessage(Message& message);
|
||||
void addOvertakingMessage(unique_ptr<Message> message);
|
||||
int sendOvertakingMessage(int msgNumRec);
|
||||
void resetMessageNumberReceived();
|
||||
// void addOvertakingMessage(unique_ptr<Message> message);
|
||||
// void parseConnectAnswer(Message::ConnectAnswer &message);
|
||||
// void parseDisconnect(Message::Disconnect &message);
|
||||
// void parseWatchdog(Message::Watchdog &message);
|
||||
// void parseWatchdogAnswer(Message::WatchdogAnswer &message);
|
||||
|
||||
string getServerProjectID() { return mServerProjectID; }
|
||||
string getServerProjectName() { return mServerProjectName; }
|
||||
int getServerFramesPerSecond() { return mServerFramesPerSecond; }
|
||||
// public:
|
||||
// /** Used internally*/
|
||||
// void sendWatchdog();
|
||||
// /** Used internally. When the connection to the SPITServer is lost an eventConnectionStatus will occur*/
|
||||
// void eventWatchdogLost();
|
||||
// //--------------- SPIT Project ---------------
|
||||
// private:
|
||||
public: // tood remove
|
||||
void parseReportProject(Message::ReportProject &message);
|
||||
void parseCloseProject(Message::CloseProject &message);
|
||||
|
||||
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:
|
||||
public: // todo remove
|
||||
void parseRequestProjectTransfer(Message::RequestProjectTransfer &message);
|
||||
void parseStartProjectTransfer(Message::StartProjectTransfer &message);
|
||||
void parseEndProjectTransfer(Message::EndProjectTransfer &message);
|
||||
|
||||
// // --------------- 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.
|
||||
// */
|
||||
// SType *createTypeFixed(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration);
|
||||
|
||||
// /**
|
||||
// * Creates a SPITType for application actions.<br>
|
||||
@@ -118,9 +253,13 @@ class SProcessor {
|
||||
// * @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.
|
||||
// */
|
||||
SType *createType(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration, bool fixed, bool projectIndepended);
|
||||
int sendTypeInternal(SType &sType);
|
||||
// SType *createType(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration, bool fixed, bool projectIndepended);
|
||||
private:
|
||||
public: // @todo delete
|
||||
void parseReportType(Message::ReportType &message);
|
||||
void parseRemoveType(Message::RemoveType &message);
|
||||
|
||||
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>
|
||||
@@ -136,33 +275,41 @@ class SProcessor {
|
||||
*/
|
||||
int removeType(string spitypeID);
|
||||
|
||||
int removeObject(string objectID);
|
||||
bool changeObject(SObject *sObject);
|
||||
void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00);
|
||||
void resetConfirmedFlags() {
|
||||
SType::setConfirmedFalse(mSpitTypes);
|
||||
SObject::setConfirmedFalse(mSpitObjects);
|
||||
}
|
||||
|
||||
private:
|
||||
void parseReportProject(Message::ReportProject &message);
|
||||
void parseCloseProject(Message::CloseProject &message);
|
||||
void parseRequestProjectTransfer(Message::RequestProjectTransfer &message);
|
||||
void parseStartProjectTransfer(Message::StartProjectTransfer &message);
|
||||
void parseEndProjectTransfer(Message::EndProjectTransfer &message);
|
||||
void parseReportType(Message::ReportType &message);
|
||||
void parseRemoveType(Message::RemoveType &message);
|
||||
// public:
|
||||
// //--------------- SPIT Objects ---------------
|
||||
// private:
|
||||
public:
|
||||
void parseReportObject(Message::ReportObject &message);
|
||||
void parseRemoveObject(Message::RemoveObject &message);
|
||||
// int sendSPITObjectInternal(SObject *ptrObject);
|
||||
|
||||
// public:
|
||||
int removeObject(string objectID);
|
||||
|
||||
// public:
|
||||
// //--------------- Play SPIT Objects ---------------
|
||||
// private:
|
||||
public:
|
||||
void parsePlayStart(Message::PlayStart &message);
|
||||
void parsePlayObject(Message::PlayObject &message);
|
||||
void parsePlayEnd(Message::PlayEnd &message);
|
||||
void parseReportPlayStatus(Message::ReportPlayStatus &message);
|
||||
int sendObjectInternal(SObject *sObject);
|
||||
|
||||
// public:
|
||||
// //--------- Remote ----------
|
||||
// void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00);
|
||||
|
||||
// private:
|
||||
// bool mAbortSearch{};
|
||||
// bool sAnswered{};
|
||||
// void answerWatchdog() {
|
||||
// sAnswered = true;
|
||||
// }
|
||||
|
||||
public: // @todo remove
|
||||
SpitRepo<SObject> mSpitObjects;
|
||||
SpitRepo<SType> mSpitTypes;
|
||||
SpitRepo<SObject> mRemoteSpitObjects;
|
||||
SpitRepo<SType> mSpitTypes;
|
||||
SpitRepo<SType> mRemoteSpitTypes;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace spit {
|
||||
static const char *TAG = "SPIT";
|
||||
static fos::Queue<vector<char>> incommingSpit(128);
|
||||
static fos::Queue<vector<char>> incommingSpit(64);
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,14 +16,19 @@ static fos::Queue<vector<char>> incommingSpit(128);
|
||||
SClient::SClient(string name, string projName, ISocket &socket, Callbacks calls)
|
||||
: ISadClient(),
|
||||
mCallbacks(calls),
|
||||
mName(name),
|
||||
mProjName(projName),
|
||||
mProcessor(name, projName, getClientHostName(), createGUID(), calls,
|
||||
{
|
||||
.delay = [&](int ms){ return fos::Task::delayMs(ms); },
|
||||
.sendMessage = [&](Message::OPPart &msg){ return sendMessage(msg); },
|
||||
.parseMessage = [&](Message& msg) { parseMessage(msg); }
|
||||
.sendTypeInternal = [&](SType &sType) { return sendTypeInternal(sType);},
|
||||
.sendObjectInternal = [&](SObject *sObject) { return sendObjectInternal(sObject);}
|
||||
}
|
||||
),
|
||||
mSocket(socket) {
|
||||
mID = createGUID();
|
||||
mComputerName = getClientHostName();
|
||||
}
|
||||
|
||||
SClient::~SClient() {
|
||||
@@ -34,7 +39,7 @@ SClient::~SClient() {
|
||||
void SClient::clientProjectClose() {
|
||||
if (mConnectionStatus == Connection::Ok) {
|
||||
ESP_LOGI(TAG, " ... tidy up ressources");
|
||||
Message::CloseProject closeSPITProject(mProcessor.getProjName());
|
||||
Message::CloseProject closeSPITProject(mProjName);
|
||||
if (sendMessage(closeSPITProject) < 0) {
|
||||
ESP_LOGD(TAG, "Client could not send Client's ReportProject");
|
||||
}
|
||||
@@ -43,10 +48,12 @@ void SClient::clientProjectClose() {
|
||||
|
||||
void SClient::clientProjectLoaded() {
|
||||
// set confirmed = false for all SPITTypes and SPITObjects
|
||||
mProcessor.resetConfirmedFlags();
|
||||
SType::setConfirmedFalse(mProcessor.mSpitTypes);
|
||||
SObject::setConfirmedFalse(mProcessor.mSpitObjects);
|
||||
|
||||
if (mConnectionStatus == Connection::Ok) {
|
||||
// send ReportProject to the server
|
||||
Message::ReportProject reportSPITProject(mProcessor.getProjName(), mProcessor.getProjName());
|
||||
Message::ReportProject reportSPITProject(mProjName, mProjName);
|
||||
reportSPITProject.setFramesPerSecond(0);
|
||||
if (sendMessage(reportSPITProject) < 0) {
|
||||
ESP_LOGD(TAG, "SPIT_CLient::clientProjectLoaded could not send Client's ReportProject");
|
||||
@@ -60,6 +67,39 @@ void SClient::clientProjectLoaded() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* This tells the server not what action is done, but it tells the server that there is an action.
|
||||
* @param typeId the id of the SPITType
|
||||
* @param actionAssigned
|
||||
*/
|
||||
void SClient::setActionSPITType(string typeId, bool actionAssigned) {
|
||||
SType *spitType = mProcessor.mSpitTypes.getEntry(typeId);
|
||||
if (spitType == nullptr)
|
||||
return;
|
||||
if (spitType->ActionAssigned.set(actionAssigned)) {
|
||||
sendTypeInternal(*spitType);
|
||||
for (auto& [key, value] : mProcessor.mSpitObjects.getRepo()) {
|
||||
if (value->SPITTypeID.get() == spitType->getID()) {
|
||||
if (value->setActionAssignedType(actionAssigned) == true) {
|
||||
sendObjectInternal(value.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** This should be called if the user wants to associate/remove an action with a SPITObject. */
|
||||
void SClient::setActionSPITObject(string spitObjId, bool actionAssigned) {
|
||||
SObject *spitObject = mProcessor.mSpitObjects.getEntry(spitObjId);
|
||||
if (spitObject == nullptr)
|
||||
return;
|
||||
if (spitObject->setActionAssigned(actionAssigned) == true) {
|
||||
sendObjectInternal(spitObject);
|
||||
}
|
||||
}
|
||||
//---------- ServerAutoDetection SAD -----------
|
||||
|
||||
/** Starts the autodetection of SPITServers in the local network. If a connection is tried, the autodetection should be stopped before.
|
||||
@@ -174,7 +214,7 @@ int SClient::sendMessage(Message::OPPart &opPart) {
|
||||
else
|
||||
mMessageNumberSend++;
|
||||
opPart.setMessageNumber(mMessageNumberSend);
|
||||
opPart.setServerInfoInHeader(mProcessor.getID(), mServerID);
|
||||
opPart.setServerInfoInHeader(mID, mServerID);
|
||||
|
||||
int opFlag = opPart.getHeader()->getType();
|
||||
try {
|
||||
@@ -207,10 +247,10 @@ void SClient::stopReceiveSPITMessages() {
|
||||
}
|
||||
|
||||
void SClient::receiveSpitMessage(SClient &rM) {
|
||||
char buffer[Message::MAX_MESSAGE_SIZE];
|
||||
char buffer[MAXSPITMESSAGEBYTECOUNT + 1];
|
||||
int rdLen;
|
||||
while (rM.mStopReceiveMessages == false) {
|
||||
rdLen = rM.mSocket.receiveMessage(buffer, Message::MAX_MESSAGE_SIZE, nullptr);
|
||||
rdLen = rM.mSocket.receiveMessage(buffer, MAXSPITMESSAGEBYTECOUNT, nullptr);
|
||||
if (rdLen < 0) {
|
||||
if (rM.mStopReceiveMessages) {
|
||||
return;
|
||||
@@ -227,14 +267,14 @@ void SClient::processSpitMessage(SClient &rM) {
|
||||
while (true) {
|
||||
auto data = *incommingSpit.dequeue();
|
||||
auto spitMsg = make_unique<Message>(data);
|
||||
rM.checkParseMessage(move(spitMsg));
|
||||
rM.parseMessage(move(spitMsg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SClient::resetMessageNumberReceived() {
|
||||
mMessageNumberReceived = -1;
|
||||
mProcessor.resetMessageNumberReceived();
|
||||
mOvertakingMessages.clear();
|
||||
}
|
||||
|
||||
void SClient::checkParseMessage(unique_ptr<Message> p_SPITMessage) {
|
||||
@@ -247,12 +287,12 @@ void SClient::checkParseMessage(unique_ptr<Message> p_SPITMessage) {
|
||||
int msgNum = (int)(p_SPITMessage->getHeader()->getMessageNumber() & 0xFF);
|
||||
|
||||
if (msgNum == 0) {
|
||||
parseMessage(*p_SPITMessage);
|
||||
parseMessage(std::move(p_SPITMessage));
|
||||
return;
|
||||
}
|
||||
if (mMessageNumberReceived < 0) {
|
||||
mMessageNumberReceived = msgNum;
|
||||
parseMessage(*p_SPITMessage);
|
||||
parseMessage(std::move(p_SPITMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -262,39 +302,122 @@ void SClient::checkParseMessage(unique_ptr<Message> p_SPITMessage) {
|
||||
|
||||
if (msgNum == intNextMessageNumber) {
|
||||
mMessageNumberReceived = msgNum;
|
||||
parseMessage(*p_SPITMessage);
|
||||
parseMessage(std::move(p_SPITMessage));
|
||||
|
||||
// check overtaking messages
|
||||
auto it = mOvertakingMessages.begin();
|
||||
while (mOvertakingMessages.size() > 0) {
|
||||
|
||||
intNextMessageNumber = mMessageNumberReceived + 1;
|
||||
if (intNextMessageNumber > 255 || intNextMessageNumber < 1)
|
||||
intNextMessageNumber = 1;
|
||||
|
||||
auto &ptrOvertakingSPIT_Message = *it;
|
||||
msgNum = (int)(ptrOvertakingSPIT_Message->getHeader()->getMessageNumber() & 0xFF);
|
||||
|
||||
if (msgNum == intNextMessageNumber) {
|
||||
mMessageNumberReceived = msgNum;
|
||||
parseMessage(move(ptrOvertakingSPIT_Message));
|
||||
mOvertakingMessages.erase(it);
|
||||
|
||||
it = mOvertakingMessages.begin();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mMessageNumberReceived = mProcessor.sendOvertakingMessage(mMessageNumberReceived);
|
||||
} else {
|
||||
// p_SPITMessage has overtaken another message
|
||||
mProcessor.addOvertakingMessage(move(p_SPITMessage));
|
||||
addOvertakingMessage(move(p_SPITMessage));
|
||||
}
|
||||
}
|
||||
|
||||
void SClient::parseMessage(Message& message) {
|
||||
void SClient::addOvertakingMessage(unique_ptr<Message> message) {
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
if (mOvertakingMessages.size() > MAX_OVERTAKING_SPIT_MESSAGES) {
|
||||
ESP_LOGD(TAG, "Client receiveing: perhaps message lost !!!!!");
|
||||
}
|
||||
|
||||
int intMessageNumber = (int)(message->getHeader()->getMessageNumber() & 0xFF);
|
||||
for (auto it = mOvertakingMessages.begin(); it != mOvertakingMessages.end(); ++it) {
|
||||
const auto &overtaking = *it;
|
||||
int intOvertakingMessageNumber = (int)(overtaking->getHeader()->getMessageNumber() & 0xFF);
|
||||
if (intMessageNumber < intOvertakingMessageNumber) {
|
||||
mOvertakingMessages.insert(it, move(message));
|
||||
return;
|
||||
}
|
||||
}
|
||||
mOvertakingMessages.push_back(move(message));
|
||||
}
|
||||
|
||||
void SClient::parseMessage(unique_ptr<Message> message) {
|
||||
answerWatchdog();
|
||||
if (!message.getHeader() || !message.getOPPart()) {
|
||||
if (!message || !message->getHeader() || !message->getOPPart()) {
|
||||
ESP_LOGD(TAG, "Client::parseMessage incomplete message");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message.getType()) {
|
||||
switch (message->getType()) {
|
||||
//----- Connection -----
|
||||
case Message::ConnectAnswer::OPFLAG:
|
||||
parseConnectAnswer(message.getAs<Message::ConnectAnswer>());
|
||||
parseConnectAnswer(message->getAs<Message::ConnectAnswer>());
|
||||
break;
|
||||
case Message::Disconnect::OPFLAG:
|
||||
parseDisconnect(message.getAs<Message::Disconnect>());
|
||||
parseDisconnect(message->getAs<Message::Disconnect>());
|
||||
break;
|
||||
case Message::ReportProject::OPFLAG:
|
||||
mProcessor.parseReportProject(message->getAs<Message::ReportProject>());
|
||||
break;
|
||||
case Message::Watchdog::OPFLAG:
|
||||
parseWatchdog(message.getAs<Message::Watchdog>());
|
||||
parseWatchdog(message->getAs<Message::Watchdog>());
|
||||
break;
|
||||
case Message::WatchdogAnswer::OPFLAG:
|
||||
parseWatchdogAnswer(message.getAs<Message::WatchdogAnswer>());
|
||||
parseWatchdogAnswer(message->getAs<Message::WatchdogAnswer>());
|
||||
break;
|
||||
//----- SPIT Project -----
|
||||
case Message::StartProjectTransfer::OPFLAG:
|
||||
mProcessor.parseStartProjectTransfer(message->getAs<Message::StartProjectTransfer>());
|
||||
break;
|
||||
case Message::CloseProject::OPFLAG:
|
||||
mProcessor.parseCloseProject(message->getAs<Message::CloseProject>());
|
||||
break;
|
||||
case Message::RequestProjectTransfer::OPFLAG:
|
||||
mProcessor.parseRequestProjectTransfer(message->getAs<Message::RequestProjectTransfer>());
|
||||
break;
|
||||
case Message::EndProjectTransfer::OPFLAG:
|
||||
mProcessor.parseEndProjectTransfer(message->getAs<Message::EndProjectTransfer>());
|
||||
break;
|
||||
//----- SPIT Types ------
|
||||
case Message::ReportType::OPFLAG:
|
||||
mProcessor.parseReportType(message->getAs<Message::ReportType>());
|
||||
break;
|
||||
case Message::RemoveType::OPFLAG:
|
||||
mProcessor. parseRemoveType(message->getAs<Message::RemoveType>());
|
||||
//----- SPIT Objects ------
|
||||
break;
|
||||
case Message::ReportObject::OPFLAG:
|
||||
mProcessor.parseReportObject(message->getAs<Message::ReportObject>());
|
||||
break;
|
||||
case Message::RemoveObject::OPFLAG:
|
||||
mProcessor.parseRemoveObject(message->getAs<Message::RemoveObject>());
|
||||
break;
|
||||
//----- Play SPIT Objects ------
|
||||
case Message::PlayStart::OPFLAG:
|
||||
mProcessor.parsePlayStart(message->getAs<Message::PlayStart>());
|
||||
break;
|
||||
case Message::PlayObject::OPFLAG:
|
||||
mProcessor.parsePlayObject(message->getAs<Message::PlayObject>());
|
||||
break;
|
||||
case Message::PlayEnd::OPFLAG:
|
||||
mProcessor.parsePlayEnd(message->getAs<Message::PlayEnd>());
|
||||
break;
|
||||
case Message::ReportPlayStatus::OPFLAG:
|
||||
mProcessor.parseReportPlayStatus(message->getAs<Message::ReportPlayStatus>());
|
||||
break;
|
||||
default:
|
||||
// pass object to SubProcessor
|
||||
mProcessor.parseMessage(message);
|
||||
ESP_LOGD(TAG, "Client::parseMessage: Unknown Message");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,8 +439,15 @@ bool SClient::connect(string serverIP, string serverPort, string clientIP, strin
|
||||
mStopReceiveMessages = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto connMsg = mProcessor.createConnectMessage(serverIP, serverPort, loginName, loginPassword);
|
||||
Message::Connect sMConnect(mComputerName, mName);
|
||||
sMConnect.setLoginName(loginName);
|
||||
sMConnect.setLoginPassword(loginPassword);
|
||||
sMConnect.setServerIP(serverIP);
|
||||
if (serverPort.length() <= 0) {
|
||||
serverPort = "0";
|
||||
}
|
||||
int intServerPort = stoi(serverPort);
|
||||
sMConnect.setServerPort(intServerPort);
|
||||
|
||||
if (startReceiveSPITMessages() == false) {
|
||||
mStopReceiveMessages = true;
|
||||
@@ -332,7 +462,7 @@ bool SClient::connect(string serverIP, string serverPort, string clientIP, strin
|
||||
|
||||
// sleep a little to make sure that the reception of the messages is started
|
||||
fos::Task::delayMs(500);
|
||||
if (sendMessage(*connMsg) < 0) {
|
||||
if (sendMessage(sMConnect) < 0) {
|
||||
mConnectionStatus = Connection::None;
|
||||
mStopReceiveMessages = true;
|
||||
return false;
|
||||
@@ -398,7 +528,7 @@ void SClient::disconnectInternal(Connection cause) {
|
||||
}
|
||||
|
||||
void SClient::parseConnectAnswer(Message::ConnectAnswer &message) {
|
||||
if (message.getClientID() != mProcessor.getID())
|
||||
if (message.getClientID() != mID)
|
||||
return;
|
||||
|
||||
mServerID = message.getServerID();
|
||||
@@ -409,6 +539,7 @@ void SClient::parseConnectAnswer(Message::ConnectAnswer &message) {
|
||||
if (message.getConnected() == false) {
|
||||
disconnectInternal(Connection::NoneServer);
|
||||
} else {
|
||||
message.getStepTime();
|
||||
mConnectionStatus = Connection::Ok;
|
||||
mDisconnectedByServer = false;
|
||||
ESP_LOGD(TAG, "connection established");
|
||||
@@ -428,7 +559,10 @@ void SClient::parseConnectAnswer(Message::ConnectAnswer &message) {
|
||||
*/
|
||||
void SClient::parseDisconnect(Message::Disconnect &message) {
|
||||
Connection intCauseDisconnect = Connection::NoneServer;
|
||||
|
||||
/*
|
||||
function<void()> o_Callable = bind(&SClient::disconnectInternal, this, intCauseDisconnect);
|
||||
SPIT_Handler::addCallable(o_Callable);
|
||||
*/
|
||||
mDisconnectedByServer = true;
|
||||
SClient::disconnectInternal(intCauseDisconnect);
|
||||
}
|
||||
@@ -441,6 +575,7 @@ void SClient::parseDisconnect(Message::Disconnect &message) {
|
||||
* @param message
|
||||
*/
|
||||
void SClient::parseWatchdog(Message::Watchdog &message) {
|
||||
// ESP_LOGD(TAG, "parse Watchdog ");
|
||||
Message::WatchdogAnswer o_WatchdogAnswer;
|
||||
sendMessage(o_WatchdogAnswer);
|
||||
}
|
||||
@@ -469,6 +604,9 @@ void SClient::eventWatchdogLost() {
|
||||
}
|
||||
}
|
||||
|
||||
string SClient::getServerProjectID() { return mProcessor.getServerProjectID(); }
|
||||
string SClient::getServerProjectName() { return mProcessor.getServerProjectName(); }
|
||||
int SClient::getServerFramesPerSecond() { return mProcessor.getServerFramesPerSecond(); }
|
||||
|
||||
void SClient::sendProject(SClient *p_PtrSPIT_Client) {
|
||||
// int intResult;
|
||||
@@ -531,8 +669,135 @@ void SClient::sendProject(SClient *p_PtrSPIT_Client) {
|
||||
// //Send act
|
||||
}
|
||||
|
||||
SType *SClient::createTypeFixed(string iD, string group, string name, uint64_t delay, uint64_t duration) {
|
||||
return mProcessor.createType(iD, group, name, delay, duration, true, true);
|
||||
/**
|
||||
* If a client has changed a SPITType, it should send it to the server to transmit the changes.
|
||||
* If the SPITType is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the changes.
|
||||
* @param p_SPITType the pointer to the changed SPITType
|
||||
* @return 0 = is sended, -1 = is not sended
|
||||
*/
|
||||
int SClient::sendTypeInternal(SType &p_SPITType) {
|
||||
Message::ReportType sMReportSPITType;
|
||||
p_SPITType.fillMessageOP(sMReportSPITType);
|
||||
return sendMessage(sMReportSPITType);
|
||||
}
|
||||
|
||||
SType *SClient::createTypeFixed(string iD, string p_GroupName, string p_Name, uint64_t p_DefaultDelay, uint64_t p_DefaultDuration) {
|
||||
return createType(iD, p_GroupName, p_Name, p_DefaultDelay, p_DefaultDuration, true, true);
|
||||
}
|
||||
|
||||
SType *SClient::createType(string p_ID, string p_GroupName, string p_Name, uint64_t p_DefaultDelay, uint64_t p_DefaultDuration, bool p_FIxed, bool p_ProjectIndepended) {
|
||||
bool boolNew;
|
||||
SType *ptrSPITType = mProcessor.mSpitTypes.getEntry(p_ID);
|
||||
if (ptrSPITType == nullptr) {
|
||||
auto spitType = make_unique<SType>(p_ID, p_GroupName, p_Name, p_FIxed, p_ProjectIndepended, p_DefaultDelay, p_DefaultDuration);
|
||||
ptrSPITType = spitType.get();
|
||||
mProcessor.mSpitTypes.addEntry(move(spitType));
|
||||
ptrSPITType->setCreatedByClient(true);
|
||||
boolNew = true;
|
||||
} else {
|
||||
ptrSPITType->GroupName.set(p_GroupName);
|
||||
ptrSPITType->Name.set(p_Name);
|
||||
ptrSPITType->Fixed.set(p_FIxed);
|
||||
ptrSPITType->ProjectIndepended.set(p_ProjectIndepended);
|
||||
ptrSPITType->DefaultDelay.set(p_DefaultDelay);
|
||||
ptrSPITType->DefaultDuration.set(p_DefaultDuration);
|
||||
boolNew = false;
|
||||
}
|
||||
|
||||
auto eventType = boolNew ? ObjectEvent::Created : ObjectEvent::Changed;
|
||||
mCallbacks.onSpitType(eventType, false, *ptrSPITType);
|
||||
sendTypeInternal(*ptrSPITType);
|
||||
return ptrSPITType;
|
||||
}
|
||||
|
||||
int SClient::sendObjectInternal(SObject *ptrSPITObject) {
|
||||
if (ptrSPITObject == nullptr)
|
||||
return -1;
|
||||
Message::ReportObject sMReportSPITObject;
|
||||
ptrSPITObject->fillMessageOP(sMReportSPITObject);
|
||||
|
||||
return sendMessage(sMReportSPITObject);
|
||||
}
|
||||
/**
|
||||
* When the client changes an existing SPITObject (normally the client should not do this), then he should send the changes to the SPITServer.
|
||||
* An eventSPITObject occurs.
|
||||
* The SPITServer may discard the changes and a second eventSPITObject occurs to correct the changes.
|
||||
* @param obj the pointer to the changed SPITObject.
|
||||
* CAUTION: The SPITObject must already exist.
|
||||
* @return true = SPITObject is changed, false = not changed, maybe obj is NULL or the SPITObject doesn't exists
|
||||
*/
|
||||
bool SClient::changeSPITObject(SObject *obj) {
|
||||
if (obj == nullptr)
|
||||
return false;
|
||||
SObject *ptrSPITObject;
|
||||
SType *ptrSPITType;
|
||||
{
|
||||
ptrSPITObject = mProcessor.mSpitObjects.getEntry(obj->getID());
|
||||
if (ptrSPITObject == nullptr)
|
||||
return false;
|
||||
ptrSPITType = mProcessor.mSpitTypes.getEntry(obj->getID());
|
||||
if (ptrSPITObject == nullptr)
|
||||
return false;
|
||||
|
||||
ptrSPITObject->setActionAssigned(obj->getActionAssigned());
|
||||
;
|
||||
ptrSPITObject->Delay.set(obj->Delay.get());
|
||||
ptrSPITObject->Duration.set(obj->Delay.get());
|
||||
ptrSPITObject->Fixed.set(obj->Fixed.get());
|
||||
ptrSPITObject->FrameFadeInLength.set(obj->FrameFadeInLength.get());
|
||||
ptrSPITObject->FrameFadeOutLength.set(obj->FrameFadeOutLength.get());
|
||||
ptrSPITObject->FrameLength.set(obj->FrameLength.get());
|
||||
ptrSPITObject->FrameStart.set(obj->FrameStart.get());
|
||||
ptrSPITObject->Name.set(obj->Name.get());
|
||||
ptrSPITObject->Remark.set(obj->Remark.get());
|
||||
ptrSPITObject->SPITTypeID.set(obj->SPITTypeID.get());
|
||||
ptrSPITObject->ServerParams.set(obj->ServerParams.get());
|
||||
ptrSPITObject->Track.set(obj->Track.get());
|
||||
ptrSPITObject->ValueFactor.set(obj->ValueFactor.get());
|
||||
ptrSPITObject->ValueUse.set(obj->ValueUse.get());
|
||||
|
||||
mCallbacks.onSpitObject(ObjectEvent::Changed, false, *ptrSPITType, *ptrSPITObject);
|
||||
sendObjectInternal(ptrSPITObject);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------- Remote ----------
|
||||
|
||||
/**
|
||||
* Send a remote control command to the SPITServer.
|
||||
* There may be different command types:
|
||||
* a) Some don't use value e.g. go to next scene, olay a jingle
|
||||
* b) Some use values e.g. the main sound fader
|
||||
* @param p_SPITObjectID the id of the remote SPITObject (this represents the remote control command)
|
||||
* @param valuePpm the value in ppm
|
||||
* in case a) the value is ignored
|
||||
* in case b) the value is used
|
||||
* @param valueFlag indicates how the server should use valuePpm:
|
||||
* VALUEFLAG_DIRECT (0x00) The server overwrites its existing value with p_Value
|
||||
* VALUEFLAG_INCREASE (0x01) The server increases his existing value by valuePpm
|
||||
* VALUEFLAG_DECREASE (0x01) The server decreases his existing value by valuePpm
|
||||
*/
|
||||
void SClient::sendRemoteObject(string p_SPITObjectID, int valuePpm, char valueFlag) {
|
||||
SObject *ptrRemoteSPITObject = mProcessor.mRemoteSpitObjects.getEntry(p_SPITObjectID);
|
||||
if (ptrRemoteSPITObject == nullptr)
|
||||
return;
|
||||
|
||||
Message::PlayStart playSPITStart(mID, mProjName, PLAYERTYPE_DISCRETE);
|
||||
playSPITStart.setPlayerIsRunning(false);
|
||||
playSPITStart.setTime(0);
|
||||
sendMessage(playSPITStart);
|
||||
|
||||
Message::PlayObject playSPITObject;
|
||||
playSPITObject.setID(ptrRemoteSPITObject->getID());
|
||||
playSPITObject.setPlayPrePosition(false);
|
||||
playSPITObject.setPlayerID(mID);
|
||||
playSPITObject.setValue(valuePpm);
|
||||
playSPITObject.setValueFlag(valueFlag);
|
||||
sendMessage(playSPITObject);
|
||||
|
||||
Message::PlayEnd playSPITEnd(mID);
|
||||
sendMessage(playSPITEnd);
|
||||
}
|
||||
|
||||
fos::Semaphore SClient::sStartSad;
|
||||
@@ -623,7 +888,7 @@ void SClient::processSocketTask(SClient &instance) {
|
||||
ESP_LOGW(TAG, "Finished searching");
|
||||
ESP_LOGW(TAG, "Start working");
|
||||
auto nextWdTrigger = fos::Timing::getMilliSec() + WATCHDOGTIME;
|
||||
// auto nextWdCheck = nextWdTrigger + WATCHDOGTIME;
|
||||
auto nextWdCheck = nextWdTrigger + WATCHDOGTIME;
|
||||
while (true) {
|
||||
// auto time = fos::Timing::getMilliSec();
|
||||
// if (time > nextWdTrigger) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,3 @@
|
||||
-- COPY to: /usr/lib/x86_64-linux-gnu/wireshark/plugins/spit.lua
|
||||
|
||||
-- LiveShowSoftware SPIT-Protocol
|
||||
spit_proto = Proto("spit", "LiveShowSoftware SPIT")
|
||||
spit_sad_proto = Proto("spit_sad", "LiveShowSoftware SPIT SAD")
|
||||
@@ -11,7 +9,7 @@ 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", "Payload Length")
|
||||
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")
|
||||
@@ -96,17 +94,6 @@ function extractVersionString(buffer)
|
||||
|
||||
end
|
||||
|
||||
function addBigEndianValue(tree, proto, buffer)
|
||||
local val = -1;
|
||||
-- local val = buffer(99,4):le_uint()
|
||||
if proto.type == ftypes.UINT32 then
|
||||
val = buffer:le_uint()
|
||||
elseif proto.type == ftypes.UINT64 then
|
||||
val = buffer:le_uint64()
|
||||
end
|
||||
tree:add(proto, buffer):set_text(proto.name .. ": " .. val)
|
||||
end
|
||||
|
||||
-- Heuristic dissector function
|
||||
function spit_proto.dissector(buffer, pinfo, tree)
|
||||
if buffer:len() < 6 then return false end
|
||||
@@ -127,9 +114,8 @@ function spit_proto.dissector(buffer, pinfo, tree)
|
||||
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)
|
||||
addBigEndianValue(pTree, f_pLen, buffer(99,4))
|
||||
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
|
||||
@@ -180,7 +166,7 @@ function spit_proto.dissector(buffer, pinfo, tree)
|
||||
|
||||
pTree:add(f_pProjectId, buffer(103,41))
|
||||
pTree:add(f_pProjectName, buffer(144,64))
|
||||
addBigEndianValue(pTree, f_pFramesPerSec, buffer(208,4))
|
||||
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())
|
||||
|
||||
@@ -216,8 +202,8 @@ function spit_proto.dissector(buffer, pinfo, tree)
|
||||
pTree:add(f_pProjIndep, buffer(147,1))
|
||||
pTree:add(f_pTypeGroupName, buffer(148,39))
|
||||
pTree:add(f_pTypeName, buffer(187,64))
|
||||
addBigEndianValue(pTree, f_pDelay, buffer(251,8))
|
||||
addBigEndianValue(pTree, f_pDuration, buffer(259,8))
|
||||
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()
|
||||
@@ -240,16 +226,17 @@ function spit_proto.dissector(buffer, pinfo, tree)
|
||||
pTree:add(f_pObjectName, buffer(147,64))
|
||||
pTree:add(f_pTypeId, buffer(211,41))
|
||||
pTree:add(f_pSrvParam, buffer(252,64))
|
||||
addBigEndianValue(pTree, f_pFrameStart, buffer(316,8))
|
||||
addBigEndianValue(pTree, f_pFrameLength, buffer(324,8))
|
||||
addBigEndianValue(pTree, f_pFrameFadeIn, buffer(332,8))
|
||||
addBigEndianValue(pTree, f_pFrameFadeOut, buffer(340,8))
|
||||
addBigEndianValue(pTree, f_pValueFactor, buffer(348,4))
|
||||
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))
|
||||
addBigEndianValue(pTree, f_pTrack, buffer(350,4))
|
||||
pTree:add(f_pTrack, buffer(350,4))
|
||||
pTree:add(f_pRemark, buffer(354,64))
|
||||
addBigEndianValue(pTree, f_pDelay, buffer(418,8))
|
||||
addBigEndianValue(pTree, f_pDuration, buffer(426,8))
|
||||
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()
|
||||
@@ -270,16 +257,17 @@ function spit_proto.dissector(buffer, pinfo, tree)
|
||||
pTree:add(f_pPlayerName, buffer(144,64))
|
||||
pTree:add(f_pPlayerType, buffer(208,1))
|
||||
pTree:add(f_pPlayerRunning, buffer(209,1))
|
||||
addBigEndianValue(pTree, f_pPlayerFrames, buffer(210,8))
|
||||
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))
|
||||
addBigEndianValue(pTree, f_pObjectsFrames, buffer(185,8))
|
||||
pTree:add(f_pObjectsFrames, buffer(185,8))
|
||||
pTree:add(f_pPlayerPrePos, buffer(193,1))
|
||||
addBigEndianValue(pTree, f_pValue, buffer(194,4))
|
||||
pTree:add(f_pValue, buffer(194,4))
|
||||
pTree:add(f_pValueFlag, buffer(198,1))
|
||||
|
||||
local oId = buffer(144,41):string()
|
||||
@@ -293,9 +281,10 @@ function spit_proto.dissector(buffer, pinfo, tree)
|
||||
|
||||
elseif type == 40 then
|
||||
pTree:add(f_pSession, extractSession(buffer, pinfo))
|
||||
|
||||
pTree:add(f_pObjectId, buffer(103,41))
|
||||
addBigEndianValue(pTree, f_pObjectsFrames, buffer(144,8))
|
||||
addBigEndianValue(pTree, f_pValue, buffer(152,4))
|
||||
pTree:add(f_pObjectsFrames, buffer(144,8))
|
||||
pTree:add(f_pValue, buffer(152,4))
|
||||
info_text = string.format("Report Play Status")
|
||||
|
||||
else
|
||||
@@ -359,3 +348,15 @@ 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")
|
||||
|
||||
@@ -46,8 +46,6 @@ class ClientMock {
|
||||
|
||||
class SpitClientFix {
|
||||
protected:
|
||||
std::vector<string> messages;
|
||||
|
||||
ClientMock client;
|
||||
SProcessor::Callbacks callbacks{
|
||||
.onServerEvent = [&](SProcessor::ServerEvent event, const SadDetectedServer &detectedServer) { client.onServerEvent(event, detectedServer); },
|
||||
@@ -63,15 +61,14 @@ class SpitClientFix {
|
||||
SProcessor::InternalCallbacks intCallbacks {
|
||||
.delay = [&](int ms){ return ; },
|
||||
.sendMessage = [&](Message::OPPart &msg){ return 0; },
|
||||
.parseMessage = [&](Message &msg) {
|
||||
// auto o = fmt::format("msg-{}", msg.getHeader()->getMessageNumber());
|
||||
// messages.push_back(o);
|
||||
},
|
||||
.sendTypeInternal = [&](SType &sType) { return 0; },
|
||||
.sendObjectInternal = [&](SObject *sObject) { return 0; }
|
||||
};
|
||||
SProcessor sut{"sut", "sutProj", "dev", "##GUID##", callbacks, intCallbacks};
|
||||
};
|
||||
|
||||
TEST_CASE_FIXTURE(SpitClientFix, "Spit types") {
|
||||
|
||||
{
|
||||
Message::ReportType t;
|
||||
t.setConfirmed(false);
|
||||
@@ -177,174 +174,3 @@ TEST_CASE_FIXTURE(SpitClientFix, "Spit types") {
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(SpitClientFix, "Message Counter") {
|
||||
Message::ReportType t1;
|
||||
t1.setID("type#1");
|
||||
t1.setServerRemote(true);
|
||||
auto m1 = sut.createMessage(t1);
|
||||
|
||||
Message::ReportType t2;
|
||||
t2.setID("type#2");
|
||||
t2.setServerRemote(true);
|
||||
auto m2 = sut.createMessage(t2);
|
||||
|
||||
Message::ReportType t3;
|
||||
t3.setID("type#3");
|
||||
t3.setServerRemote(true);
|
||||
auto m3 = sut.createMessage(t3);
|
||||
|
||||
Message::ReportType t4;
|
||||
t4.setID("type#4");
|
||||
t4.setServerRemote(true);
|
||||
auto m4 = sut.createMessage(t4);
|
||||
|
||||
Message::ReportType t5;
|
||||
t5.setID("type#5");
|
||||
t5.setServerRemote(true);
|
||||
auto m5 = sut.createMessage(t5);
|
||||
|
||||
Message::ReportType t6;
|
||||
t6.setID("type#6");
|
||||
t6.setServerRemote(true);
|
||||
auto m6 = sut.createMessage(t6);
|
||||
|
||||
CHECK(cbEvents.empty());
|
||||
SUBCASE("Normal order") {
|
||||
REQUIRE(cbEvents.size() == 0);
|
||||
sut.checkParseMessageData(m1);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#1 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m2);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#2 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m3);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#3 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m4);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#4 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
}
|
||||
|
||||
CHECK(cbEvents.empty());
|
||||
SUBCASE("overtakes one") {
|
||||
REQUIRE(cbEvents.size() == 0);
|
||||
sut.checkParseMessageData(m1);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#1 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m3);
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m2);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#2 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#3 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m4);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#4 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
}
|
||||
|
||||
CHECK(cbEvents.empty());
|
||||
SUBCASE("overtakes two") {
|
||||
REQUIRE(cbEvents.size() == 0);
|
||||
sut.checkParseMessageData(m1);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#1 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m4);
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m2);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#2 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m3);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#3 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#4 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m5);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#5 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
}
|
||||
|
||||
CHECK(cbEvents.empty());
|
||||
SUBCASE("many overtakes") {
|
||||
REQUIRE(cbEvents.size() == 0);
|
||||
sut.checkParseMessageData(m1);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#1 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m5);
|
||||
CHECK(cbEvents.empty());
|
||||
sut.checkParseMessageData(m6);
|
||||
CHECK(cbEvents.empty());
|
||||
sut.checkParseMessageData(m4);
|
||||
CHECK(cbEvents.empty());
|
||||
sut.checkParseMessageData(m3);
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m2);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#2 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#3 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#4 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#5 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#6 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
}
|
||||
|
||||
CHECK(cbEvents.empty());
|
||||
SUBCASE("reverse order") {
|
||||
REQUIRE(cbEvents.size() == 0);
|
||||
sut.checkParseMessageData(m1);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#1 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m6);
|
||||
CHECK(cbEvents.empty());
|
||||
sut.checkParseMessageData(m5);
|
||||
CHECK(cbEvents.empty());
|
||||
sut.checkParseMessageData(m4);
|
||||
CHECK(cbEvents.empty());
|
||||
sut.checkParseMessageData(m3);
|
||||
CHECK(cbEvents.empty());
|
||||
|
||||
sut.checkParseMessageData(m2);
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#2 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#3 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#4 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#5 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK_MESSAGE(cbEvents.front() == "0: true type#6 ", cbEvents.front());
|
||||
cbEvents.pop();
|
||||
CHECK(cbEvents.empty());
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,8 @@ class SpitClientCmplsFix {
|
||||
SProcessor::InternalCallbacks intCallbacks {
|
||||
.delay = [&](int ms){ return ; },
|
||||
.sendMessage = [&](Message::OPPart &msg){ return 0; },
|
||||
.parseMessage = [&](Message &msg) { },
|
||||
.sendTypeInternal = [&](SType &sType) { return 0; },
|
||||
.sendObjectInternal = [&](SObject *sObject) { return 0; }
|
||||
};
|
||||
SProcessor sut{"sut", "sutProj", "dev", "##GUID##", callbacks, intCallbacks};
|
||||
};
|
||||
|
||||
@@ -3,17 +3,15 @@
|
||||
#include "stepperDrv.hpp"
|
||||
#include "stepperMotor.hpp"
|
||||
#include <cmath>
|
||||
#include "logging.hpp"
|
||||
|
||||
class WatchMotor {
|
||||
static constexpr uint8_t Positions = 6;
|
||||
|
||||
public:
|
||||
using AlmostFinishedCb = void (*)(uint8_t newIdx);
|
||||
WatchMotor(IStepperMotor &stepper, AlmostFinishedCb onDone, ILogging &logger)
|
||||
using AllmostFinishedCb = void (*)(uint8_t newIdx);
|
||||
WatchMotor(IStepperMotor &stepper, AllmostFinishedCb onDone)
|
||||
: _stepper(stepper),
|
||||
_onFinCb(onDone),
|
||||
_logger(logger) {
|
||||
_onFinCb(onDone) {
|
||||
}
|
||||
|
||||
void moveTo(uint8_t position, uint8_t profile, int minJumps, float accel, float speed) {
|
||||
@@ -46,12 +44,7 @@ class WatchMotor {
|
||||
|
||||
ESP_LOGD("MV", "Moving to %d by %.2f + %.2f", sign, delta, corr);
|
||||
|
||||
_stepper.moveBy(delta + corr, profile, accel, speed, [&](int diff) {
|
||||
_logger.logv(ILogging::Severity::Debug,"Almost done with head=%i",diff);
|
||||
if (diff < 6) {
|
||||
_logger.logv(ILogging::Severity::Warning,"Low headroom in Profile pipeline=%i",diff);
|
||||
}
|
||||
|
||||
_stepper.moveBy(delta + corr, profile, accel, speed, [&]() {
|
||||
if (_onFinCb) {
|
||||
_onFinCb(position);
|
||||
}
|
||||
@@ -65,6 +58,5 @@ class WatchMotor {
|
||||
private:
|
||||
IStepperMotor &_stepper;
|
||||
uint8_t _currentIndex{};
|
||||
AlmostFinishedCb _onFinCb{};
|
||||
ILogging &_logger;
|
||||
AllmostFinishedCb _onFinCb{};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
UnitTestsFrame()
|
||||
target_link_libraries(${moduleName} PUBLIC
|
||||
devHal
|
||||
bases
|
||||
)
|
||||
@@ -19,7 +19,7 @@ class StepperMotorMock : public IStepperMotor {
|
||||
lastAngle = angle;
|
||||
lastProfile = profile;
|
||||
}
|
||||
void moveBy(float angle, uint8_t profile, float accel, float speed, std::function<void(int diff)> profileDone = nullptr) override {
|
||||
void moveBy(float angle, uint8_t profile, float accel, float speed, std::function<void()> profileDone = nullptr) override {
|
||||
lastAngle = angle;
|
||||
lastProfile = profile;
|
||||
}
|
||||
@@ -37,12 +37,6 @@ class StepperMotorMock : public IStepperMotor {
|
||||
float nextPos{};
|
||||
};
|
||||
|
||||
class LoggerMock : public ILogging {
|
||||
void output(Severity severity, std::string message) override {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
|
||||
void onFin(uint8_t idx) {
|
||||
}
|
||||
|
||||
@@ -53,8 +47,7 @@ class WatchFaceFixture {
|
||||
protected:
|
||||
static constexpr int MicroSteps = 32;
|
||||
StepperMotorMock motor;
|
||||
LoggerMock logger;
|
||||
WatchMotor sut{motor, onFin, logger};
|
||||
WatchMotor sut{motor, onFin};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
+1
-1
Submodule core updated: 93e9682854...e09e7dc576
+2
-2
@@ -12,10 +12,10 @@ dependencies:
|
||||
idf:
|
||||
source:
|
||||
type: idf
|
||||
version: 5.4.3
|
||||
version: 5.4.1
|
||||
direct_dependencies:
|
||||
- frozen-eye/esp_telnet
|
||||
- idf
|
||||
manifest_hash: f3dbb2beffe19f6e4fa3818b79ea2bfac679eaaf47effee78f152007a2be54f5
|
||||
manifest_hash: 8e2a908d16408b9cafcd4c4b109b841acfca6e660d2500fc6d1362f0f143376c
|
||||
target: esp32c6
|
||||
version: 2.0.0
|
||||
|
||||
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.
@@ -7,7 +7,6 @@ struct {
|
||||
const char *mqttBroker = "mqttBroker"; // example: "172.16.16.10"
|
||||
const char *mqttPrefix = "mqttPrefix"; // example: "SomeTag"
|
||||
const char *spitServer = "spitServer"; // example: "172.16.16.10"
|
||||
const char *motorPower = "motorPower"; // example: "50"
|
||||
} ConfigKeys;
|
||||
|
||||
// MQTT Topics
|
||||
+22
-98
@@ -17,7 +17,7 @@
|
||||
// activeState.speed = (min .5 / max 3)
|
||||
|
||||
#include "watchMain.hpp"
|
||||
#include "config.hpp"
|
||||
#include "interconConfig.hpp"
|
||||
|
||||
using namespace spit;
|
||||
|
||||
@@ -104,7 +104,7 @@ void testPictoIllum(Cli::CArgs args) {
|
||||
int p = std::stoi(args[0]);
|
||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(p));
|
||||
} catch (const std::exception &e) {
|
||||
ESP_LOGI(TAG, "Failed to parse %s", args[0].c_str());
|
||||
ESP_LOGI(TAG, "Failed to parse %s and %s", args[0].c_str(), args[1].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,25 +132,6 @@ void testMovement(Cli::CArgs args) {
|
||||
}
|
||||
}
|
||||
|
||||
void testFeedback(Cli::CArgs args) {
|
||||
ESP_LOGI(TAG, "on triggerMovement:");
|
||||
if (args.size() != 1) {
|
||||
pShell->writeLine("need target position (1..6) or 0 for moving");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int p = std::stoi(args[0]);
|
||||
if (p == 0) {
|
||||
responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StartMoving, 0));
|
||||
} else {
|
||||
responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StepAt, p));
|
||||
}
|
||||
|
||||
} catch (const std::exception &e) {
|
||||
ESP_LOGI(TAG, "Failed to parse %s", args[0].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void setConfig(Cli::CArgs args) {
|
||||
if (args.size() != 2) {
|
||||
pShell->writeLine("Needs string key and value");
|
||||
@@ -206,22 +187,9 @@ void showProcessValues(Cli::CArgs args) {
|
||||
pShell->writeLine(std::string{" Provile: "} + std::to_string((int)activeState.profile));
|
||||
}
|
||||
|
||||
void setSyslogLevel(Cli::CArgs args) {
|
||||
if (args.size() != 1) {
|
||||
pShell->writeLine("Needs SyslogLevel Warning = 4, Notice = 5, Informational = 6, Debug = 7");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
auto lvl = std::stoi(args[0]);
|
||||
if (lvl >= (int)Syslog::Severity::Warning && lvl <= (int)Syslog::Severity::Debug) {
|
||||
Syslog::setSeverity((Syslog::Severity)lvl);
|
||||
} else {
|
||||
pShell->writeLine("New level was not accepted");
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
ESP_LOGI(TAG, "Failed to parse %s", args[0].c_str());
|
||||
}
|
||||
void startDemoMovement(Cli::CArgs args) {
|
||||
ESP_LOGI(TAG, "on startDemoMovement:");
|
||||
commandQueue.enqueue(std::make_unique<MoveCommand>(MoveType::Demo));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,11 +209,8 @@ static void telnetSocketTask(int addrFamily) {
|
||||
{"update", "Start OTA-Update-Process",
|
||||
[](Cli::CArgs a) { startUpdate(a); }});
|
||||
pShell->addBinding(
|
||||
{"setLogserver", "Set log server config ip",
|
||||
{"logserver_set", "Set log server config ip",
|
||||
[](Cli::CArgs a) { setLogServerConfig(a); }});
|
||||
pShell->addBinding(
|
||||
{"setLogLevel", "Set severity log server",
|
||||
[](Cli::CArgs a) { setSyslogLevel(a); }});
|
||||
|
||||
pShell->addBinding(
|
||||
{"getcfg", "Get configuration value for key",
|
||||
@@ -255,7 +220,7 @@ static void telnetSocketTask(int addrFamily) {
|
||||
[](Cli::CArgs a) { setConfig(a); }});
|
||||
|
||||
pShell->addBinding(
|
||||
{"setDyn", "set dynamics of movement (velocity,accelerations) as floats",
|
||||
{"dyn_set", "set dynamics of movement (velocity,accelerations) as floats",
|
||||
[](Cli::CArgs a) { setDynamics(a); }});
|
||||
pShell->addBinding(
|
||||
{"tstMove", "start movement (profile-idx,steps) as integers ",
|
||||
@@ -263,9 +228,6 @@ static void telnetSocketTask(int addrFamily) {
|
||||
pShell->addBinding(
|
||||
{"tstIllum", "test illumination command 0=off /1..6",
|
||||
[](Cli::CArgs a) { testPictoIllum(a); }});
|
||||
pShell->addBinding(
|
||||
{"tstFb", "test feedback-channel to control 0=Move /1..6=FinalPos",
|
||||
[](Cli::CArgs a) { testFeedback(a); }});
|
||||
pShell->addBinding(
|
||||
{"showData", "Show process values that are input by DMX, MQTT and SPIT",
|
||||
[](Cli::CArgs a) { showProcessValues(a); }});
|
||||
@@ -463,7 +425,7 @@ const Macro macDemoFlicker = {
|
||||
{16, 1, &InitSlopeWave, StateMachine::UpdateWave, 0xFF},
|
||||
{32, 1, StateMachine::UpdateFlicker, 0xFF},
|
||||
};
|
||||
} // namespace Effect
|
||||
}
|
||||
|
||||
void LightingTask() {
|
||||
ESP_LOGI(TAG, "Start Lighting");
|
||||
@@ -513,7 +475,7 @@ void LightingTask() {
|
||||
};
|
||||
|
||||
while (true) {
|
||||
auto onPos = pictoIllumQue.tryDequeue();
|
||||
auto onPos = pictoIllumQue.dequeue(0);
|
||||
if (onPos) {
|
||||
ESP_LOGI(TAG, "Changing picto-Illum to pos = %i", onPos->pos);
|
||||
ESP_LOGI(TAG, "Current color set r%i g%i b%i ",
|
||||
@@ -558,20 +520,7 @@ void MovementTask() {
|
||||
{LEDC_CHANNEL_0, LEDC_CHANNEL_1, LEDC_CHANNEL_2, LEDC_CHANNEL_3},
|
||||
{GPIO_NUM_21, GPIO_NUM_20, GPIO_NUM_23, GPIO_NUM_22},
|
||||
};
|
||||
|
||||
float power = 0.25F;
|
||||
// try
|
||||
// {
|
||||
// auto pwr = store.getValue(ConfigKeys.motorPower);
|
||||
// power = std::stof(pwr);
|
||||
// }
|
||||
// catch(...)
|
||||
// {
|
||||
// std::cerr << e.what() << '\n';
|
||||
// ESP_LOGI("Stepper", "Applying default");
|
||||
// }
|
||||
|
||||
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps, power);
|
||||
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps, 0.25F);
|
||||
stepperDriver.setPos(0);
|
||||
|
||||
StepperConfig stepperCfg{1.8F, MicroSteps};
|
||||
@@ -585,11 +534,10 @@ void MovementTask() {
|
||||
|
||||
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
||||
|
||||
SyslogInst logger;
|
||||
WatchMotor watch(stepper, [](uint8_t newPos) {
|
||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos));
|
||||
responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StepAt, newPos));
|
||||
}, logger);
|
||||
});
|
||||
|
||||
ESP_LOGI("Stepper", "Find Home");
|
||||
stepper.findRef();
|
||||
@@ -635,33 +583,6 @@ void MovementTask() {
|
||||
// pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos));
|
||||
// responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StepAt, newPos));
|
||||
}
|
||||
} else if (cmd->type == MoveType::Shuffle) {
|
||||
Syslog::logv(Syslog::Severity::Informational,
|
||||
"Starting Shuffle mode");
|
||||
while (true) {
|
||||
int pos = Random::randomWithIn(1,6);
|
||||
int profile = Random::randomWithIn(0,3);
|
||||
if (stepper.isIdle()) {
|
||||
Syslog::logv(Syslog::Severity::Notice,
|
||||
"Running Stepper to %i by min%i steps with prof=%i a=%.2f w=%.2f",
|
||||
pos, activeState.minJumps, activeState.profile, activeState.accel, activeState.speed);
|
||||
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(0));
|
||||
responseQueue.enqueue(std::make_unique<WatchIndex>(ResponseType::StartMoving, 0));
|
||||
auto &as = activeState;
|
||||
watch.moveTo(pos, profile, as.minJumps, as.accel, as.speed);
|
||||
}
|
||||
// int delay = Random::randomWithIn(20000,100000)/portTICK_PERIOD_MS;
|
||||
int delay = Random::randomWithIn(2000,3000)/portTICK_PERIOD_MS;
|
||||
Syslog::logv(Syslog::Severity::Informational,
|
||||
"ShuffleMode Wait for %i", delay);
|
||||
auto cmd = commandQueue.tryDequeueFor(delay);
|
||||
if (cmd) {
|
||||
if (cmd->type != MoveType::Shuffle) {
|
||||
commandQueue.enqueue(std::move(cmd));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (cmd->type == MoveType::Demo) {
|
||||
ESP_LOGI(TAG, "Running Demo");
|
||||
for (size_t i = ProfileGenerator::Smooth; i < ProfileGenerator::NumProfiles; i++) {
|
||||
@@ -855,14 +776,14 @@ void onPlay(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_Pl
|
||||
ESP_LOGD(TAG, "eventPlay Player: %s Runs: %d Time: %lld", p_PlayerName.data(), p_PlayerIsRunning, p_TimeFrames);
|
||||
|
||||
switch (p_PlayerType) {
|
||||
case SClient::PlayerType::PTYPE_MAIN:
|
||||
case SClient::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 SClient::PlayerType::PTYPE_CONTINOUS:
|
||||
case SClient::PLAYERTYPE_CONTINOUS:
|
||||
// The olayer is playing only single Object sequences sometime during the project
|
||||
break;
|
||||
case SClient::PlayerType::PTYPE_DISCRETE:
|
||||
case SClient::PLAYERTYPE_DISCRETE:
|
||||
// Only discrete values where submitted, e.g the fader position of remote faders.
|
||||
break;
|
||||
}
|
||||
@@ -935,7 +856,7 @@ void SpitClientApp() {
|
||||
|
||||
for (auto &obj : ProvidedObj) {
|
||||
SType *ptrSPITType1Fix = spitClient.createTypeFixed(obj.iD, obj.groupName, obj.name, 0, 0);
|
||||
spitClient.setActionType(ptrSPITType1Fix->getID(), true); // should be executed whenever a SPITObject with this SPITType is played
|
||||
spitClient.setActionSPITType(ptrSPITType1Fix->getID(), true); // should be executed whenever a SPITObject with this SPITType is played
|
||||
}
|
||||
spitClient.clientProjectLoaded();
|
||||
spitClient.startServerAutoDetect();
|
||||
@@ -992,11 +913,12 @@ void app_main(void) {
|
||||
initialize_ethernet();
|
||||
NvsApi::init();
|
||||
static fos::Task lightingTask(LightingTask, "Lights", 0x8000uL);
|
||||
static fos::Task movementTask(MovementTask, "Motor", 0x8000uL, fos::Task::MAX_PRIORITY-4 );
|
||||
static fos::Task movementTask(MovementTask, "Motor", 0x8000uL);
|
||||
|
||||
etherActive.take();
|
||||
fos::Task::delayMs(10000);
|
||||
ESP_LOGI(TAG, "Start net services");
|
||||
// esp_log_level_set("SPIT", esp_log_level_t::ESP_LOG_DEBUG);
|
||||
|
||||
static int ipVersion = AF_INET;
|
||||
static fos::TaskT<int> telnetSocket(telnetSocketTask, ipVersion, "tcpServer", 4096);
|
||||
@@ -1020,8 +942,10 @@ void app_main(void) {
|
||||
while (true) {
|
||||
fos::Task::delayMs(5000);
|
||||
// ToDo send
|
||||
Syslog::logv(Syslog::Severity::Notice, "Min heap size: %u / FreeHeap %lu",
|
||||
heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT),
|
||||
esp_get_free_heap_size());
|
||||
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
-1
@@ -40,7 +40,22 @@
|
||||
#include "nvsFunctions.hpp"
|
||||
#include "mqttClient.hpp"
|
||||
#include "watchFace.hpp"
|
||||
#include "random.hpp"
|
||||
|
||||
// #include "esp_chip_info.h"
|
||||
// #include "esp_flash.h"
|
||||
// #include "esp_ota_ops.h"
|
||||
// #include "esp_partition.h"
|
||||
// #include "esp_random.h"
|
||||
// #include "esp_system.h"
|
||||
// #include "fileSystem.hpp"
|
||||
// #include "lwip/apps/netbiosns.h"
|
||||
// #include "mdns.h"
|
||||
// #include "soc/soc_caps.h"
|
||||
// #include "systemFunctions.hpp"
|
||||
// #include <inttypes.h>
|
||||
// #include <sys/param.h>
|
||||
// #include <unistd.h>
|
||||
|
||||
#include "sad_DetectedServer.hpp"
|
||||
#include "spit_object.hpp"
|
||||
#include "spit_player.hpp"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
.PHONY: start test clean
|
||||
|
||||
start:
|
||||
./startCode
|
||||
|
||||
# testConfig: buildTestOnTarget
|
||||
|
||||
test:
|
||||
cmake -DTgtEnv:STRING=Target -S . -B buildTestOnTarget
|
||||
cmake --build buildTestOnTarget --parallel
|
||||
idf.py -B buildTestOnTarget -p /dev/ttyACM0 flash monitor
|
||||
|
||||
uTest:
|
||||
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -DTgtEnv:STRING=Host -S . -B buildUTest
|
||||
cmake --build buildUTest --parallel
|
||||
ctest --test-dir buildUTest
|
||||
|
||||
clean:
|
||||
rm -rf build buildTestOnTarget
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Automatically generated file. DO NOT EDIT.
|
||||
# Espressif IoT Development Framework (ESP-IDF) 5.4.3 Project Configuration
|
||||
# Espressif IoT Development Framework (ESP-IDF) 5.4.1 Project Configuration
|
||||
#
|
||||
CONFIG_SOC_ADC_SUPPORTED=y
|
||||
CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y
|
||||
CONFIG_SOC_UART_SUPPORTED=y
|
||||
CONFIG_SOC_UHCI_SUPPORTED=y
|
||||
CONFIG_SOC_GDMA_SUPPORTED=y
|
||||
CONFIG_SOC_AHB_GDMA_SUPPORTED=y
|
||||
CONFIG_SOC_GPTIMER_SUPPORTED=y
|
||||
@@ -64,7 +63,6 @@ CONFIG_SOC_DEEP_SLEEP_SUPPORTED=y
|
||||
CONFIG_SOC_MODEM_CLOCK_SUPPORTED=y
|
||||
CONFIG_SOC_PM_SUPPORTED=y
|
||||
CONFIG_SOC_XTAL_SUPPORT_40M=y
|
||||
CONFIG_SOC_XTAL_CLOCK_PATH_DEPENDS_ON_TOP_DOMAIN=y
|
||||
CONFIG_SOC_AES_SUPPORT_DMA=y
|
||||
CONFIG_SOC_AES_GDMA=y
|
||||
CONFIG_SOC_AES_SUPPORT_AES_128=y
|
||||
@@ -141,7 +139,6 @@ CONFIG_SOC_RTCIO_PIN_COUNT=8
|
||||
CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y
|
||||
CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y
|
||||
CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y
|
||||
CONFIG_SOC_RTCIO_EDGE_WAKE_SUPPORTED=y
|
||||
CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8
|
||||
CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8
|
||||
CONFIG_SOC_DEDIC_PERIPH_ALWAYS_ENABLE=y
|
||||
@@ -203,7 +200,7 @@ CONFIG_SOC_RMT_CHANNELS_PER_GROUP=4
|
||||
CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=48
|
||||
CONFIG_SOC_RMT_SUPPORT_RX_PINGPONG=y
|
||||
CONFIG_SOC_RMT_SUPPORT_RX_DEMODULATION=y
|
||||
CONFIG_SOC_RMT_SUPPORT_ASYNC_STOP=y
|
||||
CONFIG_SOC_RMT_SUPPORT_TX_ASYNC_STOP=y
|
||||
CONFIG_SOC_RMT_SUPPORT_TX_LOOP_COUNT=y
|
||||
CONFIG_SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP=y
|
||||
CONFIG_SOC_RMT_SUPPORT_TX_SYNCHRO=y
|
||||
@@ -332,7 +329,6 @@ CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=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_UHCI_NUM=1
|
||||
CONFIG_SOC_COEX_HW_PTI=y
|
||||
CONFIG_SOC_EXTERNAL_COEX_ADVANCE=y
|
||||
CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21
|
||||
@@ -362,7 +358,6 @@ 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_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED=y
|
||||
CONFIG_SOC_PM_RETENTION_MODULE_NUM=32
|
||||
CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y
|
||||
CONFIG_SOC_MODEM_CLOCK_IS_INDEPENDENT=y
|
||||
@@ -527,7 +522,6 @@ CONFIG_ESP_ROM_USB_OTG_NUM=-1
|
||||
CONFIG_ESP_ROM_HAS_VERSION=y
|
||||
CONFIG_ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB=y
|
||||
CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y
|
||||
CONFIG_ESP_ROM_NO_USB_SERIAL_OUTPUT_API=y
|
||||
|
||||
#
|
||||
# Boot ROM Behavior
|
||||
@@ -676,20 +670,7 @@ CONFIG_APPTRACE_LOCK_ENABLE=y
|
||||
# Bluetooth
|
||||
#
|
||||
# CONFIG_BT_ENABLED is not set
|
||||
|
||||
#
|
||||
# Common Options
|
||||
#
|
||||
|
||||
#
|
||||
# BLE Log
|
||||
#
|
||||
# CONFIG_BLE_LOG_ENABLED is not set
|
||||
# end of BLE Log
|
||||
|
||||
# CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED is not set
|
||||
# CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED is not set
|
||||
# end of Common Options
|
||||
CONFIG_BT_ALARM_MAX_NUM=50
|
||||
# end of Bluetooth
|
||||
|
||||
#
|
||||
@@ -749,12 +730,6 @@ CONFIG_APPTRACE_LOCK_ENABLE=y
|
||||
# CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||
# end of Legacy I2S Driver Configurations
|
||||
|
||||
#
|
||||
# Legacy I2C Driver Configurations
|
||||
#
|
||||
# CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK is not set
|
||||
# end of Legacy I2C Driver Configurations
|
||||
|
||||
#
|
||||
# Legacy PCNT Driver Configurations
|
||||
#
|
||||
@@ -796,7 +771,6 @@ CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y
|
||||
# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set
|
||||
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
|
||||
# CONFIG_ESP_TLS_INSECURE is not set
|
||||
CONFIG_ESP_TLS_DYN_BUF_STRATEGY_SUPPORTED=y
|
||||
# end of ESP-TLS
|
||||
|
||||
#
|
||||
@@ -835,7 +809,6 @@ CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
||||
CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y
|
||||
# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set
|
||||
# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set
|
||||
CONFIG_GPTIMER_OBJ_CACHE_SAFE=y
|
||||
# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set
|
||||
# end of ESP-Driver:GPTimer Configurations
|
||||
|
||||
@@ -920,14 +893,6 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
|
||||
# CONFIG_UART_ISR_IN_IRAM is not set
|
||||
# end of ESP-Driver:UART Configurations
|
||||
|
||||
#
|
||||
# ESP-Driver:UHCI Configurations
|
||||
#
|
||||
# CONFIG_UHCI_ISR_HANDLER_IN_IRAM is not set
|
||||
# CONFIG_UHCI_ISR_CACHE_SAFE is not set
|
||||
# CONFIG_UHCI_ENABLE_DEBUG_LOG is not set
|
||||
# end of ESP-Driver:UHCI Configurations
|
||||
|
||||
#
|
||||
# ESP-Driver:USB Serial/JTAG Configuration
|
||||
#
|
||||
@@ -1017,7 +982,6 @@ CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT=2000
|
||||
#
|
||||
CONFIG_ESP32C6_REV_MIN_0=y
|
||||
# CONFIG_ESP32C6_REV_MIN_1 is not set
|
||||
# CONFIG_ESP32C6_REV_MIN_2 is not set
|
||||
CONFIG_ESP32C6_REV_MIN_FULL=0
|
||||
CONFIG_ESP_REV_MIN_FULL=0
|
||||
|
||||
@@ -1089,10 +1053,8 @@ CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y
|
||||
# GDMA Configurations
|
||||
#
|
||||
CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y
|
||||
CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y
|
||||
CONFIG_GDMA_OBJ_DRAM_SAFE=y
|
||||
# CONFIG_GDMA_ENABLE_DEBUG_LOG is not set
|
||||
# CONFIG_GDMA_ISR_IRAM_SAFE is not set
|
||||
# CONFIG_GDMA_ENABLE_DEBUG_LOG is not set
|
||||
# end of GDMA Configurations
|
||||
|
||||
#
|
||||
@@ -1150,11 +1112,8 @@ CONFIG_ESP_PHY_RF_CAL_PARTIAL=y
|
||||
# CONFIG_ESP_PHY_RF_CAL_NONE is not set
|
||||
# CONFIG_ESP_PHY_RF_CAL_FULL is not set
|
||||
CONFIG_ESP_PHY_CALIBRATION_MODE=0
|
||||
CONFIG_ESP_PHY_PLL_TRACK_PERIOD_MS=1000
|
||||
# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set
|
||||
# CONFIG_ESP_PHY_RECORD_USED_TIME is not set
|
||||
CONFIG_ESP_PHY_IRAM_OPT=y
|
||||
# CONFIG_ESP_PHY_DEBUG is not set
|
||||
# end of PHY
|
||||
|
||||
#
|
||||
@@ -1405,14 +1364,6 @@ CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0
|
||||
# CONFIG_FATFS_IMMEDIATE_FSYNC is not set
|
||||
# CONFIG_FATFS_USE_LABEL is not set
|
||||
CONFIG_FATFS_LINK_LOCK=y
|
||||
# CONFIG_FATFS_USE_DYN_BUFFERS is not set
|
||||
|
||||
#
|
||||
# File system free space calculation behavior
|
||||
#
|
||||
CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT=0
|
||||
CONFIG_FATFS_DONT_TRUST_LAST_ALLOC=0
|
||||
# end of File system free space calculation behavior
|
||||
# end of FAT Filesystem support
|
||||
|
||||
#
|
||||
@@ -1511,7 +1462,6 @@ CONFIG_HEAP_TRACING_OFF=y
|
||||
# CONFIG_HEAP_TASK_TRACKING is not set
|
||||
# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set
|
||||
CONFIG_HEAP_TLSF_USE_ROM_IMPL=y
|
||||
# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set
|
||||
# end of Heap memory debugging
|
||||
|
||||
#
|
||||
@@ -1529,7 +1479,6 @@ CONFIG_IEEE802154_PENDING_TABLE_SIZE=20
|
||||
# CONFIG_IEEE802154_MULTI_PAN_ENABLE is not set
|
||||
# CONFIG_IEEE802154_TIMING_OPTIMIZATION is not set
|
||||
# CONFIG_IEEE802154_DEBUG is not set
|
||||
# CONFIG_IEEE802154_DEBUG_ASSERT_MONITOR is not set
|
||||
# end of IEEE 802.15.4
|
||||
|
||||
#
|
||||
@@ -1616,7 +1565,7 @@ CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
||||
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
|
||||
CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y
|
||||
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
|
||||
CONFIG_LWIP_DHCP_OPTIONS_LEN=69
|
||||
CONFIG_LWIP_DHCP_OPTIONS_LEN=68
|
||||
CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0
|
||||
CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1
|
||||
|
||||
@@ -1690,7 +1639,6 @@ 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_IPV6_ND6_ROUTE_INFO_OPTION_SUPPORT is not set
|
||||
# CONFIG_LWIP_PPP_SUPPORT is not set
|
||||
# CONFIG_LWIP_SLIP_SUPPORT is not set
|
||||
|
||||
@@ -1778,7 +1726,6 @@ CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
|
||||
# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set
|
||||
# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set
|
||||
CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y
|
||||
# CONFIG_MBEDTLS_SSL_KEYING_MATERIAL_EXPORT is not set
|
||||
CONFIG_MBEDTLS_PKCS7_C=y
|
||||
# end of mbedTLS v3.x related
|
||||
|
||||
@@ -1814,7 +1761,6 @@ CONFIG_MBEDTLS_HAVE_TIME=y
|
||||
# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set
|
||||
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
|
||||
CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y
|
||||
CONFIG_MBEDTLS_SHA1_C=y
|
||||
CONFIG_MBEDTLS_SHA512_C=y
|
||||
# CONFIG_MBEDTLS_SHA3_C is not set
|
||||
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
||||
@@ -1896,7 +1842,6 @@ CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y
|
||||
# CONFIG_MBEDTLS_THREADING_C is not set
|
||||
CONFIG_MBEDTLS_ERROR_STRINGS=y
|
||||
CONFIG_MBEDTLS_FS_IO=y
|
||||
# CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION is not set
|
||||
# end of mbedTLS
|
||||
|
||||
#
|
||||
@@ -1949,8 +1894,6 @@ CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y
|
||||
#
|
||||
# CONFIG_OPENTHREAD_SPINEL_ONLY is not set
|
||||
# end of OpenThread Spinel
|
||||
|
||||
# CONFIG_OPENTHREAD_DEBUG is not set
|
||||
# end of OpenThread
|
||||
|
||||
#
|
||||
@@ -2001,7 +1944,6 @@ CONFIG_SPI_FLASH_BROWNOUT_RESET=y
|
||||
# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set
|
||||
CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50
|
||||
# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set
|
||||
# CONFIG_SPI_FLASH_FORCE_ENABLE_C6_H2_SUSPEND is not set
|
||||
# end of Optional and Experimental Features (READ DOCS FIRST)
|
||||
# end of Main Flash configuration
|
||||
|
||||
@@ -2159,15 +2101,6 @@ CONFIG_MDNS_TASK_STACK_SIZE=4096
|
||||
# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set
|
||||
CONFIG_MDNS_TASK_AFFINITY_CPU0=y
|
||||
CONFIG_MDNS_TASK_AFFINITY=0x0
|
||||
|
||||
#
|
||||
# MDNS Memory Configuration
|
||||
#
|
||||
CONFIG_MDNS_TASK_CREATE_FROM_INTERNAL=y
|
||||
CONFIG_MDNS_MEMORY_ALLOC_INTERNAL=y
|
||||
# CONFIG_MDNS_MEMORY_CUSTOM_IMPL is not set
|
||||
# end of MDNS Memory Configuration
|
||||
|
||||
CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000
|
||||
CONFIG_MDNS_TIMER_PERIOD_MS=100
|
||||
# CONFIG_MDNS_NETWORKING_SOCKET is not set
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Compiler options
|
||||
#
|
||||
CONFIG_COMPILER_CXX_EXCEPTIONS=y
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="ChaosWatch"
|
||||
|
||||
#
|
||||
# Ethernet Configuration
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(UnitTests)
|
||||
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)
|
||||
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../../core/test/unitOnHost/netMock" netMock)
|
||||
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../../core/test/unitOnHost/osMock" osMock)
|
||||
# add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../../core/test/unitOnHost/freeRtos" freeRtos)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user