Subversion Repositories HomeAutomation

Rev

Rev 999 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 999 Rev 1008
Line 22... Line 22...
22
#include "virtualmachine.h"
22
#include "virtualmachine.h"
23
#include "commandthread.h"
23
#include "commandthread.h"
24
 
24
 
25
CommandThread::CommandThread()
25
CommandThread::CommandThread()
26
{
26
{
-
 
27
    myBuffer = "";
27
}
28
}
28
 
29
 
29
CommandThread::~CommandThread()
30
CommandThread::~CommandThread()
30
{
31
{
31
}
32
}
32
 
33
 
33
void CommandThread::handleClientData(int id, string data)
34
void CommandThread::handleClientData(int id, string data)
34
{
35
{
35
    VirtualMachine &vm = VirtualMachine::getInstance();
36
    VirtualMachine &vm = VirtualMachine::getInstance();
36
 
37
 
-
 
38
    myBuffer += data;
-
 
39
   
-
 
40
    string tempBuffer = str_replace("\r", "", myBuffer);
-
 
41
    tempBuffer = str_replace("\n", "\\n", tempBuffer);
-
 
42
   
-
 
43
    if (tempBuffer[tempBuffer.size()-1] == ';')
-
 
44
    {
37
    vm.queueExpression(Expression(id, data));
45
        vm.queueExpression(Expression(id, tempBuffer));
-
 
46
        myBuffer = "";
-
 
47
    }
38
}
48
}