refactor/bringup: Bringup full project

moving SPIT-App parts to main app
LiveShowDemoProject added
Debugging motor movements
This commit is contained in:
2025-03-29 14:57:01 +01:00
parent 810264aa71
commit 04a8904cbe
63 changed files with 9220 additions and 6605 deletions
+6 -4
View File
@@ -3,8 +3,9 @@
#include <string> #include <string>
using namespace std; using namespace std;
class SAD_DetectedServer;
class I_SAD_Client { class I_SAD_Client {
public: public:
/** /**
* If a new server was found by the ServerAutoDetect mechanism, this function is called.<br> * If a new server was found by the ServerAutoDetect mechanism, this function is called.<br>
* To do so the SAD_Client ServerAutoDetect has to be startet - see SAD_Client::startServerAutoDetect.<br> * To do so the SAD_Client ServerAutoDetect has to be startet - see SAD_Client::startServerAutoDetect.<br>
@@ -20,7 +21,7 @@ public:
* @param p_Addition sometimes server may have additional informations * @param p_Addition sometimes server may have additional informations
* @param p_IsIP4 the server ip is a ip4 address * @param p_IsIP4 the server ip is a ip4 address
*/ */
virtual void eventServerDetected(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ProjectName, string p_ClientIP, bool p_IsIP4) = 0; virtual void eventServerDetected(SAD_DetectedServer &server) = 0;
/** /**
* If a SPITServer is not more found, this function is called. * If a SPITServer is not more found, this function is called.
* To do so the SAD_Client ServerAutoDetect has to be startet - see SAD_Client::startServerAutoDetect.<br> * To do so the SAD_Client ServerAutoDetect has to be startet - see SAD_Client::startServerAutoDetect.<br>
@@ -32,6 +33,7 @@ public:
* @param p_Addition sometimes server may have additional informations * @param p_Addition sometimes server may have additional informations
* @param p_IsIP4 the server ip is a ip4 address * @param p_IsIP4 the server ip is a ip4 address
*/ */
virtual void eventServerLost(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ProjectName, string p_ClientIP, bool p_IsIP4) = 0; virtual void eventServerChanged(SAD_DetectedServer &server) = 0;
virtual void eventServerChanged(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ProjectName, string p_ClientIP, bool p_IsIP4) = 0;
virtual void eventServerLost(SAD_DetectedServer &server) = 0;
}; };
-85
View File
@@ -1,85 +0,0 @@
/*
* 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: MySPITApp.h
* Author: Hagi
*
* Created on 17. April 2019, 18:24
*/
#ifndef MYSPITAPP_H
#define MYSPITAPP_H
#include "SPIT_Client.h"
#include <chrono>
#include <string>
#include "SPITType.h"
#include "SPITObject.h"
#include "SPITPlayer.h"
#include "SAD_DetectedServer.hpp"
using namespace std;
class MyApp {
public:
MyApp();
// Client's infos is set by the client
static string s_ClientName;
static string s_ProjectName;
void init();
private:
SPIT_Client _SpitClient; // pointer to an instance of the SPIT_Client, which do the main work for you
// Server's project infos filled by eventProjectReport
static string m_ServerProjectID;
static string m_ServerProjectName;
static int m_ServerFramesPerSecond; // set when the server reports his project, see eventProjectReport
// liveSHOWsoftware will use 44100 frames per second as time resolution
// All times are given in frames,
public:
static void onServerEvent(SPIT_Client::ServerEvent event, const SAD_DetectedServer &p_DetectedServer);
static void onConnectionStatus(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, int p_ConnectionStatus, int p_OldConnectionStatus);
//----- Project -----
static void onStartProjectTransfer();
static void onEndProjectTransfer();
static void onProjectReport(string p_ProjectID, string p_ProjectName, int p_FramesPerSeoond);
static void onProjectClosed(string p_ProjectID);
//----- SPITType -----
static bool onCheckSpitTypeVeto(SPIT_Message::ReportSPITType* p_ReportSPITType);
static void onSpitType(bool p_New, const SPITType &p_SPITType);
static void onSpitTypeRemote(bool p_New, const SPITType &p_SPITType);
static void onSpitTypeRemoved(const SPITType &p_SPITType);
static void onSpitTypeRemoteRemoved(const SPITType &p_SPITType);
//----- SPITObject -----
static bool onCheckSpitObjectVeto(SPIT_Message::ReportSPITObject* p_ReportSPITObject);
static void onSpitObject(bool p_New, const SPITType &p_SPITType, const SPITObject &p_SPITObject);
static void onSpitObjectRemote(bool p_New, const SPITType &p_SPITType, const SPITObject &p_SPITObject);
static void onSpitObjectRemoved(const SPITType &p_SPITType, const SPITObject &p_SPITObject);
static void onSpitObjectRemoteRemoved(const SPITType &p_SPITType, const SPITObject &p_SPITObject);
//----- Play SPITObjects -----
static void onPlay(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_PlayerIsRunning, long long p_TimeFrames);
static void onPlaySpitType(string p_PlayerID, string p_SPITTypeID, bool p_PlayerIsRunning, bool p_Started, bool p_Ended, double p_Value);
//----- Server changes status of one of his REMOTE SPITObjects -----
// REMOTE only Server->Client RemoteObject's play status
static void onPlayRemoteObjectStatus(const SPITType &p_SPITType, const SPITObject &p_SPITObject, long long p_FrameInsideObject, int p_Value);
void sendRemoteObject(string p_SPITObjectID, int p_Valueppm = 0, char p_ValueFlag = 0x00);
//-----
void testLiveShowRemote();
//------ User's options normally should not be used, the server is master of things ------
public:
};
#endif /* MYSPITAPP_H */
+17 -36
View File
@@ -1,22 +1,21 @@
#pragma once #pragma once
#include "I_SAD_Client.hpp" #include "I_SAD_Client.hpp"
#include <list>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <list>
using namespace std; using namespace std;
class SAD_DetectedServer { class SAD_DetectedServer {
public: public:
SAD_DetectedServer(); SAD_DetectedServer();
SAD_DetectedServer(const SAD_DetectedServer& orig) { SAD_DetectedServer(const SAD_DetectedServer &orig) {
m_ID = orig.getID(); m_ID = orig.getID();
m_Name = orig.getName(); m_Name = orig.getName();
m_ComputerName = orig.getComputerName(); m_ComputerName = orig.getComputerName();
m_IP = orig.getIP(); m_IP = orig.getIP();
m_IPIsIP4 = orig.getIpIsIP4();
m_ClientIP = orig.getClientIP(); m_ClientIP = orig.getClientIP();
m_Port = orig.getPort(); m_Port = orig.getPort();
m_Additions = orig.getAdditions(); m_Additions = orig.getAdditions();
@@ -28,7 +27,6 @@ public:
string m_Name; string m_Name;
string m_ComputerName; string m_ComputerName;
string m_IP; string m_IP;
bool m_IPIsIP4;
string m_ClientIP; string m_ClientIP;
string m_Port; string m_Port;
string m_Additions; string m_Additions;
@@ -42,22 +40,21 @@ public:
string getName() const { return m_Name; } string getName() const { return m_Name; }
string getComputerName() const { return m_ComputerName; } string getComputerName() const { return m_ComputerName; }
string getIP() const { return m_IP; } string getIP() const { return m_IP; }
bool getIpIsIP4() const { return m_IPIsIP4; }
string getPort() const { return m_Port; } string getPort() const { return m_Port; }
string getClientIP() const { return m_ClientIP; } string getClientIP() const { return m_ClientIP; }
string getAdditions() const { return m_Additions; } string getAdditions() const { return m_Additions; }
string getProjectName() const {return m_ServerProjectName;} string getProjectName() const { return m_ServerProjectName; }
private:
private:
void setID(string p_ID) { m_ID = p_ID; } void setID(string p_ID) { m_ID = p_ID; }
void setName(string p_Name) { m_Name = p_Name; } void setName(string p_Name) { m_Name = p_Name; }
void setComputerName(string p_ComputerName) { m_ComputerName = p_ComputerName; } void setComputerName(string p_ComputerName) { m_ComputerName = p_ComputerName; }
void setIP(string p_IP) { m_IP = p_IP; } void setIP(string p_IP) { m_IP = p_IP; }
void setClientIP(string p_IP) { m_ClientIP = p_IP; } void setClientIP(string p_IP) { m_ClientIP = p_IP; }
void setPort(string p_Port) { m_Port = p_Port; } void setPort(string p_Port) { m_Port = p_Port; }
void setAdditions(string p_Additions) { m_Additions = p_Additions;} void setAdditions(string p_Additions) { m_Additions = p_Additions; }
void setProjectName(string p_ServerProjectName); void setProjectName(string p_ServerProjectName);
void setIPIsIP4(bool p_IsIP4) { m_IPIsIP4 = p_IsIP4; }
bool getNew() const { return m_New; } bool getNew() const { return m_New; }
bool getChanged() const { return m_Changed; } bool getChanged() const { return m_Changed; }
bool getFoundAgain() const { return m_FoundAgain; } bool getFoundAgain() const { return m_FoundAgain; }
@@ -65,18 +62,17 @@ private:
void setNew(bool p_New) { m_New = p_New; } void setNew(bool p_New) { m_New = p_New; }
void setFoundAgain() { m_FoundAgain = true; } void setFoundAgain() { m_FoundAgain = true; }
//SAD_Client m_ThreadSend will send to Multicast addresses // SAD_Client m_ThreadSend will send to Multicast addresses
void startCycleSAD() { void startCycleSAD() {
m_IPIsIP4 = false;
m_Changed = false; m_Changed = false;
m_FoundAgain = false; m_FoundAgain = false;
m_New = false; m_New = false;
} }
//SAD_Client m_Thread_Send has paused in the meantime m_ThreadReceive may received messages from servers
void endCycleSAD() { } private:
private: static unordered_map<string, SAD_DetectedServer *> s_DetectedServers;
static unordered_map<string, SAD_DetectedServer*> s_DetectedServers;
public: public:
static const int PARAMINDEX_PRECODE = 0; static const int PARAMINDEX_PRECODE = 0;
static const int PARAMINDEX_SPITTASKID = 1; static const int PARAMINDEX_SPITTASKID = 1;
static const int PARAMINDEX_NAME = 2; static const int PARAMINDEX_NAME = 2;
@@ -93,12 +89,12 @@ public:
* @param p_ServerID the id of the server, every instance of a SPITServer has an own id * @param p_ServerID the id of the server, every instance of a SPITServer has an own id
* @param p_ServerParams the server's parameter * @param p_ServerParams the server's parameter
*/ */
static void addDetectedServer(bool p_IsIP4, string p_ServerID, string p_ServerParams[]); static void addDetectedServer(string p_ServerID, string p_ServerParams[]);
/** /**
* Used by SAD_Client to remove a SPITServer - don't use this manually * Used by SAD_Client to remove a SPITServer - don't use this manually
* @param p_DetectedServer * @param p_DetectedServer
*/ */
static void removeDetectedServer(SAD_DetectedServer* p_DetectedServer); static void removeDetectedServer(SAD_DetectedServer &server);
/** /**
* Used by SAD_Client to clear all found SPITServers - don't use this manually * Used by SAD_Client to clear all found SPITServers - don't use this manually
*/ */
@@ -111,7 +107,7 @@ public:
* Used by SAD_Client internally -don't use this manually * Used by SAD_Client internally -don't use this manually
* @param p_SADClientInterface * @param p_SADClientInterface
*/ */
static void cycleEnd(I_SAD_Client& p_SADClientInterface); static void cycleEnd(I_SAD_Client &p_SADClientInterface);
/** /**
* Returns a reference of the DetectedServer with the id p_ServerID.<br> * Returns a reference of the DetectedServer with the id p_ServerID.<br>
@@ -119,20 +115,5 @@ public:
* @param p_ServerID the id of the SPITServer * @param p_ServerID the id of the SPITServer
* @return the reference of the SAD_DetectedServer instance with getID() == p_ServerID * @return the reference of the SAD_DetectedServer instance with getID() == p_ServerID
*/ */
static const SAD_DetectedServer& getRefDetectedServer(string p_ServerID) { static const SAD_DetectedServer &getRefDetectedServer(string p_ServerID);
SAD_DetectedServer* ptrDetectedServer = NULL;
{
auto i = s_DetectedServers.find(p_ServerID);
if (i != s_DetectedServers.end()) {
ptrDetectedServer = i->second;
}
if (ptrDetectedServer != NULL) {
return *ptrDetectedServer;
}
throw new exception();
}
}
}; };
+32 -32
View File
@@ -14,8 +14,8 @@
#ifndef SPITOBJECT_H #ifndef SPITOBJECT_H
#define SPITOBJECT_H #define SPITOBJECT_H
#include "SPIT_Message.h"
#include "SPITType.h" #include "SPITType.h"
#include "SPIT_Message.h"
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
@@ -24,39 +24,40 @@ using namespace std;
class SPITObjectListener; class SPITObjectListener;
class SPITObject { class SPITObject {
private: private:
static unordered_map<string, SPITObject *> s_SPITObjects;
static unordered_map<string, SPITObject *> s_SPITObjectsRemote;
static unordered_map<string, SPITObject*> s_SPITObjects; public:
static unordered_map<string, SPITObject*> s_SPITObjectsRemote; static SPITObject *getSPITObject(string p_ID);
public: static const SPITObject &getSPITObjectRef(string p_ID);
static SPITObject* getSPITObject(string p_ID); static bool addSPITObject(SPITObject *p_ptrSpitObject);
static const SPITObject& getSPITObjectRef(string p_ID); static bool removeSPITObject(SPITObject *p_ptrSpitObject);
static bool addSPITObject(SPITObject* p_ptrSpitObject);
static bool removeSPITObject(SPITObject* p_ptrSpitObject);
static bool removeSPITObject(string p_SpitObjectID); static bool removeSPITObject(string p_SpitObjectID);
static int getSPITObjectCount(); static int getSPITObjectCount();
static SPITObject* getSPITObject(int p_Index); static SPITObject *getSPITObject(int p_Index);
static const SPITObject& getSPITObjectRef(int p_Index); static const SPITObject &getSPITObjectRef(int p_Index);
static void clearSPITObjects(); static void clearSPITObjects();
static void clearUnconfirmedSPITObjects(); static void clearUnconfirmedSPITObjects();
static void setConfirmedFalse(); static void setConfirmedFalse();
static SPITObject* getSPITObjectRemote(string p_ID); static SPITObject *getSPITObjectRemote(string p_ID);
static const SPITObject& getSPITObjectRemoteRef(string p_ID); static const SPITObject &getSPITObjectRemoteRef(string p_ID);
static bool addSPITObjectRemote(SPITObject* p_ptrSpitObject); static bool addSPITObjectRemote(SPITObject *p_ptrSpitObject);
static bool removeSPITObjectRemote(SPITObject* p_ptrSpitObject); static bool removeSPITObjectRemote(SPITObject *p_ptrSpitObject);
static bool removeSPITObjectRemote(string p_SpitObjectID); static bool removeSPITObjectRemote(string p_SpitObjectID);
static int getSPITObjectRemoteCount(); static int getSPITObjectRemoteCount();
static SPITObject* getSPITObjectRemote(int p_Index); static SPITObject *getSPITObjectRemote(int p_Index);
static const SPITObject& getSPITObjectRemoteRef(int p_Index); static const SPITObject &getSPITObjectRemoteRef(int p_Index);
static void clearSPITObjectsRemote(); static void clearSPITObjectsRemote();
static void eventProjectClosed(); static void eventProjectClosed();
SPITObject(); SPITObject();
// SPITObject(const SPITObject& orig); // SPITObject(const SPITObject& orig);
~SPITObject(); ~SPITObject();
private:
private:
string m_ID; string m_ID;
string m_Name; string m_Name;
string m_SPITTypeID; string m_SPITTypeID;
@@ -67,7 +68,7 @@ private:
bool m_CreatedByClient; bool m_CreatedByClient;
bool m_ServerRemote; bool m_ServerRemote;
bool m_ActionAssigned; bool m_ActionAssigned;
bool m_ActionAssignedType; //Virtual construct bool m_ActionAssignedType; // Virtual construct
long long m_FrameStart; long long m_FrameStart;
long long m_FrameLength; long long m_FrameLength;
long long m_FrameFadeInLength; long long m_FrameFadeInLength;
@@ -83,9 +84,9 @@ private:
int m_PlayValue; int m_PlayValue;
char m_PlayValueFlag; char m_PlayValueFlag;
void initMembers(); void initMembers();
public:
public:
string getID() const { return m_ID; } string getID() const { return m_ID; }
string getName() const { return m_Name; } string getName() const { return m_Name; }
string getRemark() const { return m_Remark; } string getRemark() const { return m_Remark; }
@@ -132,15 +133,16 @@ public:
long long getDuration() const { return m_Duration; } long long getDuration() const { return m_Duration; }
bool getProjectIndepended() const { bool getProjectIndepended() const {
SPITType* ptrSPITType; SPITType *ptrSPITType;
if (m_ServerRemote == false) { if (m_ServerRemote == false) {
ptrSPITType = SPITType::getSPITType(m_SPITTypeID); ptrSPITType = SPITType::getSPITType(m_SPITTypeID);
if (ptrSPITType == NULL) return true; if (ptrSPITType == NULL)
return true;
return ptrSPITType->getProjectIndepended(); return ptrSPITType->getProjectIndepended();
} } else {
else {
ptrSPITType = SPITType::getSPITTypeRemote(m_SPITTypeID); ptrSPITType = SPITType::getSPITTypeRemote(m_SPITTypeID);
if (ptrSPITType == NULL) return true; if (ptrSPITType == NULL)
return true;
return ptrSPITType->getProjectIndepended(); return ptrSPITType->getProjectIndepended();
} }
}; };
@@ -166,11 +168,9 @@ public:
bool setDelay(long long p_Delay); bool setDelay(long long p_Delay);
bool setDuration(long long p_Duration); bool setDuration(long long p_Duration);
bool setMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject); bool setMessageOP(SPIT_Message::ReportSPITObject *p_ReportSPITObject);
void fillMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject); void fillMessageOP(SPIT_Message::ReportSPITObject *p_ReportSPITObject);
void fillMessageOP(SPIT_Message::RemoveSPITObject* p_RemoveSPITObject); void fillMessageOP(SPIT_Message::RemoveSPITObject *p_RemoveSPITObject);
}; };
#endif /* SPITOBJECT_H */ #endif /* SPITOBJECT_H */
+19 -21
View File
@@ -19,13 +19,13 @@
class SPITPlayer { class SPITPlayer {
//----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------ //----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------
public: public:
class PlaySPITType { class PlaySPITType {
public: public:
PlaySPITType(); PlaySPITType();
PlaySPITType(SPITPlayer* p_SPITPlayer, string p_SPITObjectID); PlaySPITType(SPITPlayer *p_SPITPlayer, string p_SPITObjectID);
PlaySPITType(const PlaySPITType& orig); PlaySPITType(const PlaySPITType &orig);
string getSPITTypeID() const { string getSPITTypeID() const {
return m_SPITTypeID; return m_SPITTypeID;
@@ -54,43 +54,41 @@ public:
double m_Value; double m_Value;
}; };
//----- SPITPlayer ------ //----- SPITPlayer ------
public: public:
//list the SPITPlayers // list the SPITPlayers
static unordered_map<string, SPITPlayer*> s_SPITPlayers; //all actual played objects static unordered_map<string, SPITPlayer *> s_SPITPlayers; // all actual played objects
static SPITPlayer* getSPITPlayer(string p_PlayerID); //if a player does not exist creates a new one static SPITPlayer *getSPITPlayer(string p_PlayerID); // if a player does not exist creates a new one
static void clearPlayers(); static void clearPlayers();
SPITPlayer(string p_PlayerID); SPITPlayer(string p_PlayerID);
virtual ~SPITPlayer(); virtual ~SPITPlayer();
void startPlaySequence(); // called by SPIT_Client::parsePlaySPITStart
void startPlaySequence(); //called by SPIT_Client::parsePlaySPITStart PlaySPITType *addSPITType_Playing(string p_SPITTypeID); // called by SPIT_Client::parsePlaySPITStart
PlaySPITType* addSPITType_Playing (string p_SPITTypeID); //called by SPIT_Client::parsePlaySPITStart void endPlaySequence(); // called by SPIT_Client::parsePlaySPITEnd
void endPlaySequence(); //called by SPIT_Client::parsePlaySPITEnd
string getID() { string getID() {
return m_ID; return m_ID;
} }
unordered_map<string, PlaySPITType*>* getPlaySPITTypes(); unordered_map<string, PlaySPITType *> *getPlaySPITTypes();
void setIsRunning(bool p_IsRunning); 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() { return m_IsRunning; } bool getIsRunning() { return m_IsRunning; }
void setName(string p_Name);
string getName() { return m_Name; } string getName() { return m_Name; }
void setType(char p_Type);
char getType() { return m_Type; } char getType() { return m_Type; }
void setTime(long long p_Frames);
long long getTime() { return m_TimeFrames; } long long getTime() { return m_TimeFrames; }
private: private:
string m_ID; string m_ID;
string m_Name; string m_Name;
char m_Type; char m_Type;
unordered_map<string, PlaySPITType*> m_PlaySPITTypes; unordered_map<string, PlaySPITType *> m_PlaySPITTypes;
bool m_IsRunning; bool m_IsRunning;
long long m_TimeFrames; long long m_TimeFrames;
}; };
#endif /* SPITPLAYER_H */ #endif /* SPITPLAYER_H */
+23 -24
View File
@@ -16,17 +16,17 @@
#ifndef SPITSOCKET_H #ifndef SPITSOCKET_H
#define SPITSOCKET_H #define SPITSOCKET_H
#include <string>
#include "esp_netif.h"
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "Task.hpp" #include "Task.hpp"
#include "esp_log.h" #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; using namespace std;
@@ -35,7 +35,7 @@ string createGUID();
/** Returns the name of the client's host computer*/ /** Returns the name of the client's host computer*/
string getClientHostName(); string getClientHostName();
class SPITSocket{ class SPITSocket {
public: public:
static const int FAMILY_IP4 = AF_INET; static const int FAMILY_IP4 = AF_INET;
@@ -45,8 +45,8 @@ class SPITSocket{
*/ */
struct IPAddress { struct IPAddress {
public: public:
IPAddress(const string& p_IPAddress, const string& p_SubnetMask) IPAddress(const string &p_IPAddress, const string &p_SubnetMask)
: m_IPAddress(p_IPAddress), m_SubnetMask(p_SubnetMask) { } : m_IPAddress(p_IPAddress), m_SubnetMask(p_SubnetMask) {}
const string m_IPAddress; const string m_IPAddress;
const string m_SubnetMask; const string m_SubnetMask;
@@ -72,10 +72,10 @@ class SPITSocket{
bool createSocket_UDP(); bool createSocket_UDP();
static const int INVALID_SOCKET = -1; static const int INVALID_SOCKET = -1;
private: private:
int m_UDPSocketIP4; int m_UDPSocketIP4;
public: public:
//-------- class -------------- //-------- class --------------
SPITSocket(IPAddress ip) : mOwnIp(ip) { SPITSocket(IPAddress ip) : mOwnIp(ip) {
m_UDPSocketIP4 = INVALID_SOCKET; m_UDPSocketIP4 = INVALID_SOCKET;
@@ -88,7 +88,6 @@ public:
m_BoundClientFamily = 0; m_BoundClientFamily = 0;
m_IsBound = false; m_IsBound = false;
createSocket_UDP(); createSocket_UDP();
} }
virtual ~SPITSocket() { virtual ~SPITSocket() {
ESP_LOGD("UDP", "Shutting down ..."); ESP_LOGD("UDP", "Shutting down ...");
@@ -101,16 +100,17 @@ public:
fos::Task::delayMs(100); fos::Task::delayMs(100);
m_IsBound = false; m_IsBound = false;
} }
private:
private:
string m_ServerIP; string m_ServerIP;
string m_ServerPort; string m_ServerPort;
string m_ClientIP; string m_ClientIP;
string m_ClientPort; //port given by the user maybe "0" string m_ClientPort; // port given by the user maybe "0"
string m_BoundClientPort; //port set after bind string m_BoundClientPort; // port set after bind
int m_BoundClientFamily; int m_BoundClientFamily;
bool m_IsBound; bool m_IsBound;
public: public:
/** /**
* Sets the ip address and port for server and client. * Sets the ip address and port for server and client.
* @param p_ServerIP * @param p_ServerIP
@@ -131,7 +131,7 @@ public:
* @param p_MessageLength length of the messaeg * @param p_MessageLength length of the messaeg
* @return * @return
*/ */
int sendMessage(const char* p_MessageBytes, int p_MessageLength) { int sendMessage(const char *p_MessageBytes, int p_MessageLength) {
if (m_ServerPort.length() <= 0) if (m_ServerPort.length() <= 0)
return -1; return -1;
int intResult; int intResult;
@@ -143,16 +143,16 @@ public:
return intResult; return intResult;
} }
int receiveMessage(int p_InetFamily, char* p_Buffer, int p_BufferLength, string* p_ServerIP); int receiveMessage(int p_InetFamily, char *p_Buffer, int p_BufferLength, string *p_ServerIP);
int setBroadcast(bool p_Broadcast); int setBroadcast(bool p_Broadcast);
int bindSocket(string p_ServerIP, string p_ClientIP, string p_ClientPort); int bindSocket(string p_ServerIP, string p_ClientIP, string p_ClientPort);
// * Internal usage - don't use this manually // * Internal usage - don't use this manually
// * Use sendMessage instead // * Use sendMessage instead
int sendMessageTo(int p_InetFamily, string p_ServerIP, string p_Port, const char* p_MessageBytes, int p_MessageLength); int sendMessageTo(int p_InetFamily, string p_ServerIP, string p_Port, const char *p_MessageBytes, int p_MessageLength);
string getServerIP() { return m_ServerIP; } string getServerIP() { return m_ServerIP; }
string getServerPort(){ return m_ServerPort; } string getServerPort() { return m_ServerPort; }
string getClientIP() { return m_ClientIP; } string getClientIP() { return m_ClientIP; }
string getClientPort() { return m_ClientPort; } string getClientPort() { return m_ClientPort; }
string getBoundClientPort() { return m_BoundClientPort; } string getBoundClientPort() { return m_BoundClientPort; }
@@ -164,4 +164,3 @@ public:
}; };
#endif /* SPITSOCKET_H */ #endif /* SPITSOCKET_H */
+30 -32
View File
@@ -24,38 +24,38 @@ using namespace std;
class SPITTypeListener; class SPITTypeListener;
class SPITType { class SPITType {
private: private:
static unordered_map<string, SPITType*> s_SPITTypes; static unordered_map<string, SPITType *> s_SPITTypes;
static unordered_map<string, SPITType*> s_SPITTypesRemote; static unordered_map<string, SPITType *> s_SPITTypesRemote;
public: public:
static SPITType* getSPITType(string p_ID); static SPITType *getSPITType(string p_ID);
static const SPITType& getSPITTypeRef(string p_ID); static const SPITType &getSPITTypeRef(string p_ID);
static bool addSPITType(SPITType* p_ptrSpitType); static bool addSPITType(SPITType *p_ptrSpitType);
static bool removeSPITType(SPITType* p_ptrSpitType); static bool removeSPITType(SPITType *p_ptrSpitType);
static int getSPITTypeCount(); static int getSPITTypeCount();
static SPITType* getSPITType(int p_Index); static SPITType *getSPITType(int p_Index);
static const SPITType& getSPITTypeRef(int p_Index); static const SPITType &getSPITTypeRef(int p_Index);
static void clearSPITTypes(); static void clearSPITTypes();
static void setConfirmedFalse(); static void setConfirmedFalse();
static SPITType* getSPITTypeRemote(string p_ID); static SPITType *getSPITTypeRemote(string p_ID);
static const SPITType& getSPITTypeRemoteRef(string p_ID); static const SPITType &getSPITTypeRemoteRef(string p_ID);
static bool addSPITTypeRemote(SPITType* p_ptrSpitType); static bool addSPITTypeRemote(SPITType *p_ptrSpitType);
static bool removeSPITTypeRemote(SPITType* p_ptrSpitType); static bool removeSPITTypeRemote(SPITType *p_ptrSpitType);
static int getSPITTypeRemoteCount(); static int getSPITTypeRemoteCount();
static SPITType* getSPITTypeRemote(int p_Index); static SPITType *getSPITTypeRemote(int p_Index);
static const SPITType& getSPITTypeRemoteRef(int p_Index); static const SPITType &getSPITTypeRemoteRef(int p_Index);
static void clearSPITTypesRemote(); static void clearSPITTypesRemote();
static void eventProjectClosed(); static void eventProjectClosed();
SPITType(); SPITType();
SPITType(string p_ID, string p_GroupName, string p_Name, bool p_Fixed, bool p_ProjectIndepended,long long p_DefaultDelay, long long p_DefaultDuration); SPITType(string p_ID, string p_GroupName, string p_Name, bool p_Fixed, bool p_ProjectIndepended, long long p_DefaultDelay, long long p_DefaultDuration);
// SPITType(const SPITType& orig); // SPITType(const SPITType& orig);
~SPITType(); ~SPITType();
private:
private:
bool m_Confirmed; bool m_Confirmed;
string m_ID; string m_ID;
bool m_Fixed; bool m_Fixed;
@@ -66,16 +66,16 @@ private:
long long m_DefaultDelay; long long m_DefaultDelay;
long long m_DefaultDuration; long long m_DefaultDuration;
bool m_CreatedByClient; //flag true = the SPITTyype is created by the client bool m_CreatedByClient; // flag true = the SPITTyype is created by the client
//false = the SPITType is received from the server // false = the SPITType is received from the server
bool m_ActionAssigned; //This is a virtual flag if user associates an action with a SPITType. 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 // Can be used to setActionAssigned for all SPITObjects with this SPITType
void initMembers(); void initMembers();
public: public:
string getID() const{ return m_ID; } string getID() const { return m_ID; }
string getGroupName() const { return m_GroupName; } string getGroupName() const { return m_GroupName; }
string getName() const { return m_Name; } string getName() const { return m_Name; }
/** /**
@@ -110,8 +110,7 @@ public:
return m_ActionAssigned; return m_ActionAssigned;
} }
public:
public:
void setID(string p_ID); void setID(string p_ID);
bool setGroupName(string p_GroupName); bool setGroupName(string p_GroupName);
bool setName(string p_Name); bool setName(string p_Name);
@@ -132,11 +131,10 @@ public:
*/ */
bool setActionAssigned(bool p_ActionAssigned); bool setActionAssigned(bool p_ActionAssigned);
bool setMessageOP(SPIT_Message::ReportSPITType* p_ReportSPITType); bool setMessageOP(SPIT_Message::ReportSPITType *p_ReportSPITType);
void fillMessageOP(SPIT_Message::ReportSPITType* p_ReportSPITType); void fillMessageOP(SPIT_Message::ReportSPITType *p_ReportSPITType);
void fillMessageOP(SPIT_Message::RemoveSPITType* p_RemoveSPITType); void fillMessageOP(SPIT_Message::RemoveSPITType *p_RemoveSPITType);
// static char* stringCopy(const char* p_String); // static char* stringCopy(const char* p_String);
}; };
#endif /* SPITTYPE_H */ #endif /* SPITTYPE_H */
+115 -104
View File
@@ -14,12 +14,12 @@
#ifndef SPIT_CLIENT_H #ifndef SPIT_CLIENT_H
#define SPIT_CLIENT_H #define SPIT_CLIENT_H
#include "SPITSocket.h"
#include "SAD_DetectedServer.hpp" #include "SAD_DetectedServer.hpp"
#include "SPIT_Message.h"
#include "SPITType.h"
#include "SPITObject.h" #include "SPITObject.h"
#include "SPITPlayer.h" #include "SPITPlayer.h"
#include "SPITSocket.h"
#include "SPITType.h"
#include "SPIT_Message.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
@@ -27,40 +27,46 @@ using namespace std;
class SPIT_Client : I_SAD_Client { class SPIT_Client : I_SAD_Client {
public: public:
/** Maximal length of a SPITMessage*/ /** Maximal length of a SPITMessage*/
static const int MAXSPITMESSAGEBYTECOUNT = 512; static const int MAXSPITMESSAGEBYTECOUNT = 512;
enum ServerEvent { enum class ProjUpdate {
ServerLoaded,
StartTransfer,
EndTransfer,
ServerClosed,
};
enum class ServerEvent {
Detect, Detect,
Lost, Lost,
Changed, Changed,
}; };
enum class ObjectEvent {
struct Callbacks { Created,
void(*onServerEvent)(ServerEvent event, const SAD_DetectedServer &p_DetectedServer); Changed,
void(*onConnectionStatus)(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, int p_ConnectionStatus, int p_OldConnectionStatus); Deleted
void(*onStartProjectTransfer)();
void(*onEndProjectTransfer)();
void(*onProjectClosed)(string);
void(*onProjectReport)(string p_ProjectID, string p_ProjectName, int p_FramesPerSeoond);
void(*onSpitType)(bool p_New, const SPITType &p_SPITType);
void(*onSpitTypeRemote)(bool p_New, const SPITType &p_SPITType);
void(*onSpitObject)(bool p_New, const SPITType &p_SPITType, const SPITObject &p_SPITObject);
void(*onSpitObjectRemote)(bool p_New, const SPITType &p_SPITType, const SPITObject &p_SPITObject);
void(*onSpitTypeRemoved)(const SPITType &p_SPITType);
void(*onSpitTypeRemoteRemoved)(const SPITType &p_SPITType);
void(*onSpitObjectRemoved)(const SPITType &p_SPITType, const SPITObject &p_SPITObject);
void(*onSpitObjectRemoteRemoved)(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)(SPIT_Message::ReportSPITType* p_ReportSPITType);
bool(*onCheckSpitObjectVeto)(SPIT_Message::ReportSPITObject* p_ReportSPITObject);
}; };
//----- Connection Status ----- struct Callbacks {
public: void (*onServerEvent)(ServerEvent event, const SAD_DetectedServer &p_DetectedServer){};
void (*onConnectionStatus)(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, int p_ConnectionStatus, int p_OldConnectionStatus){};
void (*onProjectUpdate)(ProjUpdate state, string projectId){};
void (*onSpitType)(ObjectEvent event, const SPITType &p_SPITType){};
void (*onSpitTypeRemote)(ObjectEvent event, const SPITType &p_SPITType){};
void (*onSpitObject)(ObjectEvent event, const SPITType &p_SPITType, const SPITObject &p_SPITObject){};
void (*onSpitObjectRemote)(ObjectEvent event, 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)(SPIT_Message::ReportSPITType *p_ReportSPITType){};
bool (*onCheckSpitObjectVeto)(SPIT_Message::ReportSPITObject *p_ReportSPITObject){};
};
//----- Connection Status -----
public:
/** No Connection established.<br>Either no connect tried or disconnected*/ /** No Connection established.<br>Either no connect tried or disconnected*/
static const int CONNECTION_NONE = 0; static const int CONNECTION_NONE = 0;
/** Server has disconnected*/ /** Server has disconnected*/
@@ -72,8 +78,8 @@ public:
/** A connection to the server is tried.*/ /** A connection to the server is tried.*/
static const int CONNECTION_TRYCONNECTION = 4; static const int CONNECTION_TRYCONNECTION = 4;
//------ PlayerType ------ //------ PlayerType ------
public: 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.*/ /** 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 const char PLAYERTYPE_MAIN = 0x02; static const char PLAYERTYPE_MAIN = 0x02;
/** continous player. This player plays SPIT objects sometime during the project.*/ /** continous player. This player plays SPIT objects sometime during the project.*/
@@ -81,9 +87,9 @@ public:
/** diescrete player. This player is used to transmit single discrete values.*/ /** diescrete player. This player is used to transmit single discrete values.*/
static const char PLAYERTYPE_DISCRETE = 0x00; static const char PLAYERTYPE_DISCRETE = 0x00;
//------ Value Flag ------ //------ Value Flag ------
//------ used by sendRemoteObject //------ used by sendRemoteObject
public: public:
/**Set the given value directly*/ /**Set the given value directly*/
static const char VALUEFLAG_DIRECT = 0x00; static const 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*/ /**Increase the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
@@ -91,19 +97,20 @@ public:
/**Decrease the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/ /**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 const char VALUEFLAG_DECREASE = 0x02; static const char VALUEFLAG_DECREASE = 0x02;
//----- SPIT_Client ----- //----- SPIT_Client -----
public: public:
SPIT_Client(string name, string projName, Callbacks calls); SPIT_Client(string name, string projName, Callbacks calls);
virtual ~SPIT_Client(); virtual ~SPIT_Client();
static int s_MAX_OVERTAKING_SPIT_MESSAGES; static int s_MAX_OVERTAKING_SPIT_MESSAGES;
private:
private:
Callbacks mCallbacks; Callbacks mCallbacks;
fos::TaskT<SPIT_Client&> * m_ThreadReceive{}; fos::TaskT<SPIT_Client &> *m_ThreadReceive{};
bool m_StopReceiveSPITMessages; bool m_StopReceiveSPITMessages;
int m_ConnectionStatus; int m_ConnectionStatus;
bool m_DisconnectedByServer{}; //flag true = when server disconnects bool m_DisconnectedByServer{}; // flag true = when server disconnects
string m_ID; string m_ID;
string m_Name; string m_Name;
string m_ProjName; string m_ProjName;
@@ -113,9 +120,9 @@ private:
unsigned char m_MessageNumber_Send; unsigned char m_MessageNumber_Send;
int m_MessageNumber_Received; int m_MessageNumber_Received;
vector<SPIT_Message*> m_OvertakingSPIT_Messages; vector<SPIT_Message *> m_OvertakingSPIT_Messages;
//Server's info filled by parseConnectAnswer // Server's info filled by parseConnectAnswer
string m_ServerID{}; string m_ServerID{};
string m_ServerName{}; string m_ServerName{};
string m_ServerComputerName{}; string m_ServerComputerName{};
@@ -126,7 +133,7 @@ private:
string m_ServerProjectName; string m_ServerProjectName;
int m_ServerFramesPerSecond; int m_ServerFramesPerSecond;
public: public:
/** The ID of the client.<br>Every client instance should set an unique id*/ /** The ID of the client.<br>Every client instance should set an unique id*/
string getID() { return m_ID; } string getID() { return m_ID; }
/** The name of the client, should be set by the user app*/ /** The name of the client, should be set by the user app*/
@@ -137,7 +144,7 @@ public:
void setClientProjectName(string p_ClientProjectName) { m_ClientProjectName = p_ClientProjectName; } void setClientProjectName(string p_ClientProjectName) { m_ClientProjectName = p_ClientProjectName; }
string getClientProjectName() { return m_ClientProjectName; } string getClientProjectName() { return m_ClientProjectName; }
//connected Server Infos // connected Server Infos
/** The ID of the connected SPITServer*/ /** The ID of the connected SPITServer*/
string getServerID() { return m_ServerID; } string getServerID() { return m_ServerID; }
/** The host computername of the connected SPITServer*/ /** The host computername of the connected SPITServer*/
@@ -166,31 +173,31 @@ public:
void setActionSPITType(string p_SPITTypeID, bool p_ActionAssigned); void setActionSPITType(string p_SPITTypeID, bool p_ActionAssigned);
void setActionSPITObject(string p_SPITObjectID, bool p_ActionAssigned); void setActionSPITObject(string p_SPITObjectID, bool p_ActionAssigned);
//--------------- SPITMessage --------------- //--------------- SPITMessage ---------------
private: private:
bool startReceiveSPITMessages(); bool startReceiveSPITMessages();
void stopReceiveSPITMessages(); void stopReceiveSPITMessages();
static void receiveSPITMessage(SPIT_Client& rM); static void receiveSPITMessage(SPIT_Client &rM);
// Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected // 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 bool _doReconnect{}; // true = on eventServerDetected connect to the server identified by m_ServerID
public: public:
void fillHeader(SPIT_Message::Header* p_Header); void fillHeader(SPIT_Message::Header *p_Header);
int sendSPITMessage(SPIT_Message::OPPart& p_SPITMessageOPPart); int sendSPITMessage(SPIT_Message::OPPart &p_SPITMessageOPPart);
//--------------- ServerAutoDetection SAD --------------- //--------------- ServerAutoDetection SAD ---------------
public: public:
/** Starts the autodetection of SPITServers in the local network. If a connection is tried, the autodetection should be stopped before.*/ /** Starts the autodetection of SPITServers in the local network. If a connection is tried, the autodetection should be stopped before.*/
void startServerAutoDetect(); void startServerAutoDetect();
/** Stops the autodetection of SPITServers in the local network*/ /** Stops the autodetection of SPITServers in the local network*/
void stopServerAutoDetect(); void stopServerAutoDetect();
/** Called every time a new SPITServer is detetced in the local network */ /** Called every time a new SPITServer is detetced in the local network */
void eventServerDetected(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ProjectName, string p_ClientIP, bool p_IsIP4); void eventServerDetected(SAD_DetectedServer &server);
/** Called every time a prior detected SPITServer is is no longer found.*/ /** Called every time a prior detected SPITServer is is no longer found.*/
void eventServerLost(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ProjectName, string p_ClientIP, bool p_IsIP4); void eventServerLost(SAD_DetectedServer &server);
void eventServerChanged(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ProjectName, string p_ClientIP, bool p_IsIP4); void eventServerChanged(SAD_DetectedServer &server);
//--------------- Connection --------------- //--------------- Connection ---------------
public: public:
/** /**
* Tries a connection to the SPITServer * Tries a connection to the SPITServer
* @param p_ServerIP ip address of the SPITServer * @param p_ServerIP ip address of the SPITServer
@@ -208,26 +215,28 @@ public:
*/ */
void disconnect(); void disconnect();
private: private:
void disconnectInternal(int p_Cause); void disconnectInternal(int p_Cause);
void resetMessageNumberReceived(); void resetMessageNumberReceived();
void parseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage); void parseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
void checkParseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage); void checkParseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
void addOvertakingSPIT_Message(SPIT_Message* p_SPIT_Message); void addOvertakingSPIT_Message(SPIT_Message *p_SPIT_Message);
void parseConnectAnswer(SPIT_Message::ConnectAnswer* p_ConnectAnswer); void parseConnectAnswer(SPIT_Message::ConnectAnswer *p_ConnectAnswer);
void parseDisconnect(SPIT_Message::Disconnect* p_Disconnect); void parseDisconnect(SPIT_Message::Disconnect *p_Disconnect);
void parseWatchdog(SPIT_Message::Watchdog* p_Watchdog); void parseWatchdog(SPIT_Message::Watchdog *p_Watchdog);
void parseWatchdogAnswer(SPIT_Message::WatchdogAnswer* p_WatchdogAnswer); void parseWatchdogAnswer(SPIT_Message::WatchdogAnswer *p_WatchdogAnswer);
public:
public:
/** Used internally*/ /** Used internally*/
void sendWatchdog(); void sendWatchdog();
/** Used internally. When the connection to the SPITServer is lost an eventConnectionStatus will occur*/ /** Used internally. When the connection to the SPITServer is lost an eventConnectionStatus will occur*/
void eventWatchdogLost(); void eventWatchdogLost();
//--------------- SPIT Project --------------- //--------------- SPIT Project ---------------
private: private:
void parseReportSPITProject(SPIT_Message::ReportSPITProject* p_ReportSPITProject); void parseReportSPITProject(SPIT_Message::ReportSPITProject *p_ReportSPITProject);
void parseCloseSPITProject(SPIT_Message::CloseSPITProject* p_CloseSPITProject); void parseCloseSPITProject(SPIT_Message::CloseSPITProject *p_CloseSPITProject);
public:
public:
/** Returns the SPITServer's project ID - may be the same as the project's name*/ /** Returns the SPITServer's project ID - may be the same as the project's name*/
string getServerProjectID(); string getServerProjectID();
/** Returns the SPITServer's project name*/ /** Returns the SPITServer's project name*/
@@ -235,15 +244,16 @@ public:
/** 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.*/ /** 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(); int getServerFramesPerSecond();
private: private:
void parseRequestProjectTransfer(SPIT_Message::RequestProjectTransfer* p_RequestProjectTransfer); void parseRequestProjectTransfer(SPIT_Message::RequestProjectTransfer *p_RequestProjectTransfer);
void parseStartProjectTransfer(SPIT_Message::StartProjectTransfer* p_StartProjectTransfer); void parseStartProjectTransfer(SPIT_Message::StartProjectTransfer *p_StartProjectTransfer);
void parseEndProjectTransfer(SPIT_Message::EndProjectTransfer* p_EndProjectTransfer); void parseEndProjectTransfer(SPIT_Message::EndProjectTransfer *p_EndProjectTransfer);
public:
static void sendProject(SPIT_Client* p_PtrSPIT_Client);
// --------------- SPIT Types --------------- public:
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> * 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> * Fixed SPIT types cannot be changed or deleted by the server.<br>
@@ -255,7 +265,7 @@ public:
* @param p_DefaultDuration maybe the action has a default duration, 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. * @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); 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> * Creates a SPITType for application actions.<br>
@@ -269,20 +279,22 @@ public:
* @param p_ProjectIndepended true = the SPITType belongs to a specific project, false = the SpitType always exists for every project * @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. * @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); 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 private:
void parseReportSPITType(SPIT_Message::ReportSPITType* p_ReportSPITType); // receive SPITTypes
void parseRemoveSPITType(SPIT_Message::RemoveSPITType* p_RemoveSPITType); void parseReportSPITType(SPIT_Message::ReportSPITType *p_ReportSPITType);
int sendSPITTypeInternal(SPITType* p_SPITType); void parseRemoveSPITType(SPIT_Message::RemoveSPITType *p_RemoveSPITType);
public: int sendSPITTypeInternal(SPITType *p_SPITType);
public:
/** /**
* If a client wants to change a SPITType, he should send it to the server.<br> * 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> * 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. * @param p_SPITTypeID the id of the SPITType to remove.
* @return 0 = is sended, -1 = is not sended * @return 0 = is sended, -1 = is not sended
*/ */
bool changeSPITType(SPITType* p_SPITType); bool changeSPITType(SPITType *p_SPITType);
/** /**
* If a client wants to remove a SPITType, he should send it to the server.<br> * 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> * 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>
@@ -290,21 +302,22 @@ public:
* @return 0 = is sended, -1 = is not sended * @return 0 = is sended, -1 = is not sended
*/ */
int removeSPITType(string p_SPITTypeID); int removeSPITType(string p_SPITTypeID);
public:
//--------------- SPIT Objects --------------- public:
private: //--------------- SPIT Objects ---------------
void parseReportSPITObject(SPIT_Message::ReportSPITObject* p_ReportSPITObject); private:
void parseRemoveSPITObject(SPIT_Message::RemoveSPITObject* p_RemoveSPITObject); void parseReportSPITObject(SPIT_Message::ReportSPITObject *p_ReportSPITObject);
int sendSPITObjectInternal(SPITObject* ptrSPITObject); void parseRemoveSPITObject(SPIT_Message::RemoveSPITObject *p_RemoveSPITObject);
public: 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> * 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> * The SPITServer may discard the changes and an eventSPITObject occurs.<br>
* @param p_SPITObject the pointer to the changed SPITObject. * @param p_SPITObject the pointer to the changed SPITObject.
* @return 0 = sended, -1 = not sended * @return 0 = sended, -1 = not sended
*/ */
bool changeSPITObject(SPITObject* p_SPITObject); 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> * 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> * The SPITServer may discard the deletion and an eventSPITObject occurs.<br>
@@ -312,31 +325,29 @@ public:
* @return 0 = sended, -1 = not sended * @return 0 = sended, -1 = not sended
*/ */
int removeSPITObject(string p_SPITObjectID); int removeSPITObject(string p_SPITObjectID);
public:
//--------------- Play SPIT Objects --------------- public:
private: //--------------- Play SPIT Objects ---------------
void parsePlaySPITStart(SPIT_Message::PlaySPITStart* p_PlaySPITStart); private:
void parsePlaySPITObject(SPIT_Message::PlaySPITObject* p_PlaySPITObject); void parsePlaySPITStart(SPIT_Message::PlaySPITStart *p_PlaySPITStart);
void parsePlaySPITEnd(SPIT_Message::PlaySPITEnd* p_PlaySPITEnd); void parsePlaySPITObject(SPIT_Message::PlaySPITObject *p_PlaySPITObject);
void parseReportPlayStatus(SPIT_Message::ReportPlayStatus* p_ReportPlayStatus); void parsePlaySPITEnd(SPIT_Message::PlaySPITEnd *p_PlaySPITEnd);
void parseReportPlayStatus(SPIT_Message::ReportPlayStatus *p_ReportPlayStatus);
public: public:
//--------- Remote ---------- //--------- Remote ----------
void sendRemoteObject(string p_SPITObjectID, int p_Valueppm = 0, char p_ValueFlag = 0x00); void sendRemoteObject(string p_SPITObjectID, int p_Valueppm = 0, char p_ValueFlag = 0x00);
private: private:
static void processSocketTask(SPIT_Client & instance); static void processSocketTask(SPIT_Client &instance);
fos::TaskT<SPIT_Client &>* sThread{}; fos::TaskT<SPIT_Client &> *sThread{};
bool abortSearch{}; bool abortSearch{};
bool sAnswered{}; bool sAnswered{};
static fos::Semaphore sStartSad; static fos::Semaphore sStartSad;
SPITSocket * mSPITSocket; SPITSocket *mSPITSocket;
void answerWatchdog() { void answerWatchdog() {
sAnswered = true; sAnswered = true;
} }
}; };
#endif /* SPIT_CLIENT_H */ #endif /* SPIT_CLIENT_H */
File diff suppressed because it is too large Load Diff
-452
View File
@@ -1,452 +0,0 @@
#include "MyApp.h"
#include "Task.hpp"
#include "esp_log.h"
#include "Semaphore.hpp"
#include "Queue.hpp"
#include <list>
const char *TAG = "SPIT";
MyApp::MyApp() :
_SpitClient (
s_ClientName, s_ProjectName,
{
.onServerEvent = onServerEvent,
.onConnectionStatus = onConnectionStatus,
.onStartProjectTransfer = onStartProjectTransfer,
.onEndProjectTransfer = onEndProjectTransfer,
.onProjectClosed = onProjectClosed,
.onProjectReport = onProjectReport,
.onSpitType = onSpitType,
.onSpitTypeRemote = onSpitTypeRemote,
.onSpitObject = onSpitObject,
.onSpitObjectRemote = onSpitObjectRemote,
.onSpitTypeRemoved = onSpitTypeRemoved,
.onSpitTypeRemoteRemoved = onSpitTypeRemoteRemoved,
.onSpitObjectRemoved = onSpitObjectRemoved,
.onSpitObjectRemoteRemoved = onSpitObjectRemoteRemoved,
.onPlay = onPlay,
.onPlaySpitType = onPlaySpitType,
.onPlayRemoteObjectStatus = onPlayRemoteObjectStatus,
.onCheckSpitTypeVeto = onCheckSpitTypeVeto,
.onCheckSpitObjectVeto = onCheckSpitObjectVeto,
}) {
}
string MyApp::m_ServerProjectID{};
string MyApp::m_ServerProjectName{};
int MyApp::m_ServerFramesPerSecond{44100}; // set when the server reports his project, see eventProjectReport
void MyApp::init() {
SPITType *ptrSPITType1Fix = _SpitClient.createSPITTypeFixed("MySPITAPP_Action1ID", "ActionGroupName", "Action1Name", 0, 0);
SPITType *ptrSPITType2Fix = _SpitClient.createSPITTypeFixed("MySPITAPP_Action2ID", "ActionGroupName", "Action2Name", 0, 0);
// When an action exist which should be done whenever a SPITObject with this SPITType is played,
// then you should 'setAssignedActionType' to true
_SpitClient.setActionSPITType(ptrSPITType1Fix->getID(), true);
_SpitClient.setActionSPITType(ptrSPITType2Fix->getID(), true);
_SpitClient.clientProjectLoaded();
_SpitClient.startServerAutoDetect();
}
void MyApp::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;
}
}
//---------------------------------------
//---------- Connecting event ----------
void MyApp::onConnectionStatus(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, int p_ConnectionStatus, int p_OldConnectionStatus) {
ESP_LOGI(TAG, "MySPITApp: eventConnectionStatus %d ", p_ConnectionStatus);
}
//-----------------------------------------------------------
//---------- Server's Project events ------------------------
/**
* The Server reports his loaded project
* Called when
* a) the connection to the server is established.
* b) server load a new project
* c) server saves the project under a new name
* @param p_ProjectID the server project's id (maybe the filename of the project or a part o it or the same as p_ProjectName)
* @param p_ProjectName the server project's name
* @param p_FramesPerSeoond All times in SPIT are given in frames. FramesPerSecond can be used to convert frames to seconds....
*/
void MyApp::onProjectReport(string p_ProjectID, string p_ProjectName, int p_FramesPerSeoond) {
ESP_LOGI(TAG, "eventProjectReport ID: %s Name: %s FramesPerSecond: %d", p_ProjectID.data(), p_ProjectName.data(), p_FramesPerSeoond);
m_ServerProjectID = p_ProjectID;
m_ServerProjectName = p_ProjectName;
m_ServerFramesPerSecond = p_FramesPerSeoond;
// set the frames per second as the server - perhaps the client's time values have to be recalculated.
}
/**
* Called when the server closes his project.
* @param p_ProjectID the id of the project
* The server loads only one project at time-> the ID is not actually necessary
*/
void MyApp::onProjectClosed(string p_ProjectID) {
ESP_LOGI(TAG, "eventProjectClosed ID: %s", p_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();
}
// The server starts the transfer of its project, that means
// All SPITTypes and SPITObjects available on the server are transferred in the following.
void MyApp::onStartProjectTransfer() {
ESP_LOGI(TAG, "eventStartProjectTransfer");
}
// The transfer of the server's SPITTypes and SPITObjects is finished.
void MyApp::onEndProjectTransfer() {
ESP_LOGI(TAG, "eventEndProjectTransfer");
}
//----------------------------------------------------
//--------- SPITType events ----------
/**
* The SPITCLientInterface (implemented by this) will be asked to veto the SPITType while SPIT_Client.parseReportSPITType.<br>
* @param p_ReportSPITType
* @return false = the SPITType is denied, true = the SPITType is accepted
*/
bool MyApp::onCheckSpitTypeVeto(SPIT_Message::ReportSPITType* p_ReportSPITType) {
if (p_ReportSPITType == NULL) return true;
SPITType* ptrSPITType;
ptrSPITType = SPITType::getSPITType(p_ReportSPITType->getID());
//Don't allow foreign SPITTypes
if (ptrSPITType == NULL) return false;
if (ptrSPITType->getCreatedByClient() == false) return false;
return true;
}
bool MyApp::onCheckSpitObjectVeto(SPIT_Message::ReportSPITObject* p_ReportSPITObject) {
if (p_ReportSPITObject == NULL) return true;
SPITType* ptrSPITType;
ptrSPITType = SPITType::getSPITType(p_ReportSPITObject->getSPITTypeID());
if (ptrSPITType == NULL) return false;
//Don't allow SPITObjects which refers to a SPITType which is not created by this client - other SPITTypes cannot be handled here
//if (ptrSPITType->getCreatedByClient() == false) return false;
// SPITObject* ptrSPITObject;
// ptrSPITObject = SPITObject::getSPITObject(p_ReportSPITOnject->getID());
//Don't allow foreign SPITTypes
// if (ptrSPITObject == NULL) return false;
return true;
}
/**
* Called when the server has created, loaded or changed a SPITType.
* May also occur when the server confirms a SPITType created or changed by the client.
* @param p_New true = server created a new SPITType
* false = server changed a existing SPITType
* @param p_SPITType a reference to a copy of the SPITType instance.
*/
void MyApp::onSpitType(bool p_New, const SPITType &p_SPITType) {
// fetch information of the SPITType
if (p_New) {
ESP_LOGD(TAG, "eventSPITType NEW");
} else {
ESP_LOGD(TAG, "eventSPITType CHANGED");
}
ESP_LOGI(TAG, " ID: %s GroupName: %s Name: %s confirmed: %d", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data(), p_SPITType.getConfirmed());
// Check your actions
// Whenever you provide an action for this SPITType take this over in your code.
// call _SpitClient.setActionSPITType(p_SPITType.getID(), true);
// for our little excample as described in loadClientProject we do following
// This may be redundand, because we defined the SPITTypes as fixed, so the server can't change them
// But foe all SPITTypes which are not fixed we need to setActionSPITType
// if ("MySPITAPP_Action1ID" == p_SPITType.getID()) {
// _SpitClient.setActionSPITType(p_SPITType.getID(), true);
// }
// if ("MySPITAPP_Action2ID" == p_SPITType.getID()) {
// _SpitClient.setActionSPITType(p_SPITType.getID(), true);
// }
}
/**
* Called when the server has created or changed a Remote SPITType.
* Remote SPITType are used in Remote SPITObjects. A Remote SPITObject is used to remote control the SPITServer.
* @param p_New true = server created a new SPITType / false = server changed a existing SPITType
*/
void MyApp::onSpitTypeRemote(bool p_New, const SPITType &p_SPITType) {
if (p_New) {
ESP_LOGD(TAG, "eventSPITTypeRemote NEW");
} else {
// 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 == NULL)
continue;
if (ptrSPITObject->getSPITTypeID() == p_SPITType.getID()) {
// call ecentSPITObjectRemote
onSpitObjectRemote(false, p_SPITType, *ptrSPITObject);
}
}
ESP_LOGD(TAG, "eventSPITTypeRemote CHANGED");
}
ESP_LOGD(TAG, "ID: %s GroupName: %s Name: %s confirmed: %d",
p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data(), p_SPITType.getConfirmed());
// this is a remote SPITType, if you want you can list this for later remote use.
}
/**
* Called when the server has removed a SPITType.
* After this function has been exited the SPITType is emeoved from the SPITType-List and the pointer is deleted.
* So use the pointer immediately or use the copyconstructor to make a copy for extended use.
* You have to release the copy yourself later (delete ptr...)
*/
void MyApp::onSpitTypeRemoved(const SPITType &p_SPITType) {
ESP_LOGD(TAG, "eventSPITType Removed");
ESP_LOGD(TAG, " ID: %s GroupName: %s Name: %s\n", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data());
// Check your actions
// take the removal of the SPITType over in your code
// CAUTION: Deleted SPIT types can be added later again (perhaps per UNDO on the SPITServer)
//-> don't remove your assigned action immediately - keep it to reassign it later
}
/**
* Called when the server has removed a Remote SPITType.
* Remote SPITType are used in Remote SPITObjects. A Remote SPITObject is used to remote control the SPITServer.
* After this function has been exited the SPITType is emeoved from the Remote SPITType-List and the pointer is deleted.
* So use the pointer immediately or use the copyconstructor to make a copy for extended use.
* You have to release the copy yourself later (delete ptr...)
* @param p_SPITType a reference to a copy of the SPITType instance.
*/
void MyApp::onSpitTypeRemoteRemoved(const SPITType &p_SPITType) {
ESP_LOGD(TAG, "eventSPITTypeRemote Removed");
ESP_LOGD(TAG, " ID: %s GroupName: %s Name: %s\n", p_SPITType.getID().data(), p_SPITType.getGroupName().data(), p_SPITType.getName().data());
// This is a remote SPITType
// If you have listet this prior you should remove it from the list
}
/**
* Called when the server has created, loaded or changed a SPITObject.
* May also occur when the server confirms a SPITObject created by the client, what the client should never do!!.
* @param p_New true = server created a new SPITObject
* 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 MyApp::onSpitObject(bool p_New, const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
if (p_New) {
ESP_LOGI(TAG, "eventSPITObject NEW");
} else {
ESP_LOGD(TAG, "eventSPITObject CHANGED");
}
ESP_LOGI(TAG, " 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
}
/**
* Called when the server has created or changed a Remote SPITObject.
* A Remote SPITObject is used to remote control the SPITServer.
* @param p_New true = server created a new remote SPITObject
* false = server changed a existing remote 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 MyApp::onSpitObjectRemote(bool p_New, const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
if (p_New) {
ESP_LOGI(TAG, "eventSPITObjectRemote NEW");
} else {
ESP_LOGD(TAG, "eventSPITObjectRemote CHANGED");
}
ESP_LOGI(TAG, " 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
}
/**
* Called when the server has removed a SPITObject.
* After this function has been exited the SPITObject is emeoved from the SPITObject-List and the pointer is deleted.
* So use the pointer immediately or use the copyconstructor to make a copy for extended use.
* You have to release the copy yourself later (delete ptr...)
* @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 MyApp::onSpitObjectRemoved(const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
ESP_LOGD(TAG, "eventSPITObject Removed");
ESP_LOGD(TAG, " 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
}
/**
* Called when the server has removed a Remote SPITObject.
* A Remote SPITObject is used to remote control the SPITServer.
* After this function has been exited the SPITObject is emeoved from the SPITObject-List and the pointer is deleted.
* So use the pointer immediately or use the copyconstructor to make a copy for extended use.
* You have to release the copy yourself later (delete ptr...)
* @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 MyApp::onSpitObjectRemoteRemoved(const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
ESP_LOGD(TAG, "eventSPITObjectRemote Removed");
ESP_LOGD(TAG, " 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
}
//--------------------------------------------------------------
//---------------- Playing SPITObjects ----------------
// Following is called when the SPITServer play SPITObjects.
// For every step the server does following sequence occurs:
// a) eventPlay
// b) several eventPlayObject for each actual played SPITObjectin this step
// NEXT STAP of the server
// a) eventPlay
// b) several eventPlayObject for each actual played SPITObject in this step
// ...
// 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 MyApp::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;
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.
*
* @param p_Started true = The SPITObject is newly played (e.g. in liveSHOWsoftware the cursor enters the SPITObject)
* @param p_Ended Das true = Playback of SPITObject finished (e.g. in liveSHOWsoftware the cursor has exited the SPIT object)
* @param p_SPITType the associated SPITType of p_SPITObject
* @param p_SPITObject the actual played or stopped SPITObject
* @param p_PlayObject contains information about the play status:
* frame where the cursor is inside the SPITObject
* whether the player is running or not
* the actual value of the SPITObject (in liveSHOWsoftware objects ma faded in or out or the main value is decreased, ..
*/
void MyApp::onPlaySpitType(string p_PlayerID, string p_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", p_SPITTypeID.data(), p_SPITObject.getName().data(), p_PlayObject.getFrameInside(), doubleValue);
ESP_LOGD(TAG, " SPITType: %s Value: %f\n", p_SPITTypeID.data(), p_Value);
if (p_SPITTypeID == "MySPITAPP_Action1ID") { // do Action 1
// we can get some information about the play status
if (p_Started == true) {
ESP_LOGI(TAG, "MyApp AKTION 1 started Value: %f and running: %d", p_Value, p_PlayerIsRunning);
} else if (p_Ended == true) {
ESP_LOGI(TAG, "MyApp AKTION 1 ended"); // p_PlayObject.getFrameInside() is -1
} else {
ESP_LOGD(TAG, "MyApp AKTION 1 is played Value: %f and running: %d", p_Value, p_PlayerIsRunning);
}
} else if (p_SPITTypeID == "MySPITAPP_Action2ID") { // do Action 2
if (p_Started == true) {
ESP_LOGI(TAG, "AKTION 2 started Value: %f and running: %d", p_Value, p_PlayerIsRunning);
} else if (p_Ended == true) {
ESP_LOGI(TAG, "AKTION 2 ended"); // p_PlayObject.getFrameInside() is -1
} else {
ESP_LOGD(TAG, "AKTION 2 is played Value: %f and running: %d", p_Value, p_PlayerIsRunning);
}
}
}
//--------------------------------------------------------------
//---------------- Remote Control SPITServer ----------------
// The SPITServer has sent all possibilities to control it remotely - remote SPITObjects - see eventSPITObjectRemote
// Some of them may control functionality with values (fader psotions for loudness of sound, ...).
// When the server changes one of these value objects, it sends an eventPlayRemoteObjectStatus.
/**
* 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 MyApp::onPlayRemoteObjectStatus(const SPITType &p_SPITType, const SPITObject &p_SPITObject, long long p_FrameInsideObject, int p_Value) {
ESP_LOGD(TAG, "eventPlayRemoteObjectStatus RemoteSPITType: %s RemoteSPITObject: %s Position: %lld Value: %d", p_SPITType.getName().data(), p_SPITObject.getName().data(), p_FrameInsideObject, p_Value);
}
/**
* 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 p_Valueppm the value in ppm
* in case a) the value is ignored
* in case b) the value is used
* @param p_ValueFlag indicates how the server should use p_Valueppm:
* VALUEFLAG_DIRECT (0x00) The server will overwrite his existing value with p_Value
* VALUEFLAG_INCREASE (0x01) The server increases his existing value by p_Valueppm
* VALUEFLAG_DECREASE (0x01) The server decreases his existing value by p_Valueppm
*/
void MyApp::sendRemoteObject(string p_SPITObjectID, int p_Valueppm, char p_ValueFlag) {
_SpitClient.sendRemoteObject(p_SPITObjectID, p_Valueppm, p_ValueFlag);
}
void MyApp::testLiveShowRemote() {
// We jump to the next Scenebridge - no Value is needed
_SpitClient.sendRemoteObject("playControlStart");
}
+38 -82
View File
@@ -15,9 +15,9 @@
#include "SAD_DetectedServer.hpp" #include "SAD_DetectedServer.hpp"
#include "esp_log.h" #include "esp_log.h"
static const char * TAG = "SpitSrv"; static const char *TAG = "SpitSrv";
unordered_map<string, SAD_DetectedServer*> SAD_DetectedServer::s_DetectedServers; unordered_map<string, SAD_DetectedServer *> SAD_DetectedServer::s_DetectedServers;
SAD_DetectedServer::~SAD_DetectedServer() { SAD_DetectedServer::~SAD_DetectedServer() {
} }
@@ -29,7 +29,6 @@ SAD_DetectedServer::SAD_DetectedServer() {
m_ClientIP = ""; m_ClientIP = "";
m_Port = ""; m_Port = "";
m_Additions = ""; m_Additions = "";
m_IPIsIP4 = false;
} }
void SAD_DetectedServer::setProjectName(string p_ServerProjectName) { void SAD_DetectedServer::setProjectName(string p_ServerProjectName) {
@@ -46,94 +45,43 @@ void SAD_DetectedServer::cycleStart() {
i->second->startCycleSAD(); i->second->startCycleSAD();
} }
} }
void SAD_DetectedServer::cycleEnd(I_SAD_Client& sadClient) { void SAD_DetectedServer::cycleEnd(I_SAD_Client &sadClient) {
list<SAD_DetectedServer*> o_LostServers; for (auto &srv : s_DetectedServers) {
list<SAD_DetectedServer*> o_NewServers; SAD_DetectedServer *ptrDetectedServer = srv.second;
list<SAD_DetectedServer*> o_ChangedServers;
SAD_DetectedServer* ptrDetectedServer;
{
for (auto i = s_DetectedServers.begin(); i != s_DetectedServers.end(); i++) {
ptrDetectedServer = i->second;
if (ptrDetectedServer->getFoundAgain() == false) { if (ptrDetectedServer->getFoundAgain() == false) {
o_LostServers.push_back(ptrDetectedServer); sadClient.eventServerLost(*ptrDetectedServer);
ptrDetectedServer->endCycleSAD(); removeDetectedServer(*ptrDetectedServer);
} } else if (ptrDetectedServer->getNew()) {
else if (ptrDetectedServer->getNew()) {
o_NewServers.push_back(ptrDetectedServer);
ptrDetectedServer->setNew(false); ptrDetectedServer->setNew(false);
ptrDetectedServer->endCycleSAD(); sadClient.eventServerDetected(*ptrDetectedServer);
} } else if (ptrDetectedServer->getChanged()) {
else if (ptrDetectedServer->getChanged()) { sadClient.eventServerChanged(*ptrDetectedServer);
o_ChangedServers.push_back(ptrDetectedServer);
ptrDetectedServer->endCycleSAD();
}
else {
ptrDetectedServer->endCycleSAD();
} }
} }
}
//Notify client interface about lost servers
for (auto i = o_LostServers.begin(); i != o_LostServers.end(); i++) {
ptrDetectedServer = *i;
sadClient.eventServerLost(ptrDetectedServer->getID(), ptrDetectedServer->getName(),
ptrDetectedServer->getComputerName(), ptrDetectedServer->getIP(), ptrDetectedServer->getPort(), ptrDetectedServer->getAdditions(),ptrDetectedServer->getProjectName(),
ptrDetectedServer->getClientIP(),
ptrDetectedServer->getIpIsIP4());
}
//Remove lost servers
for (auto i = o_LostServers.begin(); i != o_LostServers.end(); i++) {
ptrDetectedServer = *i;
removeDetectedServer(ptrDetectedServer);
}
o_LostServers.clear();
for (auto i = o_NewServers.begin(); i != o_NewServers.end(); i++) {
ptrDetectedServer = *i;
sadClient.eventServerDetected(ptrDetectedServer->getID(), ptrDetectedServer->getName(),
ptrDetectedServer->getComputerName(), ptrDetectedServer->getIP(), ptrDetectedServer->getPort(), ptrDetectedServer->getAdditions(),ptrDetectedServer->getProjectName(),
ptrDetectedServer->getClientIP(),
ptrDetectedServer->getIpIsIP4());
}
o_NewServers.clear();
for (auto i = o_ChangedServers.begin(); i != o_ChangedServers.end(); i++) {
ptrDetectedServer = *i;
sadClient.eventServerChanged(ptrDetectedServer->getID(), ptrDetectedServer->getName(),
ptrDetectedServer->getComputerName(), ptrDetectedServer->getIP(), ptrDetectedServer->getPort(), ptrDetectedServer->getAdditions(),ptrDetectedServer->getProjectName(),
ptrDetectedServer->getClientIP(),
ptrDetectedServer->getIpIsIP4());
}
o_ChangedServers.clear();
} }
/**
/**
* Used by SAD_Client to add a found SPITServer - don't use this manually * Used by SAD_Client to add a found SPITServer - don't use this manually
* @param p_IsIP4 true = the server is reached via a IP4 address<br>false = the server is reahed via a IP6 address * @param p_IsIP4 true = the server is reached via a IP4 address<br>false = the server is reahed via a IP6 address
* @param p_ServerID the id of the server, every instance of a SPITServer has an own id * @param p_ServerID the id of the server, every instance of a SPITServer has an own id
* @param p_ServerParams the server's parameter * @param p_ServerParams the server's parameter
*/ */
void SAD_DetectedServer::addDetectedServer(bool p_IsIP4, string p_ServerID, string p_ServerParams[]) { void SAD_DetectedServer::addDetectedServer(string p_ServerID, string p_ServerParams[]) {
SAD_DetectedServer* ptrDetectedServer; SAD_DetectedServer *ptrDetectedServer;
{ {
auto i = s_DetectedServers.find(p_ServerID); auto i = s_DetectedServers.find(p_ServerID);
if (i != s_DetectedServers.end()) { if (i != s_DetectedServers.end()) {
ptrDetectedServer = i->second; ptrDetectedServer = i->second;
} } else {
else {
ptrDetectedServer = new SAD_DetectedServer(); ptrDetectedServer = new SAD_DetectedServer();
ptrDetectedServer->setID(p_ServerParams[PARAMINDEX_ID]); ptrDetectedServer->setID(p_ServerParams[PARAMINDEX_ID]);
ptrDetectedServer->setNew(true); ptrDetectedServer->setNew(true);
} }
ptrDetectedServer->setFoundAgain(); ptrDetectedServer->setFoundAgain();
//second prefer IP4 // second prefer IP4
if (p_IsIP4 == true) {
ptrDetectedServer->setIP(p_ServerParams[PARAMINDEX_IP]);
ptrDetectedServer->setIPIsIP4(true);
ptrDetectedServer->setClientIP(p_ServerParams[PARAMINDEX_CLIENTIP]);
}
else if (ptrDetectedServer->getIpIsIP4() == false){
ptrDetectedServer->setIP(p_ServerParams[PARAMINDEX_IP]); ptrDetectedServer->setIP(p_ServerParams[PARAMINDEX_IP]);
ptrDetectedServer->setClientIP(p_ServerParams[PARAMINDEX_CLIENTIP]); ptrDetectedServer->setClientIP(p_ServerParams[PARAMINDEX_CLIENTIP]);
}
ptrDetectedServer->setName(p_ServerParams[PARAMINDEX_NAME]); ptrDetectedServer->setName(p_ServerParams[PARAMINDEX_NAME]);
ptrDetectedServer->setComputerName(p_ServerParams[PARAMINDEX_COMPUTERNAME]); ptrDetectedServer->setComputerName(p_ServerParams[PARAMINDEX_COMPUTERNAME]);
ptrDetectedServer->setPort(p_ServerParams[PARAMINDEX_PORT]); ptrDetectedServer->setPort(p_ServerParams[PARAMINDEX_PORT]);
@@ -142,36 +90,44 @@ void SAD_DetectedServer::addDetectedServer(bool p_IsIP4, string p_ServerID, stri
s_DetectedServers[ptrDetectedServer->getID()] = ptrDetectedServer; s_DetectedServers[ptrDetectedServer->getID()] = ptrDetectedServer;
} }
} }
/** /**
* Used by SAD_Client to remove a SPITServer - don't use this manually * Used by SAD_Client to remove a SPITServer - don't use this manually
* @param p_DetectedServer * @param p_DetectedServer
*/ */
void SAD_DetectedServer::removeDetectedServer(SAD_DetectedServer* p_DetectedServer) { void SAD_DetectedServer::removeDetectedServer(SAD_DetectedServer &server) {
SAD_DetectedServer* o_DetectedServer; auto i = s_DetectedServers.find(server.getID());
{
auto i = s_DetectedServers.find(p_DetectedServer->getID());
if (i != s_DetectedServers.end()) { if (i != s_DetectedServers.end()) {
o_DetectedServer = i->second; SAD_DetectedServer *o_DetectedServer = i->second;
i = s_DetectedServers.erase(i); i = s_DetectedServers.erase(i);
delete o_DetectedServer; delete o_DetectedServer;
} }
} }
}
/** /**
* Used by SAD_Client to clear all found SPITServers - don't use this manually * Used by SAD_Client to clear all found SPITServers - don't use this manually
*/ */
void SAD_DetectedServer::clearDetectedServers() { void SAD_DetectedServer::clearDetectedServers() {
SAD_DetectedServer* ptrDetectedServer;
{
for (auto i = s_DetectedServers.begin(); i != s_DetectedServers.end(); i++) { for (auto i = s_DetectedServers.begin(); i != s_DetectedServers.end(); i++) {
ptrDetectedServer = i->second; SAD_DetectedServer *ptrDetectedServer = i->second;
i = s_DetectedServers.erase(i); i = s_DetectedServers.erase(i);
delete ptrDetectedServer; delete ptrDetectedServer;
if (i == s_DetectedServers.end()) { if (i == s_DetectedServers.end()) {
break; break;
} }
} }
}
const SAD_DetectedServer &SAD_DetectedServer::getRefDetectedServer(string p_ServerID) {
SAD_DetectedServer *ptrDetectedServer = nullptr;
auto i = s_DetectedServers.find(p_ServerID);
if (i != s_DetectedServers.end()) {
ptrDetectedServer = i->second;
} }
if (ptrDetectedServer != NULL) {
return *ptrDetectedServer;
} }
throw new exception();
}
+162 -131
View File
@@ -15,10 +15,10 @@
#include "SPITObject.h" #include "SPITObject.h"
#include "SPITSocket.h" #include "SPITSocket.h"
unordered_map<string, SPITObject*> SPITObject::s_SPITObjects; unordered_map<string, SPITObject *> SPITObject::s_SPITObjects;
unordered_map<string, SPITObject*> SPITObject::s_SPITObjectsRemote; unordered_map<string, SPITObject *> SPITObject::s_SPITObjectsRemote;
SPITObject* SPITObject::getSPITObject(string p_ID) { SPITObject *SPITObject::getSPITObject(string p_ID) {
{ {
auto i = s_SPITObjects.find(p_ID); auto i = s_SPITObjects.find(p_ID);
if (i == s_SPITObjects.end()) { if (i == s_SPITObjects.end()) {
@@ -26,14 +26,14 @@
} }
return i->second; return i->second;
} }
} }
/** /**
* Returns the reference of the SPITObject with ID == p_ID.<br> * Returns the reference of the SPITObject with ID == p_ID.<br>
* Throws an exception if no SPITObject is not found.<br> * Throws an exception if no SPITObject is not found.<br>
* @param p_ID the ID * @param p_ID the ID
* @return reference of the SPITType with ID == p_ID * @return reference of the SPITType with ID == p_ID
*/ */
const SPITObject& SPITObject::getSPITObjectRef(string p_ID) { const SPITObject &SPITObject::getSPITObjectRef(string p_ID) {
{ {
auto i = s_SPITObjects.find(p_ID); auto i = s_SPITObjects.find(p_ID);
if (i == s_SPITObjects.end()) { if (i == s_SPITObjects.end()) {
@@ -41,9 +41,9 @@
} }
return *(i->second); return *(i->second);
} }
} }
SPITObject* SPITObject::getSPITObjectRemote(string p_ID) { SPITObject *SPITObject::getSPITObjectRemote(string p_ID) {
{ {
auto i = s_SPITObjectsRemote.find(p_ID); auto i = s_SPITObjectsRemote.find(p_ID);
if (i == s_SPITObjectsRemote.end()) { if (i == s_SPITObjectsRemote.end()) {
@@ -51,14 +51,14 @@
} }
return i->second; return i->second;
} }
} }
/** /**
* Returns the reference of the remote SPITObject with ID == p_ID.<br> * Returns the reference of the remote SPITObject with ID == p_ID.<br>
* Throws an exception if no SPITObject is not found.<br> * Throws an exception if no SPITObject is not found.<br>
* @param p_ID the ID * @param p_ID the ID
* @return reference of the SPITType with ID == p_ID * @return reference of the SPITType with ID == p_ID
*/ */
const SPITObject& SPITObject::getSPITObjectRemoteRef(string p_ID) { const SPITObject &SPITObject::getSPITObjectRemoteRef(string p_ID) {
{ {
auto i = s_SPITObjectsRemote.find(p_ID); auto i = s_SPITObjectsRemote.find(p_ID);
if (i == s_SPITObjectsRemote.end()) { if (i == s_SPITObjectsRemote.end()) {
@@ -66,27 +66,30 @@
} }
return *(i->second); return *(i->second);
} }
} }
bool SPITObject::addSPITObject(SPITObject* p_ptrSPITObject) { bool SPITObject::addSPITObject(SPITObject *p_ptrSPITObject) {
if (p_ptrSPITObject == NULL) return false; if (p_ptrSPITObject == NULL)
return false;
{ {
s_SPITObjects[p_ptrSPITObject->getID()] = p_ptrSPITObject; s_SPITObjects[p_ptrSPITObject->getID()] = p_ptrSPITObject;
return true; return true;
} }
} }
bool SPITObject::addSPITObjectRemote(SPITObject* p_ptrSPITObject) { bool SPITObject::addSPITObjectRemote(SPITObject *p_ptrSPITObject) {
if (p_ptrSPITObject == NULL) return false; if (p_ptrSPITObject == NULL)
return false;
{ {
s_SPITObjectsRemote[p_ptrSPITObject->getID()] = p_ptrSPITObject; s_SPITObjectsRemote[p_ptrSPITObject->getID()] = p_ptrSPITObject;
return true; return true;
} }
} }
bool SPITObject::removeSPITObject(SPITObject* p_ptrSPITObject) { bool SPITObject::removeSPITObject(SPITObject *p_ptrSPITObject) {
if (p_ptrSPITObject == NULL) return false; if (p_ptrSPITObject == NULL)
return false;
return removeSPITObject(p_ptrSPITObject->getID()); return removeSPITObject(p_ptrSPITObject->getID());
} }
bool SPITObject::removeSPITObject(string p_SPITObjectID) { bool SPITObject::removeSPITObject(string p_SPITObjectID) {
{ {
auto i = s_SPITObjects.find(p_SPITObjectID); auto i = s_SPITObjects.find(p_SPITObjectID);
if (i == s_SPITObjects.end()) { if (i == s_SPITObjects.end()) {
@@ -95,12 +98,13 @@
i = s_SPITObjects.erase(i); i = s_SPITObjects.erase(i);
return true; return true;
} }
} }
bool SPITObject::removeSPITObjectRemote(SPITObject* p_ptrSPITObject) { bool SPITObject::removeSPITObjectRemote(SPITObject *p_ptrSPITObject) {
if (p_ptrSPITObject == NULL) return false; if (p_ptrSPITObject == NULL)
return false;
return removeSPITObjectRemote(p_ptrSPITObject->getID()); return removeSPITObjectRemote(p_ptrSPITObject->getID());
} }
bool SPITObject::removeSPITObjectRemote(string p_ptrSPITObject) { bool SPITObject::removeSPITObjectRemote(string p_ptrSPITObject) {
{ {
auto i = s_SPITObjectsRemote.find(p_ptrSPITObject); auto i = s_SPITObjectsRemote.find(p_ptrSPITObject);
if (i == s_SPITObjectsRemote.end()) { if (i == s_SPITObjectsRemote.end()) {
@@ -109,81 +113,77 @@
i = s_SPITObjectsRemote.erase(i); i = s_SPITObjectsRemote.erase(i);
return true; return true;
} }
} }
int SPITObject::getSPITObjectCount() { int SPITObject::getSPITObjectCount() {
return s_SPITObjects.size(); return s_SPITObjects.size();
} }
int SPITObject::getSPITObjectRemoteCount() { int SPITObject::getSPITObjectRemoteCount() {
return s_SPITObjectsRemote.size(); return s_SPITObjectsRemote.size();
} }
SPITObject* SPITObject::getSPITObject(int p_Index) { SPITObject *SPITObject::getSPITObject(int p_Index) {
SPITObject* ptrSPITObject = NULL; SPITObject *ptrSPITObject = NULL;
{ {
if (p_Index >= 0 && p_Index < s_SPITObjects.size()) { if (p_Index >= 0 && p_Index < s_SPITObjects.size()) {
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjects.begin(), p_Index); unordered_map<string, SPITObject *>::iterator i = next(s_SPITObjects.begin(), p_Index);
ptrSPITObject = i->second; ptrSPITObject = i->second;
return ptrSPITObject; return ptrSPITObject;
} } else {
else {
return NULL; return NULL;
} }
} }
} }
/** /**
* Returns a reference to the SPITObject at position p_Index.<br> * Returns a reference to the SPITObject at position p_Index.<br>
* Throws an exception if p_Index is out of range.<br> * Throws an exception if p_Index is out of range.<br>
* @param p_Index position * @param p_Index position
* @return the reference of the SPITObject at position. * @return the reference of the SPITObject at position.
*/ */
const SPITObject& SPITObject::getSPITObjectRef(int p_Index) { const SPITObject &SPITObject::getSPITObjectRef(int p_Index) {
SPITObject* ptrSPITObject = NULL; SPITObject *ptrSPITObject = NULL;
{ {
if (p_Index >= 0 && p_Index < s_SPITObjects.size()) { if (p_Index >= 0 && p_Index < s_SPITObjects.size()) {
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjects.begin(), p_Index); unordered_map<string, SPITObject *>::iterator i = next(s_SPITObjects.begin(), p_Index);
ptrSPITObject = i->second; ptrSPITObject = i->second;
return *ptrSPITObject; return *ptrSPITObject;
} } else {
else {
throw "SPITObject index out of range"; throw "SPITObject index out of range";
} }
} }
} }
SPITObject* SPITObject::getSPITObjectRemote(int p_Index) { SPITObject *SPITObject::getSPITObjectRemote(int p_Index) {
SPITObject* ptrSPITObject = NULL; SPITObject *ptrSPITObject = NULL;
{ {
if (p_Index >= 0 && p_Index < s_SPITObjectsRemote.size()) { if (p_Index >= 0 && p_Index < s_SPITObjectsRemote.size()) {
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjectsRemote.begin(), p_Index); unordered_map<string, SPITObject *>::iterator i = next(s_SPITObjectsRemote.begin(), p_Index);
ptrSPITObject = i->second; ptrSPITObject = i->second;
return ptrSPITObject; return ptrSPITObject;
} } else {
else {
return NULL; return NULL;
} }
} }
} }
/** /**
* Returns a reference to the remote SPITObject at position p_Index.<br> * Returns a reference to the remote SPITObject at position p_Index.<br>
* Throws an exception if p_Index is out of range.<br> * Throws an exception if p_Index is out of range.<br>
* @param p_Index position * @param p_Index position
* @return the reference of the SPITObject at position. * @return the reference of the SPITObject at position.
*/ */
const SPITObject& SPITObject::getSPITObjectRemoteRef(int p_Index) { const SPITObject &SPITObject::getSPITObjectRemoteRef(int p_Index) {
SPITObject* ptrSPITObject = NULL; SPITObject *ptrSPITObject = NULL;
{ {
if (p_Index >= 0 && p_Index < s_SPITObjectsRemote.size()) { if (p_Index >= 0 && p_Index < s_SPITObjectsRemote.size()) {
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjectsRemote.begin(), p_Index); unordered_map<string, SPITObject *>::iterator i = next(s_SPITObjectsRemote.begin(), p_Index);
ptrSPITObject = i->second; ptrSPITObject = i->second;
return *ptrSPITObject; return *ptrSPITObject;
} } else {
else {
throw "Remote SPITObject index out of range"; throw "Remote SPITObject index out of range";
} }
} }
} }
void SPITObject::clearSPITObjects() { void SPITObject::clearSPITObjects() {
SPITObject* ptrSPITObject; SPITObject *ptrSPITObject;
{ {
for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) { for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) {
ptrSPITObject = i->second; ptrSPITObject = i->second;
@@ -194,9 +194,9 @@
} }
} }
} }
} }
void SPITObject::clearSPITObjectsRemote() { void SPITObject::clearSPITObjectsRemote() {
SPITObject* ptrSPITObject; SPITObject *ptrSPITObject;
{ {
for (auto i = s_SPITObjectsRemote.begin(); i != s_SPITObjectsRemote.end(); i++) { for (auto i = s_SPITObjectsRemote.begin(); i != s_SPITObjectsRemote.end(); i++) {
ptrSPITObject = i->second; ptrSPITObject = i->second;
@@ -207,14 +207,14 @@
} }
} }
} }
} }
/** /**
* clears all unconfirmed SPITObjects not created by this SPIT_Client. * clears all unconfirmed SPITObjects not created by this SPIT_Client.
*/ */
void SPITObject::clearUnconfirmedSPITObjects() { void SPITObject::clearUnconfirmedSPITObjects() {
for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) { for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) {
SPITObject* ptrSPITObject = i->second; SPITObject *ptrSPITObject = i->second;
if (ptrSPITObject->getCreatedByClient() == false && ptrSPITObject->getConfirmed() == false) { if (ptrSPITObject->getCreatedByClient() == false && ptrSPITObject->getConfirmed() == false) {
i = s_SPITObjects.erase(i); i = s_SPITObjects.erase(i);
delete ptrSPITObject; delete ptrSPITObject;
@@ -223,11 +223,11 @@
break; break;
} }
} }
} }
void SPITObject::eventProjectClosed() { void SPITObject::eventProjectClosed() {
for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) { for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) {
SPITObject* ptrSPITObject = i->second; SPITObject *ptrSPITObject = i->second;
if (ptrSPITObject->getCreatedByClient() == true) { if (ptrSPITObject->getCreatedByClient() == true) {
continue; continue;
} }
@@ -237,31 +237,29 @@
break; break;
} }
} }
//Remote // Remote
for (auto i = s_SPITObjectsRemote.begin(); i != s_SPITObjectsRemote.end(); i++) { for (auto i = s_SPITObjectsRemote.begin(); i != s_SPITObjectsRemote.end(); i++) {
SPITObject* ptrSPITObject = i->second; SPITObject *ptrSPITObject = i->second;
i = s_SPITObjectsRemote.erase(i); i = s_SPITObjectsRemote.erase(i);
delete ptrSPITObject; delete ptrSPITObject;
if (i == s_SPITObjectsRemote.end()) { if (i == s_SPITObjectsRemote.end()) {
break; break;
} }
} }
} }
/** /**
* sets confirmed = false for all SPITObjects.<br> * sets confirmed = false for all SPITObjects.<br>
* This should be called when the client has loaded a project.<br> * This should be called when the client has loaded a project.<br>
*/ */
void SPITObject::setConfirmedFalse() { void SPITObject::setConfirmedFalse() {
SPITObject* ptrSPITObject; SPITObject *ptrSPITObject;
{ {
for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) { for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) {
ptrSPITObject = i->second; ptrSPITObject = i->second;
ptrSPITObject->setConfirmed(false); ptrSPITObject->setConfirmed(false);
} }
} }
} }
SPITObject::SPITObject() { SPITObject::SPITObject() {
initMembers(); initMembers();
@@ -285,119 +283,132 @@ void SPITObject::initMembers() {
m_ServerParams = ""; m_ServerParams = "";
m_ServerRemote = false; m_ServerRemote = false;
m_Track = 0; m_Track = 0;
m_ValueFactor = 1000000; //Values are given in ppm -> 1000000 = 1/1; m_ValueFactor = 1000000; // Values are given in ppm -> 1000000 = 1/1;
m_ValueUse = 0x01; m_ValueUse = 0x01;
} }
SPITObject::~SPITObject() { } SPITObject::~SPITObject() {}
bool SPITObject::setMessageOP(SPIT_Message::ReportSPITObject *p_ReportSPITObject) {
bool SPITObject::setMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject) {
bool boolChangeAllowed; bool boolChangeAllowed;
bool boolChanged = false; bool boolChanged = false;
if (m_CreatedByClient == true && m_Fixed == true) { if (m_CreatedByClient == true && m_Fixed == true) {
boolChangeAllowed = false; boolChangeAllowed = false;
} } else {
else {
boolChangeAllowed = true; boolChangeAllowed = true;
} }
//Confirmation should be changable // Confirmation should be changable
if (m_CreatedByClient) { if (m_CreatedByClient) {
//Server reports a client created SPITType -> the type is confirmed // Server reports a client created SPITType -> the type is confirmed
m_Confirmed = true; m_Confirmed = true;
} } else {
else { // type is NOT client created -> the client has to confirm the SPITtype
//type is NOT client created -> the client has to confirm the SPITtype
m_Confirmed = p_ReportSPITObject->getConfirmed(); m_Confirmed = p_ReportSPITObject->getConfirmed();
} }
if (m_Delay != p_ReportSPITObject->getDelay()) { if (m_Delay != p_ReportSPITObject->getDelay()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Delay = p_ReportSPITObject->getDelay(); m_Delay = p_ReportSPITObject->getDelay();
boolChanged = true; boolChanged = true;
} }
if (m_Duration != p_ReportSPITObject->getDuration()) { if (m_Duration != p_ReportSPITObject->getDuration()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Duration = p_ReportSPITObject->getDuration(); m_Duration = p_ReportSPITObject->getDuration();
boolChanged = true; boolChanged = true;
} }
if (m_Fixed != p_ReportSPITObject->getFixed()) { if (m_Fixed != p_ReportSPITObject->getFixed()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Fixed = p_ReportSPITObject->getFixed(); m_Fixed = p_ReportSPITObject->getFixed();
boolChanged = true; boolChanged = true;
} }
if (m_FrameFadeInLength != p_ReportSPITObject->getFrameFadeInLength()) { if (m_FrameFadeInLength != p_ReportSPITObject->getFrameFadeInLength()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_FrameFadeInLength = p_ReportSPITObject->getFrameFadeInLength(); m_FrameFadeInLength = p_ReportSPITObject->getFrameFadeInLength();
boolChanged= true; boolChanged = true;
} }
if (m_FrameFadeOutLength != p_ReportSPITObject->getFrameFadeOutLength()) { if (m_FrameFadeOutLength != p_ReportSPITObject->getFrameFadeOutLength()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_FrameFadeOutLength = p_ReportSPITObject->getFrameFadeOutLength(); m_FrameFadeOutLength = p_ReportSPITObject->getFrameFadeOutLength();
boolChanged = true; boolChanged = true;
} }
if (m_FrameLength != p_ReportSPITObject->getFrameLength()) { if (m_FrameLength != p_ReportSPITObject->getFrameLength()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_FrameLength = p_ReportSPITObject->getFrameLength(); m_FrameLength = p_ReportSPITObject->getFrameLength();
boolChanged = true; boolChanged = true;
} }
if (m_FrameStart != p_ReportSPITObject->getFrameStart()) { if (m_FrameStart != p_ReportSPITObject->getFrameStart()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_FrameStart = p_ReportSPITObject->getFrameStart(); m_FrameStart = p_ReportSPITObject->getFrameStart();
boolChanged = true; boolChanged = true;
} }
if (m_Remark != p_ReportSPITObject->getRemark()) { if (m_Remark != p_ReportSPITObject->getRemark()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Remark = p_ReportSPITObject->getRemark(); m_Remark = p_ReportSPITObject->getRemark();
boolChanged = true; boolChanged = true;
} }
if (m_ID != p_ReportSPITObject->getID()) { if (m_ID != p_ReportSPITObject->getID()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ID = p_ReportSPITObject->getID(); m_ID = p_ReportSPITObject->getID();
boolChanged = true; boolChanged = true;
} }
if (m_Name != p_ReportSPITObject->getName()) { if (m_Name != p_ReportSPITObject->getName()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Name = p_ReportSPITObject->getName(); m_Name = p_ReportSPITObject->getName();
boolChanged = true; boolChanged = true;
} }
if (m_SPITTypeID != p_ReportSPITObject->getSPITTypeID()) { if (m_SPITTypeID != p_ReportSPITObject->getSPITTypeID()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_SPITTypeID = p_ReportSPITObject->getSPITTypeID(); m_SPITTypeID = p_ReportSPITObject->getSPITTypeID();
boolChanged = true; boolChanged = true;
} }
if (m_ServerParams != p_ReportSPITObject->getServerParams()) { if (m_ServerParams != p_ReportSPITObject->getServerParams()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ServerParams = p_ReportSPITObject->getServerParams(); m_ServerParams = p_ReportSPITObject->getServerParams();
boolChanged = true; boolChanged = true;
} }
if (m_ServerRemote != p_ReportSPITObject->getServerRemote()) { if (m_ServerRemote != p_ReportSPITObject->getServerRemote()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ServerRemote = p_ReportSPITObject->getServerRemote(); m_ServerRemote = p_ReportSPITObject->getServerRemote();
boolChanged = true; boolChanged = true;
} }
if (m_Track != p_ReportSPITObject->getTrack()) { if (m_Track != p_ReportSPITObject->getTrack()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Track = p_ReportSPITObject->getTrack(); m_Track = p_ReportSPITObject->getTrack();
boolChanged = true; boolChanged = true;
} }
if (m_ValueFactor != p_ReportSPITObject->getValueFactor()) { if (m_ValueFactor != p_ReportSPITObject->getValueFactor()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ValueFactor = p_ReportSPITObject->getValueFactor(); m_ValueFactor = p_ReportSPITObject->getValueFactor();
boolChanged = true; boolChanged = true;
} }
if (m_ValueUse != p_ReportSPITObject->getValueUse()) { if (m_ValueUse != p_ReportSPITObject->getValueUse()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ValueUse = p_ReportSPITObject->getValueUse(); m_ValueUse = p_ReportSPITObject->getValueUse();
boolChanged = true; boolChanged = true;
} }
return boolChanged; return boolChanged;
} }
void SPITObject::fillMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject) { void SPITObject::fillMessageOP(SPIT_Message::ReportSPITObject *p_ReportSPITObject) {
p_ReportSPITObject->setActionAssigned(getActionAssigned()); //Action can be assigned to type or to this object p_ReportSPITObject->setActionAssigned(getActionAssigned()); // Action can be assigned to type or to this object
p_ReportSPITObject->setConfirmed(m_Confirmed); p_ReportSPITObject->setConfirmed(m_Confirmed);
p_ReportSPITObject->setDelay(m_Delay); p_ReportSPITObject->setDelay(m_Delay);
p_ReportSPITObject->setDuration(m_Duration); p_ReportSPITObject->setDuration(m_Duration);
@@ -416,7 +427,7 @@ void SPITObject::fillMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObjec
p_ReportSPITObject->setValueFactor(m_ValueFactor); p_ReportSPITObject->setValueFactor(m_ValueFactor);
p_ReportSPITObject->setValueUse(m_ValueUse); p_ReportSPITObject->setValueUse(m_ValueUse);
} }
void SPITObject::fillMessageOP(SPIT_Message::RemoveSPITObject* p_RemoveSPITObject) { void SPITObject::fillMessageOP(SPIT_Message::RemoveSPITObject *p_RemoveSPITObject) {
p_RemoveSPITObject->setID(m_ID); p_RemoveSPITObject->setID(m_ID);
} }
@@ -433,121 +444,141 @@ void SPITObject::setCreatedByClient(bool p_CreatedByClient) {
* @return if m_Confirmed has changed * @return if m_Confirmed has changed
*/ */
bool SPITObject::setConfirmed(bool p_Confirmed) { bool SPITObject::setConfirmed(bool p_Confirmed) {
if (m_Confirmed == p_Confirmed) return false; if (m_Confirmed == p_Confirmed)
return false;
m_Confirmed = p_Confirmed; m_Confirmed = p_Confirmed;
return true; return true;
} }
bool SPITObject::setName(string p_Name) { bool SPITObject::setName(string p_Name) {
if (m_Name == p_Name) return false; if (m_Name == p_Name)
return false;
m_Name = p_Name; m_Name = p_Name;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setRemark(string p_Remark) { bool SPITObject::setRemark(string p_Remark) {
if (m_Remark == p_Remark) return false; if (m_Remark == p_Remark)
return false;
m_Remark = p_Remark; m_Remark = p_Remark;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setServerParams(string p_ServerParams) { bool SPITObject::setServerParams(string p_ServerParams) {
if (m_ServerParams == p_ServerParams) return false; if (m_ServerParams == p_ServerParams)
return false;
m_ServerParams = p_ServerParams; m_ServerParams = p_ServerParams;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setSPITTypeID(string p_SPITTypeID) { bool SPITObject::setSPITTypeID(string p_SPITTypeID) {
if (m_SPITTypeID == p_SPITTypeID) return false; if (m_SPITTypeID == p_SPITTypeID)
return false;
m_SPITTypeID = p_SPITTypeID; m_SPITTypeID = p_SPITTypeID;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setServerRemote(bool p_BelongstoServer) { bool SPITObject::setServerRemote(bool p_BelongstoServer) {
if (m_ServerRemote == p_BelongstoServer) return false; if (m_ServerRemote == p_BelongstoServer)
return false;
m_ServerRemote = p_BelongstoServer; m_ServerRemote = p_BelongstoServer;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
/** /**
* This is a virtual construct - ActionAssignedType is not implemented in the SPITProtocol.<br> * This is a virtual construct - ActionAssignedType is not implemented in the SPITProtocol.<br>
* This is used when an action is associated with a SPITType. <br> * This is used when an action is associated with a SPITType. <br>
* Then this action is done for every SPITObject with the SPITType. * Then this action is done for every SPITObject with the SPITType.
* @return true = an action is assigned for the SPITType. * @return true = an action is assigned for the SPITType.
*/ */
bool SPITObject::setActionAssignedType(bool p_ActionAssigned) { bool SPITObject::setActionAssignedType(bool p_ActionAssigned) {
if (m_ActionAssignedType == p_ActionAssigned) return false; if (m_ActionAssignedType == p_ActionAssigned)
return false;
bool boolOldActionAssigend; bool boolOldActionAssigend;
boolOldActionAssigend = getActionAssigned(); boolOldActionAssigend = getActionAssigned();
m_ActionAssignedType = p_ActionAssigned; m_ActionAssignedType = p_ActionAssigned;
if (getActionAssigned() == boolOldActionAssigend) return false; if (getActionAssigned() == boolOldActionAssigend)
return false;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setActionAssigned(bool p_ActionAssigned) { bool SPITObject::setActionAssigned(bool p_ActionAssigned) {
if (m_ActionAssigned == p_ActionAssigned) return false; if (m_ActionAssigned == p_ActionAssigned)
return false;
bool boolOldActionAssigend; bool boolOldActionAssigend;
boolOldActionAssigend = getActionAssigned(); boolOldActionAssigend = getActionAssigned();
m_ActionAssigned = p_ActionAssigned; m_ActionAssigned = p_ActionAssigned;
if (getActionAssigned() == boolOldActionAssigend) return false; if (getActionAssigned() == boolOldActionAssigend)
return false;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setFixed(bool p_Fixed) { bool SPITObject::setFixed(bool p_Fixed) {
if (m_Fixed == p_Fixed) return false; if (m_Fixed == p_Fixed)
return false;
m_Fixed = p_Fixed; m_Fixed = p_Fixed;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setFrameStart(long long p_FrameStart) { bool SPITObject::setFrameStart(long long p_FrameStart) {
if (m_FrameStart == p_FrameStart) return false; if (m_FrameStart == p_FrameStart)
return false;
m_FrameStart = p_FrameStart; m_FrameStart = p_FrameStart;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setFrameLength(long long p_FrameLength) { bool SPITObject::setFrameLength(long long p_FrameLength) {
if (m_FrameLength == p_FrameLength) return false; if (m_FrameLength == p_FrameLength)
return false;
m_FrameLength = p_FrameLength; m_FrameLength = p_FrameLength;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setFrameFadeInLength(long long p_FrameFadeInLength) { bool SPITObject::setFrameFadeInLength(long long p_FrameFadeInLength) {
if (m_FrameFadeInLength == p_FrameFadeInLength) return false; if (m_FrameFadeInLength == p_FrameFadeInLength)
return false;
m_FrameFadeInLength = p_FrameFadeInLength; m_FrameFadeInLength = p_FrameFadeInLength;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setFrameFadeOutLength(long long p_FrameFadeOutLength) { bool SPITObject::setFrameFadeOutLength(long long p_FrameFadeOutLength) {
if (m_FrameFadeOutLength == p_FrameFadeOutLength) return false; if (m_FrameFadeOutLength == p_FrameFadeOutLength)
return false;
m_FrameFadeOutLength = p_FrameFadeOutLength; m_FrameFadeOutLength = p_FrameFadeOutLength;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setValueUse(char p_ValueUse) { bool SPITObject::setValueUse(char p_ValueUse) {
if (m_ValueUse == p_ValueUse) return false; if (m_ValueUse == p_ValueUse)
return false;
m_ValueUse = p_ValueUse; m_ValueUse = p_ValueUse;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setValueFactor(int p_ValueFactor) { bool SPITObject::setValueFactor(int p_ValueFactor) {
if (m_ValueFactor == p_ValueFactor) return false; if (m_ValueFactor == p_ValueFactor)
return false;
m_ValueFactor = p_ValueFactor; m_ValueFactor = p_ValueFactor;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setTrack(int p_Track) { bool SPITObject::setTrack(int p_Track) {
if (m_Track == p_Track) return false; if (m_Track == p_Track)
return false;
m_Track = p_Track; m_Track = p_Track;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setDelay(long long p_Delay) { bool SPITObject::setDelay(long long p_Delay) {
if (m_Delay == p_Delay) return false; if (m_Delay == p_Delay)
return false;
m_Delay = p_Delay; m_Delay = p_Delay;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITObject::setDuration(long long p_Duration) { bool SPITObject::setDuration(long long p_Duration) {
if (m_Duration == p_Duration) return false; if (m_Duration == p_Duration)
return false;
m_Duration = p_Duration; m_Duration = p_Duration;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
+16 -32
View File
@@ -15,29 +15,30 @@
#include "SPITPlayer.h" #include "SPITPlayer.h"
#include <vector> #include <vector>
unordered_map<string, SPITPlayer*> SPITPlayer::s_SPITPlayers; unordered_map<string, SPITPlayer *> SPITPlayer::s_SPITPlayers;
SPITPlayer* SPITPlayer::getSPITPlayer(string p_PlayerID) { SPITPlayer *SPITPlayer::getSPITPlayer(string p_PlayerID) {
{ {
auto i = s_SPITPlayers.find(p_PlayerID); auto i = s_SPITPlayers.find(p_PlayerID);
if (i == s_SPITPlayers.end()) { if (i == s_SPITPlayers.end()) {
s_SPITPlayers[p_PlayerID] = new SPITPlayer(p_PlayerID); s_SPITPlayers[p_PlayerID] = new SPITPlayer(p_PlayerID);
} }
i = s_SPITPlayers.find(p_PlayerID); i = s_SPITPlayers.find(p_PlayerID);
if (i == s_SPITPlayers.end()) return NULL; if (i == s_SPITPlayers.end())
return NULL;
return i->second; return i->second;
} }
} }
void SPITPlayer::clearPlayers() { void SPITPlayer::clearPlayers() {
; ;
vector<SPITPlayer*> o_SPITPlayers; vector<SPITPlayer *> o_SPITPlayers;
for (auto i = s_SPITPlayers.begin(); i != s_SPITPlayers.end(); i++) { for (auto i = s_SPITPlayers.begin(); i != s_SPITPlayers.end(); i++) {
SPITPlayer* ptrSPITPlayer = i->second; SPITPlayer *ptrSPITPlayer = i->second;
o_SPITPlayers.push_back(ptrSPITPlayer); o_SPITPlayers.push_back(ptrSPITPlayer);
} }
for (auto i = o_SPITPlayers.begin(); i != o_SPITPlayers.end(); i++) { for (auto i = o_SPITPlayers.begin(); i != o_SPITPlayers.end(); i++) {
SPITPlayer* ptrSPITPlayer = *i; SPITPlayer *ptrSPITPlayer = *i;
delete ptrSPITPlayer; delete ptrSPITPlayer;
} }
o_SPITPlayers.clear(); o_SPITPlayers.clear();
@@ -49,7 +50,7 @@ SPITPlayer::SPITPlayer(string p_PlayerID) {
} }
SPITPlayer::~SPITPlayer() { SPITPlayer::~SPITPlayer() {
PlaySPITType* ptrPlaySPITType; PlaySPITType *ptrPlaySPITType;
for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) { for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) {
ptrPlaySPITType = i->second; ptrPlaySPITType = i->second;
i = m_PlaySPITTypes.erase(i); i = m_PlaySPITTypes.erase(i);
@@ -58,23 +59,9 @@ SPITPlayer::~SPITPlayer() {
break; break;
} }
} }
} }
void SPITPlayer::setIsRunning(bool p_IsRunning) { unordered_map<string, SPITPlayer::PlaySPITType *> *SPITPlayer::getPlaySPITTypes() {
m_IsRunning = p_IsRunning;
}
void SPITPlayer::setName(string p_Name) {
m_Name = p_Name;
}
void SPITPlayer::setType(char p_Type) {
m_Type = p_Type;
}
void SPITPlayer::setTime(long long p_Frames) {
m_TimeFrames = p_Frames;
}
unordered_map<string, SPITPlayer::PlaySPITType*>* SPITPlayer::getPlaySPITTypes() {
return &m_PlaySPITTypes; return &m_PlaySPITTypes;
} }
/** /**
@@ -83,8 +70,8 @@ unordered_map<string, SPITPlayer::PlaySPITType*>* SPITPlayer::getPlaySPITTypes()
* @return true = new PlayObject added<br> * @return true = new PlayObject added<br>
* false = PlayObject exists * false = PlayObject exists
*/ */
SPITPlayer::PlaySPITType* SPITPlayer::addSPITType_Playing (string p_SPITTypeID) { SPITPlayer::PlaySPITType *SPITPlayer::addSPITType_Playing(string p_SPITTypeID) {
PlaySPITType* ptrPlaySPITType; PlaySPITType *ptrPlaySPITType;
auto i = m_PlaySPITTypes.find(p_SPITTypeID); auto i = m_PlaySPITTypes.find(p_SPITTypeID);
if (i == m_PlaySPITTypes.end()) { if (i == m_PlaySPITTypes.end()) {
@@ -92,17 +79,15 @@ SPITPlayer::PlaySPITType* SPITPlayer::addSPITType_Playing (string p_SPITTypeID)
ptrPlaySPITType->setIsPlayed(true); ptrPlaySPITType->setIsPlayed(true);
ptrPlaySPITType->setIsNew(true); ptrPlaySPITType->setIsNew(true);
m_PlaySPITTypes[p_SPITTypeID] = ptrPlaySPITType; m_PlaySPITTypes[p_SPITTypeID] = ptrPlaySPITType;
} } else {
else {
ptrPlaySPITType = i->second; ptrPlaySPITType = i->second;
ptrPlaySPITType->setIsPlayed(true); ptrPlaySPITType->setIsPlayed(true);
} }
return ptrPlaySPITType; return ptrPlaySPITType;
} }
void SPITPlayer::startPlaySequence() { void SPITPlayer::startPlaySequence() {
PlaySPITType* ptrPlaySPITType; PlaySPITType *ptrPlaySPITType;
for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) { for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) {
ptrPlaySPITType = i->second; ptrPlaySPITType = i->second;
ptrPlaySPITType->startPlaySequence(); ptrPlaySPITType->startPlaySequence();
@@ -110,7 +95,7 @@ void SPITPlayer::startPlaySequence() {
} }
void SPITPlayer::endPlaySequence() { void SPITPlayer::endPlaySequence() {
PlaySPITType* ptrPlaySPITType; PlaySPITType *ptrPlaySPITType;
for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) { for (auto i = m_PlaySPITTypes.begin(); i != m_PlaySPITTypes.end(); i++) {
ptrPlaySPITType = i->second; ptrPlaySPITType = i->second;
@@ -122,19 +107,18 @@ void SPITPlayer::endPlaySequence() {
} }
} }
} }
} }
SPITPlayer::PlaySPITType::PlaySPITType() { SPITPlayer::PlaySPITType::PlaySPITType() {
} }
SPITPlayer::PlaySPITType::PlaySPITType(SPITPlayer* p_SPITPlayer, string p_SPITTypeID) { SPITPlayer::PlaySPITType::PlaySPITType(SPITPlayer *p_SPITPlayer, string p_SPITTypeID) {
m_SPITTypeID = p_SPITTypeID; m_SPITTypeID = p_SPITTypeID;
m_PlayerID = p_SPITPlayer->getID(); m_PlayerID = p_SPITPlayer->getID();
m_PlayerName = p_SPITPlayer->getName(); m_PlayerName = p_SPITPlayer->getName();
startPlaySequence(); startPlaySequence();
m_IsNew = true; m_IsNew = true;
} }
SPITPlayer::PlaySPITType::PlaySPITType(const PlaySPITType& orig) { SPITPlayer::PlaySPITType::PlaySPITType(const PlaySPITType &orig) {
m_SPITTypeID = orig.getSPITTypeID(); m_SPITTypeID = orig.getSPITTypeID();
m_IsPlayed = orig.getIsPlayed(); m_IsPlayed = orig.getIsPlayed();
m_IsNew = orig.getIsNew(); m_IsNew = orig.getIsNew();
+7 -7
View File
@@ -15,11 +15,11 @@
#include "SPITSocket.h" #include "SPITSocket.h"
#include "Task.hpp" #include "Task.hpp"
#include "esp/uuid.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_netif.h" #include "esp_netif.h"
#include "esp/uuid.h"
#include <unistd.h>
#include <string> #include <string>
#include <unistd.h>
using namespace std; using namespace std;
/** /**
@@ -201,7 +201,7 @@ int SPITSocket::sendMessageTo(int p_InetFamily, string p_ServerIP, string p_Serv
} }
return 0; return 0;
} }
/** /**
* Call this for receiving a message * Call this for receiving a message
* This will block until a message is received or the underlying socket is closed * This will block until a message is received or the underlying socket is closed
* @param p_InetFamily either AF_INET or AF_INET6<br> * @param p_InetFamily either AF_INET or AF_INET6<br>
@@ -226,7 +226,7 @@ int SPITSocket::receiveMessage(int p_InetFamily, char *p_Buffer, int p_BufferLen
} }
intSocklen = sizeof(o_IP4SocketAddress); intSocklen = sizeof(o_IP4SocketAddress);
memset(&o_IP4SocketAddress, 0, intSocklen); memset(&o_IP4SocketAddress, 0, intSocklen);
intResult = recvfrom(m_UDPSocketIP4, (void *)p_Buffer, p_BufferLength, 0 , (sockaddr *)&o_IP4SocketAddress, (socklen_t *)&intSocklen); intResult = recvfrom(m_UDPSocketIP4, (void *)p_Buffer, p_BufferLength, 0, (sockaddr *)&o_IP4SocketAddress, (socklen_t *)&intSocklen);
if (intResult >= 0) { if (intResult >= 0) {
if (p_ServerIP != NULL) { if (p_ServerIP != NULL) {
char bufferIP4[INET_ADDRSTRLEN]; char bufferIP4[INET_ADDRSTRLEN];
@@ -239,7 +239,6 @@ int SPITSocket::receiveMessage(int p_InetFamily, char *p_Buffer, int p_BufferLen
return intResult; return intResult;
} }
SPITSocket::IPAddress SPITSocket::getAdaptersInfo() { SPITSocket::IPAddress SPITSocket::getAdaptersInfo() {
// iterate over active interfaces, and print out IPs // iterate over active interfaces, and print out IPs
esp_netif_t *netif = NULL; esp_netif_t *netif = NULL;
@@ -279,10 +278,11 @@ string createGUID() {
/** The name of the client's host computer*/ /** The name of the client's host computer*/
string getClientHostName() { string getClientHostName() {
string stringHostName = ""; string stringHostName = "";
const char * hostname; const char *hostname;
esp_netif_get_hostname(esp_netif_get_default_netif(), &hostname); esp_netif_get_hostname(esp_netif_get_default_netif(), &hostname);
if (hostname != nullptr) { if (hostname != nullptr) {
stringHostName = hostname; stringHostName = hostname;
} }
return stringHostName;; return stringHostName;
;
} }
+136 -128
View File
@@ -12,16 +12,15 @@
* Created on 8. April 2019, 08:40 * Created on 8. April 2019, 08:40
*/ */
#include "SPITType.h" #include "SPITType.h"
#include "esp_log.h" #include "esp_log.h"
static const char * TAG = "SPIT"; static const char *TAG = "SPIT";
unordered_map<string, SPITType*> SPITType::s_SPITTypes; unordered_map<string, SPITType *> SPITType::s_SPITTypes;
unordered_map<string, SPITType*> SPITType::s_SPITTypesRemote; unordered_map<string, SPITType *> SPITType::s_SPITTypesRemote;
SPITType* SPITType::getSPITType(string p_ID) { SPITType *SPITType::getSPITType(string p_ID) {
{ {
auto i = s_SPITTypes.find(p_ID); auto i = s_SPITTypes.find(p_ID);
if (i == s_SPITTypes.end()) { if (i == s_SPITTypes.end()) {
@@ -29,14 +28,14 @@ static const char * TAG = "SPIT";
} }
return i->second; return i->second;
} }
} }
/** /**
* Returns the reference of the SPITType with ID == p_ID.<br> * Returns the reference of the SPITType with ID == p_ID.<br>
* Throws an exception if no SPITType is not found.<br> * Throws an exception if no SPITType is not found.<br>
* @param p_ID the ID * @param p_ID the ID
* @return reference of the SPITType with ID == p_ID * @return reference of the SPITType with ID == p_ID
*/ */
const SPITType& SPITType::getSPITTypeRef(string p_ID) { const SPITType &SPITType::getSPITTypeRef(string p_ID) {
{ {
auto i = s_SPITTypes.find(p_ID); auto i = s_SPITTypes.find(p_ID);
if (i == s_SPITTypes.end()) { if (i == s_SPITTypes.end()) {
@@ -44,9 +43,9 @@ static const char * TAG = "SPIT";
} }
return *(i->second); return *(i->second);
} }
} }
SPITType* SPITType::getSPITTypeRemote(string p_ID) { SPITType *SPITType::getSPITTypeRemote(string p_ID) {
{ {
auto i = s_SPITTypesRemote.find(p_ID); auto i = s_SPITTypesRemote.find(p_ID);
if (i == s_SPITTypesRemote.end()) { if (i == s_SPITTypesRemote.end()) {
@@ -54,14 +53,14 @@ static const char * TAG = "SPIT";
} }
return i->second; return i->second;
} }
} }
/** /**
* Returns the reference of the remote SPITType with ID == p_ID.<br> * Returns the reference of the remote SPITType with ID == p_ID.<br>
* Throws an exception if no SPITType is not found.<br> * Throws an exception if no SPITType is not found.<br>
* @param p_ID the ID * @param p_ID the ID
* @return reference of the SPITType with ID == p_ID * @return reference of the SPITType with ID == p_ID
*/ */
const SPITType& SPITType::getSPITTypeRemoteRef(string p_ID) { const SPITType &SPITType::getSPITTypeRemoteRef(string p_ID) {
{ {
auto i = s_SPITTypesRemote.find(p_ID); auto i = s_SPITTypesRemote.find(p_ID);
if (i == s_SPITTypesRemote.end()) { if (i == s_SPITTypesRemote.end()) {
@@ -69,24 +68,27 @@ static const char * TAG = "SPIT";
} }
return *(i->second); return *(i->second);
} }
} }
bool SPITType::addSPITType(SPITType* p_ptrSpitType) { bool SPITType::addSPITType(SPITType *p_ptrSpitType) {
if (p_ptrSpitType == NULL) return false; if (p_ptrSpitType == NULL)
return false;
{ {
s_SPITTypes[p_ptrSpitType->getID()] = p_ptrSpitType; s_SPITTypes[p_ptrSpitType->getID()] = p_ptrSpitType;
return true; return true;
} }
} }
bool SPITType::addSPITTypeRemote(SPITType* p_ptrSpitType) { bool SPITType::addSPITTypeRemote(SPITType *p_ptrSpitType) {
if (p_ptrSpitType == NULL) return false; if (p_ptrSpitType == NULL)
return false;
{ {
s_SPITTypesRemote[p_ptrSpitType->getID()] = p_ptrSpitType; s_SPITTypesRemote[p_ptrSpitType->getID()] = p_ptrSpitType;
return true; return true;
} }
} }
bool SPITType::removeSPITType(SPITType* p_ptrSpitType) { bool SPITType::removeSPITType(SPITType *p_ptrSpitType) {
if (p_ptrSpitType == NULL) return false; if (p_ptrSpitType == NULL)
return false;
{ {
auto i = s_SPITTypes.find(p_ptrSpitType->getID()); auto i = s_SPITTypes.find(p_ptrSpitType->getID());
if (i == s_SPITTypes.end()) { if (i == s_SPITTypes.end()) {
@@ -95,9 +97,10 @@ static const char * TAG = "SPIT";
i = s_SPITTypes.erase(i); i = s_SPITTypes.erase(i);
return true; return true;
} }
} }
bool SPITType::removeSPITTypeRemote(SPITType* p_ptrSpitType) { bool SPITType::removeSPITTypeRemote(SPITType *p_ptrSpitType) {
if (p_ptrSpitType == NULL) return false; if (p_ptrSpitType == NULL)
return false;
{ {
auto i = s_SPITTypesRemote.find(p_ptrSpitType->getID()); auto i = s_SPITTypesRemote.find(p_ptrSpitType->getID());
if (i == s_SPITTypesRemote.end()) { if (i == s_SPITTypesRemote.end()) {
@@ -106,75 +109,73 @@ static const char * TAG = "SPIT";
i = s_SPITTypesRemote.erase(i); i = s_SPITTypesRemote.erase(i);
return true; return true;
} }
} }
int SPITType::getSPITTypeCount() { int SPITType::getSPITTypeCount() {
return s_SPITTypes.size(); return s_SPITTypes.size();
} }
int SPITType::getSPITTypeRemoteCount() { int SPITType::getSPITTypeRemoteCount() {
return s_SPITTypesRemote.size(); return s_SPITTypesRemote.size();
} }
SPITType* SPITType::getSPITType(int p_Index) { SPITType *SPITType::getSPITType(int p_Index) {
SPITType* ptrSPITType = NULL; SPITType *ptrSPITType = NULL;
{ {
if (p_Index < s_SPITTypes.size()) { if (p_Index < s_SPITTypes.size()) {
unordered_map<string, SPITType*>::iterator i = next(s_SPITTypes.begin(), p_Index); unordered_map<string, SPITType *>::iterator i = next(s_SPITTypes.begin(), p_Index);
ptrSPITType = i->second; ptrSPITType = i->second;
} }
return ptrSPITType; return ptrSPITType;
} }
} }
/** /**
* Returns a reference to the SPITType at position p_Index.<br> * Returns a reference to the SPITType at position p_Index.<br>
* Throws an exception if p_Index is out of range.<br> * Throws an exception if p_Index is out of range.<br>
* @param p_Index position * @param p_Index position
* @return the reference of the SPITType at position. * @return the reference of the SPITType at position.
*/ */
const SPITType& SPITType::getSPITTypeRef(int p_Index) { const SPITType &SPITType::getSPITTypeRef(int p_Index) {
SPITType* ptrSPITType = NULL; SPITType *ptrSPITType = NULL;
{ {
if (p_Index >= 0 && p_Index < s_SPITTypes.size()) { if (p_Index >= 0 && p_Index < s_SPITTypes.size()) {
unordered_map<string, SPITType*>::iterator i = next(s_SPITTypes.begin(), p_Index); unordered_map<string, SPITType *>::iterator i = next(s_SPITTypes.begin(), p_Index);
ptrSPITType = i->second; ptrSPITType = i->second;
return *ptrSPITType; return *ptrSPITType;
} } else {
else {
throw "SPITType index out of range"; throw "SPITType index out of range";
} }
} }
} }
SPITType* SPITType::getSPITTypeRemote(int p_Index) { SPITType *SPITType::getSPITTypeRemote(int p_Index) {
SPITType* ptrSPITType = NULL; SPITType *ptrSPITType = NULL;
{ {
if (p_Index < s_SPITTypesRemote.size()) { if (p_Index < s_SPITTypesRemote.size()) {
unordered_map<string, SPITType*>::iterator i = next(s_SPITTypesRemote.begin(), p_Index); unordered_map<string, SPITType *>::iterator i = next(s_SPITTypesRemote.begin(), p_Index);
ptrSPITType = i->second; ptrSPITType = i->second;
} }
return ptrSPITType; return ptrSPITType;
} }
} }
/** /**
* Returns a reference to the remote SPITType at position p_Index.<br> * Returns a reference to the remote SPITType at position p_Index.<br>
* Throws an exception if p_Index is out of range.<br> * Throws an exception if p_Index is out of range.<br>
* @param p_Index position * @param p_Index position
* @return the reference of the SPITType at position. * @return the reference of the SPITType at position.
*/ */
const SPITType& SPITType::getSPITTypeRemoteRef(int p_Index) { const SPITType &SPITType::getSPITTypeRemoteRef(int p_Index) {
SPITType* ptrSPITType = NULL; SPITType *ptrSPITType = NULL;
{ {
if (p_Index >= 0 && p_Index < s_SPITTypesRemote.size()) { if (p_Index >= 0 && p_Index < s_SPITTypesRemote.size()) {
unordered_map<string, SPITType*>::iterator i = next(s_SPITTypesRemote.begin(), p_Index); unordered_map<string, SPITType *>::iterator i = next(s_SPITTypesRemote.begin(), p_Index);
ptrSPITType = i->second; ptrSPITType = i->second;
return *ptrSPITType; return *ptrSPITType;
} } else {
else {
throw "Remote SPITType index out of range"; throw "Remote SPITType index out of range";
} }
} }
} }
void SPITType::clearSPITTypes() { void SPITType::clearSPITTypes() {
SPITType* ptrSPITType; SPITType *ptrSPITType;
{ {
for (auto i = s_SPITTypes.begin(); i != s_SPITTypes.end(); i++) { for (auto i = s_SPITTypes.begin(); i != s_SPITTypes.end(); i++) {
ptrSPITType = i->second; ptrSPITType = i->second;
@@ -185,9 +186,9 @@ static const char * TAG = "SPIT";
} }
} }
} }
} }
void SPITType::clearSPITTypesRemote() { void SPITType::clearSPITTypesRemote() {
SPITType* ptrSPITType; SPITType *ptrSPITType;
{ {
for (auto i = s_SPITTypesRemote.begin(); i != s_SPITTypesRemote.end(); i++) { for (auto i = s_SPITTypesRemote.begin(); i != s_SPITTypesRemote.end(); i++) {
ptrSPITType = i->second; ptrSPITType = i->second;
@@ -198,10 +199,10 @@ static const char * TAG = "SPIT";
} }
} }
} }
} }
void SPITType::eventProjectClosed() { void SPITType::eventProjectClosed() {
SPITType* ptrSPITType; SPITType *ptrSPITType;
for (auto i = s_SPITTypes.begin(); i != s_SPITTypes.end(); i++) { for (auto i = s_SPITTypes.begin(); i != s_SPITTypes.end(); i++) {
ptrSPITType = i->second; ptrSPITType = i->second;
if (ptrSPITType->getCreatedByClient() == true) { if (ptrSPITType->getCreatedByClient() == true) {
@@ -213,7 +214,7 @@ static const char * TAG = "SPIT";
break; break;
} }
} }
//Remote // Remote
for (auto i = s_SPITTypesRemote.begin(); i != s_SPITTypesRemote.end(); i++) { for (auto i = s_SPITTypesRemote.begin(); i != s_SPITTypesRemote.end(); i++) {
ptrSPITType = i->second; ptrSPITType = i->second;
i = s_SPITTypesRemote.erase(i); i = s_SPITTypesRemote.erase(i);
@@ -222,26 +223,21 @@ static const char * TAG = "SPIT";
break; break;
} }
} }
} }
/** /**
* Sets confirmed = false for all SPITTypes.<br> * Sets confirmed = false for all SPITTypes.<br>
* This should be called when the client has loaded a project.<br> * This should be called when the client has loaded a project.<br>
*/ */
void SPITType::setConfirmedFalse() { void SPITType::setConfirmedFalse() {
SPITType* ptrSPITType; SPITType *ptrSPITType;
{ {
for (auto i = s_SPITTypes.begin(); i != s_SPITTypes.end(); i++) { for (auto i = s_SPITTypes.begin(); i != s_SPITTypes.end(); i++) {
ptrSPITType = i->second; ptrSPITType = i->second;
ptrSPITType->setConfirmed(false); ptrSPITType->setConfirmed(false);
} }
} }
} }
SPITType::SPITType() { SPITType::SPITType() {
initMembers(); initMembers();
@@ -259,7 +255,7 @@ SPITType::SPITType(const SPITType& orig) {
m_ServerRemote = orig.getServerRemote(); m_ServerRemote = orig.getServerRemote();
} }
*/ */
SPITType::SPITType(string p_ID, string p_GroupName, string p_Name, bool p_Fixed, bool p_ProjectIndepended,long long p_DefaultDelay, long long p_DefaultDuration) { SPITType::SPITType(string p_ID, string p_GroupName, string p_Name, bool p_Fixed, bool p_ProjectIndepended, long long p_DefaultDelay, long long p_DefaultDuration) {
initMembers(); initMembers();
m_ActionAssigned = false; m_ActionAssigned = false;
m_Confirmed = false; m_Confirmed = false;
@@ -287,154 +283,166 @@ void SPITType::initMembers() {
m_ServerRemote = false; m_ServerRemote = false;
} }
void SPITType::setCreatedByClient(bool p_CreatedByClient) { void SPITType::setCreatedByClient(bool p_CreatedByClient) {
m_CreatedByClient = p_CreatedByClient; m_CreatedByClient = p_CreatedByClient;
} }
void SPITType::setID(string p_ID) {
void SPITType::setID(string p_ID) {
m_ID = p_ID; m_ID = p_ID;
} }
/** /**
* This is used by the server and client to tell if the other side has registered the changes. * This is used by the server and client to tell if the other side has registered the changes.
* @param p_Confirmed * @param p_Confirmed
* @return if m_Confirmed has changed * @return if m_Confirmed has changed
*/ */
bool SPITType::setConfirmed(bool p_Confirmed) { bool SPITType::setConfirmed(bool p_Confirmed) {
if (m_Confirmed == p_Confirmed) return false; if (m_Confirmed == p_Confirmed)
return false;
m_Confirmed = p_Confirmed; m_Confirmed = p_Confirmed;
return true; return true;
} }
bool SPITType::setGroupName(string p_GroupName) { bool SPITType::setGroupName(string p_GroupName) {
if (m_GroupName == p_GroupName) return false; if (m_GroupName == p_GroupName)
return false;
m_GroupName = p_GroupName; m_GroupName = p_GroupName;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITType::setName(string p_Name) { bool SPITType::setName(string p_Name) {
if (m_Name == p_Name) return false; if (m_Name == p_Name)
return false;
m_Name = p_Name; m_Name = p_Name;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITType::setServerRemote(bool p_BelongstoServer) { bool SPITType::setServerRemote(bool p_BelongstoServer) {
if (m_ServerRemote == p_BelongstoServer) return false; if (m_ServerRemote == p_BelongstoServer)
return false;
m_ServerRemote = p_BelongstoServer; m_ServerRemote = p_BelongstoServer;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITType::setProjectIndepended(bool p_ProjectIndepended) { bool SPITType::setProjectIndepended(bool p_ProjectIndepended) {
if (m_ServerProjectIndepended == p_ProjectIndepended) return false; if (m_ServerProjectIndepended == p_ProjectIndepended)
return false;
m_ServerProjectIndepended = p_ProjectIndepended; m_ServerProjectIndepended = p_ProjectIndepended;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITType::setFixed(bool p_Fixed) { bool SPITType::setFixed(bool p_Fixed) {
if (m_Fixed == p_Fixed) return false; if (m_Fixed == p_Fixed)
return false;
m_Fixed = p_Fixed; m_Fixed = p_Fixed;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITType::setDefaultDelay(long long p_Delay) { bool SPITType::setDefaultDelay(long long p_Delay) {
if (m_DefaultDelay == p_Delay) return false; if (m_DefaultDelay == p_Delay)
return false;
m_DefaultDelay = p_Delay; m_DefaultDelay = p_Delay;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
bool SPITType::setDefaultDuration(long long p_Duration) { bool SPITType::setDefaultDuration(long long p_Duration) {
if (m_DefaultDuration == p_Duration) return false; if (m_DefaultDuration == p_Duration)
return false;
m_DefaultDuration = p_Duration; m_DefaultDuration = p_Duration;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
/** /**
* Virtual construct - means ActionAssigned for SPITTypes is is not implemented in SPITProtocol.<br> * Virtual construct - means ActionAssigned for SPITTypes is is not implemented in SPITProtocol.<br>
* This can used to setActionAssigned to all SPITObjects with this SPITType.<br> * This can used to setActionAssigned to all SPITObjects with this SPITType.<br>
* This may be used in the case when the same action should be done for every SPITObject with this SPITType associated.<br> * This may be used in the case when the same action should be done for every SPITObject with this SPITType associated.<br>
* @return true = the m_ActionAssigned has changed. * @return true = the m_ActionAssigned has changed.
*/ */
bool SPITType::setActionAssigned(bool p_ActionAssigned) { bool SPITType::setActionAssigned(bool p_ActionAssigned) {
if (m_ActionAssigned == p_ActionAssigned) return false; if (m_ActionAssigned == p_ActionAssigned)
return false;
m_ActionAssigned = p_ActionAssigned; m_ActionAssigned = p_ActionAssigned;
m_Confirmed = false; m_Confirmed = false;
return true; return true;
} }
/** /**
* Set the content of the SPITType as received from the server * Set the content of the SPITType as received from the server
* @param p_ReportSPITType * @param p_ReportSPITType
* @return true = the SPITType is changed<br> * @return true = the SPITType is changed<br>
* false = the SPITType is NOT changed, because it is not allowed to change. * false = the SPITType is NOT changed, because it is not allowed to change.
*/ */
bool SPITType::setMessageOP(SPIT_Message::ReportSPITType* p_ReportSPITType) { bool SPITType::setMessageOP(SPIT_Message::ReportSPITType *p_ReportSPITType) {
bool boolChangeAllowed; bool boolChangeAllowed;
bool boolChanged = false; bool boolChanged = false;
if (m_CreatedByClient == true && m_Fixed == true) { if (m_CreatedByClient == true && m_Fixed == true) {
boolChangeAllowed = false; boolChangeAllowed = false;
} } else {
else {
boolChangeAllowed = true; boolChangeAllowed = true;
} }
//Confirmation should be changable // Confirmation should be changable
if (m_CreatedByClient) { if (m_CreatedByClient) {
//Server reports a client created SPITType -> the type is confirmed // Server reports a client created SPITType -> the type is confirmed
m_Confirmed = true; m_Confirmed = true;
} } else {
else { // type is NOT client created -> the client has to confirm the SPITtype
//type is NOT client created -> the client has to confirm the SPITtype
m_Confirmed = p_ReportSPITType->getConfirmed(); m_Confirmed = p_ReportSPITType->getConfirmed();
} }
if (m_DefaultDelay != p_ReportSPITType->getDelay()) { if (m_DefaultDelay != p_ReportSPITType->getDelay()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_DefaultDelay = p_ReportSPITType->getDelay(); m_DefaultDelay = p_ReportSPITType->getDelay();
boolChanged = true; boolChanged = true;
} }
if (m_DefaultDuration != p_ReportSPITType->getDuration()) { if (m_DefaultDuration != p_ReportSPITType->getDuration()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_DefaultDuration = p_ReportSPITType->getDuration(); m_DefaultDuration = p_ReportSPITType->getDuration();
boolChanged = true; boolChanged = true;
} }
if (m_Fixed != p_ReportSPITType->getFixed()) { if (m_Fixed != p_ReportSPITType->getFixed()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Fixed = p_ReportSPITType->getFixed(); m_Fixed = p_ReportSPITType->getFixed();
boolChanged = true; boolChanged = true;
} }
if (m_GroupName != p_ReportSPITType->getGroupName()) { if (m_GroupName != p_ReportSPITType->getGroupName()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_GroupName = p_ReportSPITType->getGroupName(); m_GroupName = p_ReportSPITType->getGroupName();
boolChanged = true; boolChanged = true;
} }
if (m_ID != p_ReportSPITType->getID()) { if (m_ID != p_ReportSPITType->getID()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ID = p_ReportSPITType->getID(); m_ID = p_ReportSPITType->getID();
boolChanged = true; boolChanged = true;
} }
if (m_Name != p_ReportSPITType->getName()) { if (m_Name != p_ReportSPITType->getName()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_Name = p_ReportSPITType->getName(); m_Name = p_ReportSPITType->getName();
boolChanged = true; boolChanged = true;
} }
if (m_ServerProjectIndepended != p_ReportSPITType->getServerProjectIndepended()) { if (m_ServerProjectIndepended != p_ReportSPITType->getServerProjectIndepended()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ServerProjectIndepended = p_ReportSPITType->getServerProjectIndepended(); m_ServerProjectIndepended = p_ReportSPITType->getServerProjectIndepended();
boolChanged = true; boolChanged = true;
} }
if (m_ServerRemote != p_ReportSPITType->getServerRemote()) { if (m_ServerRemote != p_ReportSPITType->getServerRemote()) {
if (boolChangeAllowed == false) throw new exception(); if (boolChangeAllowed == false)
throw new exception();
m_ServerRemote = p_ReportSPITType->getServerRemote(); m_ServerRemote = p_ReportSPITType->getServerRemote();
boolChanged = true; boolChanged = true;
} }
return boolChanged; return boolChanged;
} }
void SPITType::fillMessageOP(SPIT_Message::ReportSPITType* ptrSMReportSPITType) { void SPITType::fillMessageOP(SPIT_Message::ReportSPITType *ptrSMReportSPITType) {
ptrSMReportSPITType->setConfirmed(m_Confirmed); ptrSMReportSPITType->setConfirmed(m_Confirmed);
ptrSMReportSPITType->setDelay(m_DefaultDelay); ptrSMReportSPITType->setDelay(m_DefaultDelay);
ptrSMReportSPITType->setDuration(m_DefaultDuration); ptrSMReportSPITType->setDuration(m_DefaultDuration);
@@ -444,7 +452,7 @@ void SPITType::setCreatedByClient(bool p_CreatedByClient) {
ptrSMReportSPITType->setName(m_Name); ptrSMReportSPITType->setName(m_Name);
ptrSMReportSPITType->setServerProjectIndepended(m_ServerProjectIndepended); ptrSMReportSPITType->setServerProjectIndepended(m_ServerProjectIndepended);
ptrSMReportSPITType->setServerRemote(m_ServerRemote); ptrSMReportSPITType->setServerRemote(m_ServerRemote);
} }
void SPITType::fillMessageOP(SPIT_Message::RemoveSPITType* ptrSMRemoveSPITType) { void SPITType::fillMessageOP(SPIT_Message::RemoveSPITType *ptrSMRemoveSPITType) {
ptrSMRemoveSPITType->setID(m_ID); ptrSMRemoveSPITType->setID(m_ID);
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
idf_component_register(
INCLUDE_DIRS "."
REQUIRES devHal
)
+50
View File
@@ -0,0 +1,50 @@
#pragma once
#include "StepperDrv8833.hpp"
#include "stepperMotor.hpp"
#include <cmath>
class WatchMotor {
static constexpr uint8_t Positions = 6;
public:
WatchMotor(StepperMotor &stepper, OutputPort &sleep)
: _stepper(stepper),
_motorSleep(sleep) {
_motorSleep.write(false);
}
void moveTo(uint8_t sign, uint8_t profile = 0) {
sign = sign % 6;
float delta = 2.0F * std::numbers::pi;
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;
}
// stepper.getScaledPos() * 6
if (_currentIndex < sign) {
delta = delta / 6 * (sign - _currentIndex);
} else if (_currentIndex > sign) {
delta = delta / 6 * (sign + 6 - _currentIndex);
}
ESP_LOGD("MV", "Moving to %d by %.2f + %.2f", sign, delta, corr);
_stepper.moveBy(delta + corr, profile);
_currentIndex = sign;
}
float getScaled() { return _stepper.getScaledPos() * 6; }
uint8_t getIndex() { return _currentIndex; }
private:
StepperMotor &_stepper;
OutputPort &_motorSleep;
uint8_t _currentIndex{};
};
+1 -1
Submodule core updated: 3041a17851...c85bfa2afc
+312
View File
@@ -0,0 +1,312 @@
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=29b54h (170836) map
I (127) esp_image: segment 1: paddr=00039b7c vaddr=40800000 size=0649ch ( 25756) load
I (134) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=6a434h (435252) map
I (225) esp_image: segment 3: paddr=000aa45c vaddr=4080649c size=07d28h ( 32040) load
I (233) esp_image: segment 4: paddr=000b218c vaddr=4080e1d0 size=01c00h ( 7168) load
I (239) boot: Loaded app from partition at offset 0x10000
I (239) boot: Disabling RNG early entropy source...
I (253) cpu_start: Unicore app
I (262) cpu_start: Pro cpu start user code
I (262) cpu_start: cpu freq: 160000000 Hz
I (263) app_init: Application information:
I (265) app_init: Project name: X_WatchController_FW
I (271) app_init: App version: 3ec39a2-dirty
I (277) app_init: Compile time: Mar 29 2025 16:21:16
I (283) app_init: ELF file SHA256: c5ad318a2...
I (288) app_init: ESP-IDF: v5.3
I (292) efuse_init: Min chip rev: v0.0
I (297) efuse_init: Max chip rev: v0.99
I (302) efuse_init: Chip rev: v0.0
I (307) heap_init: Initializing. RAM available for dynamic allocation:
I (314) heap_init: At 40812190 len 0006A480 (425 KiB): RAM
I (320) heap_init: At 4087C610 len 00002F54 (11 KiB): RAM
I (326) heap_init: At 50000000 len 00003FE8 (15 KiB): RTCRAM
I (334) spi_flash: detected chip: generic
I (337) spi_flash: flash io: dio
I (343) sleep: Configure to isolate all GPIO pins in sleep state
I (348) sleep: Enable automatic switching of GPIO sleep configuration
I (355) coexist: coex firmware version: dab85ae96
I (383) coexist: coexist rom version 5b8dcfa
I (383) main_task: Started on CPU0
I (383) main_task: Calling app_main()
I (393) esp_eth.netif.netif_glue: 42:4c:ca:ff:fe:4e
I (393) esp_eth.netif.netif_glue: ethernet attached to netif
I (403) Watch: Ethernet Started
I (403) Watch: Start Lighting
I (403) gpio: GPIO[10]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (413) gpio: GPIO[11]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (423) Watch: Start Stepper
I (423) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (433) gpio: GPIO[8]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (443) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (453) TMR: Create timer handle
I (453) TMR: Setup timer
I (453) Stepper: Find Home
I (463) Stepper: Homing ...
I (463) Stepper: Fast find right side of home sensor
I (483) gpio: GPIO[1]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (2133) Stepper: Find right side of home sensor
I (2313) Stepper: Find end of sensor
I (2403) Watch: Ethernet Link Up
I (2403) Watch: Ethernet Link Up
I (2403) Watch: Ethernet HW Addr 00:00:00:00:00:00
I (3403) esp_netif_handlers: eth ip: 172.16.17.56, mask: 255.255.0.0, gw: 172.16.0.1
I (3403) Watch: Ethernet Got IP Address
I (3403) Watch: ~~~~~~~~~~~
I (3403) Watch: ETHIP:172.16.17.56
I (3413) Watch: ETHMASK:255.255.0.0
I (3413) Watch: ETHGW:172.16.0.1
I (3413) Watch: ~~~~~~~~~~~
I (3423) Watch: Start net services
I (3423) Watch: Starting Telnet task
I (3423) Watch: Starting ArtNet task
I (3423) Watch: Starting SPIT task
I (3433) SPIT: Connected to eth
I (3443) SPIT: - IPv4 address: 172.16.17.56,
I (3443) SPIT: - IPv4 netmask: 255.255.0.0,
I (3423) UDP: Starting syslog session to 172.16.16.10
I (3433) TCP: Socket created
I (3433) UDP: Socket bound, port 6454
I (3453) Watch: NEW SPIT-Type ID: ActionStartShuffle GroupName: CatasWatchMovement Name: ActionStartShuffle confirmed: 0
I (3453) SysLog: Starting Syslog Task
I (3463) TCP: Socket bound, port 23
I (3473) Watch: NEW SPIT-Type ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 0
I (3493) Watch: NEW SPIT-Type ID: ActionMoveTo2 GroupName: CatasWatchMovement Name: ActionMoveTo2 confirmed: 0
I (3483) Telnet: Socket waiting for connect
I (3483) UDP: Socket bound, port 514
I (3503) Watch: NEW SPIT-Type ID: ActionMoveTo3 GroupName: CatasWatchMovement Name: ActionMoveTo3 confirmed: 0
I (3523) Watch: NEW SPIT-Type ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 0
I (3533) Watch: NEW SPIT-Type ID: ActionMoveTo5 GroupName: CatasWatchMovement Name: ActionMoveTo5 confirmed: 0
I (3543) Watch: NEW SPIT-Type ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 0
I (3553) SPIT: Starting Socket managing
I (5713) Stepper: Find left side of home sensor
I (6183) Stepper: Move back to mid position 145
I (7633) Stepper: Reset position
I (7633) Watch: Fist Position is 0.000000.2
I (7663) Watch: SERVER DETECTED
I (7663) Watch: Name: liveShowSPIT
I (7663) Watch: ID: 698a3e4f-1ae9-4dd8-9015-29332d29629e
I (7663) Watch: Computer: GgP17
I (7663) Watch: IP: 172.16.16.10
I (7673) Watch: Port: 15120
I (7673) Watch: Addition:
I (7673) Watch: ClientIP: 172.16.17.56
I (7683) SPIT: connect to 172.16.16.10
I (7683) Watch: MySPITApp: eventConnectionStatus 0
I (7663) Watch: Changing picto-Illum to pos = 1
I (7693) Watch: Current color set r128 g128 b128
I (7693) Watch: MySPITApp: eventConnectionStatus 4
I (8203) Watch: eventProjectReport ID: CatasWatchProject Name: CatasWatchProject FramesPerSecond: 44100
I (8203) Watch: eventStartProjectTransfer
I (8283) Watch: SPIT-Type CHANGED ID: ActionMoveTo5 GroupName: CatasWatchMovement Name: ActionMoveTo5 confirmed: 1
I (8283) Watch: SPIT-Type CHANGED ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 1
I (8293) Watch: SPIT-Type CHANGED ID: ActionMoveTo3 GroupName: CatasWatchMovement Name: ActionMoveTo3 confirmed: 1
I (8303) Watch: SPIT-Type CHANGED ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 1
I (8313) Watch: NEW SPIT-REMOTE-Type ID: playControlStart GroupName: Playcontrol Name: start confirmed: 1
I (8323) Watch: NEW SPIT-REMOTE-Type ID: playControlPause GroupName: Playcontrol Name: pause confirmed: 1
I (8343) Watch: NEW SPIT-REMOTE-Type ID: nextSceneBridge GroupName: Playcontrol Name: next scene confirmed: 1
I (8353) Watch: NEW SPIT-REMOTE-Type ID: nextMainSceneBridge GroupName: Playcontrol Name: next main scene confirmed: 1
I (8373) Watch: NEW SPIT-REMOTE-Type ID: previuosSceneBridge GroupName: Playcontrol Name: previous scene confirmed: 1
I (8383) Watch: NEW SPIT-REMOTE-Type ID: previousMainSceneBridge GroupName: Playcontrol Name: previous main scene confirmed: 1
I (8403) Watch: NEW SPIT-REMOTE-Type ID: mainmixerSound_Volume00 GroupName: Main Mixer Name: Sound confirmed: 1
I (8423) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_Dimmer00 GroupName: Main Mixer Name: confirmed: 1
I (8433) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB00 GroupName: Main Mixer Name: confirmed: 1
I (8453) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB10 GroupName: Main Mixer Name: confirmed: 1
I (8463) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB20 GroupName: Main Mixer Name: confirmed: 1
I (8483) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB30 GroupName: Main Mixer Name: confirmed: 1
I (8503) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB40 GroupName: Main Mixer Name: confirmed: 1
I (8513) Watch: NEW SPIT-REMOTE-Type ID: mainmixerDMX_RGB50 GroupName: Main Mixer Name: confirmed: 1
I (8533) Watch: NEW SPIT-REMOTE-Type ID: mainmixerMedia_SoundVolume00 GroupName: Main Mixer Name: Media confirmed: 1
I (8543) Watch: NEW SPIT-REMOTE-Type ID: mainmixerMedia_Transparency00 GroupName: Main Mixer Name: Media confirmed: 1
I (8563) Watch: NEW SPIT-REMOTE-Type ID: selectedJingles GroupName: Playcontrol Name: selected Jingles confirmed: 1
I (8573) Watch: NEW SPIT-REMOTE-Type ID: selectedJingleGroups GroupName: Playcontrol Name: selected Jinglegroups confirmed: 1
I (8593) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000lo0va8bom GroupName: MainScene Name: ChangingPositionScene confirmed: 1
I (8603) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000m70va8bom GroupName: MainScene Name: InPosition1Scene confirmed: 1
I (8623) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000mh0va8bom GroupName: MainScene Name: InPosition2Scene confirmed: 1
I (8633) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000mr0va8bom GroupName: MainScene Name: InPosition3Scene confirmed: 1
I (8653) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000nk0va8bom GroupName: MainScene Name: InPosition4Scene confirmed: 1
I (8673) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000nu0va8bom GroupName: MainScene Name: InPosition5Scene confirmed: 1
I (8683) Watch: NEW SPIT-REMOTE-Type ID: 00000m8uedyyt0000000000000000o40va8bom GroupName: MainScene Name: InPosition6Scene confirmed: 1
I (8703) Watch: NEW SPIT-REMOTE-Object ID: playControlStart Name: start -> SPITType: start
I (8703) Watch: eventPlayRemoteObjectStatus RemoteSPITType: start RemoteSPITObject: start Position: 0 Value: 0
I (8713) Watch: NEW SPIT-REMOTE-Object ID: playControlPause Name: pause -> SPITType: pause
I (8723) Watch: eventPlayRemoteObjectStatus RemoteSPITType: pause RemoteSPITObject: pause Position: 0 Value: 0
I (8733) Watch: NEW SPIT-REMOTE-Object ID: nextSceneBridge Name: next scene -> SPITType: next scene
I (8743) Watch: eventPlayRemoteObjectStatus RemoteSPITType: next scene RemoteSPITObject: next scene Position: 0 Value: 0
I (8753) Watch: NEW SPIT-REMOTE-Object ID: nextMainSceneBridge Name: next main scene -> SPITType: next main scene
I (8763) Watch: eventPlayRemoteObjectStatus RemoteSPITType: next main scene RemoteSPITObject: next main scene Position: 0 Value: 0
I (8773) Watch: NEW SPIT-REMOTE-Object ID: previuosSceneBridge Name: previous scene -> SPITType: previous scene
I (8783) Watch: eventPlayRemoteObjectStatus RemoteSPITType: previous scene RemoteSPITObject: previous scene Position: 0 Value: 0
I (8793) Watch: NEW SPIT-REMOTE-Object ID: previousMainSceneBridge Name: previous main scene -> SPITType: previous main scene
I (8813) Watch: eventPlayRemoteObjectStatus RemoteSPITType: previous main scene RemoteSPITObject: previous main scene Position: 0 Value: 0
I (8823) Watch: NEW SPIT-REMOTE-Object ID: mainmixerSound_Volume00 Name: Sound Volume -> SPITType: Sound
I (8833) Watch: eventPlayRemoteObjectStatus RemoteSPITType: Sound RemoteSPITObject: Sound Volume Position: 0 Value: 500000
I (8843) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_Dimmer00 Name: Dimmer -> SPITType:
I (8853) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Dimmer Position: 0 Value: 1000000
I (8863) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB00 Name: Red -> SPITType:
I (8873) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Red Position: 0 Value: 1000000
I (8883) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB10 Name: Green -> SPITType:
I (8893) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Green Position: 0 Value: 1000000
I (8903) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB20 Name: Blue -> SPITType:
I (8913) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Blue Position: 0 Value: 1000000
I (8923) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB30 Name: Cyan -> SPITType:
I (8933) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB40 Name: Magenta -> SPITType:
I (8943) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Magenta Position: 0 Value: 0
I (8953) Watch: NEW SPIT-REMOTE-Object ID: mainmixerDMX_RGB50 Name: Yellow -> SPITType:
I (8963) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Yellow Position: 0 Value: 0
I (8973) Watch: NEW SPIT-REMOTE-Object ID: mainmixerMedia_SoundVolume00 Name: Sound Volume -> SPITType: Media
I (8983) Watch: NEW SPIT-REMOTE-Object ID: mainmixerMedia_Transparency00 Name: Media Transparency -> SPITType: Media
I (8993) Watch: eventPlayRemoteObjectStatus RemoteSPITType: Media RemoteSPITObject: Media Transparency Position: 0 Value: 1000000
I (9003) Watch: NEW SPIT-REMOTE-Object ID: selectedJinglesps Name: Play / Stop -> SPITType: selected Jingles
I (9013) Watch: eventPlayRemoteObjectStatus RemoteSPITType: selected Jingles RemoteSPITObject: Play / Stop Position: 0 Value: 0
I (9023) Watch: NEW SPIT-REMOTE-Object ID: selectedJinglespf Name: Play / Fade Out -> SPITType: selected Jingles
I (9033) Watch: NEW SPIT-REMOTE-Object ID: selectedJingleGroupsps Name: Play / Stop -> SPITType: selected Jinglegroups
I (9053) Watch: eventPlayRemoteObjectStatus RemoteSPITType: selected Jinglegroups RemoteSPITObject: Play / Stop Position: 0 Value: 0
I (9063) Watch: NEW SPIT-REMOTE-Object ID: selectedJingleGroupspf Name: Play / Fade Out -> SPITType: selected Jinglegroups
I (9073) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000lo0va8bom Name: play -> SPITType: ChangingPositionScene
I (9083) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000m70va8bom Name: play -> SPITType: InPosition1Scene
I (9093) Watch: eventPlayRemoteObjectStatus RemoteSPITType: InPosition1Scene RemoteSPITObject: play Position: 0 Value: 0
I (9103) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000mh0va8bom Name: play -> SPITType: InPosition2Scene
I (9123) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000mr0va8bom Name: play -> SPITType: InPosition3Scene
I (9133) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000nk0va8bom Name: play -> SPITType: InPosition4Scene
I (9143) Watch: eventPlayRemoteObjectStatus RemoteSPITType: InPosition4Scene RemoteSPITObject: play Position: 0 Value: 0
I (9153) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000nu0va8bom Name: play -> SPITType: InPosition5Scene
I (9163) Watch: NEW SPIT-REMOTE-Object ID: 00000m8uedyyt0000000000000000o40va8bom Name: play -> SPITType: InPosition6Scene
I (9183) Watch: eventEndProjectTransfer
W (9203) SPIT: Finished searching
W (9203) SPIT: Start working
I (9253) Watch: SPIT-Type CHANGED ID: ActionMoveTo5 GroupName: CatasWatchMovement Name: ActionMoveTo5 confirmed: 1
I (9253) Watch: SPIT-Type CHANGED ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 1
I (9263) Watch: SPIT-Type CHANGED ID: ActionMoveTo3 GroupName: CatasWatchMovement Name: ActionMoveTo3 confirmed: 1
I (9273) Watch: SPIT-Type CHANGED ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 1
I (9283) Watch: SPIT-Type CHANGED ID: ActionMoveTo2 GroupName: CatasWatchMovement Name: ActionMoveTo2 confirmed: 1
I (9293) Watch: SPIT-Type CHANGED ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 1
I (459853) Watch: SPIT-Type CHANGED ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 1
I (459853) Watch: SPIT-Type CHANGED ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 1
I (459863) Watch: SPIT-Type CHANGED ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 1
I (459883) Watch: SPIT-Type CHANGED ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 1
I (459893) Watch: SPIT-Type CHANGED ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 1
I (459903) Watch: SPIT-Type CHANGED ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 1
I (466093) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000000zq0va8bom Name: -> SPITType: ActionStartShuffle
I (466733) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000000zq0va8bom Name: -> SPITType: ActionStartShuffle
I (468643) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000000zq0va8bom Name: -> SPITType: ActionStartShuffle
I (471243) Watch: NEW SPIT-Object ID: 00000m8uedyyt00000000000000010u0va8bom Name: -> SPITType: ActionMoveTo1
I (472153) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000010u0va8bom Name: -> SPITType: ActionMoveTo1
I (473403) Watch: NEW SPIT-Object ID: 00000m8uedyyt00000000000000011a0va8bom Name: -> SPITType: ActionMoveTo2
I (474763) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000011a0va8bom Name: -> SPITType: ActionMoveTo2
I (483183) Watch: NEW SPIT-Object ID: 00000m8uedyyt00000000000000011s0va8bom Name: -> SPITType: ActionMoveTo3
I (483283) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000011s0va8bom Name: -> SPITType: ActionMoveTo3
I (483333) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000011s0va8bom Name: -> SPITType: ActionMoveTo3
I (483703) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000011s0va8bom Name: -> SPITType: ActionMoveTo3
I (484613) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000011s0va8bom Name: -> SPITType: ActionMoveTo3
I (485993) Watch: NEW SPIT-Object ID: 00000m8uedyyt00000000000000012m0va8bom Name: -> SPITType: ActionMoveTo4
I (486063) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000012m0va8bom Name: -> SPITType: ActionMoveTo4
I (486593) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000012m0va8bom Name: -> SPITType: ActionMoveTo4
I (488103) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000001330va8bom Name: -> SPITType: ActionMoveTo5
I (489273) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000001330va8bom Name: -> SPITType: ActionMoveTo5
I (490913) Watch: NEW SPIT-Object ID: 00000m8uedyyt00000000000000013r0va8bom Name: -> SPITType: ActionMoveTo6
I (491043) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000013r0va8bom Name: -> SPITType: ActionMoveTo6
I (491083) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000013r0va8bom Name: -> SPITType: ActionMoveTo6
I (493163) Watch: NEW SPIT-Object ID: 00000m8uedyyt0000000000000001470va8bom Name: -> SPITType: ActionMoveTo6
I (493243) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000001470va8bom Name: -> SPITType: ActionMoveTo6
I (493353) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000001470va8bom Name: -> SPITType: ActionMoveTo6
I (493883) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000001470va8bom Name: -> SPITType: ActionMoveTo6
I (503223) Watch: eventProjectReport ID: CatasWatchProject Name: CatasWatchProject FramesPerSecond: 44100
I (503373) Watch: eventStartProjectTransfer
I (503373) Watch: SPIT-Type CHANGED ID: ActionStartShuffle GroupName: CatasWatchMovement Name: ActionStartShuffle confirmed: 1
I (503373) Watch: SPIT-Type CHANGED ID: ActionMoveTo5 GroupName: CatasWatchMovement Name: ActionMoveTo5 confirmed: 1
I (503383) Watch: SPIT-Type CHANGED ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 1
I (503393) Watch: SPIT-Type CHANGED ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 1
I (503413) Watch: SPIT-Type CHANGED ID: ActionMoveTo3 GroupName: CatasWatchMovement Name: ActionMoveTo3 confirmed: 1
I (503423) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000011s0va8bom Name: -> SPITType: ActionMoveTo3
I (503433) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt00000000000000012m0va8bom Name: -> SPITType: ActionMoveTo4
I (503443) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000001330va8bom Name: -> SPITType: ActionMoveTo5
I (503453) Watch: SPIT-Object CHANGED ID: 00000m8uedyyt0000000000000001470va8bom Name: -> SPITType: ActionMoveTo6
I (503463) Watch: SPIT-REMOTE-Type CHANGED ID: playControlStart GroupName: Playcontrol Name: start confirmed: 1
I (503473) Watch: SPIT-REMOTE-Type CHANGED ID: playControlPause GroupName: Playcontrol Name: pause confirmed: 1
I (503483) Watch: SPIT-REMOTE-Type CHANGED ID: nextSceneBridge GroupName: Playcontrol Name: next scene confirmed: 1
I (503493) Watch: SPIT-REMOTE-Type CHANGED ID: nextMainSceneBridge GroupName: Playcontrol Name: next main scene confirmed: 1
I (503513) Watch: SPIT-REMOTE-Type CHANGED ID: previuosSceneBridge GroupName: Playcontrol Name: previous scene confirmed: 1
I (503523) Watch: SPIT-REMOTE-Type CHANGED ID: previousMainSceneBridge GroupName: Playcontrol Name: previous main scene confirmed: 1
I (503543) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerSound_Volume00 GroupName: Main Mixer Name: Sound confirmed: 1
I (503553) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_Dimmer00 GroupName: Main Mixer Name: confirmed: 1
I (503573) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_RGB00 GroupName: Main Mixer Name: confirmed: 1
I (503583) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_RGB10 GroupName: Main Mixer Name: confirmed: 1
I (503603) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_RGB20 GroupName: Main Mixer Name: confirmed: 1
I (503613) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_RGB30 GroupName: Main Mixer Name: confirmed: 1
I (503633) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_RGB40 GroupName: Main Mixer Name: confirmed: 1
I (503653) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerDMX_RGB50 GroupName: Main Mixer Name: confirmed: 1
I (503663) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerMedia_SoundVolume00 GroupName: Main Mixer Name: Media confirmed: 1
I (503683) Watch: SPIT-REMOTE-Type CHANGED ID: mainmixerMedia_Transparency00 GroupName: Main Mixer Name: Media confirmed: 1
I (503693) Watch: SPIT-REMOTE-Type CHANGED ID: selectedJingles GroupName: Playcontrol Name: selected Jingles confirmed: 1
I (503713) Watch: SPIT-REMOTE-Type CHANGED ID: selectedJingleGroups GroupName: Playcontrol Name: selected Jinglegroups confirmed: 1
I (503723) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000lo0va8bom GroupName: MainScene Name: ChangingPositionScene confirmed: 1
I (503743) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000m70va8bom GroupName: MainScene Name: InPosition1Scene confirmed: 1
I (503753) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000mh0va8bom GroupName: MainScene Name: InPosition2Scene confirmed: 1
I (503773) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000mr0va8bom GroupName: MainScene Name: InPosition3Scene confirmed: 1
I (503793) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000nk0va8bom GroupName: MainScene Name: InPosition4Scene confirmed: 1
I (503803) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000nu0va8bom GroupName: MainScene Name: InPosition5Scene confirmed: 1
I (503823) Watch: SPIT-REMOTE-Type CHANGED ID: 00000m8uedyyt0000000000000000o40va8bom GroupName: MainScene Name: InPosition6Scene confirmed: 1
I (503833) Watch: SPIT-REMOTE-Object CHANGED ID: playControlStart Name: start -> SPITType: start
I (503833) Watch: eventPlayRemoteObjectStatus RemoteSPITType: start RemoteSPITObject: start Position: 0 Value: 0
I (503853) Watch: SPIT-REMOTE-Object CHANGED ID: playControlPause Name: pause -> SPITType: pause
I (503853) Watch: eventPlayRemoteObjectStatus RemoteSPITType: pause RemoteSPITObject: pause Position: 0 Value: 0
I (503863) Watch: SPIT-REMOTE-Object CHANGED ID: nextSceneBridge Name: next scene -> SPITType: next scene
I (503873) Watch: eventPlayRemoteObjectStatus RemoteSPITType: next scene RemoteSPITObject: next scene Position: 0 Value: 0
I (503883) Watch: SPIT-REMOTE-Object CHANGED ID: nextMainSceneBridge Name: next main scene -> SPITType: next main scene
I (503903) Watch: eventPlayRemoteObjectStatus RemoteSPITType: next main scene RemoteSPITObject: next main scene Position: 0 Value: 0
I (503913) Watch: SPIT-REMOTE-Object CHANGED ID: previuosSceneBridge Name: previous scene -> SPITType: previous scene
I (503923) Watch: eventPlayRemoteObjectStatus RemoteSPITType: previous scene RemoteSPITObject: previous scene Position: 0 Value: 0
I (503933) Watch: SPIT-REMOTE-Object CHANGED ID: previousMainSceneBridge Name: previous main scene -> SPITType: previous main scene
I (503953) Watch: eventPlayRemoteObjectStatus RemoteSPITType: previous main scene RemoteSPITObject: previous main scene Position: 0 Value: 0
I (503963) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerSound_Volume00 Name: Sound Volume -> SPITType: Sound
I (503973) Watch: eventPlayRemoteObjectStatus RemoteSPITType: Sound RemoteSPITObject: Sound Volume Position: 0 Value: 500000
I (503983) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_Dimmer00 Name: Dimmer -> SPITType:
I (503993) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Dimmer Position: 0 Value: 1000000
I (504003) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_RGB00 Name: Red -> SPITType:
I (504013) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Red Position: 0 Value: 1000000
I (504023) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_RGB10 Name: Green -> SPITType:
I (504033) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Green Position: 0 Value: 1000000
I (504043) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_RGB20 Name: Blue -> SPITType:
I (504053) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_RGB30 Name: Cyan -> SPITType:
I (504063) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Cyan Position: 0 Value: 0
I (504073) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_RGB40 Name: Magenta -> SPITType:
I (504083) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerDMX_RGB50 Name: Yellow -> SPITType:
I (504093) Watch: eventPlayRemoteObjectStatus RemoteSPITType: RemoteSPITObject: Yellow Position: 0 Value: 0
I (504103) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerMedia_SoundVolume00 Name: Sound Volume -> SPITType: Media
I (504113) Watch: eventPlayRemoteObjectStatus RemoteSPITType: Media RemoteSPITObject: Sound Volume Position: 0 Value: 500000
I (504123) Watch: SPIT-REMOTE-Object CHANGED ID: mainmixerMedia_Transparency00 Name: Media Transparency -> SPITType: Media
I (504133) Watch: SPIT-REMOTE-Object CHANGED ID: selectedJinglesps Name: Play / Stop -> SPITType: selected Jingles
I (504143) Watch: eventPlayRemoteObjectStatus RemoteSPITType: selected Jingles RemoteSPITObject: Play / Stop Position: 0 Value: 0
I (504163) Watch: SPIT-REMOTE-Object CHANGED ID: selectedJinglespf Name: Play / Fade Out -> SPITType: selected Jingles
I (504173) Watch: SPIT-REMOTE-Object CHANGED ID: selectedJingleGroupsps Name: Play / Stop -> SPITType: selected Jinglegroups
I (504183) Watch: eventPlayRemoteObjectStatus RemoteSPITType: selected Jinglegroups RemoteSPITObject: Play / Stop Position: 0 Value: 0
I (504193) Watch: SPIT-REMOTE-Object CHANGED ID: selectedJingleGroupspf Name: Play / Fade Out -> SPITType: selected Jinglegroups
I (504213) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000lo0va8bom Name: play -> SPITType: ChangingPositionScene
I (504223) Watch: eventPlayRemoteObjectStatus RemoteSPITType: ChangingPositionScene RemoteSPITObject: play Position: 0 Value: 0
I (504233) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000m70va8bom Name: play -> SPITType: InPosition1Scene
I (504243) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000mh0va8bom Name: play -> SPITType: InPosition2Scene
I (504253) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000mr0va8bom Name: play -> SPITType: InPosition3Scene
I (504273) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000nk0va8bom Name: play -> SPITType: InPosition4Scene
I (504283) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000nu0va8bom Name: play -> SPITType: InPosition5Scene
I (504293) Watch: SPIT-REMOTE-Object CHANGED ID: 00000m8uedyyt0000000000000000o40va8bom Name: play -> SPITType: InPosition6Scene
I (504303) Watch: eventEndProjectTransfer
I (504433) Watch: SPIT-Type CHANGED ID: ActionMoveTo5 GroupName: CatasWatchMovement Name: ActionMoveTo5 confirmed: 1
I (504433) Watch: SPIT-Type CHANGED ID: ActionMoveTo4 GroupName: CatasWatchMovement Name: ActionMoveTo4 confirmed: 1
I (504443) Watch: SPIT-Type CHANGED ID: ActionMoveTo3 GroupName: CatasWatchMovement Name: ActionMoveTo3 confirmed: 1
I (504453) Watch: SPIT-Type CHANGED ID: ActionMoveTo6 GroupName: CatasWatchMovement Name: ActionMoveTo6 confirmed: 1
I (504463) Watch: SPIT-Type CHANGED ID: ActionMoveTo2 GroupName: CatasWatchMovement Name: ActionMoveTo2 confirmed: 1
I (504473) Watch: SPIT-Type CHANGED ID: ActionMoveTo1 GroupName: CatasWatchMovement Name: ActionMoveTo1 confirmed: 1
Binary file not shown.
BIN
View File
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.
+426 -67
View File
@@ -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,8 +66,8 @@ struct {
#include "watchMain.hpp" #include "watchMain.hpp"
string MyApp::s_ClientName = "CatasWatchDev"; string ClientName = "CatasWatchDev";
string MyApp::s_ProjectName = "CatastrphicProj"; 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);
@@ -47,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 {
@@ -68,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;
@@ -245,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{
@@ -263,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) {
@@ -346,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,
@@ -437,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},
}; };
} }
@@ -472,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);
@@ -504,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];
@@ -533,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);
@@ -549,25 +591,34 @@ void MovementTask() {
StepperMotor stepper(stepperCfg, stepperDriver, initSens); StepperMotor stepper(stepperCfg, stepperDriver, initSens);
WatchMotor watch(stepper, motorSleep);
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 {
@@ -575,60 +626,367 @@ 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) { int jumps = newPos - watch.getIndex();
delta += 6; if (jumps <= 0) {
jumps += 6;
} }
delta = delta + (activeState.minJumps % 6) * 6; jumps = jumps + (activeState.minJumps % 6) * 6;
if (delta < activeState.minJumps) { if (jumps < activeState.minJumps) {
delta += 6; jumps += 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 %i steps with prof=%i a=%.2f w=%.2f",
delta, activeState.profile, activeState.accel, activeState.speed); jumps, 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); watch.moveTo(newPos, activeState.profile);
pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos)); pictoIllumQue.enqueue(std::make_unique<PictoIllumCommand>(newPos));
activeState.pictogram = 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);
stepper.findRef();
activeState.pictogram = -1;
stepper.findRef();
fos::Task::delayMs(1000); 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, int p_ConnectionStatus, int p_OldConnectionStatus) {
ESP_LOGI(TAG, "MySPITApp: eventConnectionStatus %d ", 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;
}
}
/**
* The SPITCLientInterface (implemented by this) will be asked to veto the SPITType while SPIT_Client.parseReportSPITType.<br>
* @param p_ReportSPITType
* @return false = the SPITType is denied, true = the SPITType is accepted
*/
bool onCheckSpitTypeVeto(SPIT_Message::ReportSPITType *p_ReportSPITType) {
return true; // Bypass veto
if (p_ReportSPITType == NULL)
return true;
SPITType *ptrSPITType;
ptrSPITType = SPITType::getSPITType(p_ReportSPITType->getID());
// Don't allow foreign SPITTypes
if (ptrSPITType == NULL) {
// ESP_LOGW(TAG, "ObjectVeto NoSpitType");
return false;
}
if (ptrSPITType->getCreatedByClient() == false) {
// ESP_LOGW(TAG, "getCreatedByClient");
return false;
}
return true;
}
bool onCheckSpitObjectVeto(SPIT_Message::ReportSPITObject *p_ReportSPITObject) {
return true; // Bypass veto
if (p_ReportSPITObject == NULL)
return true;
SPITType *ptrSPITType = SPITType::getSPITType(p_ReportSPITObject->getSPITTypeID());
if (ptrSPITType == NULL) {
// ESP_LOGW(TAG, "ObjectVeto NoSpitObj");
return false;
}
// Don't allow SPITObjects which refers to a SPITType which is not created by this client - other SPITTypes cannot be handled here
if (ptrSPITType->getCreatedByClient() == false) {
// ESP_LOGW(TAG, "getCreatedByClient");
return false;
}
SPITObject *ptrSPITObject = SPITObject::getSPITObject(p_ReportSPITObject->getID());
// Don't allow foreign SPITTypes
if (ptrSPITObject == NULL) {
// ESP_LOGE(TAG, "Unknown ID");
return false;
}
return true;
}
// Called when the server has created, loaded, changed or deleted a SPITType.
// May also occur when the server confirms a SPITType created or changed by the client.
void onSpitType(SPIT_Client::ObjectEvent event, const SPITType &p_SPITType) {
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 or changed a Remote SPITType.
* Remote SPITType are used in Remote SPITObjects. A Remote SPITObject is used to remote control the SPITServer.
* @param p_New true = server created a new SPITType / false = server changed a existing SPITType
*/
void onSpitTypeRemote(SPIT_Client::ObjectEvent event, const SPITType &p_SPITType) {
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 == NULL)
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());
}
}
/**
* Called when the server has created, loaded or changed a SPITObject.
* 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, const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
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
}
}
/**
* Called when the server has created or changed a Remote SPITObject.
* A Remote SPITObject is used to remote control the SPITServer.
* @param p_New true = server created a new remote SPITObject
* false = server changed a existing remote 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 onSpitObjectRemote(SPIT_Client::ObjectEvent event, const SPITType &p_SPITType, const SPITObject &p_SPITObject) {
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
}
}
// 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_LOGI(TAG, "eventPlayRemoteObjectStatus RemoteSPITType: %s RemoteSPITObject: %s Position: %lld Value: %d", p_SPITType.getName().data(), p_SPITObject.getName().data(), p_FrameInsideObject, p_Value);
}
void SpitClientApp() { void SpitClientApp() {
ESP_LOGI(TAG, "Starting SPIT task"); ESP_LOGI(TAG, "Starting SPIT task");
auto ptrMyApp = std::make_unique<MyApp>();
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]] = "";
}
// load a client project and start auto detection of SPITServers SPIT_Client spitClient(ClientName, ProjectName,
ptrMyApp->init(); {
.onServerEvent = onServerEvent,
.onConnectionStatus = onConnectionStatus,
.onProjectUpdate = onProjectUpdate,
.onSpitType = onSpitType,
.onSpitTypeRemote = onSpitTypeRemote,
.onSpitObject = onSpitObject,
.onSpitObjectRemote = onSpitObjectRemote,
.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) { while (true) {
fos::Task::delayMs(10000); auto res = responseQueue.dequeue();
ESP_LOGI(TAG, "Test LiveShow"); if (res->type == ResponseType::StartMoving) {
ptrMyApp->testLiveShowRemote(); //This is an excample how to remote control the liveSHOWsoftware spitClient.sendRemoteObject(ExpectedObjects[expected.changingPos]);
} else if (res->type == ResponseType::StepAt) {
spitClient.sendRemoteObject(ExpectedObjects[expected.inPosX[res->pos - 1]]);
}
} }
} }
@@ -641,17 +999,18 @@ void app_main(void) {
ESP_ERROR_CHECK(ret); ESP_ERROR_CHECK(ret);
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");
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"); 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);
+13 -3
View File
@@ -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"
@@ -36,7 +37,7 @@
#include "Processor.hpp" #include "Processor.hpp"
#include "nvsFunctions.hpp" #include "nvsFunctions.hpp"
#include "mqttClient.hpp" #include "mqttClient.hpp"
#include "MyApp.h" #include "watchFace.hpp"
// #include "esp_chip_info.h" // #include "esp_chip_info.h"
// #include "esp_flash.h" // #include "esp_flash.h"
@@ -52,3 +53,12 @@
// #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>
+12
View File
@@ -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)
+2
View File
@@ -0,0 +1,2 @@
idf_component_register(SRCS "movementTests.cpp"
INCLUDE_DIRS ".")
+322
View File
@@ -0,0 +1,322 @@
/**
* @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 "StepperDrv8833.hpp"
#include "Task.hpp"
#include "esp_event.h"
#include "esp_log.h"
#include "sdkconfig.h"
#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 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);
///
/// 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);
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);
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);
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");
}
}
File diff suppressed because it is too large Load Diff
+18
View File
@@ -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
View File
@@ -0,0 +1,3 @@
{
"cmake.cmakePath": "C:/msys64/usr/bin/cmake.exe"
}
@@ -20,7 +20,7 @@ project(UnitTests)
find_package(doctest REQUIRED PATHS "/mingw64/lib/cmake") find_package(doctest REQUIRED PATHS "/mingw64/lib/cmake")
# target_link_libraries(${PROJECT_NAME} PRIVATE doctest::doctest) # target_link_libraries(${PROJECT_NAME} PRIVATE doctest::doctest)
addSubDirs_ofRoot("${CMAKE_CURRENT_LIST_DIR}/../components") addSubDirs_ofRoot("${CMAKE_CURRENT_LIST_DIR}/../../components")
@@ -3,7 +3,10 @@ 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"
# "../../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:
+9
View File
@@ -0,0 +1,9 @@
dependencies:
idf:
component_hash: null
source:
type: idf
version: 5.3.0
manifest_hash: c4f4ec05313d427eb56c633f78ce213e553379725bf2af3c511665f930571beb
target: esp32c6
version: 1.0.0