@@ -106,7 +106,7 @@ public VirtualCLU(String name, Inet4Address address, Path aDriveDirectory) {
106
106
this .aDriveDirectory = aDriveDirectory ;
107
107
108
108
featureFunctions .put (0 , this ::getUptime ); // clu_uptime
109
- VirtualCLU . this . featureValues .put (2 , valueOf (0 )); // clu_state
109
+ featureValues .put (2 , valueOf (0 )); // clu_state
110
110
featureFunctions .put (5 , this ::getCurrentDateAsString ); // clu_date
111
111
featureFunctions .put (6 , this ::getCurrentTimeAsString ); // clu_time
112
112
featureFunctions .put (7 , this ::getCurrentDayOfMonth ); // clu_day
@@ -116,11 +116,11 @@ public VirtualCLU(String name, Inet4Address address, Path aDriveDirectory) {
116
116
featureFunctions .put (11 , this ::getCurrentHour ); // clu_hour
117
117
featureFunctions .put (12 , this ::getCurrentMinute ); // clu_minute
118
118
featureFunctions .put (13 , this ::getCurrentEpochSeconds ); // clu_localtime
119
- VirtualCLU . this . featureValues .put (14 , valueOf (UTC_TIMEZONE_ID )); // clu_timezone
120
- VirtualCLU . this . featureValues .put (20 , valueOf ("ssl://localhost:8883" )); // clu_mqtturl
119
+ featureValues .put (14 , valueOf (UTC_TIMEZONE_ID )); // clu_timezone
120
+ featureValues .put (20 , valueOf ("ssl://localhost:8883" )); // clu_mqtturl
121
121
featureFunctions .put (21 , arg1 -> { // clu_usemqtt
122
122
if (arg1 .isnil ()) {
123
- return VirtualCLU . this . featureValues .get (21 );
123
+ return featureValues .get (21 );
124
124
}
125
125
126
126
// Sometimes OM uses true/false and sometimes 0/1
@@ -153,14 +153,14 @@ public VirtualCLU(String name, Inet4Address address, Path aDriveDirectory) {
153
153
154
154
@ Override
155
155
public void setup () {
156
- VirtualCLU . this . featureValues .put (2 , valueOf (1 )); // clu_state
156
+ featureValues .put (2 , valueOf (1 )); // clu_state
157
157
158
158
triggerEvent (0 ); // clu_oninit
159
159
}
160
160
161
161
@ Override
162
162
public void loop () {
163
- final boolean mqttEnable = VirtualCLU . this . featureValues .get (21 ).checkboolean ();
163
+ final boolean mqttEnable = featureValues .get (21 ).checkboolean ();
164
164
final boolean mqttAlreadyEnabled = mqttClient != null ;
165
165
if (mqttEnable ^ mqttAlreadyEnabled ) {
166
166
disableMqtt ();
@@ -244,7 +244,7 @@ private ZonedDateTime getCurrentDateTime() {
244
244
}
245
245
246
246
private ZoneId getCurrentZoneId () {
247
- final LuaValue zoneIdLuaValue = VirtualCLU . this . featureValues .get (14 );
247
+ final LuaValue zoneIdLuaValue = featureValues .get (14 );
248
248
if (!zoneIdLuaValue .isint ()) {
249
249
return ZoneOffset .UTC ;
250
250
}
@@ -260,18 +260,18 @@ private LuaNumber getCurrentEpochSeconds(LuaValue arg1) {
260
260
}
261
261
262
262
private LuaValue addToLog (LuaValue arg ) {
263
- VirtualCLU . this . featureValues .put (1 , arg );
263
+ featureValues .put (1 , arg );
264
264
265
265
if (!arg .isnil ()) {
266
266
final String logValue = String .valueOf (arg .checkstring ());
267
- LOGGER .info (VirtualCLU . this . name + ": " + logValue );
267
+ LOGGER .info (name + ": " + logValue );
268
268
}
269
269
270
270
return LuaValue .NIL ;
271
271
}
272
272
273
273
private LuaValue clearLog (LuaValue arg ) {
274
- VirtualCLU . this . featureValues .put (1 , LuaValue .NIL );
274
+ featureValues .put (1 , LuaValue .NIL );
275
275
276
276
return LuaValue .NIL ;
277
277
}
@@ -293,7 +293,7 @@ private void disableMqtt() {
293
293
private void enableMqtt () {
294
294
// TODO: manage the client connection and topics
295
295
// TODO: expose some LUA API to publish/subscribe
296
- final String mqttUrl = String .valueOf (VirtualCLU . this . featureValues .get (20 ).checkstring ());
296
+ final String mqttUrl = String .valueOf (featureValues .get (20 ).checkstring ());
297
297
298
298
try {
299
299
LOGGER .info ("Connecting to MQTT on: {}" , mqttUrl );
0 commit comments