mirror of
https://github.com/nasa/trick.git
synced 2024-12-21 22:17:51 +00:00
c2e42f4ef4
- Split VariableServerThread into VariableServerSession and VariableReference classes - Use C++ streams for data handling - Unit tests
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
/*************************************************************************
|
|
PURPOSE: (Represent the state of a variable server websocket connection.)
|
|
**************************************************************************/
|
|
|
|
#ifndef WSSESSION_HH
|
|
#define WSSESSION_HH
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
#ifndef SWIG
|
|
#include "CivetServer.h"
|
|
#endif
|
|
|
|
#include "trick/WebSocketSession.hh"
|
|
#include "VariableServerVariable.hh"
|
|
|
|
class VariableServerSession : public WebSocketSession {
|
|
public:
|
|
VariableServerSession(struct mg_connection *nc);
|
|
~VariableServerSession();
|
|
void marshallData(); /* -- base */
|
|
void sendMessage(); /* -- base */
|
|
int handleMessage(const 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, ... );
|
|
int sendSieMessage(void);
|
|
int sendUnitsMessage(const char* vname);
|
|
// REF2* make_error_ref(const char* in_name);
|
|
double stageTime;
|
|
bool dataStaged;
|
|
|
|
std::vector<VariableServerVariable*> session_variables;
|
|
bool cyclicSendEnabled;
|
|
long long nextTime;
|
|
long long intervalTimeTics;
|
|
};
|
|
|
|
WebSocketSession* makeVariableServerSession( struct mg_connection *nc );
|
|
#endif
|