refactor: Tidy up SPIT
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "sad_DetectedServer.hpp"
|
||||
#include "spit_message.hpp"
|
||||
#include "spit_object.hpp"
|
||||
#include "spit_player.hpp"
|
||||
#include "spit_processor.hpp"
|
||||
#include "spit_repo.hpp"
|
||||
#include "spit_socket.hpp"
|
||||
#include "spit_type.hpp"
|
||||
#include "spit_message.hpp"
|
||||
#include "spit_repo.hpp"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "syslog.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -19,53 +18,28 @@ namespace spit {
|
||||
|
||||
class SClient : ISadClient {
|
||||
public:
|
||||
/** Maximal length of a SPITMessage*/
|
||||
static const int MAXSPITMESSAGEBYTECOUNT = 512;
|
||||
|
||||
using Callbacks = SProcessor::Callbacks;
|
||||
using ProjUpdate = SProcessor::ProjUpdate;
|
||||
using ServerEvent = SProcessor::ServerEvent;
|
||||
using ObjectEvent = SProcessor::ObjectEvent;
|
||||
using Connection = SProcessor::Connection;
|
||||
|
||||
//------ PlayerType ------
|
||||
public:
|
||||
/** continous main player, time value can be used like a timecode.<br>The time value is the position in server's project.<br>A server should use only one main player.*/
|
||||
static constexpr char PLAYERTYPE_MAIN = 0x02;
|
||||
/** continous player. This player plays SPIT objects sometime during the project.*/
|
||||
static constexpr char PLAYERTYPE_CONTINOUS = 0x01;
|
||||
/** diescrete player. This player is used to transmit single discrete values.*/
|
||||
static constexpr char PLAYERTYPE_DISCRETE = 0x00;
|
||||
using PlayerType = SPlayer::PTypes;
|
||||
using ValueFlags = SPlayer::VFlags;
|
||||
|
||||
//------ Value Flag ------
|
||||
//------ used by sendRemoteObject
|
||||
public:
|
||||
/**Set the given value directly*/
|
||||
static constexpr char VALUEFLAG_DIRECT = 0x00;
|
||||
/**Increase the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||
static constexpr char VALUEFLAG_INCREASE = 0x01;
|
||||
/**Decrease the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||
static constexpr char VALUEFLAG_DECREASE = 0x02;
|
||||
static constexpr int MAX_OVERTAKING_SPIT_MESSAGES = 10;
|
||||
|
||||
//----- SClient -----
|
||||
public:
|
||||
SClient(string name, string projName, ISocket &socket, Callbacks calls);
|
||||
virtual ~SClient();
|
||||
|
||||
|
||||
private:
|
||||
Callbacks mCallbacks;
|
||||
|
||||
fos::TaskT<SClient &> *mThreadReceive{};
|
||||
fos::TaskT<SClient &> *mThreadProcess{};
|
||||
bool mStopReceiveMessages{};
|
||||
|
||||
Connection mConnectionStatus{Connection::None};
|
||||
bool mDisconnectedByServer{}; // flag true = when server disconnects
|
||||
string mID;
|
||||
string mName;
|
||||
string mProjName;
|
||||
string mComputerName;
|
||||
|
||||
SProcessor mProcessor;
|
||||
|
||||
string mClientProjectName;
|
||||
@@ -80,19 +54,13 @@ class SClient : ISadClient {
|
||||
string mServerComputerName{};
|
||||
int mServerStepTime{-1};
|
||||
|
||||
//--- Server Project ---
|
||||
string mServerProjectID;
|
||||
string mServerProjectName;
|
||||
int mServerFramesPerSecond;
|
||||
|
||||
public:
|
||||
/** The ID of the client.<br>Every client instance should set an unique id*/
|
||||
string getID() { return mID; }
|
||||
string getID() { return mProcessor.getID(); }
|
||||
/** The name of the client, should be set by the user app*/
|
||||
string getName() { return mName; }
|
||||
//----- Computer Params -----
|
||||
string getName() { return mProcessor.getName(); }
|
||||
/** The name of the client's host computer*/
|
||||
string getComputerName() { return mComputerName; }
|
||||
string getComputerName() { return mProcessor.getComputerName(); }
|
||||
void setClientProjectName(string clientProjectName) { mClientProjectName = clientProjectName; }
|
||||
string getClientProjectName() { return mClientProjectName; }
|
||||
|
||||
@@ -117,8 +85,12 @@ class SClient : ISadClient {
|
||||
*/
|
||||
void clientProjectLoaded();
|
||||
|
||||
void setActionSPITType(string spitypeID, bool actionAssigned);
|
||||
void setActionSPITObject(string objectID, bool actionAssigned);
|
||||
void setActionType(string spitypeID, bool actionAssigned) {
|
||||
mProcessor.setActionType(spitypeID, actionAssigned);
|
||||
}
|
||||
void setActionObject(string objectID, bool actionAssigned) {
|
||||
mProcessor.setActionObject(objectID, actionAssigned);
|
||||
}
|
||||
|
||||
//--------------- SPITMessage ---------------
|
||||
private:
|
||||
@@ -129,7 +101,7 @@ class SClient : ISadClient {
|
||||
// Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected
|
||||
bool _doReconnect{}; // true = on eventServerDetected connect to the server identified by mServerID
|
||||
public:
|
||||
int sendSPITMessage(Message::OPPart & spitMessageOPPart);
|
||||
int sendMessage(Message::OPPart &spitMessageOPPart);
|
||||
|
||||
//--------------- ServerAutoDetection SAD ---------------
|
||||
public:
|
||||
@@ -179,22 +151,13 @@ class SClient : ISadClient {
|
||||
/** Used internally. When the connection to the SPITServer is lost an eventConnectionStatus will occur*/
|
||||
void eventWatchdogLost();
|
||||
//--------------- SPIT Project ---------------
|
||||
private:
|
||||
void parseReportProject(Message::ReportProject &message);
|
||||
void parseCloseProject(Message::CloseProject &message);
|
||||
|
||||
public:
|
||||
/** Returns the SPITServer's project ID - may be the same as the project's name*/
|
||||
string getServerProjectID();
|
||||
string getServerProjectID() { return mProcessor.getServerProjectID(); }
|
||||
/** Returns the SPITServer's project name*/
|
||||
string getServerProjectName();
|
||||
string getServerProjectName() { return mProcessor.getServerProjectName(); }
|
||||
/** Returns frame rate per second. This is the time resolution in which the server transmits time data. The unit of time data is always frames.*/
|
||||
int getServerFramesPerSecond();
|
||||
|
||||
private:
|
||||
void parseRequestProjectTransfer(Message::RequestProjectTransfer &message);
|
||||
void parseStartProjectTransfer(Message::StartProjectTransfer &message);
|
||||
void parseEndProjectTransfer(Message::EndProjectTransfer &message);
|
||||
int getServerFramesPerSecond() { return mProcessor.getServerFramesPerSecond(); }
|
||||
|
||||
public:
|
||||
static void sendProject(SClient *p_PtrSClient);
|
||||
@@ -214,76 +177,17 @@ class SClient : ISadClient {
|
||||
*/
|
||||
SType *createTypeFixed(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration);
|
||||
|
||||
/**
|
||||
* Creates a SPITType for application actions.<br>
|
||||
* These SPITTypes will be automatically added to the SPITType-List and sended to the server.
|
||||
* @param p_ID an unique of the SPITType, these are always the same per client approach. Different client approaches should use different ids.
|
||||
* @param p_GroupName a name which groups the actions/SPITTypes
|
||||
* @param p_Name the name of the Action/SPITType
|
||||
* @param p_DefaultDelay maybe there is an default delay until the action starts, this is only used for graphical representations, 0 is allowd
|
||||
* @param p_DefaultDuration maybe the action has a default duration, this is only used for graphical representations, 0 is allowd
|
||||
* @param p_Fixed true = the server is not allowed to change this SPITType, false = the server may change or delete this SPITType
|
||||
* @param p_ProjectIndepended true = the SPITType belongs to a specific project, false = the SpitType always exists for every project
|
||||
* @return the pointer to the new SPITType.
|
||||
*/
|
||||
SType *createType(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration, bool fixed, bool projectIndepended);
|
||||
|
||||
private:
|
||||
// receive SPIT-Types
|
||||
void parseReportType(Message::ReportType &message);
|
||||
void parseRemoveSPITType(Message::RemoveType &message);
|
||||
int sendSPITTypeInternal(SType &spitType);
|
||||
public:
|
||||
bool changeType(SType *spitType) { return mProcessor.changeType(spitType); }
|
||||
int removeType(string spitypeID) { return mProcessor.removeType(spitypeID); }
|
||||
|
||||
public:
|
||||
/**
|
||||
* If a client wants to change a SPITType, he should send it to the server.<br>
|
||||
* If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the change.<br>
|
||||
* @param spitypeID the id of the SPITType to remove.
|
||||
* @return 0 = is sended, -1 = is not sended
|
||||
*/
|
||||
bool changeSPITType(SType *spitType);
|
||||
/**
|
||||
* If a client wants to remove a SPITType, he should send it to the server.<br>
|
||||
* If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the deletion.<br>
|
||||
* @param spitypeID the id of the SPITType to remove.
|
||||
* @return 0 = is sended, -1 = is not sended
|
||||
*/
|
||||
int removeSPITType(string spitypeID);
|
||||
|
||||
public:
|
||||
//--------------- SPIT Objects ---------------
|
||||
private:
|
||||
void parseReportSPITObject(Message::ReportObject &message);
|
||||
void parseRemoveSPITObject(Message::RemoveObject &message);
|
||||
int sendSPITObjectInternal(SObject *ptrObject);
|
||||
|
||||
public:
|
||||
/**
|
||||
* When the client changes a SPITObject (normally the client should not do this), then it should send the changes to the SPITServer.<br>
|
||||
* The SPITServer may discard the changes and an eventSPITObject occurs.<br>
|
||||
* @param spitObject the pointer to the changed SPITObject.
|
||||
* @return 0 = sended, -1 = not sended
|
||||
*/
|
||||
bool changeSPITObject(SObject *spitObject);
|
||||
/**
|
||||
* When the client removes a SPITObject (normally the client should not do this), then he should send it to the SPITServer.<br>
|
||||
* The SPITServer may discard the deletion and an eventSPITObject occurs.<br>
|
||||
* @param objectID the id of the SPITObject to remove.
|
||||
* @return 0 = sended, -1 = not sended
|
||||
*/
|
||||
int removeSPITObject(string objectID);
|
||||
|
||||
public:
|
||||
//--------------- Play SPIT Objects ---------------
|
||||
private:
|
||||
void parsePlaySPITStart(Message::PlayStart &message);
|
||||
void parsePlaySPITObject(Message::PlayObject &message);
|
||||
void parsePlaySPITEnd(Message::PlayEnd &message);
|
||||
void parseReportPlayStatus(Message::ReportPlayStatus &message);
|
||||
|
||||
public:
|
||||
//--------- Remote ----------
|
||||
void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00);
|
||||
bool changeObject(SObject *sObject) { return mProcessor.changeObject(sObject); }
|
||||
void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00) {
|
||||
mProcessor.sendRemoteObject(objectID, valuePpm, valueFlag);
|
||||
}
|
||||
|
||||
private:
|
||||
static void processSocketTask(SClient &instance);
|
||||
@@ -295,9 +199,6 @@ class SClient : ISadClient {
|
||||
void answerWatchdog() {
|
||||
sAnswered = true;
|
||||
}
|
||||
|
||||
SpitRepo<SObject> mSpitObjects;
|
||||
SpitRepo<SObject> mRemoteSpitObjects;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace spit
|
||||
@@ -14,6 +14,9 @@ namespace spit {
|
||||
class Message {
|
||||
//----------- Header -----------
|
||||
public:
|
||||
/** Maximal length of a SPITMessage*/
|
||||
static const int MAX_MESSAGE_SIZE = 512;
|
||||
|
||||
class Header {
|
||||
public:
|
||||
static constexpr int BYTESLENGTH = 99;
|
||||
|
||||
@@ -9,6 +9,24 @@ class SPlayer {
|
||||
|
||||
//----- PlayObject used in PlaySequences: PlaySPITStart, PlaySPITObject,..., PlaySPITEnd ------
|
||||
public:
|
||||
enum PTypes {
|
||||
// diescrete player: This player is used to transmit single discrete values.
|
||||
PTYPE_DISCRETE = 0x00,
|
||||
// continous player: This player plays SPIT objects sometime during the project.
|
||||
PTYPE_CONTINOUS = 0x01,
|
||||
// continous main player: time value can be used like a timecode.<br>The time value is the position in server's project.<br>A server should use only one main player.
|
||||
PTYPE_MAIN = 0x02,
|
||||
};
|
||||
|
||||
enum VFlags {
|
||||
// Set the given value directly
|
||||
VFLAG_DIRECT = 0x00,
|
||||
// Increase the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||
VFLAG_INCREASE = 0x01,
|
||||
// Decrease the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||
VFLAG_DECREASE = 0x02,
|
||||
};
|
||||
|
||||
class PlayType {
|
||||
public:
|
||||
PlayType(SPlayer *spitPlayer, string spitObjectID);
|
||||
@@ -43,7 +61,7 @@ class SPlayer {
|
||||
public:
|
||||
// list the SPITPlayers
|
||||
static unordered_map<string, unique_ptr<SPlayer>> sSpitPlayers; // all actual played objects
|
||||
static SPlayer &getSPITPlayer(string pPlayerID); // if a player does not exist creates a new one
|
||||
static SPlayer &getSPITPlayer(string pPlayerID); // if a player does not exist creates a new one
|
||||
static void clearPlayers() { sSpitPlayers.clear(); }
|
||||
|
||||
SPlayer(string pPlayerID);
|
||||
@@ -77,4 +95,4 @@ class SPlayer {
|
||||
uint64_t mTimeFrames;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace spit
|
||||
@@ -16,9 +16,6 @@ namespace spit {
|
||||
|
||||
class SProcessor {
|
||||
public:
|
||||
// /** Maximal length of a SPITMessage*/
|
||||
// static const int MAXSPITMESSAGEBYTECOUNT = 512;
|
||||
|
||||
enum class ProjUpdate {
|
||||
ServerLoaded,
|
||||
StartTransfer,
|
||||
@@ -57,188 +54,71 @@ class SProcessor {
|
||||
};
|
||||
|
||||
struct InternalCallbacks {
|
||||
function<int(SType &sType)> sendSpitTypeInternal;
|
||||
function<void(int ms)> delay;
|
||||
function<int(Message::OPPart &msg)> sendMessage;
|
||||
};
|
||||
|
||||
// //------ PlayerType ------
|
||||
// public:
|
||||
// /** continous main player, time value can be used like a timecode.<br>The time value is the position in server's project.<br>A server should use only one main player.*/
|
||||
// static constexpr char PLAYERTYPE_MAIN = 0x02;
|
||||
// /** continous player. This player plays SPIT objects sometime during the project.*/
|
||||
// static constexpr char PLAYERTYPE_CONTINOUS = 0x01;
|
||||
// /** diescrete player. This player is used to transmit single discrete values.*/
|
||||
// static constexpr char PLAYERTYPE_DISCRETE = 0x00;
|
||||
|
||||
// //------ Value Flag ------
|
||||
// //------ used by sendRemoteObject
|
||||
// public:
|
||||
// /**Set the given value directly*/
|
||||
// static constexpr char VALUEFLAG_DIRECT = 0x00;
|
||||
// /**Increase the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||
// static constexpr char VALUEFLAG_INCREASE = 0x01;
|
||||
// /**Decrease the existing value by the given value.<br>This is usefull e.g. when instead of a fader a endless wheel is used*/
|
||||
// static constexpr char VALUEFLAG_DECREASE = 0x02;
|
||||
// static constexpr int MAX_OVERTAKING_SPIT_MESSAGES = 10;
|
||||
static constexpr int MAX_OVERTAKING_SPIT_MESSAGES = 10;
|
||||
|
||||
//----- SProcessor -----
|
||||
public:
|
||||
SProcessor(string name, string projName, string hostName, string guid,
|
||||
Callbacks calls, InternalCallbacks intern);
|
||||
SProcessor(string name, string projName, string hostName, string guid,
|
||||
Callbacks calls, InternalCallbacks intern);
|
||||
virtual ~SProcessor();
|
||||
|
||||
private:
|
||||
Callbacks mCallbacks;
|
||||
InternalCallbacks mInternCallbacks;
|
||||
|
||||
// Connection mConnectionStatus{Connection::None};
|
||||
// bool mDisconnectedByServer{}; // flag true = when server disconnects
|
||||
string mGuid;
|
||||
string mName;
|
||||
string mGuid;
|
||||
string mProjName;
|
||||
string mComputerName;
|
||||
|
||||
// string mClientProjectName;
|
||||
|
||||
// uint8_t mMessageNumberSend{1};
|
||||
// int mMessageNumberReceived{-1}; // set to -1 because the first received message will set the number (1..255)
|
||||
// vector<unique_ptr<Message>> mOvertakingMessages;
|
||||
uint8_t mMessageNumberSend{1};
|
||||
int mMessageNumberReceived{-1}; // set to -1 because the first received message will set the number (1..255)
|
||||
vector<unique_ptr<Message>> mOvertakingMessages;
|
||||
|
||||
// // Server's info filled by parseConnectAnswer
|
||||
// string mServerID{};
|
||||
string mServerID{};
|
||||
// string mServerName{};
|
||||
// string mServerComputerName{};
|
||||
// int mServerStepTime{-1};
|
||||
|
||||
// //--- Server Project ---
|
||||
// string mServerProjectID;
|
||||
// string mServerProjectName;
|
||||
// int mServerFramesPerSecond;
|
||||
string mServerProjectID;
|
||||
string mServerProjectName;
|
||||
int mServerFramesPerSecond;
|
||||
|
||||
// public:
|
||||
// /** The ID of the client.<br>Every client instance should set an unique id*/
|
||||
// string getID() { return mGuid; }
|
||||
// /** The name of the client, should be set by the user app*/
|
||||
// string getName() { return mName; }
|
||||
// //----- Computer Params -----
|
||||
// /** The name of the client's host computer*/
|
||||
// string getComputerName() { return mComputerName; }
|
||||
// void setClientProjectName(string clientProjectName) { mClientProjectName = clientProjectName; }
|
||||
// string getClientProjectName() { return mClientProjectName; }
|
||||
public:
|
||||
string getID() { return mGuid; }
|
||||
string getName() { return mName; }
|
||||
string getProjName() { return mProjName; }
|
||||
string getComputerName() { return mComputerName; }
|
||||
void setActionType(string spitypeID, bool actionAssigned);
|
||||
void setActionObject(string objectID, bool actionAssigned);
|
||||
void checkParseMessageData(vector<char> data);
|
||||
|
||||
unique_ptr<Message::Connect> createConnectMessage(string serverIP, string serverPort, string loginName, string loginPassword);
|
||||
|
||||
std::vector<char> createMessage(Message::OPPart &spitMessageOPPart);
|
||||
void parseMessage(Message &message);
|
||||
void addOvertakingMessage(unique_ptr<Message> message);
|
||||
void parseReportProject(Message::ReportProject &message);
|
||||
void parseCloseProject(Message::CloseProject &message);
|
||||
|
||||
string getServerProjectID() { return mServerProjectID; }
|
||||
string getServerProjectName() { return mServerProjectName; }
|
||||
int getServerFramesPerSecond() { return mServerFramesPerSecond; }
|
||||
|
||||
// // connected Server Infos
|
||||
// /** The ID of the connected SPITServer*/
|
||||
// string getServerID() { return mServerID; }
|
||||
// /** The host computername of the connected SPITServer*/
|
||||
// string getServerComputerName() { return mServerComputerName; }
|
||||
// /** The name of the connected SPITServer*/
|
||||
// string getServerName() { return mServerName; }
|
||||
|
||||
// /** Expected Refreah Rate of the connectd SPITServer.<br>
|
||||
// * When the server plays objects, it will do so at discrete time steps.<br>
|
||||
// * Play events will take place in these time steps..
|
||||
// */
|
||||
// int getServerStepTime() { return mServerStepTime; }
|
||||
|
||||
// /** Should be called when the client wants to close his project*/
|
||||
// void clientProjectClose();
|
||||
// /**
|
||||
// * Should be called whenever the client has a project loaded
|
||||
// */
|
||||
// void clientProjectLoaded();
|
||||
|
||||
// void setActionSPITType(string spitypeID, bool actionAssigned);
|
||||
// void setActionSPITObject(string objectID, bool actionAssigned);
|
||||
|
||||
// //--------------- SPITMessage ---------------
|
||||
// private:
|
||||
// // Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected
|
||||
// bool _doReconnect{}; // true = on eventServerDetected connect to the server identified by mServerID
|
||||
// public:
|
||||
// std::vector<char> createMessage(Message::OPPart & spitMessageOPPart);
|
||||
// void checkParseMessageData(vector<char> data);
|
||||
|
||||
// //--------------- ServerAutoDetection SAD ---------------
|
||||
// public:
|
||||
// /** Starts the autodetection of SPITServers in the local network. If a connection is tried, the autodetection should be stopped before.*/
|
||||
// void startServerAutoDetect();
|
||||
// /** Stops the autodetection of SPITServers in the local network*/
|
||||
// void stopServerAutoDetect();
|
||||
// /** Called every time a new SPITServer is detetced in the local network */
|
||||
// void eventServerDetected(SadDetectedServer &server);
|
||||
// /** Called every time a prior detected SPITServer is is no longer found.*/
|
||||
// void eventServerLost(SadDetectedServer &server);
|
||||
// void eventServerChanged(SadDetectedServer &server);
|
||||
|
||||
// //--------------- Connection ---------------
|
||||
// public:
|
||||
// /**
|
||||
// * Tries a connection to the SPITServer
|
||||
// * @param p_ServerIP ip address of the SPITServer
|
||||
// * @param p_ServerPort port of the SPITServer
|
||||
// * @param p_ClientIP IP of the client
|
||||
// * @param p_ClientPort if "0" any free port will be used
|
||||
// * @param p_LoginName maybe some SPITServer need a login - liveSHOWsoftware will not.
|
||||
// * @param p_LoginPassword maybe some SPITServer need a login - liveSHOWsoftware will not
|
||||
// * @return true = the connection try is ok, SPITServer will answer with COnnectAnswer and an eventConnectionStatus will occur.<br>
|
||||
// * false = something is going wrong. (client could not bind)
|
||||
// */
|
||||
// bool connect(string serverIP, string serverPort, string clientIP, string clientPort, string loginName = "", string loginPassword = "");
|
||||
// /**
|
||||
// * Terminates the connection to the SPITServer.
|
||||
// */
|
||||
// void disconnect();
|
||||
|
||||
// private:
|
||||
// void disconnectInternal(Connection cause);
|
||||
// void resetMessageNumberReceived();
|
||||
// void parseMessage(Message& message);
|
||||
// void addOvertakingMessage(unique_ptr<Message> message);
|
||||
// void parseConnectAnswer(Message::ConnectAnswer &message);
|
||||
// void parseDisconnect(Message::Disconnect &message);
|
||||
// void parseWatchdog(Message::Watchdog &message);
|
||||
// void parseWatchdogAnswer(Message::WatchdogAnswer &message);
|
||||
|
||||
// public:
|
||||
// /** Used internally*/
|
||||
// void sendWatchdog();
|
||||
// /** Used internally. When the connection to the SPITServer is lost an eventConnectionStatus will occur*/
|
||||
// void eventWatchdogLost();
|
||||
// //--------------- SPIT Project ---------------
|
||||
// private:
|
||||
// void parseReportProject(Message::ReportProject &message);
|
||||
// void parseCloseProject(Message::CloseProject &message);
|
||||
|
||||
// public:
|
||||
// /** Returns the SPITServer's project ID - may be the same as the project's name*/
|
||||
// string getServerProjectID();
|
||||
// /** Returns the SPITServer's project name*/
|
||||
// string getServerProjectName();
|
||||
// /** Returns frame rate per second. This is the time resolution in which the server transmits time data. The unit of time data is always frames.*/
|
||||
// int getServerFramesPerSecond();
|
||||
|
||||
// private:
|
||||
// void parseRequestProjectTransfer(Message::RequestProjectTransfer &message);
|
||||
// void parseStartProjectTransfer(Message::StartProjectTransfer &message);
|
||||
// void parseEndProjectTransfer(Message::EndProjectTransfer &message);
|
||||
|
||||
// public:
|
||||
// // static void sendProject(SClient *p_PtrSProcessor);
|
||||
void parseRequestProjectTransfer(Message::RequestProjectTransfer &message);
|
||||
void parseStartProjectTransfer(Message::StartProjectTransfer &message);
|
||||
void parseEndProjectTransfer(Message::EndProjectTransfer &message);
|
||||
|
||||
// // --------------- SPIT Types ---------------
|
||||
// public:
|
||||
// /**
|
||||
// * Creates a fixed SPITType for application actions that are always present and project independent.<br>
|
||||
// * Fixed SPIT types cannot be changed or deleted by the server.<br>
|
||||
// * These SPITTypes will be automatically added to the SPITType-List and sended to the server.
|
||||
// * @param p_ID an unique of the SPITType, these are always the same per client approach. Different client approaches should use different ids.
|
||||
// * @param p_GroupName a name which groups the actions/SPITTypes
|
||||
// * @param p_Name the name of the Action/SPITType
|
||||
// * @param p_DefaultDelay maybe there is an default delay until the action starts, this is only used for graphical representations, 0 is allowd
|
||||
// * @param p_DefaultDuration maybe the action has a default duration, this is only used for graphical representations, 0 is allowd
|
||||
// * @return the pointer to the new SPITType.
|
||||
// */
|
||||
// SType *createTypeFixed(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration);
|
||||
|
||||
// /**
|
||||
// * Creates a SPITType for application actions.<br>
|
||||
// * These SPITTypes will be automatically added to the SPITType-List and sended to the server.
|
||||
@@ -251,75 +131,64 @@ class SProcessor {
|
||||
// * @param p_ProjectIndepended true = the SPITType belongs to a specific project, false = the SpitType always exists for every project
|
||||
// * @return the pointer to the new SPITType.
|
||||
// */
|
||||
// SType *createType(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration, bool fixed, bool projectIndepended);
|
||||
private:
|
||||
public: // @todo delete
|
||||
void parseReportType(Message::ReportType &message);
|
||||
// void parseRemoveSPITType(Message::RemoveType &message);
|
||||
// int sendSPITTypeInternal(SType &sType);
|
||||
SType *createType(string iD, string groupName, string name, uint64_t defaultDelay, uint64_t defaultDuration, bool fixed, bool projectIndepended);
|
||||
int sendTypeInternal(SType &sType);
|
||||
|
||||
// public:
|
||||
// /**
|
||||
// * If a client wants to change a SPITType, he should send it to the server.<br>
|
||||
// * If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the change.<br>
|
||||
// * @param spitypeID the id of the SPITType to remove.
|
||||
// * @return 0 = is sended, -1 = is not sended
|
||||
// */
|
||||
// bool changeSPITType(SType *spitType);
|
||||
// /**
|
||||
// * If a client wants to remove a SPITType, he should send it to the server.<br>
|
||||
// * If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the deletion.<br>
|
||||
// * @param spitypeID the id of the SPITType to remove.
|
||||
// * @return 0 = is sended, -1 = is not sended
|
||||
// */
|
||||
// int removeSPITType(string spitypeID);
|
||||
private:
|
||||
public: // @todo delete
|
||||
void parseReportType(Message::ReportType &message);
|
||||
void parseRemoveType(Message::RemoveType &message);
|
||||
|
||||
public:
|
||||
/**
|
||||
* If a client wants to change a SPITType, he should send it to the server.<br>
|
||||
* If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the change.<br>
|
||||
* @param spitypeID the id of the SPITType to remove.
|
||||
* @return 0 = is sended, -1 = is not sended
|
||||
*/
|
||||
bool changeType(SType *spitType);
|
||||
/**
|
||||
* If a client wants to remove a SPITType, he should send it to the server.<br>
|
||||
* If the SPITTye is a fixed one and not created by the client himself, then an eventSPITType can be sent from the server, which cancels the deletion.<br>
|
||||
* @param spitypeID the id of the SPITType to remove.
|
||||
* @return 0 = is sended, -1 = is not sended
|
||||
*/
|
||||
int removeType(string spitypeID);
|
||||
|
||||
// public:
|
||||
// //--------------- SPIT Objects ---------------
|
||||
// private:
|
||||
// void parseReportSPITObject(Message::ReportObject &message);
|
||||
// void parseRemoveSPITObject(Message::RemoveObject &message);
|
||||
// int sendSPITObjectInternal(SObject *ptrObject);
|
||||
public:
|
||||
void parseReportObject(Message::ReportObject &message);
|
||||
void parseRemoveObject(Message::RemoveObject &message);
|
||||
int sendObjectInternal(SObject *sObject);
|
||||
|
||||
// public:
|
||||
// /**
|
||||
// * When the client changes a SPITObject (normally the client should not do this), then it should send the changes to the SPITServer.<br>
|
||||
// * The SPITServer may discard the changes and an eventSPITObject occurs.<br>
|
||||
// * @param spitObject the pointer to the changed SPITObject.
|
||||
// * @return 0 = sended, -1 = not sended
|
||||
// */
|
||||
// bool changeSPITObject(SObject *spitObject);
|
||||
// /**
|
||||
// * When the client removes a SPITObject (normally the client should not do this), then he should send it to the SPITServer.<br>
|
||||
// * The SPITServer may discard the deletion and an eventSPITObject occurs.<br>
|
||||
// * @param objectID the id of the SPITObject to remove.
|
||||
// * @return 0 = sended, -1 = not sended
|
||||
// */
|
||||
// int removeSPITObject(string objectID);
|
||||
int removeObject(string objectID);
|
||||
bool changeObject(SObject *sObject);
|
||||
|
||||
// public:
|
||||
// //--------------- Play SPIT Objects ---------------
|
||||
// private:
|
||||
// void parsePlaySPITStart(Message::PlayStart &message);
|
||||
// void parsePlaySPITObject(Message::PlayObject &message);
|
||||
// void parsePlaySPITEnd(Message::PlayEnd &message);
|
||||
// void parseReportPlayStatus(Message::ReportPlayStatus &message);
|
||||
public:
|
||||
void parsePlayStart(Message::PlayStart &message);
|
||||
void parsePlayObject(Message::PlayObject &message);
|
||||
void parsePlayEnd(Message::PlayEnd &message);
|
||||
void parseReportPlayStatus(Message::ReportPlayStatus &message);
|
||||
|
||||
// public:
|
||||
// //--------- Remote ----------
|
||||
// void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00);
|
||||
void sendRemoteObject(string objectID, int valuePpm = 0, char valueFlag = 0x00);
|
||||
|
||||
// private:
|
||||
// bool mAbortSearch{};
|
||||
// bool sAnswered{};
|
||||
// void answerWatchdog() {
|
||||
// sAnswered = true;
|
||||
// }
|
||||
void resetConfirmedFlags() {
|
||||
SType::setConfirmedFalse(mSpitTypes);
|
||||
SObject::setConfirmedFalse(mSpitObjects);
|
||||
}
|
||||
|
||||
// SpitRepo<SObject> mSpitObjects;
|
||||
// SpitRepo<SObject> mRemoteSpitObjects;
|
||||
public: // @todo remove
|
||||
private:
|
||||
SpitRepo<SObject> mSpitObjects;
|
||||
SpitRepo<SType> mSpitTypes;
|
||||
SpitRepo<SObject> mRemoteSpitObjects;
|
||||
SpitRepo<SType> mRemoteSpitTypes;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user