feat: Migrating features from newer implementation
This commit is contained in:
@@ -20,7 +20,7 @@ public:
|
||||
* @param p_Addition sometimes server may have additional informations
|
||||
* @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_CLientIP, bool p_IsIP4) = 0;
|
||||
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;
|
||||
/**
|
||||
* 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>
|
||||
@@ -32,5 +32,6 @@ public:
|
||||
* @param p_Addition sometimes server may have additional informations
|
||||
* @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_CLientIP, bool p_IsIP4) = 0;
|
||||
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(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;
|
||||
};
|
||||
|
||||
@@ -43,12 +43,8 @@ class MyApp {
|
||||
// All times are given in frames,
|
||||
|
||||
public:
|
||||
//----- ServerAutoDetection -----
|
||||
static void onServerDetected(const SAD_DetectedServer &p_DetectedServer); // a SPITServer is detected
|
||||
static void onServerLost(const SAD_DetectedServer &p_DetectedServer); // a prior detected SPITServer is lost
|
||||
|
||||
//----- Connection -----
|
||||
void eventConnectionStatus(string p_ServerID, string p_ServerComputerName, string p_ServerName, int p_ServerStepTime, int p_ConnectionStatus, int p_OldConnectionStatus);
|
||||
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();
|
||||
@@ -57,12 +53,14 @@ class MyApp {
|
||||
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);
|
||||
@@ -70,7 +68,7 @@ class MyApp {
|
||||
|
||||
//----- Play SPITObjects -----
|
||||
static void onPlay(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_PlayerIsRunning, long long p_TimeFrames);
|
||||
static void onPlayObject(string p_PlayerID, bool p_Started, bool p_Stopped, const SPITType &p_SPITType, const SPITObject &p_SPITObject, const SPITPlayer::PlayObject &p_PlayObject);
|
||||
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
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
string m_ClientIP;
|
||||
string m_Port;
|
||||
string m_Additions;
|
||||
string m_ServerProjectName;
|
||||
bool m_New;
|
||||
bool m_Changed;
|
||||
bool m_FoundAgain;
|
||||
@@ -45,6 +46,7 @@ public:
|
||||
string getPort() const { return m_Port; }
|
||||
string getClientIP() const { return m_ClientIP; }
|
||||
string getAdditions() const { return m_Additions; }
|
||||
string getProjectName() const {return m_ServerProjectName;}
|
||||
private:
|
||||
void setID(string p_ID) { m_ID = p_ID; }
|
||||
void setName(string p_Name) { m_Name = p_Name; }
|
||||
@@ -53,6 +55,7 @@ private:
|
||||
void setClientIP(string p_IP) { m_ClientIP = p_IP; }
|
||||
void setPort(string p_Port) { m_Port = p_Port; }
|
||||
void setAdditions(string p_Additions) { m_Additions = p_Additions;}
|
||||
void setProjectName(string p_ServerProjectName);
|
||||
|
||||
void setIPIsIP4(bool p_IsIP4) { m_IPIsIP4 = p_IsIP4; }
|
||||
bool getNew() const { return m_New; }
|
||||
@@ -67,6 +70,7 @@ private:
|
||||
m_IPIsIP4 = false;
|
||||
m_Changed = false;
|
||||
m_FoundAgain = false;
|
||||
m_New = false;
|
||||
}
|
||||
//SAD_Client m_Thread_Send has paused in the meantime m_ThreadReceive may received messages from servers
|
||||
void endCycleSAD() { }
|
||||
@@ -81,7 +85,8 @@ public:
|
||||
static const int PARAMINDEX_PORT = 5;
|
||||
static const int PARAMINDEX_CLIENTIP = 6;
|
||||
static const int PARAMINDEX_ADDITIONS = 7;
|
||||
static const int PARAMINDEX_IP = 8;
|
||||
static const int PARAMINDEX_SERVERPROJECTNAME = 8;
|
||||
static const int PARAMINDEX_IP = 9;
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -33,20 +33,25 @@ public:
|
||||
static const SPITObject& getSPITObjectRef(string p_ID);
|
||||
static bool addSPITObject(SPITObject* p_ptrSpitObject);
|
||||
static bool removeSPITObject(SPITObject* p_ptrSpitObject);
|
||||
static bool removeSPITObject(string p_SpitObjectID);
|
||||
static int getSPITObjectCount();
|
||||
static SPITObject* getSPITObject(int p_Index);
|
||||
static const SPITObject& getSPITObjectRef(int p_Index);
|
||||
static void clearSPITObjects();
|
||||
static void clearUnconfirmedSPITObjects();
|
||||
static void setConfirmedFalse();
|
||||
|
||||
static SPITObject* getSPITObjectRemote(string p_ID);
|
||||
static const SPITObject& getSPITObjectRemoteRef(string p_ID);
|
||||
static bool addSPITObjectRemote(SPITObject* p_ptrSpitObject);
|
||||
static bool removeSPITObjectRemote(SPITObject* p_ptrSpitObject);
|
||||
static bool removeSPITObjectRemote(string p_SpitObjectID);
|
||||
static int getSPITObjectRemoteCount();
|
||||
static SPITObject* getSPITObjectRemote(int p_Index);
|
||||
static const SPITObject& getSPITObjectRemoteRef(int p_Index);
|
||||
static void clearSPITObjectsRemote();
|
||||
|
||||
static void eventProjectClosed();
|
||||
|
||||
SPITObject();
|
||||
// SPITObject(const SPITObject& orig);
|
||||
@@ -59,6 +64,7 @@ private:
|
||||
string m_Remark;
|
||||
bool m_Confirmed;
|
||||
bool m_Fixed;
|
||||
bool m_CreatedByClient;
|
||||
bool m_ServerRemote;
|
||||
bool m_ActionAssigned;
|
||||
bool m_ActionAssignedType; //Virtual construct
|
||||
@@ -80,90 +86,68 @@ private:
|
||||
|
||||
void initMembers();
|
||||
public:
|
||||
string getID() const {
|
||||
return m_ID;
|
||||
}
|
||||
string getName() const {
|
||||
return m_Name;
|
||||
}
|
||||
string getRemark() const {
|
||||
return m_Remark;
|
||||
}
|
||||
string getSPITTypeID() const {
|
||||
return m_SPITTypeID;
|
||||
}
|
||||
string getServerParams() const {
|
||||
return m_ServerParams;
|
||||
}
|
||||
string getID() const { return m_ID; }
|
||||
string getName() const { return m_Name; }
|
||||
string getRemark() const { return m_Remark; }
|
||||
string getSPITTypeID() const { return m_SPITTypeID; }
|
||||
string getServerParams() const { return m_ServerParams; }
|
||||
|
||||
/**
|
||||
* Returns if the SPITType triggers an action on the Server or on the client.
|
||||
* @return false = the action is triggered on the client The client waits for the server to play objects of this SPITType<br>
|
||||
* true = the action is triggered on the server. The server waits for the client to play objects of this SPITType.
|
||||
*/
|
||||
bool getServerRemote() const {
|
||||
return m_ServerRemote;
|
||||
}
|
||||
bool getServerRemote() const { return m_ServerRemote; }
|
||||
|
||||
/**
|
||||
* This is used by the server and client to tell if the other side has registered the changes.
|
||||
* @return true = other side has registered the changes.
|
||||
*/
|
||||
bool getConfirmed() const {
|
||||
return m_Confirmed;
|
||||
}
|
||||
bool getFixed() const {
|
||||
return m_Fixed;
|
||||
}
|
||||
bool getConfirmed() const { return m_Confirmed; }
|
||||
bool getFixed() const { return m_Fixed; }
|
||||
bool getCreatedByClient() { return m_CreatedByClient; }
|
||||
/**
|
||||
* 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>
|
||||
* Then this action is done for every SPITObject with the SPITType.
|
||||
* @return true = an action is assigned for the SPITType.
|
||||
*/
|
||||
bool getActionAssignedType() const {
|
||||
return m_ActionAssignedType;
|
||||
}
|
||||
bool getActionAssignedType() const { return m_ActionAssignedType; }
|
||||
/** Returns if this SPITObject has an associated action or not.<br>
|
||||
* @return true = the user has asscociated an action with this SPITObject or <br>
|
||||
* the user has asscociated an action with the SPITType of this SPITObject
|
||||
*/
|
||||
bool getActionAssigned() const {
|
||||
return m_ActionAssigned || m_ActionAssignedType;
|
||||
}
|
||||
bool getActionAssigned() const { return m_ActionAssigned || m_ActionAssignedType; }
|
||||
|
||||
long long getFrameStart() const {
|
||||
return m_FrameStart;
|
||||
}
|
||||
long long getFrameLength() const {
|
||||
return m_FrameLength;
|
||||
}
|
||||
long long getFrameFadeInLength() const {
|
||||
return m_FrameFadeInLength;
|
||||
}
|
||||
long long getFrameFadeOutLength() const {
|
||||
return m_FrameFadeOutLength;
|
||||
}
|
||||
char getValueUse() const {
|
||||
return m_ValueUse;
|
||||
}
|
||||
int getValueFactor() const {
|
||||
return m_ValueFactor;
|
||||
}
|
||||
int getTrack() const {
|
||||
return m_Track;
|
||||
}
|
||||
long long getFrameStart() const { return m_FrameStart; }
|
||||
// contains the length of the SPITObject
|
||||
long long getFrameLength() const { return m_FrameLength; }
|
||||
long long getFrameFadeInLength() const { return m_FrameFadeInLength; }
|
||||
long long getFrameFadeOutLength() const { return m_FrameFadeOutLength; }
|
||||
char getValueUse() const { return m_ValueUse; }
|
||||
int getValueFactor() const { return m_ValueFactor; }
|
||||
int getTrack() const { return m_Track; }
|
||||
|
||||
long long getDelay() const {
|
||||
return m_Delay;
|
||||
}
|
||||
long long getDuration() const {
|
||||
return m_Duration;
|
||||
}
|
||||
long long getDelay() const { return m_Delay; }
|
||||
long long getDuration() const { return m_Duration; }
|
||||
|
||||
bool getProjectIndepended() const {
|
||||
SPITType* ptrSPITType;
|
||||
if (m_ServerRemote == false) {
|
||||
ptrSPITType = SPITType::getSPITType(m_SPITTypeID);
|
||||
if (ptrSPITType == NULL) return true;
|
||||
return ptrSPITType->getProjectIndepended();
|
||||
}
|
||||
else {
|
||||
ptrSPITType = SPITType::getSPITTypeRemote(m_SPITTypeID);
|
||||
if (ptrSPITType == NULL) return true;
|
||||
return ptrSPITType->getProjectIndepended();
|
||||
}
|
||||
};
|
||||
|
||||
void setID(string p_ID);
|
||||
bool setConfirmed(bool p_Confirmed);
|
||||
void setCreatedByClient(bool p_CreatedByClient);
|
||||
bool setName(string p_Name);
|
||||
bool setRemark(string p_Remark);
|
||||
bool setServerParams(string p_ServerParams);
|
||||
@@ -182,7 +166,7 @@ public:
|
||||
bool setDelay(long long p_Delay);
|
||||
bool setDuration(long long p_Duration);
|
||||
|
||||
void setMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject);
|
||||
bool setMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject);
|
||||
void fillMessageOP(SPIT_Message::ReportSPITObject* p_ReportSPITObject);
|
||||
void fillMessageOP(SPIT_Message::RemoveSPITObject* p_RemoveSPITObject);
|
||||
};
|
||||
|
||||
@@ -21,149 +21,73 @@ class SPITPlayer {
|
||||
|
||||
//----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------
|
||||
public:
|
||||
class PlayObject {
|
||||
class PlaySPITType {
|
||||
public:
|
||||
PlayObject();
|
||||
PlayObject(SPITPlayer* p_SPITPlayer, string p_SPITObjectID);
|
||||
PlayObject(const PlayObject& orig);
|
||||
PlaySPITType();
|
||||
PlaySPITType(SPITPlayer* p_SPITPlayer, string p_SPITObjectID);
|
||||
PlaySPITType(const PlaySPITType& orig);
|
||||
|
||||
string getSPITObjectID() const {
|
||||
return m_SPITObjectID;
|
||||
string getSPITTypeID() const {
|
||||
return m_SPITTypeID;
|
||||
}
|
||||
|
||||
void startPlaySequence();
|
||||
bool getIsNew() const {
|
||||
return m_IsNew;
|
||||
}
|
||||
void setIsNew(bool p_IsNew) {
|
||||
m_IsNew = p_IsNew;
|
||||
}
|
||||
bool getIsPlayed() const {
|
||||
return m_IsPlayed;
|
||||
}
|
||||
void setIsPlayed(bool p_IsFound) {
|
||||
m_IsPlayed = p_IsFound;
|
||||
}
|
||||
|
||||
|
||||
string getPlayerID() const {
|
||||
return m_PlayerID;
|
||||
}
|
||||
string getPlayerName() const {
|
||||
return m_PlayerName;
|
||||
}
|
||||
bool getPlayerIsRunning() const {
|
||||
return m_PlayerRuns;
|
||||
}
|
||||
void setPlayerIsRunning(bool p_PlayerRuns) {
|
||||
m_PlayerRuns = p_PlayerRuns;
|
||||
}
|
||||
|
||||
void setValue(int p_Value, bool p_PlayPrePosition) {
|
||||
if (p_PlayPrePosition) m_ValuePrePosition = p_Value;
|
||||
else m_Value = p_Value;
|
||||
}
|
||||
|
||||
int getValue() const {
|
||||
return m_ValuePrePosition + m_Value;
|
||||
}
|
||||
int getValueFadePrePosition() const {
|
||||
return m_ValuePrePosition;
|
||||
}
|
||||
int getValueFade() const {
|
||||
return m_Value;
|
||||
}
|
||||
void setValueFactor(int p_ValueFactor) {
|
||||
m_ValueFactor = p_ValueFactor;
|
||||
}
|
||||
void setValueFlag(char p_ValueFlag) {
|
||||
m_ValueFlag = p_ValueFlag;
|
||||
}
|
||||
int getValueFactor() const {
|
||||
return m_ValueFactor;
|
||||
}
|
||||
char getValueFlag() const {
|
||||
return m_ValueFlag;
|
||||
}
|
||||
void setFrameInside(long long p_FrameInside, bool p_PlayPrePosition) {
|
||||
if (p_PlayPrePosition) m_FrameInsidePrePosition = p_FrameInside;
|
||||
else m_FrameInside = p_FrameInside;
|
||||
}
|
||||
long long getFrameInside() const {
|
||||
return m_FrameInside;
|
||||
}
|
||||
long long getFrameInsidePrePosition() const {
|
||||
return m_FrameInsidePrePosition;
|
||||
}
|
||||
|
||||
|
||||
bool getIsNew() const { return m_IsNew; }
|
||||
void setIsNew(bool p_IsNew) { m_IsNew = p_IsNew; }
|
||||
bool getIsPlayed() const { return m_IsPlayed; }
|
||||
void setIsPlayed(bool p_IsFound) { m_IsPlayed = p_IsFound; }
|
||||
string getPlayerID() const { return m_PlayerID; }
|
||||
string getPlayerName() const { return m_PlayerName; }
|
||||
bool getPlayerIsRunning() const { return m_PlayerRuns; }
|
||||
void setPlayerIsRunning(bool p_PlayerRuns) { m_PlayerRuns = p_PlayerRuns; }
|
||||
void setValue(double p_Value) { m_Value = p_Value; }
|
||||
void addValue(double p_Value, double p_ValueFactor) { m_Value += (p_Value * p_ValueFactor); }
|
||||
double getValue() const { return m_Value; }
|
||||
|
||||
private:
|
||||
string m_PlayerID;
|
||||
string m_PlayerName;
|
||||
bool m_PlayerRuns;
|
||||
string m_SPITObjectID;
|
||||
string m_SPITTypeID;
|
||||
bool m_IsPlayed;
|
||||
bool m_IsNew;
|
||||
|
||||
int m_Value;
|
||||
int m_ValuePrePosition;
|
||||
int m_ValueFactor;
|
||||
char m_ValueFlag;
|
||||
long long m_FrameInsidePrePosition;
|
||||
long long m_FrameInside;
|
||||
|
||||
|
||||
double m_Value;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----- SPITPlayer ------
|
||||
public:
|
||||
//list the SPITPlayers
|
||||
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 void clearPlayers();
|
||||
|
||||
|
||||
|
||||
|
||||
SPITPlayer(string p_PlayerID);
|
||||
virtual ~SPITPlayer();
|
||||
|
||||
|
||||
void startPlaySequence(); //called by SPIT_Client::parsePlaySPITStart
|
||||
PlayObject* addSPITObject_Playing (string p_SPITObjectID); //called by SPIT_Client::parsePlaySPITStart
|
||||
PlaySPITType* addSPITType_Playing (string p_SPITTypeID); //called by SPIT_Client::parsePlaySPITStart
|
||||
void endPlaySequence(); //called by SPIT_Client::parsePlaySPITEnd
|
||||
|
||||
string getID() {
|
||||
return m_ID;
|
||||
}
|
||||
|
||||
unordered_map<string, PlayObject*>* getPlayObjects();
|
||||
|
||||
unordered_map<string, PlaySPITType*>* getPlaySPITTypes();
|
||||
void setIsRunning(bool p_IsRunning);
|
||||
bool getIsRunning() {
|
||||
return m_IsRunning;
|
||||
}
|
||||
void setName(string p_Name);
|
||||
string getName() {
|
||||
return m_Name;
|
||||
}
|
||||
bool getIsRunning() { return m_IsRunning; }
|
||||
void setName(string p_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;
|
||||
}
|
||||
|
||||
PlayObject* getPlayObject(string p_SPITObjectID);
|
||||
|
||||
long long getTime() { return m_TimeFrames; }
|
||||
|
||||
private:
|
||||
string m_ID;
|
||||
string m_Name;
|
||||
char m_Type;
|
||||
unordered_map<string, PlayObject*> m_PlayObjects;
|
||||
unordered_map<string, PlaySPITType*> m_PlaySPITTypes;
|
||||
bool m_IsRunning;
|
||||
long long m_TimeFrames;
|
||||
};
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
int receiveMessage(int p_InetFamily, char* p_Buffer, int p_BufferLength, string* p_ServerIP);
|
||||
int setBroadcast(bool p_Broadcast);
|
||||
int bindSocket(string p_ClientIP, string p_ClientPort);
|
||||
int bindSocket(string p_ServerIP, string p_ClientIP, string p_ClientPort);
|
||||
|
||||
// * Internal usage - don't use this manually
|
||||
// * Use sendMessage instead
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
static const SPITType& getSPITTypeRemoteRef(int p_Index);
|
||||
static void clearSPITTypesRemote();
|
||||
|
||||
static void eventProjectClosed();
|
||||
|
||||
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);
|
||||
@@ -138,6 +139,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* SPITTYPE_H */
|
||||
|
||||
#endif /* SPITTYPE_H */
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "SPITObject.h"
|
||||
#include "SPITPlayer.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -30,9 +31,15 @@ public:
|
||||
/** Maximal length of a SPITMessage*/
|
||||
static const int MAXSPITMESSAGEBYTECOUNT = 512;
|
||||
|
||||
enum ServerEvent {
|
||||
Detect,
|
||||
Lost,
|
||||
Changed,
|
||||
};
|
||||
|
||||
struct Callbacks {
|
||||
void(*onServerDetect)(const SAD_DetectedServer &p_DetectedServer);
|
||||
void(*onServerLost)(const SAD_DetectedServer &p_DetectedServer);
|
||||
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(*onStartProjectTransfer)();
|
||||
void(*onEndProjectTransfer)();
|
||||
void(*onProjectClosed)(string);
|
||||
@@ -46,8 +53,10 @@ public:
|
||||
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(*onPlayObject)(string p_PlayerID, bool p_Started, bool p_Stopped, const SPITType &p_SPITType, const SPITObject &p_SPITObject, const SPITPlayer::PlayObject &p_PlayObject);
|
||||
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 -----
|
||||
@@ -86,6 +95,7 @@ public:
|
||||
public:
|
||||
SPIT_Client(string name, string projName, Callbacks calls);
|
||||
virtual ~SPIT_Client();
|
||||
static int s_MAX_OVERTAKING_SPIT_MESSAGES;
|
||||
private:
|
||||
Callbacks mCallbacks;
|
||||
|
||||
@@ -99,15 +109,18 @@ private:
|
||||
string m_ProjName;
|
||||
string m_ComputerName;
|
||||
|
||||
string m_ClientProjectName;
|
||||
|
||||
unsigned char m_MessageNumber_Send;
|
||||
int m_MessageNumber_Received;
|
||||
vector<SPIT_Message*> m_OvertakingSPIT_Messages;
|
||||
|
||||
//Server's info filled by parseConnectAnswer
|
||||
string m_ServerID{};
|
||||
string m_ServerName{};
|
||||
string m_ServerComputerName{};
|
||||
int m_ServerStepTime{-1};
|
||||
|
||||
unsigned char m_MessageNumber_Send;
|
||||
int m_MessageNumber_Received;
|
||||
|
||||
//--- Server Project ---
|
||||
string m_ServerProjectID;
|
||||
string m_ServerProjectName;
|
||||
@@ -115,25 +128,28 @@ private:
|
||||
|
||||
public:
|
||||
/** The ID of the client.<br>Every client instance should set an unique id*/
|
||||
string getID();
|
||||
string getID() { return m_ID; }
|
||||
/** The name of the client, should be set by the user app*/
|
||||
string getName();
|
||||
string getName() { return m_Name; }
|
||||
//----- Computer Params -----
|
||||
/** The name of the client's host computer*/
|
||||
string getComputerName();
|
||||
string getComputerName() { return m_ComputerName; }
|
||||
void setClientProjectName(string p_ClientProjectName) { m_ClientProjectName = p_ClientProjectName; }
|
||||
string getClientProjectName() { return m_ClientProjectName; }
|
||||
|
||||
//connected Server Infos
|
||||
/** The ID of the connected SPITServer*/
|
||||
string getServerID();
|
||||
string getServerID() { return m_ServerID; }
|
||||
/** The host computername of the connected SPITServer*/
|
||||
string getServerComputerName();
|
||||
string getServerComputerName() { return m_ServerComputerName; }
|
||||
/** The name of the connected SPITServer*/
|
||||
string getServerName();
|
||||
string getServerName() { return m_ServerName; }
|
||||
|
||||
/** Expected Refreah Rate of the connectd SPITServer.<br>
|
||||
* When the server plays objects, it will do so at discrete time steps.<br>
|
||||
* Play events will take place in these time steps..
|
||||
*/
|
||||
int getServerStepTime();
|
||||
int getServerStepTime() { return m_ServerStepTime; }
|
||||
|
||||
/** Should be called when the client wants to close his project*/
|
||||
void clientProjectClose();
|
||||
@@ -155,11 +171,11 @@ private:
|
||||
bool startReceiveSPITMessages();
|
||||
void stopReceiveSPITMessages();
|
||||
static void receiveSPITMessage(SPIT_Client& rM);
|
||||
int sendSPITMessage(SPIT_Message::OPPart& p_SPITMessageOPPart);
|
||||
void fillHeader(SPIT_Message::Header* p_Header);
|
||||
|
||||
// Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected
|
||||
bool _doReconnect{}; // true = on eventServerDetected connect to the server identified by m_ServerID
|
||||
public:
|
||||
void fillHeader(SPIT_Message::Header* p_Header);
|
||||
int sendSPITMessage(SPIT_Message::OPPart& p_SPITMessageOPPart);
|
||||
|
||||
//--------------- ServerAutoDetection SAD ---------------
|
||||
public:
|
||||
@@ -168,10 +184,10 @@ public:
|
||||
/** Stops the autodetection of SPITServers in the local network*/
|
||||
void stopServerAutoDetect();
|
||||
/** Called every time a new SPITServer is detetced in the local network */
|
||||
void eventServerDetected(string p_ID, string p_Name, string p_ComputerName, string p_IP, string p_Port, string p_Addition, string p_ClientIP, bool p_IsIP4);
|
||||
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);
|
||||
/** 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_ClientIP, bool p_IsIP4);
|
||||
|
||||
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 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);
|
||||
|
||||
//--------------- Connection ---------------
|
||||
public:
|
||||
@@ -194,7 +210,10 @@ public:
|
||||
|
||||
private:
|
||||
void disconnectInternal(int p_Cause);
|
||||
void resetMessageNumberReceived();
|
||||
void parseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
|
||||
void checkParseSPIT_Message(unique_ptr<SPIT_Message> p_SPITMessage);
|
||||
void addOvertakingSPIT_Message(SPIT_Message* p_SPIT_Message);
|
||||
void parseConnectAnswer(SPIT_Message::ConnectAnswer* p_ConnectAnswer);
|
||||
void parseDisconnect(SPIT_Message::Disconnect* p_Disconnect);
|
||||
void parseWatchdog(SPIT_Message::Watchdog* p_Watchdog);
|
||||
@@ -220,7 +239,8 @@ private:
|
||||
void parseRequestProjectTransfer(SPIT_Message::RequestProjectTransfer* p_RequestProjectTransfer);
|
||||
void parseStartProjectTransfer(SPIT_Message::StartProjectTransfer* p_StartProjectTransfer);
|
||||
void parseEndProjectTransfer(SPIT_Message::EndProjectTransfer* p_EndProjectTransfer);
|
||||
|
||||
public:
|
||||
static void sendProject(SPIT_Client* p_PtrSPIT_Client);
|
||||
|
||||
// --------------- SPIT Types ---------------
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user