Subversion Repositories HomeAutomation

Rev

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

Rev 969 Rev 971
Line 40... Line 40...
40
using namespace v8;
40
using namespace v8;
41
 
41
 
42
Handle<Value> VirtualMachine_log(const Arguments& args);
42
Handle<Value> VirtualMachine_log(const Arguments& args);
43
Handle<Value> VirtualMachine_sendCanMessage(const Arguments& args);
43
Handle<Value> VirtualMachine_sendCanMessage(const Arguments& args);
44
Handle<Value> VirtualMachine_loadScript(const Arguments& args);
44
Handle<Value> VirtualMachine_loadScript(const Arguments& args);
45
Handle<Value> VirtualMachine_clearInterval(const Arguments& args);
45
Handle<Value> VirtualMachine_stopIntervalThread(const Arguments& args);
46
Handle<Value> VirtualMachine_setTimeout(const Arguments& args);
-
 
47
Handle<Value> VirtualMachine_setInterval(const Arguments& args);
46
Handle<Value> VirtualMachine_startIntervalThread(const Arguments& args);
48
 
47
 
49
class VirtualMachine : public Thread<VirtualMachine>
48
class VirtualMachine : public Thread<VirtualMachine>
50
{
49
{
51
public:
50
public:
52
    static VirtualMachine& getInstance();
51
    static VirtualMachine& getInstance();
Line 56... Line 55...
56
    void queueExpression(string expression);
55
    void queueExpression(string expression);
57
 
56
 
58
    void run();
57
    void run();
59
 
58
 
60
    bool loadScript(string scriptName);
59
    bool loadScript(string scriptName);
61
    int setInterval(string expression, int interval, bool single);
60
    unsigned int startIntervalThread(unsigned int timeout);
62
    bool clearInterval(int timeoutId);
61
    bool stopIntervalThread(unsigned int id);
63
 
62
 
64
private:
63
private:
65
    void callHandleHeartbeat(int hardwareId);
64
    void callHandleHeartbeat(int hardwareId);
66
    void callHandleMessage(CanMessage canMessage);
65
    void callHandleMessage(CanMessage canMessage);
67
    bool runExpression(string expression);
66
    bool runExpression(string expression);
Line 82... Line 81...
82
    Semaphore mySemaphore;
81
    Semaphore mySemaphore;
83
 
82
 
84
    ThreadSafeQueue<string> myExpressions;
83
    ThreadSafeQueue<string> myExpressions;
85
    ThreadSafeQueue<CanMessage> myCanMessages;
84
    ThreadSafeQueue<CanMessage> myCanMessages;
86
 
85
 
87
    map<int, IntervalThread> myTimers;
86
    map<int, IntervalThread> myIntervalThreads;
88
};
87
};
89
 
88
 
90
#endif  /* _VIRTUALMACHINE_H */
89
#endif  /* _VIRTUALMACHINE_H */
91
 
90