forked from aryeharmon/activetick
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSession.h
More file actions
51 lines (44 loc) · 1.46 KB
/
Session.h
File metadata and controls
51 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <string>
#include <queue>
#include <node.h>
#include "Jsonifier.h"
#include "import/atfeed-cppsdk/include/ActiveTickServerAPI/ActiveTickServerAPI.h"
#include "import/libjson/_internal/Source/JSONNode.h"
using namespace v8;
class APISession
{
public:
APISession( std::queue< JSONNode > *pInboundMsgs );
virtual ~APISession(void);
public:
uint64_t GetSessionHandle() const { return m_hSession; }
public:
bool Init( const ATGUID& apiUserid,
const std::string& serverIpAddress,
uint32_t serverPort,
const wchar16_t* userid,
const wchar16_t* password );
bool Destroy();
private:
static void ATSessionStatusChangeCallback(
uint64_t hSession,
ATSessionStatusType statusType);
static void ATLoginResponseCallback(
uint64_t hSession,
uint64_t hRequest,
LPATLOGIN_RESPONSE pResponse );
static void ATServerTimeUpdateCallback( LPATTIME pTime );
static void ATRequestTimeoutCallback( uint64_t hOrigRequest );
private:
static JSONNode jsonifyAtloginResponse( LPATLOGIN_RESPONSE pResponse );
private:
uint64_t m_hSession;
uint64_t m_hLastRequest;
wchar16_t m_userid[50];
wchar16_t m_password[50];
private:
static Jsonifier m_jsonifier;
static APISession* s_pInstance;
static std::queue< JSONNode > *s_pInboundMsgs;
};