refactor: simplifying project until runs on embedded system
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* File: MySPITApp.h
|
||||
* Author: Hagi
|
||||
*
|
||||
@@ -15,105 +15,73 @@
|
||||
#define MYSPITAPP_H
|
||||
|
||||
#include "SPIT_Client.h"
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include "SPITType.h"
|
||||
#include "SPITObject.h"
|
||||
#include "SPITPlayer.h"
|
||||
#include "SAD_DetectedServer.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MyApp : SPIT_ClientInterface {
|
||||
public:
|
||||
MyApp();
|
||||
virtual ~MyApp();
|
||||
|
||||
//Client's infos is set by the client
|
||||
static string s_ClientName;
|
||||
void loadClientProject();
|
||||
|
||||
private:
|
||||
SPIT_Client* m_SPIT_Client; //pointer to an instance of the SPIT_Client, which do the main work for you
|
||||
|
||||
//MySPITApp client project infos they are transferred after the server send his project infos, see eventProjectReport
|
||||
string m_ClientProjectID; //can be an id or simple the project's name
|
||||
string m_ClientProjectName; //the name of the client's (this) project
|
||||
|
||||
//Server's info filled by eventConnectionStatus when SPIT_Client::CONNECTION_OK
|
||||
string m_ServerID;
|
||||
string m_ServerName;
|
||||
string m_ServerComputerName;
|
||||
int m_ServerStepTime;
|
||||
|
||||
//Server's project infos filled by eventProjectReport
|
||||
string m_ServerProjectID;
|
||||
string m_ServerProjectName;
|
||||
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,
|
||||
class MyApp {
|
||||
public:
|
||||
MyApp();
|
||||
// Client's infos is set by the client
|
||||
static string s_ClientName;
|
||||
static string s_ProjectName;
|
||||
void init();
|
||||
|
||||
//Reconnect to the server when connection is lost see eventConnectionStatus and eventServerDetected
|
||||
bool m_FlagReconnect; //true = on eventServerDetected connect to the server identified by m_ServerID
|
||||
|
||||
|
||||
|
||||
private:
|
||||
SPIT_Client _SpitClient; // pointer to an instance of the SPIT_Client, which do the main work for you
|
||||
|
||||
public:
|
||||
//---------- SPIT_ClientInterface -------------
|
||||
string getClientProjectID(); //should return the client's project id, maybe the same as project name
|
||||
string getClientProjectName();
|
||||
// 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,
|
||||
|
||||
//----- ServerAutoDetection -----
|
||||
void startServerAutoDetect(); //starts the autodetection of SPITServers in the local network area (see eventServerDetected)
|
||||
void stopServerAutoDetect(); //stopps the autodetection
|
||||
void eventServerDetected(const SAD_DetectedServer& p_DetectedServer); //a SPITServer is detected
|
||||
void eventServerLost(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);
|
||||
|
||||
//----- Project -----
|
||||
void eventProjectReport(string p_ProjectID, string p_ProjectName, int p_FramesPerSeoond);
|
||||
void eventProjectClosed(string p_ProjectID);
|
||||
|
||||
void eventStartProjectTransfer();
|
||||
void eventEndProjectTransfer();
|
||||
|
||||
|
||||
//----- SPITType -----
|
||||
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);
|
||||
|
||||
void eventSPITType(bool p_New, const SPITType& p_SPITType);
|
||||
void eventSPITTypeRemote(bool p_New, const SPITType& p_SPITType);
|
||||
void eventSPITTypeRemoved(const SPITType& p_SPITType);
|
||||
void eventSPITTypeRemoteRemoved(const SPITType& p_SPITType);
|
||||
//----- 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);
|
||||
|
||||
//----- SPITObject -----
|
||||
void eventSPITObject(bool p_New, const SPITType& p_SPITType, const SPITObject& p_SPITObject);
|
||||
void eventSPITObjectRemote(bool p_New, const SPITType& p_SPITType, const SPITObject& p_SPITObject);
|
||||
void eventSPITObjectRemoved(const SPITType& p_SPITType, const SPITObject& p_SPITObject);
|
||||
void eventSPITObjectRemoteRemoved(const SPITType& p_SPITType, const SPITObject& p_SPITObject);
|
||||
//----- SPITType -----
|
||||
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);
|
||||
|
||||
//----- Play SPITObjects -----
|
||||
void eventPlay(string p_PlayerID, string p_PlayerName, char p_PlayerType, bool p_PlayerIsRunning, long long p_TimeFrames);
|
||||
void eventPlayObject(string p_PlayerID, bool p_Started, bool p_Stopped, const SPITType& p_SPITType, const SPITObject& p_SPITObject, const SPITPlayer::PlayObject& p_PlayObject);
|
||||
//----- SPITObject -----
|
||||
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);
|
||||
|
||||
|
||||
//----- Server changes status of one of his REMOTE SPITObjects -----
|
||||
//REMOTE only Server->Client RemoteObject's play status
|
||||
void eventPlayRemoteObjectStatus(const SPITType& p_SPITType, const SPITObject& p_SPITObject, long long p_FrameInsideObject, int p_Value);
|
||||
//----- 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);
|
||||
|
||||
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:
|
||||
//----- SPITType -----
|
||||
int removeSPITType(string p_SPITTypeID);
|
||||
int changeSPITType(SPITType* p_SPITType);
|
||||
|
||||
//----- SPITObject -----
|
||||
int removeSPITObject(string p_SPITObjectID);
|
||||
int changeSPITObject(SPITObject* p_SPITObject);
|
||||
|
||||
//----- 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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user