forked from M-griffin/EtherTerm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sequenceManager.cpp
97 lines (81 loc) · 2.3 KB
/
sequenceManager.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// EtherTerm SVN: $Id$
// Source: $HeadURL$
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy$
#include "safeQueue.hpp"
#include "messageQueue.hpp"
#include "sequenceManager.hpp"
#include "queueManager.hpp"
#include "sequenceParser.hpp"
#include "renderer.hpp"
#include <iostream>
// Init the Global Instance
SequenceManager* SequenceManager::m_globalInstance = nullptr;
SequenceManager::SequenceManager()
{ }
SequenceManager::~SequenceManager()
{
std::cout << "SequenceManager Released." << std::endl;
}
/*
* Process Any Waiting Decided Data
* Push to the Parser for Display
*/
void SequenceManager::update()
{
//std::cout << "SequenceManager upadate() " << std::endl;
if(TheQueueManager::Instance()->m_queue.isEmpty())
return;
/*
* Loop the Queue and Send all decoded data
* Through to be parsed and displayed.
*/
MessageQueue msgQueue;
while(!TheQueueManager::Instance()->m_queue.isEmpty())
{
msgQueue = std::move(TheQueueManager::Instance()->m_queue.dequeue());
if(msgQueue.m_text.empty())
{
// Make Sure Vector is not Empty!
if(msgQueue.m_queueParams.size() > 0)
{
TheSequenceParser::Instance()->sequenceInput(
msgQueue.m_queueParams);
}
}
else
{
TheSequenceParser::Instance()->textInput(
msgQueue.m_text);
}
msgQueue.clear();
}
/*
* Render The final screen data
* 1. Copy Surface to Texture
* 2. Render the Texture to Monitor.
*/
TheRenderer::Instance()->renderScreen();
TheRenderer::Instance()->drawTextureScreen();
// When no data received, this is when we want to show the cursor!
// Setup cursor in current x/y position Cursor. after getting
// New Data Received.
if (TheSequenceParser::Instance()->isCursorActive())
{
TheRenderer::Instance()->setupCursorChar();
TheRenderer::Instance()->renderCursorOnScreen();
TheRenderer::Instance()->drawTextureScreen();
}
// Clear And Move on.
msgQueue.clear();
}
/*
* Decode and Store Data in the Queue
*/
void SequenceManager::decode(std::string input)
{
//SequenceDecoder seq;
//seq.decodeEscSequenceData(input);
decodeEscSequenceData(input);
}