2019-10-23 16:58:19 +00:00
|
|
|
/*************************************************************************
|
|
|
|
PURPOSE: (Represent the state of a variable server websocket connection.)
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef WSSESSION_HH
|
|
|
|
#define WSSESSION_HH
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2021-08-18 18:15:10 +00:00
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
#include "civet/CivetServer.h"
|
|
|
|
#endif
|
|
|
|
|
2021-10-14 23:17:04 +00:00
|
|
|
#include "trick/WebSocketSession.hh"
|
2019-10-23 16:58:19 +00:00
|
|
|
#include "VariableServerVariable.hh"
|
|
|
|
|
|
|
|
class VariableServerSession : public WebSocketSession {
|
|
|
|
public:
|
|
|
|
VariableServerSession(struct mg_connection *nc);
|
|
|
|
~VariableServerSession();
|
|
|
|
void marshallData(); /* -- base */
|
|
|
|
void sendMessage(); /* -- base */
|
|
|
|
int handleMessage(std::string); /* -- base */
|
|
|
|
|
|
|
|
void setTimeInterval(unsigned int milliseconds);
|
|
|
|
void addVariable(char* vname);
|
|
|
|
void stageValues();
|
|
|
|
void pause();
|
|
|
|
void unpause();
|
|
|
|
void clear();
|
|
|
|
void exit();
|
|
|
|
|
|
|
|
static int bad_ref_int ;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int sendErrorMessage(const char* fmt, ... );
|
2019-10-31 15:39:13 +00:00
|
|
|
int sendSieMessage(void);
|
|
|
|
int sendUnitsMessage(const char* vname);
|
2019-10-23 16:58:19 +00:00
|
|
|
REF2* make_error_ref(const char* in_name);
|
|
|
|
double stageTime;
|
|
|
|
bool dataStaged;
|
|
|
|
|
|
|
|
std::vector<VariableServerVariable*> sessionVariables;
|
|
|
|
bool cyclicSendEnabled;
|
|
|
|
long long nextTime;
|
|
|
|
long long intervalTimeTics;
|
|
|
|
};
|
|
|
|
|
|
|
|
WebSocketSession* makeVariableServerSession( struct mg_connection *nc );
|
|
|
|
#endif
|