2019-06-19 17:23:32 -05:00
|
|
|
/*************************************************************************
|
2019-08-26 13:40:11 -05:00
|
|
|
PURPOSE: (Represent the state of a variable server websocket connection.)
|
2019-06-19 17:23:32 -05:00
|
|
|
**************************************************************************/
|
2019-08-21 10:52:48 -05:00
|
|
|
|
2019-06-19 17:23:32 -05:00
|
|
|
#ifndef WSSESSION_HH
|
|
|
|
#define WSSESSION_HH
|
|
|
|
|
|
|
|
#include <vector>
|
2019-08-16 18:39:45 -05:00
|
|
|
#include <string>
|
2019-06-19 17:23:32 -05:00
|
|
|
#include <mongoose.h>
|
2019-08-19 15:15:33 -05:00
|
|
|
#include "WebSocketSession.hh"
|
2019-08-20 18:14:47 -05:00
|
|
|
#include "VariableServerVariable.hh"
|
2019-06-19 17:23:32 -05:00
|
|
|
|
2019-08-19 16:50:24 -05:00
|
|
|
class VariableServerSession : public WebSocketSession {
|
2019-08-16 18:39:45 -05:00
|
|
|
public:
|
2019-08-19 16:50:24 -05:00
|
|
|
VariableServerSession(struct mg_connection *nc);
|
2019-08-21 10:52:48 -05:00
|
|
|
~VariableServerSession();
|
2019-10-08 14:14:18 -05:00
|
|
|
void marshallData(); /* -- base */
|
2019-08-20 18:14:47 -05:00
|
|
|
void sendMessage(); /* -- base */
|
|
|
|
int handleMessage(std::string); /* -- base */
|
2019-08-16 20:16:27 -05:00
|
|
|
|
2019-08-20 18:14:47 -05:00
|
|
|
void setTimeInterval(unsigned int milliseconds);
|
|
|
|
void addVariable(char* vname);
|
2019-10-08 14:14:18 -05:00
|
|
|
void stageValues();
|
2019-08-20 18:14:47 -05:00
|
|
|
void pause();
|
|
|
|
void unpause();
|
|
|
|
void clear();
|
|
|
|
void exit();
|
2019-08-16 20:16:27 -05:00
|
|
|
|
2019-08-16 18:39:45 -05:00
|
|
|
static int bad_ref_int ;
|
|
|
|
|
|
|
|
private:
|
2019-08-19 15:15:33 -05:00
|
|
|
int sendErrorMessage(const char* fmt, ... );
|
2019-08-20 18:14:47 -05:00
|
|
|
REF2* make_error_ref(const char* in_name);
|
|
|
|
double stageTime;
|
2019-10-08 14:14:18 -05:00
|
|
|
bool dataStaged;
|
|
|
|
|
2019-08-20 18:14:47 -05:00
|
|
|
std::vector<VariableServerVariable*> sessionVariables;
|
|
|
|
bool cyclicSendEnabled;
|
|
|
|
long long nextTime;
|
|
|
|
long long intervalTimeTics;
|
2019-06-19 17:23:32 -05:00
|
|
|
};
|
2019-10-08 14:14:18 -05:00
|
|
|
|
|
|
|
WebSocketSession* makeVariableServerSession( struct mg_connection *nc );
|
2019-06-19 17:23:32 -05:00
|
|
|
#endif
|