@iotize/device-com-nfc.cordova 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/iotize-device-com-nfc.cordova.umd.js +16 -178
- package/bundles/iotize-device-com-nfc.cordova.umd.js.map +1 -1
- package/bundles/iotize-device-com-nfc.cordova.umd.min.js +1 -1
- package/bundles/iotize-device-com-nfc.cordova.umd.min.js.map +1 -1
- package/esm2015/iotize-device-com-nfc.cordova.ngsummary.json +1 -1
- package/esm2015/public_api.ngsummary.json +1 -1
- package/esm2015/www/cordova-interface.js.map +1 -1
- package/esm2015/www/index.js +1 -1
- package/esm2015/www/index.js.map +1 -1
- package/esm2015/www/index.metadata.json +1 -1
- package/esm2015/www/index.ngsummary.json +1 -1
- package/esm2015/www/ndef/parse-ndef-message.js +4 -133
- package/esm2015/www/ndef/parse-ndef-message.js.map +1 -1
- package/esm2015/www/ndef/parse-ndef-message.metadata.json +1 -1
- package/esm2015/www/ndef/parse-ndef-message.ngsummary.json +1 -1
- package/esm2015/www/nfc-com-protocol.js.map +1 -1
- package/fesm2015/iotize-device-com-nfc.cordova.js +6 -134
- package/fesm2015/iotize-device-com-nfc.cordova.js.map +1 -1
- package/iotize-device-com-nfc.cordova.metadata.json +1 -1
- package/package.json +2 -2
- package/plugin.xml +98 -98
- package/src/android/.gradle/4.10.1/fileHashes/fileHashes.bin +0 -0
- package/src/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/src/android/.gradle/vcs-1/gc.properties +0 -0
- package/src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java +1162 -1151
- package/src/ios/AppDelegate+NFC.swift +51 -51
- package/src/ios/NFCHelpers.swift +144 -144
- package/src/ios/NFCNDEFDelegate.swift +78 -78
- package/src/ios/NFCTagReader.swift +536 -506
- package/src/ios/NFCTapPlugin.swift +57 -1
- package/www/index.d.ts +1 -1
- package/www/ndef/parse-ndef-message.d.ts +67 -10
- package/www/phonegap-nfc.js +911 -911
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
20
20
|
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
21
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
22
22
|
var extendStatics = function (d, b) {
|
|
23
23
|
extendStatics = Object.setPrototypeOf ||
|
|
24
24
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -154,8 +154,8 @@
|
|
|
154
154
|
}
|
|
155
155
|
function __generator(thisArg, body) {
|
|
156
156
|
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
157
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
158
|
-
return g
|
|
157
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
158
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
159
159
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
160
160
|
function step(op) {
|
|
161
161
|
if (f)
|
|
@@ -310,13 +310,9 @@
|
|
|
310
310
|
if (!Symbol.asyncIterator)
|
|
311
311
|
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
312
312
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
313
|
-
return i =
|
|
314
|
-
function
|
|
315
|
-
|
|
316
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
|
|
317
|
-
if (f)
|
|
318
|
-
i[n] = f(i[n]);
|
|
319
|
-
} }
|
|
313
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
314
|
+
function verb(n) { if (g[n])
|
|
315
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
320
316
|
function resume(n, v) { try {
|
|
321
317
|
step(g[n](v));
|
|
322
318
|
}
|
|
@@ -396,7 +392,7 @@
|
|
|
396
392
|
if (value !== null && value !== void 0) {
|
|
397
393
|
if (typeof value !== "object" && typeof value !== "function")
|
|
398
394
|
throw new TypeError("Object expected.");
|
|
399
|
-
var dispose
|
|
395
|
+
var dispose;
|
|
400
396
|
if (async) {
|
|
401
397
|
if (!Symbol.asyncDispose)
|
|
402
398
|
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
@@ -406,18 +402,9 @@
|
|
|
406
402
|
if (!Symbol.dispose)
|
|
407
403
|
throw new TypeError("Symbol.dispose is not defined.");
|
|
408
404
|
dispose = value[Symbol.dispose];
|
|
409
|
-
if (async)
|
|
410
|
-
inner = dispose;
|
|
411
405
|
}
|
|
412
406
|
if (typeof dispose !== "function")
|
|
413
407
|
throw new TypeError("Object not disposable.");
|
|
414
|
-
if (inner)
|
|
415
|
-
dispose = function () { try {
|
|
416
|
-
inner.call(this);
|
|
417
|
-
}
|
|
418
|
-
catch (e) {
|
|
419
|
-
return Promise.reject(e);
|
|
420
|
-
} };
|
|
421
408
|
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
422
409
|
}
|
|
423
410
|
else if (async) {
|
|
@@ -434,26 +421,18 @@
|
|
|
434
421
|
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
435
422
|
env.hasError = true;
|
|
436
423
|
}
|
|
437
|
-
var r, s = 0;
|
|
438
424
|
function next() {
|
|
439
|
-
while (
|
|
425
|
+
while (env.stack.length) {
|
|
426
|
+
var rec = env.stack.pop();
|
|
440
427
|
try {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
var result = r.dispose.call(r.value);
|
|
445
|
-
if (r.async)
|
|
446
|
-
return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
|
447
|
-
}
|
|
448
|
-
else
|
|
449
|
-
s |= 1;
|
|
428
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
429
|
+
if (rec.async)
|
|
430
|
+
return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
|
450
431
|
}
|
|
451
432
|
catch (e) {
|
|
452
433
|
fail(e);
|
|
453
434
|
}
|
|
454
435
|
}
|
|
455
|
-
if (s === 1)
|
|
456
|
-
return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
457
436
|
if (env.hasError)
|
|
458
437
|
throw env.error;
|
|
459
438
|
}
|
|
@@ -557,22 +536,16 @@
|
|
|
557
536
|
switch (message.tnf) {
|
|
558
537
|
case exports.TNF.ABSOLUTE_URI:
|
|
559
538
|
return {
|
|
560
|
-
id: message.id,
|
|
561
|
-
type: message.type,
|
|
562
539
|
tnf: 'uri',
|
|
563
540
|
value: toAsciiString(message.payload),
|
|
564
541
|
};
|
|
565
542
|
case exports.TNF.WELL_KNOWN_TYPE:
|
|
566
543
|
return {
|
|
567
|
-
id: message.id,
|
|
568
|
-
type: message.type,
|
|
569
544
|
tnf: 'wkt',
|
|
570
545
|
value: parseWellKnownType(message),
|
|
571
546
|
};
|
|
572
547
|
case exports.TNF.EMPTY:
|
|
573
548
|
return {
|
|
574
|
-
id: message.id,
|
|
575
|
-
type: message.type,
|
|
576
549
|
tnf: 'empty',
|
|
577
550
|
value: {
|
|
578
551
|
type: message.type,
|
|
@@ -581,22 +554,16 @@
|
|
|
581
554
|
};
|
|
582
555
|
case exports.TNF.EXTERNAL:
|
|
583
556
|
return {
|
|
584
|
-
id: message.id,
|
|
585
|
-
type: message.type,
|
|
586
557
|
tnf: 'external',
|
|
587
558
|
value: paseExternalType(message),
|
|
588
559
|
};
|
|
589
560
|
case exports.TNF.MIME_TYPE:
|
|
590
561
|
return {
|
|
591
|
-
id: message.id,
|
|
592
|
-
type: message.type,
|
|
593
562
|
tnf: 'mimetype',
|
|
594
563
|
value: parseMimeType(message),
|
|
595
564
|
};
|
|
596
565
|
case exports.TNF.RFU:
|
|
597
566
|
return {
|
|
598
|
-
id: message.id,
|
|
599
|
-
type: message.type,
|
|
600
567
|
tnf: 'rfu',
|
|
601
568
|
value: {
|
|
602
569
|
type: message.type,
|
|
@@ -605,8 +572,6 @@
|
|
|
605
572
|
};
|
|
606
573
|
case exports.TNF.UNCHANGED:
|
|
607
574
|
return {
|
|
608
|
-
id: message.id,
|
|
609
|
-
type: message.type,
|
|
610
575
|
tnf: 'unchanged',
|
|
611
576
|
value: {
|
|
612
577
|
type: message.type,
|
|
@@ -615,8 +580,6 @@
|
|
|
615
580
|
};
|
|
616
581
|
case exports.TNF.UNKNOWN:
|
|
617
582
|
return {
|
|
618
|
-
id: message.id,
|
|
619
|
-
type: message.type,
|
|
620
583
|
tnf: 'unknown',
|
|
621
584
|
value: {
|
|
622
585
|
type: message.type,
|
|
@@ -625,8 +588,6 @@
|
|
|
625
588
|
};
|
|
626
589
|
default:
|
|
627
590
|
return {
|
|
628
|
-
id: message.id,
|
|
629
|
-
type: message.type,
|
|
630
591
|
tnf: message.tnf,
|
|
631
592
|
value: {
|
|
632
593
|
type: message.type,
|
|
@@ -636,7 +597,7 @@
|
|
|
636
597
|
}
|
|
637
598
|
}
|
|
638
599
|
function parseWellKnownType(message) {
|
|
639
|
-
if (arrayEquals(message.type
|
|
600
|
+
if (arrayEquals(message.type, WellKnownType.URI)) {
|
|
640
601
|
var prefixCode = message.payload[0];
|
|
641
602
|
var prefix = WELL_KNOWN_TYPE_URI_PREFIX[prefixCode] || '';
|
|
642
603
|
return {
|
|
@@ -644,7 +605,7 @@
|
|
|
644
605
|
value: prefix + toAsciiString(message.payload.slice(1)),
|
|
645
606
|
};
|
|
646
607
|
}
|
|
647
|
-
else if (arrayEquals(message.type
|
|
608
|
+
else if (arrayEquals(message.type, WellKnownType.TEXT)) {
|
|
648
609
|
var encodingNumber = message.payload[0];
|
|
649
610
|
var encoding = 'utf8';
|
|
650
611
|
var languageSizeInBytes = 0;
|
|
@@ -659,15 +620,12 @@
|
|
|
659
620
|
languageSizeInBytes = encodingNumber & 63;
|
|
660
621
|
}
|
|
661
622
|
var text = message.payload.slice(languageSizeInBytes + 1);
|
|
662
|
-
var language = message.payload.slice(8, languageSizeInBytes + 1);
|
|
663
623
|
return {
|
|
664
624
|
type: 'text',
|
|
665
625
|
value: buffer.Buffer.from(text).toString(encoding),
|
|
666
|
-
encoding: encoding,
|
|
667
|
-
language: buffer.Buffer.from(language).toString(encoding)
|
|
668
626
|
};
|
|
669
627
|
}
|
|
670
|
-
// else if (arrayEquals(message.type
|
|
628
|
+
// else if (arrayEquals(message.type, WellKnownType.SMPART_POSTER)) {
|
|
671
629
|
// return {
|
|
672
630
|
// type: 'sp',
|
|
673
631
|
// // TODO implement
|
|
@@ -678,7 +636,7 @@
|
|
|
678
636
|
return {
|
|
679
637
|
type: 'unknown',
|
|
680
638
|
value: {
|
|
681
|
-
type: message.type
|
|
639
|
+
type: message.type,
|
|
682
640
|
payload: message.payload,
|
|
683
641
|
},
|
|
684
642
|
};
|
|
@@ -731,124 +689,6 @@
|
|
|
731
689
|
};
|
|
732
690
|
function parseMimeType(message) {
|
|
733
691
|
return buffer.Buffer.from(message.payload).toString('utf8');
|
|
734
|
-
}
|
|
735
|
-
function encodeWellKnownType(message) {
|
|
736
|
-
var e_1, _a;
|
|
737
|
-
if (message.value.type == 'uri') {
|
|
738
|
-
//identify the prefix
|
|
739
|
-
var prefixesEntries = Object.entries(WELL_KNOWN_TYPE_URI_PREFIX);
|
|
740
|
-
var prefixByte = 0;
|
|
741
|
-
try {
|
|
742
|
-
for (var prefixesEntries_1 = __values(prefixesEntries), prefixesEntries_1_1 = prefixesEntries_1.next(); !prefixesEntries_1_1.done; prefixesEntries_1_1 = prefixesEntries_1.next()) {
|
|
743
|
-
var _b = __read(prefixesEntries_1_1.value, 2), id = _b[0], prefix = _b[1];
|
|
744
|
-
if (id == '0x0') // Skip first as it is always recognized. (what about 0x1 vs 0x2?)
|
|
745
|
-
continue;
|
|
746
|
-
if (message.value.value.startsWith(prefix)) {
|
|
747
|
-
prefixByte = parseInt(id, 16);
|
|
748
|
-
break;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
753
|
-
finally {
|
|
754
|
-
try {
|
|
755
|
-
if (prefixesEntries_1_1 && !prefixesEntries_1_1.done && (_a = prefixesEntries_1.return)) _a.call(prefixesEntries_1);
|
|
756
|
-
}
|
|
757
|
-
finally { if (e_1) throw e_1.error; }
|
|
758
|
-
}
|
|
759
|
-
var lengthToSlice = WELL_KNOWN_TYPE_URI_PREFIX[prefixByte].length;
|
|
760
|
-
var slicedString = message.value.value.slice(lengthToSlice);
|
|
761
|
-
return __spreadArray([prefixByte], __read((byteConverter.asciiStringToByteBuffer(slicedString))));
|
|
762
|
-
}
|
|
763
|
-
else if (message.value.type === 'text') {
|
|
764
|
-
// b1: RFU (set to 0)
|
|
765
|
-
// b2-b7: la taille en octets de la langue (n)
|
|
766
|
-
// B8-B8+n-1: language
|
|
767
|
-
// Bn: message
|
|
768
|
-
var firstByte = message.value.encoding == 'utf16le' ? 128 : 0;
|
|
769
|
-
firstByte &= (message.value.language & 63);
|
|
770
|
-
var languageBytes = buffer.Buffer.from(message.value.language, message.value.encoding);
|
|
771
|
-
var textBytes = buffer.Buffer.from(message.value.value, message.value.encoding);
|
|
772
|
-
return __spreadArray(__spreadArray([firstByte], __read(languageBytes)), __read(textBytes));
|
|
773
|
-
}
|
|
774
|
-
else
|
|
775
|
-
return __spreadArray(__spreadArray([], __read(message.value.type)), __read(message.value.payload));
|
|
776
|
-
}
|
|
777
|
-
function encodeExternalType(message) {
|
|
778
|
-
return Array.from(buffer.Buffer.from(message.value.value, 'utf8'));
|
|
779
|
-
}
|
|
780
|
-
function encodeMimeType(message) {
|
|
781
|
-
return Array.from(buffer.Buffer.from(message.value, 'utf8'));
|
|
782
|
-
}
|
|
783
|
-
function encodeNDEFMessages(ndefRecords) {
|
|
784
|
-
return (ndefRecords || []).map(encodeNDEFMessage);
|
|
785
|
-
}
|
|
786
|
-
function encodeNDEFMessage(ndefRecord) {
|
|
787
|
-
switch (ndefRecord.tnf) {
|
|
788
|
-
case 'uri':
|
|
789
|
-
return {
|
|
790
|
-
id: ndefRecord.id,
|
|
791
|
-
type: ndefRecord.type,
|
|
792
|
-
tnf: exports.TNF.ABSOLUTE_URI,
|
|
793
|
-
payload: Array.from(byteConverter.asciiStringToByteBuffer(ndefRecord.value))
|
|
794
|
-
};
|
|
795
|
-
case 'wkt':
|
|
796
|
-
return {
|
|
797
|
-
id: ndefRecord.id,
|
|
798
|
-
type: ndefRecord.type,
|
|
799
|
-
tnf: exports.TNF.WELL_KNOWN_TYPE,
|
|
800
|
-
payload: encodeWellKnownType(ndefRecord),
|
|
801
|
-
};
|
|
802
|
-
case 'empty':
|
|
803
|
-
return {
|
|
804
|
-
id: ndefRecord.id,
|
|
805
|
-
type: ndefRecord.type,
|
|
806
|
-
tnf: exports.TNF.EMPTY,
|
|
807
|
-
payload: ndefRecord.payload,
|
|
808
|
-
};
|
|
809
|
-
case 'external':
|
|
810
|
-
return {
|
|
811
|
-
id: ndefRecord.id,
|
|
812
|
-
type: ndefRecord.type,
|
|
813
|
-
tnf: exports.TNF.EXTERNAL,
|
|
814
|
-
payload: encodeExternalType(ndefRecord),
|
|
815
|
-
};
|
|
816
|
-
case 'mimetype':
|
|
817
|
-
return {
|
|
818
|
-
id: ndefRecord.id,
|
|
819
|
-
type: ndefRecord.type,
|
|
820
|
-
tnf: exports.TNF.MIME_TYPE,
|
|
821
|
-
payload: encodeMimeType(ndefRecord),
|
|
822
|
-
};
|
|
823
|
-
case 'rfu':
|
|
824
|
-
return {
|
|
825
|
-
id: ndefRecord.id,
|
|
826
|
-
type: ndefRecord.type,
|
|
827
|
-
tnf: exports.TNF.RFU,
|
|
828
|
-
payload: ndefRecord.payload
|
|
829
|
-
};
|
|
830
|
-
case 'unchanged':
|
|
831
|
-
return {
|
|
832
|
-
id: ndefRecord.id,
|
|
833
|
-
type: ndefRecord.type,
|
|
834
|
-
tnf: exports.TNF.UNCHANGED,
|
|
835
|
-
payload: ndefRecord.payload,
|
|
836
|
-
};
|
|
837
|
-
case 'unknown':
|
|
838
|
-
return {
|
|
839
|
-
id: ndefRecord.id,
|
|
840
|
-
type: ndefRecord.type,
|
|
841
|
-
tnf: exports.TNF.UNKNOWN,
|
|
842
|
-
payload: ndefRecord.payload,
|
|
843
|
-
};
|
|
844
|
-
default:
|
|
845
|
-
return {
|
|
846
|
-
id: ndefRecord.id,
|
|
847
|
-
type: ndefRecord.type,
|
|
848
|
-
tnf: Number(ndefRecord.tnf),
|
|
849
|
-
payload: ndefRecord.payload,
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
692
|
}
|
|
853
693
|
|
|
854
694
|
var debug = debug$1.createDebugger("@iotize/device-com-nfc.cordova");
|
|
@@ -1130,8 +970,6 @@
|
|
|
1130
970
|
|
|
1131
971
|
exports.NFCComProtocol = NFCComProtocol;
|
|
1132
972
|
exports.WellKnownType = WellKnownType;
|
|
1133
|
-
exports.encodeNDEFMessage = encodeNDEFMessage;
|
|
1134
|
-
exports.encodeNDEFMessages = encodeNDEFMessages;
|
|
1135
973
|
exports.parseNdefMessage = parseNdefMessage;
|
|
1136
974
|
exports.parseNdefMessages = parseNdefMessages;
|
|
1137
975
|
exports.parseTapNdefMessage = parseTapNdefMessage;
|