Subversion Repositories HomeAutomation

Rev

Rev 1608 | Rev 1625 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1608 Rev 1609
Line 29... Line 29...
29
namespace vm {
29
namespace vm {
30
namespace plugin {
30
namespace plugin {
31
 
31
 
32
logging::Logger System::LOG("vm::plugin::System");
32
logging::Logger System::LOG("vm::plugin::System");
33
   
33
   
34
System::System()
34
System::System(bool legacy)
35
{
35
{
36
    this->name_ = "system";
36
    this->name_ = "system";
-
 
37
   
-
 
38
    this->legacy_ = legacy;
37
                 
39
                 
38
    this->ExportFunction("Log",        System::Export_Log);
40
    this->ExportFunction("Log",        System::Export_Log);
39
    this->ExportFunction("LoadScript", System::Export_LoadScript);
41
    this->ExportFunction("LoadScript", System::Export_LoadScript);
40
    this->ExportFunction("Execute",    System::Export_Execute);
42
    this->ExportFunction("Execute",    System::Export_Execute);
41
}
43
}
42
 
44
 
43
System::~System()
45
System::~System()
44
{
46
{
45
 
47
 
46
}
48
}
47
 
49
 
48
void System::InitializeDone()
50
void System::InitializeDone()
49
{
51
{
50
    Plugin::InitializeDone();
52
    Plugin::InitializeDone();
51
   
53
   
52
    this->ImportFunction("Start");
54
    this->ImportFunction("Start");
53
   
55
   
54
    this->Call(0, "Start", ArgumentListPointer(new ArgumentList));
56
    ArgumentListPointer arguments = ArgumentListPointer(new ArgumentList);
-
 
57
   
-
 
58
    arguments->push_back(v8::Boolean::New(this->legacy_));
-
 
59
   
-
 
60
    this->Call(0, "Start", arguments);
55
}
61
}
56
 
62
 
57
Value System::Export_Log(const v8::Arguments& args)
63
Value System::Export_Log(const v8::Arguments& args)
58
{
64
{
59
    if (args.Length() < 1)
65
    if (args.Length() < 1)
Line 68... Line 74...
68
    return v8::Undefined();
74
    return v8::Undefined();
69
}
75
}
70
 
76
 
71
Value System::Export_LoadScript(const v8::Arguments& args)
77
Value System::Export_LoadScript(const v8::Arguments& args)
72
{
78
{
73
    LOG.Debug(std::string(__FUNCTION__) + " called!");
79
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
74
   
80
   
75
    if (args.Length() < 1)
81
    if (args.Length() < 1)
76
    {
82
    {
77
        LOG.Error("To few arguments.");
83
        LOG.Error("To few arguments.");
78
    }
84
    }
Line 82... Line 88...
82
    return v8::Boolean::New(Manager::Instance()->LoadScript(*str));
88
    return v8::Boolean::New(Manager::Instance()->LoadScript(*str));
83
}
89
}
84
 
90
 
85
Value System::Export_Execute(const v8::Arguments& args)
91
Value System::Export_Execute(const v8::Arguments& args)
86
{
92
{
87
    LOG.Debug(std::string(__FUNCTION__) + " called!");
93
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
88
   
94
   
89
    if (args.Length() < 1)
95
    if (args.Length() < 1)
90
    {
96
    {
91
        LOG.Error("To few arguments.");
97
        LOG.Error("To few arguments.");
92
    }
98
    }