This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathLxCommunicator.js
74 lines (60 loc) · 2.62 KB
/
LxCommunicator.js
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
"use strict";
(function() {
var root = this,
previousLxCommunicator = root.LxCommunicator;
// Require and check for any modules
//////////////////////////////////////////////////////////////////////
root.WebSocket = require('./modules/WebSocket');
root.TokenHandler = require('./modules/TokenHandler');
root.HttpRequest = require('./modules/HttpRequest');
root.WebSocketConfig = require('./modules/WebSocketConfig');
root.BinaryEvent = require('./modules/BinaryEvent');
root.FeatureCheck = require('./vendor/FeatureCheck');
root.SupportCode = require('./vendor/SupportCode');
//////////////////////////////////////////////////////////////////////
/**
* Exposes all public classes and methods of LxCommunicator
* @constructor
*/
var LxCommunicator = function LxCommunicator() { };
/**
* Allows you to set the version of the Miniserver.
* The WebSocket will fetch the current version on its own if no version is provided
*/
LxCommunicator.setConfigVersion = root.FeatureCheck.setCurrentVersion;
/**
* Configuration class for the WebSocket
* It also holds the delegate for the WebSocket with the following methods
* socketOnTokenConfirmed(socket, response)
* socketOnTokenReceived(socket, result)
* socketOnTokenRefresh(socket, result) will be refreshed in Miniserver Version 10.1
* socketOnConnectionClosed(socket. code)
* socketOnEventReceived(socket, events, type)
* socketOnDataProgress(socket, progress) -> Only if the socket is a downloadSocket
*/
LxCommunicator.WebSocketConfig = root.WebSocketConfig;
/**
* Main communication channel with the Miniserver
* It handles authentication, encryption, uses the correct protocol (can be defined in the WebSocketConfig)
*/
LxCommunicator.WebSocket = root.WebSocket;
LxCommunicator.TokenHandler = root.TokenHandler;
/**
* HTTP Communication channel with the Miniserver
*/
LxCommunicator.HttpRequest = root.HttpRequest;
/**
* Helper class to interpret the Loxone binary events
*/
LxCommunicator.BinaryEvent = root.BinaryEvent;
LxCommunicator.SupportCode = root.SupportCode;
/**
* Allows the user to restore the "this" reference if we would overwrite a global variable
*/
LxCommunicator.noConflict = function noConflict() {
root.LxCommunicator = previousLxCommunicator;
};
//////////////////////////////////////////////////////////////////////
module.exports = LxCommunicator;
//////////////////////////////////////////////////////////////////////
}).call(this);