-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJsonCalls.ino
569 lines (486 loc) · 19 KB
/
JsonCalls.ino
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
/*
***************************************************************************
** Program : JsonCalls, part of DSMRloggerAPI
** Version : v3.0.0
**
** Copyright (c) 2021 Martijn Hendriks
**
** TERMS OF USE: MIT License. See bottom of file.
***************************************************************************
*/
#define ACTUALELEMENTS 21
#define INFOELEMENTS 5
#define FIELDELEMENTS 1
byte fieldsElements = 0;
char Onefield[25];
bool onlyIfPresent = false;
const static PROGMEM char infoArray[][25] = { "identification","p1_version","equipment_id","highest_peak_pwr", "highest_peak_pwr_13mnd" };
const static PROGMEM char actualArray[][25] = { "timestamp","electricity_tariff","energy_delivered_tariff1","energy_delivered_tariff2","energy_returned_tariff1","energy_returned_tariff2","power_delivered","power_returned","voltage_l1","voltage_l2","voltage_l3","current_l1","current_l2","current_l3","power_delivered_l1","power_delivered_l2","power_delivered_l3","power_returned_l1","power_returned_l2","power_returned_l3","peak_pwr_last_q"};
DynamicJsonDocument jsonDoc(4100); // generic doc to return, clear() before use!
void JsonGas(){
if (!gasDelivered) return;
jsonDoc["gas_delivered"]["value"] = (int)(gasDelivered*1000)/1000.0;
jsonDoc["gas_delivered"]["unit"] = "m3";
}
//--------------------------
void JsonGasID(){
switch (mbusGas) {
case 1: if ( DSMRdata.mbus1_equipment_id_tc_present ) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus1_equipment_id_tc;
else if (DSMRdata.mbus1_equipment_id_ntc_present) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus1_equipment_id_ntc;
break;
case 2: if ( DSMRdata.mbus2_equipment_id_tc_present ) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus2_equipment_id_tc;
else if (DSMRdata.mbus2_equipment_id_ntc_present) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus2_equipment_id_ntc;
break;
case 3: if ( DSMRdata.mbus3_equipment_id_tc_present ) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus3_equipment_id_tc;
else if (DSMRdata.mbus3_equipment_id_ntc_present) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus3_equipment_id_ntc;
break;
case 4: if ( DSMRdata.mbus4_equipment_id_tc_present ) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus4_equipment_id_tc;
else if (DSMRdata.mbus4_equipment_id_ntc_present) jsonDoc["gas_equipment_id"]["value"] = DSMRdata.mbus4_equipment_id_ntc;
break;
default: break; //do nothing
}
}
//--------------------------
struct buildJson {
template<typename Item>
void apply(Item &i) {
String Name = String(Item::name);
if (isInFieldsArray(Name.c_str())) {
if (i.present())
{
String Unit = Item::unit();
jsonDoc[Name]["value"] = value_to_json(i.val());
if (Unit.length() > 0) jsonDoc[Name]["unit"] = Unit;
} else if (!onlyIfPresent) {
jsonDoc[Name]["value"] = "-";
}
} //infielsarrayname
yield();
}
template<typename Item>
Item& value_to_json(Item& i) {
return i;
}
double value_to_json(TimestampedFixedValue i) {
return i.int_val()/1000.0;
}
double value_to_json(FixedValue i) {
return i.int_val()/1000.0;
}
}; // buildjson{}
//=======================================================================
void processAPI() {
// char fName[40] = "";
char URI[50] = "";
String words[10];
strncpy( URI, httpServer.uri().c_str(), sizeof(URI) );
if (httpServer.method() == HTTP_GET)
DebugTf("from[%s] URI[%s] method[GET] \r\n"
, httpServer.client().remoteIP().toString().c_str()
, URI);
else DebugTf("from[%s] URI[%s] method[PUT] \r\n"
, httpServer.client().remoteIP().toString().c_str()
, URI);
if (ESP.getFreeHeap() < 5000) // to prevent firmware from crashing!
{
DebugTf("==> Bailout due to low heap (%d bytes))\r\n", ESP.getFreeHeap() );
httpServer.send(500, "text/plain", "500: internal server error (low heap)\r\n");
return;
}
int8_t wc = splitString(URI, '/', words, 10);
if (Verbose2)
{
DebugT(">>");
for (int w=0; w<wc; w++)
{
Debugf("word[%d] => [%s], ", w, words[w].c_str());
}
Debugln(" ");
}
if (words[2] != "v2")
{
sendApiNotFound(URI);
return;
}
if (words[3] == "dev")
{
handleDevApi(URI, words[4].c_str(), words[5].c_str(), words[6].c_str());
}
else if (words[3] == "hist")
{
handleHistApi(URI, words[4].c_str(), words[5].c_str(), words[6].c_str());
}
else if (words[3] == "sm")
{
handleSmApi(URI, words[4].c_str(), words[5].c_str(), words[6].c_str());
}
else sendApiNotFound(URI);
} // processAPI()
template <typename TSource>
void sendJson(const TSource &doc)
{
if (doc.isNull()) {
// DebugT(F("sendjson isNull"));
sendJsonBuffer("{}");
return;
}
String buffer;
if (Verbose1) serializeJsonPretty(doc,buffer);
else serializeJson(doc,buffer);
// DebugT(F("Sending json: ")); Debugln(buffer);
// DebugT("strsize:"); Debugln(strsize);
sendJsonBuffer(buffer.c_str());
DebugTln(F("sendJson: json sent .."));
}
void sendJsonBuffer(const char* buffer){
httpServer.sendHeader("Access-Control-Allow-Origin", "*");
httpServer.setContentLength(strlen(buffer));
httpServer.send(200, "application/json", buffer);
} //sendJsonBuffer
void sendDeviceTime()
{
char buffer[80];
// {"timestamp":"201201074021S","time":"2020-12-01 07:40:21","epoch":1606808619}
sprintf_P(buffer,PSTR("{\"timestamp\":\"%s\",\"time\":\"%s\",\"epoch\":%d}"), actTimestamp, buildDateTimeString(actTimestamp, sizeof(actTimestamp)).c_str() , now() );
sendJsonBuffer(buffer);
} // sendDeviceTime()
void sendDeviceInfo()
{
DynamicJsonDocument doc(1500);
doc["fwversion"] = _VERSION;
snprintf(cMsg, sizeof(cMsg), "%s %s", __DATE__, __TIME__);
doc["compiled"] = cMsg;
doc["smr_version"] = DSMR_NL?"NL":"BE";
doc["hostname"] = settingHostname;
doc["ipaddress"] = WiFi.localIP().toString();
doc["indexfile"] = settingIndexPage;
doc["macaddress"] = WiFi.macAddress();
doc["freeheap"] ["value"] = ESP.getFreeHeap();
doc["freeheap"]["unit"] = "bytes";
doc["maxfreeblock"] ["value"] = ESP.getMaxFreeBlockSize();
doc["maxfreeblock"]["unit"] = "bytes";
doc["chipid"] = String( ESP.getChipId(), HEX );
doc["coreversion"] = String( ESP.getCoreVersion() );
doc["sdkversion"] = String( ESP.getSdkVersion() );
doc["cpufreq"] ["value"] = ESP.getCpuFreqMHz();
doc["cpufreq"]["unit"] = "MHz";
doc["sketchsize"] ["value"] = formatFloat( (ESP.getSketchSize() / 1024.0), 3);
doc["sketchsize"]["unit"] = "kB";
doc["freesketchspace"] ["value"] = formatFloat( (ESP.getFreeSketchSpace() / 1024.0), 3);
doc["freesketchspace"]["unit"] = "kB";
if ((ESP.getFlashChipId() & 0x000000ff) == 0x85)
snprintf(cMsg, sizeof(cMsg), "%08X (PUYA)", ESP.getFlashChipId());
else snprintf(cMsg, sizeof(cMsg), "%08X", ESP.getFlashChipId());
doc["flashchipid"] = cMsg;
doc["flashchipsize"] ["value"] = formatFloat((ESP.getFlashChipSize() / 1024.0 / 1024.0), 3);
doc["flashchipsize"]["unit"] = "MB";
doc["flashchiprealsize"] ["value"] = formatFloat((ESP.getFlashChipRealSize() / 1024.0 / 1024.0), 3);
doc["flashchiprealsize"]["unit"] = "MB";
FS.info(fs_info);
doc["spiffssize"] ["value"] = formatFloat( (fs_info.totalBytes / (1024.0 * 1024.0)), 0);
doc["spiffssize"]["unit"] = "MB";
doc["flashchipspeed"] ["value"] = formatFloat((ESP.getFlashChipSpeed() / 1000.0 / 1000.0), 0);
doc["flashchipspeed"]["unit"] = "MHz";
FlashMode_t ideMode = ESP.getFlashChipMode();
doc["flashchipmode"] = flashMode[ideMode];
doc["boardtype"] = ARDUINO_BOARD;
doc["compileoptions"] = ALL_OPTIONS;
doc["ssid"] = WiFi.SSID();
#ifdef SHOW_PASSWRDS
doc["pskkey"] = WiFi.psk();
#endif
doc["wifirssi"] = WiFi.RSSI();
doc["uptime"] = upTime();
doc["smhasfaseinfo"] = (int)settingSmHasFaseInfo;
if ( DSMRdata.p1_version == "50" || !DSMR_NL ) doc["telegraminterval"] = 1;
else doc["telegraminterval"] = 10;
doc["telegramcount"] = (int)telegramCount;
doc["telegramerrors"] = (int)telegramErrors;
snprintf(cMsg, sizeof(cMsg), "%s:%04d", settingMQTTbroker, settingMQTTbrokerPort);
doc["mqttbroker"] = cMsg;
doc["mqttinterval"] = settingMQTTinterval;
if (mqttIsConnected)
doc["mqttbroker_connected"] = "yes";
else doc["mqttbroker_connected"] = "no";
doc["reboots"] = (int)P1Status.reboots;
doc["lastreset"] = lastReset;
sendJson(doc);
} // sendDeviceInfo()
//=======================================================================
void sendDeviceSettings()
{
DebugTln(F("sending device settings ...\r"));
DynamicJsonDocument doc(2100);
doc["hostname"]["value"] = settingHostname;
doc["hostname"]["type"] = "s";
doc["hostname"]["maxlen"] = sizeof(settingHostname) -1;
doc["ed_tariff1"]["value"] = settingEDT1;
doc["ed_tariff1"]["type"] = "f";
doc["ed_tariff1"]["min"] = 0;
doc["ed_tariff1"]["max"] = 10;
doc["ed_tariff2"]["value"] = settingEDT2;
doc["ed_tariff2"]["type"] = "f";
doc["ed_tariff2"]["min"] = 0;
doc["ed_tariff2"]["max"] = 10;
doc["er_tariff1"]["value"] = settingERT1;
doc["er_tariff1"]["type"] = "f";
doc["er_tariff1"]["min"] = 0;
doc["er_tariff1"]["max"] = 10;
doc["er_tariff2"]["value"] = settingERT2;
doc["er_tariff2"]["type"] = "f";
doc["er_tariff2"]["min"] = 0;
doc["er_tariff2"]["max"] = 10;
doc["gd_tariff"]["value"] = settingGDT;
doc["gd_tariff"]["type"] = "f";
doc["gd_tariff"]["min"] = 0;
doc["gd_tariff"]["max"] = 10;
doc["electr_netw_costs"]["value"] = settingENBK;
doc["electr_netw_costs"]["type"] = "f";
doc["electr_netw_costs"]["min"] = 0;
doc["electr_netw_costs"]["max"] = 100;
doc["gas_netw_costs"]["value"] = settingGNBK;
doc["gas_netw_costs"]["type"] = "f";
doc["gas_netw_costs"]["min"] = 0;
doc["gas_netw_costs"]["max"] = 100;
doc["sm_has_fase_info"]["value"] = settingSmHasFaseInfo;
doc["sm_has_fase_info"]["type"] = "i";
doc["sm_has_fase_info"]["min"] = 0;
doc["sm_has_fase_info"]["max"] = 1;
doc["IndexPage"]["value"] = settingIndexPage;
doc["IndexPage"]["type"] = "s";
doc["IndexPage"]["maxlen"] = sizeof(settingIndexPage) -1;
doc["mqtt_broker"]["value"] = settingMQTTbroker;
doc["mqtt_broker"]["type"] = "s";
doc["mqtt_broker"]["maxlen"] = sizeof(settingIndexPage) -1;
doc["mqtt_broker_port"]["value"] = settingMQTTbrokerPort;
doc["mqtt_broker_port"]["type"] = "i";
doc["mqtt_broker_port"]["min"] = 1;
doc["mqtt_broker_port"]["max"] = 9999;
doc["mqtt_user"]["value"] = settingMQTTuser;
doc["mqtt_user"]["type"] = "s";
doc["mqtt_user"]["maxlen"] = sizeof(settingMQTTuser) -1;
doc["mqtt_passwd"]["value"] = settingMQTTpasswd;
doc["mqtt_passwd"]["type"] = "s";
doc["mqtt_passwd"]["maxlen"] = sizeof(settingMQTTpasswd) -1;
doc["mqtt_toptopic"]["value"] = settingMQTTtopTopic;
doc["mqtt_toptopic"]["type"] = "s";
doc["mqtt_toptopic"]["maxlen"] = sizeof(settingMQTTtopTopic) -1;
doc["mqtt_interval"]["value"] = settingMQTTinterval;
doc["mqtt_interval"]["type"] = "i";
doc["mqtt_interval"]["min"] = 0;
doc["mqtt_interval"]["max"] = 600;
if ( strncmp(BaseOTAurl, "http://", 7) == 0 ){
char ota_url[sizeof(BaseOTAurl)];
strncpy( ota_url, BaseOTAurl + 7, strlen(BaseOTAurl) );
doc["ota_url"]["value"] = ota_url;
doc["ota_url"]["maxlen"] = sizeof(ota_url) - 1;
} else {
doc["ota_url"]["value"] = BaseOTAurl;
doc["ota_url"]["maxlen"] = sizeof(BaseOTAurl) -1;
}
doc["ota_url"]["type"] = "s";
doc["b_auth_user"]["value"] = bAuthUser;
doc["b_auth_user"]["type"] = "s";
doc["b_auth_user"]["maxlen"] = sizeof(bAuthUser) -1;
doc["b_auth_pw"]["value"] = bAuthPW;
doc["b_auth_pw"]["type"] = "s";
doc["b_auth_pw"]["maxlen"] = sizeof(bAuthPW) -1;
//booleans
doc["hist"] = EnableHistory;
doc["led"] = LEDenabled;
// doc["ha_disc_enabl"] = EnableHAdiscovery;
sendJson(doc);
} // sendDeviceSettings()
//====================================================
void sendApiNotFound(const char *URI)
{
DebugTln(F("sending device settings ...\r"));
// String output = "{\"error\":{\"url\":\"" + String(URI) + "\",\"message\":\"url not valid\"}}";
byte len = 47 + strlen(URI);
char buffer[len];
sprintf_P(buffer,PSTR("{\"error\":{\"url\":\"%s\",\"message\":\"url not valid\"}}"), URI);
httpServer.sendHeader("Access-Control-Allow-Origin", "*");
httpServer.setContentLength(len);
httpServer.send(404, "application/json", buffer);
} // sendApiNotFound()
//====================================================
void handleSmApi(const char *URI, const char *word4, const char *word5, const char *word6)
{
//DebugTf("word4[%s], word5[%s], word6[%s]\r\n", word4, word5, word6);
switch (word4[0]) {
case 'i': //info
onlyIfPresent = false;
fieldsElements = INFOELEMENTS;
jsonDoc.clear();
DSMRdata.applyEach(buildJson());
JsonGasID();
sendJson(jsonDoc);
break;
case 'a': //actual
fieldsElements = ACTUALELEMENTS;
onlyIfPresent = true;
jsonDoc.clear();
DSMRdata.applyEach(buildJson());
JsonGas();
sendJson(jsonDoc);
break;
case 'f': //fields
fieldsElements = 0;
onlyIfPresent = false;
if (strlen(word5) > 0)
{
strCopy(Onefield, 24, word5);
fieldsElements = FIELDELEMENTS;
}
jsonDoc.clear();
DSMRdata.applyEach(buildJson());
if (strlen(word5) == 0) JsonGas();
sendJson(jsonDoc);
break;
case 't': //telegramm
JsonRaw = true;
break;
default:
sendApiNotFound(URI);
}
} // handleSmApi()
//====================================================
void handleDevApi(const char *URI, const char *word4, const char *word5, const char *word6)
{
//DebugTf("word4[%s], word5[%s], word6[%s]\r\n", word4, word5, word6);
if (strcmp(word4, "info") == 0)
{
sendDeviceInfo();
}
else if (strcmp(word4, "time") == 0)
{
sendDeviceTime();
}
else if (strcmp(word4, "settings") == 0)
{
if (httpServer.method() == HTTP_PUT || httpServer.method() == HTTP_POST)
{
//------------------------------------------------------------
// json string: {"name":"settingInterval","value":9}
// json string: {"name":"settingTelegramInterval","value":123.45}
// json string: {"name":"settingTelegramInterval","value":"abc"}
//------------------------------------------------------------
// so, why not use ArduinoJSON library?
// I say: try it yourself ;-) It won't be easy
String wOut[5];
String wPair[5];
String jsonIn = httpServer.arg(0).c_str();
char field[25] = "";
char newValue[101]="";
jsonIn.replace("{", "");
jsonIn.replace("}", "");
jsonIn.replace("\"", "");
int8_t wp = splitString(jsonIn.c_str(), ',', wPair, 5) ;
for (int i=0; i<wp; i++)
{
//DebugTf("[%d] -> pair[%s]\r\n", i, wPair[i].c_str());
int8_t wc = splitString(wPair[i].c_str(), ':', wOut, 5) ;
//DebugTf("==> [%s] -> field[%s]->val[%s]\r\n", wPair[i].c_str(), wOut[0].c_str(), wOut[1].c_str());
if (wOut[0].equalsIgnoreCase("name")) strCopy(field, sizeof(field), wOut[1].c_str());
if (wOut[0].equalsIgnoreCase("value")) strCopy(newValue, sizeof(newValue), wOut[1].c_str());
}
//DebugTf("--> field[%s] => newValue[%s]\r\n", field, newValue);
updateSetting(field, newValue);
httpServer.send(200, "application/json", httpServer.arg(0));
}
else
{
sendDeviceSettings();
}
}
else if (strcmp(word4, "debug") == 0)
{
sendDeviceDebug(URI, word5);
}
else sendApiNotFound(URI);
} // handleDevApi()
//====================================================
void handleHistApi(const char *URI, const char *word4, const char *word5, const char *word6)
{
if (!EnableHistory)
{
httpServer.send(200, "application/json", F("{\"error\":\"History Data is disabled\"}"));
return; //do nothing
}
//DebugTf("word4[%s], word5[%s], word6[%s]\r\n", word4, word5, word6);
if ( strcmp(word4, "hours") == 0 )
{
RingFileTo(RINGHOURS, true);
return;
}
else if (strcmp(word4, "days") == 0 )
{
RingFileTo(RINGDAYS, true);
return;
}
else if (strcmp(word4, "months") == 0)
{
if (httpServer.method() == HTTP_PUT || httpServer.method() == HTTP_POST)
{
//------------------------------------------------------------
// json string: {"recid":"29013023"
// ,"edt1":2601.146,"edt2":"9535.555"
// ,"ert1":378.074,"ert2":208.746
// ,"gdt":3314.404}
//------------------------------------------------------------
//--- update MONTHS
writeRingFile(RINGMONTHS, httpServer.arg(0).c_str());
return;
}
else
{
RingFileTo(RINGMONTHS,true);
return;
}
}
else
{
sendApiNotFound(URI);
return;
}
} // handleHistApi()
//=======================================================================
void sendDeviceDebug(const char *URI, String tail)
{
sendApiNotFound(URI);
} // sendDeviceDebug()
bool isInFieldsArray(const char* lookUp)
{
// DebugTf("Elemts[%2d] | LookUp [%s] | LookUpType[%2d]\r\n", elemts, lookUp, LookUpType);
if (fieldsElements == 0) return true;
for (int i=0; i<fieldsElements; i++)
{
//if (Verbose2) DebugTf("[%2d] Looking for [%s] in array[%s]\r\n", i, lookUp, fieldsArray[i]);
if (fieldsElements == ACTUALELEMENTS ) { if (strcmp_P(lookUp, actualArray[i]) == 0 ) return true; }
else if (fieldsElements == INFOELEMENTS ) { if (strcmp_P(lookUp, infoArray[i]) == 0 ) return true; }
else if (fieldsElements == FIELDELEMENTS ) { if ( (strcmp(lookUp, Onefield) == 0) || (strcmp(lookUp, "timestamp") == 0) ) return true; }
}
return false;
} // isInFieldsArray()
/***************************************************************************
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
***************************************************************************/