Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: mojo/dart/packages/mojo_services/lib/nfc/nfc.mojom.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // WARNING: DO NOT EDIT. This file was generated by a program. 1 // WARNING: DO NOT EDIT. This file was generated by a program.
2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py.
3 3
4 library nfc_mojom; 4 library nfc_mojom;
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:mojo/bindings.dart' as bindings; 6 import 'package:mojo/bindings.dart' as bindings;
7 import 'package:mojo/core.dart' as core; 7 import 'package:mojo/core.dart' as core;
8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
9 9
10 10
11 11
12 class NfcData extends bindings.Struct { 12 class NfcData extends bindings.Struct {
13 static const List<bindings.StructDataHeader> kVersions = const [ 13 static const List<bindings.StructDataHeader> kVersions = const [
14 const bindings.StructDataHeader(16, 0) 14 const bindings.StructDataHeader(16, 0)
15 ]; 15 ];
16 List<int> data = null; 16 List<int> data = null;
17 17
18 NfcData() : super(kVersions.last.size); 18 NfcData() : super(kVersions.last.size);
19 19
20 NfcData.init(
21 List<int> this.data
22 ) : super(kVersions.last.size);
23
20 static NfcData deserialize(bindings.Message message) { 24 static NfcData deserialize(bindings.Message message) {
21 var decoder = new bindings.Decoder(message); 25 var decoder = new bindings.Decoder(message);
22 var result = decode(decoder); 26 var result = decode(decoder);
23 if (decoder.excessHandles != null) { 27 if (decoder.excessHandles != null) {
24 decoder.excessHandles.forEach((h) => h.close()); 28 decoder.excessHandles.forEach((h) => h.close());
25 } 29 }
26 return result; 30 return result;
27 } 31 }
28 32
29 static NfcData decode(bindings.Decoder decoder0) { 33 static NfcData decode(bindings.Decoder decoder0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 85 }
82 86
83 87
84 class _NfcTransmissionCancelParams extends bindings.Struct { 88 class _NfcTransmissionCancelParams extends bindings.Struct {
85 static const List<bindings.StructDataHeader> kVersions = const [ 89 static const List<bindings.StructDataHeader> kVersions = const [
86 const bindings.StructDataHeader(8, 0) 90 const bindings.StructDataHeader(8, 0)
87 ]; 91 ];
88 92
89 _NfcTransmissionCancelParams() : super(kVersions.last.size); 93 _NfcTransmissionCancelParams() : super(kVersions.last.size);
90 94
95 _NfcTransmissionCancelParams.init(
96 ) : super(kVersions.last.size);
97
91 static _NfcTransmissionCancelParams deserialize(bindings.Message message) { 98 static _NfcTransmissionCancelParams deserialize(bindings.Message message) {
92 var decoder = new bindings.Decoder(message); 99 var decoder = new bindings.Decoder(message);
93 var result = decode(decoder); 100 var result = decode(decoder);
94 if (decoder.excessHandles != null) { 101 if (decoder.excessHandles != null) {
95 decoder.excessHandles.forEach((h) => h.close()); 102 decoder.excessHandles.forEach((h) => h.close());
96 } 103 }
97 return result; 104 return result;
98 } 105 }
99 106
100 static _NfcTransmissionCancelParams decode(bindings.Decoder decoder0) { 107 static _NfcTransmissionCancelParams decode(bindings.Decoder decoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 147
141 148
142 class _NfcReceiverOnReceivedNfcDataParams extends bindings.Struct { 149 class _NfcReceiverOnReceivedNfcDataParams extends bindings.Struct {
143 static const List<bindings.StructDataHeader> kVersions = const [ 150 static const List<bindings.StructDataHeader> kVersions = const [
144 const bindings.StructDataHeader(16, 0) 151 const bindings.StructDataHeader(16, 0)
145 ]; 152 ];
146 NfcData nfcData = null; 153 NfcData nfcData = null;
147 154
148 _NfcReceiverOnReceivedNfcDataParams() : super(kVersions.last.size); 155 _NfcReceiverOnReceivedNfcDataParams() : super(kVersions.last.size);
149 156
157 _NfcReceiverOnReceivedNfcDataParams.init(
158 NfcData this.nfcData
159 ) : super(kVersions.last.size);
160
150 static _NfcReceiverOnReceivedNfcDataParams deserialize(bindings.Message messag e) { 161 static _NfcReceiverOnReceivedNfcDataParams deserialize(bindings.Message messag e) {
151 var decoder = new bindings.Decoder(message); 162 var decoder = new bindings.Decoder(message);
152 var result = decode(decoder); 163 var result = decode(decoder);
153 if (decoder.excessHandles != null) { 164 if (decoder.excessHandles != null) {
154 decoder.excessHandles.forEach((h) => h.close()); 165 decoder.excessHandles.forEach((h) => h.close());
155 } 166 }
156 return result; 167 return result;
157 } 168 }
158 169
159 static _NfcReceiverOnReceivedNfcDataParams decode(bindings.Decoder decoder0) { 170 static _NfcReceiverOnReceivedNfcDataParams decode(bindings.Decoder decoder0) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 225
215 class _NfcTransmitOnNextConnectionParams extends bindings.Struct { 226 class _NfcTransmitOnNextConnectionParams extends bindings.Struct {
216 static const List<bindings.StructDataHeader> kVersions = const [ 227 static const List<bindings.StructDataHeader> kVersions = const [
217 const bindings.StructDataHeader(24, 0) 228 const bindings.StructDataHeader(24, 0)
218 ]; 229 ];
219 NfcData nfcData = null; 230 NfcData nfcData = null;
220 NfcTransmissionInterfaceRequest transmission = null; 231 NfcTransmissionInterfaceRequest transmission = null;
221 232
222 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size); 233 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size);
223 234
235 _NfcTransmitOnNextConnectionParams.init(
236 NfcData this.nfcData,
237 NfcTransmissionInterfaceRequest this.transmission
238 ) : super(kVersions.last.size);
239
224 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message ) { 240 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message ) {
225 var decoder = new bindings.Decoder(message); 241 var decoder = new bindings.Decoder(message);
226 var result = decode(decoder); 242 var result = decode(decoder);
227 if (decoder.excessHandles != null) { 243 if (decoder.excessHandles != null) {
228 decoder.excessHandles.forEach((h) => h.close()); 244 decoder.excessHandles.forEach((h) => h.close());
229 } 245 }
230 return result; 246 return result;
231 } 247 }
232 248
233 static _NfcTransmitOnNextConnectionParams decode(bindings.Decoder decoder0) { 249 static _NfcTransmitOnNextConnectionParams decode(bindings.Decoder decoder0) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 314
299 315
300 class NfcTransmitOnNextConnectionResponseParams extends bindings.Struct { 316 class NfcTransmitOnNextConnectionResponseParams extends bindings.Struct {
301 static const List<bindings.StructDataHeader> kVersions = const [ 317 static const List<bindings.StructDataHeader> kVersions = const [
302 const bindings.StructDataHeader(16, 0) 318 const bindings.StructDataHeader(16, 0)
303 ]; 319 ];
304 bool success = false; 320 bool success = false;
305 321
306 NfcTransmitOnNextConnectionResponseParams() : super(kVersions.last.size); 322 NfcTransmitOnNextConnectionResponseParams() : super(kVersions.last.size);
307 323
324 NfcTransmitOnNextConnectionResponseParams.init(
325 bool this.success
326 ) : super(kVersions.last.size);
327
308 static NfcTransmitOnNextConnectionResponseParams deserialize(bindings.Message message) { 328 static NfcTransmitOnNextConnectionResponseParams deserialize(bindings.Message message) {
309 var decoder = new bindings.Decoder(message); 329 var decoder = new bindings.Decoder(message);
310 var result = decode(decoder); 330 var result = decode(decoder);
311 if (decoder.excessHandles != null) { 331 if (decoder.excessHandles != null) {
312 decoder.excessHandles.forEach((h) => h.close()); 332 decoder.excessHandles.forEach((h) => h.close());
313 } 333 }
314 return result; 334 return result;
315 } 335 }
316 336
317 static NfcTransmitOnNextConnectionResponseParams decode(bindings.Decoder decod er0) { 337 static NfcTransmitOnNextConnectionResponseParams decode(bindings.Decoder decod er0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 389 }
370 390
371 391
372 class _NfcRegisterParams extends bindings.Struct { 392 class _NfcRegisterParams extends bindings.Struct {
373 static const List<bindings.StructDataHeader> kVersions = const [ 393 static const List<bindings.StructDataHeader> kVersions = const [
374 const bindings.StructDataHeader(8, 0) 394 const bindings.StructDataHeader(8, 0)
375 ]; 395 ];
376 396
377 _NfcRegisterParams() : super(kVersions.last.size); 397 _NfcRegisterParams() : super(kVersions.last.size);
378 398
399 _NfcRegisterParams.init(
400 ) : super(kVersions.last.size);
401
379 static _NfcRegisterParams deserialize(bindings.Message message) { 402 static _NfcRegisterParams deserialize(bindings.Message message) {
380 var decoder = new bindings.Decoder(message); 403 var decoder = new bindings.Decoder(message);
381 var result = decode(decoder); 404 var result = decode(decoder);
382 if (decoder.excessHandles != null) { 405 if (decoder.excessHandles != null) {
383 decoder.excessHandles.forEach((h) => h.close()); 406 decoder.excessHandles.forEach((h) => h.close());
384 } 407 }
385 return result; 408 return result;
386 } 409 }
387 410
388 static _NfcRegisterParams decode(bindings.Decoder decoder0) { 411 static _NfcRegisterParams decode(bindings.Decoder decoder0) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 450 }
428 451
429 452
430 class _NfcUnregisterParams extends bindings.Struct { 453 class _NfcUnregisterParams extends bindings.Struct {
431 static const List<bindings.StructDataHeader> kVersions = const [ 454 static const List<bindings.StructDataHeader> kVersions = const [
432 const bindings.StructDataHeader(8, 0) 455 const bindings.StructDataHeader(8, 0)
433 ]; 456 ];
434 457
435 _NfcUnregisterParams() : super(kVersions.last.size); 458 _NfcUnregisterParams() : super(kVersions.last.size);
436 459
460 _NfcUnregisterParams.init(
461 ) : super(kVersions.last.size);
462
437 static _NfcUnregisterParams deserialize(bindings.Message message) { 463 static _NfcUnregisterParams deserialize(bindings.Message message) {
438 var decoder = new bindings.Decoder(message); 464 var decoder = new bindings.Decoder(message);
439 var result = decode(decoder); 465 var result = decode(decoder);
440 if (decoder.excessHandles != null) { 466 if (decoder.excessHandles != null) {
441 decoder.excessHandles.forEach((h) => h.close()); 467 decoder.excessHandles.forEach((h) => h.close());
442 } 468 }
443 return result; 469 return result;
444 } 470 }
445 471
446 static _NfcUnregisterParams decode(bindings.Decoder decoder0) { 472 static _NfcUnregisterParams decode(bindings.Decoder decoder0) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 506
481 Map toJson() { 507 Map toJson() {
482 Map map = new Map(); 508 Map map = new Map();
483 return map; 509 return map;
484 } 510 }
485 } 511 }
486 512
487 const int _nfcTransmissionMethodCancelName = 0; 513 const int _nfcTransmissionMethodCancelName = 0;
488 514
489 class _NfcTransmissionServiceDescription implements service_describer.ServiceDes cription { 515 class _NfcTransmissionServiceDescription implements service_describer.ServiceDes cription {
490 dynamic getTopLevelInterface([Function responseFactory]) => 516 void getTopLevelInterface(Function responder) {
491 responseFactory(null); 517 responder(null);
518 }
492 519
493 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 520 void getTypeDefinition(String typeKey, Function responder) {
494 responseFactory(null); 521 responder(null);
522 }
495 523
496 dynamic getAllTypeDefinitions([Function responseFactory]) => 524 void getAllTypeDefinitions(Function responder) {
497 responseFactory(null); 525 responder(null);
526 }
498 } 527 }
499 528
500 abstract class NfcTransmission { 529 abstract class NfcTransmission {
501 static const String serviceName = null; 530 static const String serviceName = null;
502 531
503 static service_describer.ServiceDescription _cachedServiceDescription; 532 static service_describer.ServiceDescription _cachedServiceDescription;
504 static service_describer.ServiceDescription get serviceDescription { 533 static service_describer.ServiceDescription get serviceDescription {
505 if (_cachedServiceDescription == null) { 534 if (_cachedServiceDescription == null) {
506 _cachedServiceDescription = new _NfcTransmissionServiceDescription(); 535 _cachedServiceDescription = new _NfcTransmissionServiceDescription();
507 } 536 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 : super.fromHandle(handle, autoBegin: impl != null) { 665 : super.fromHandle(handle, autoBegin: impl != null) {
637 _impl = impl; 666 _impl = impl;
638 } 667 }
639 668
640 _NfcTransmissionStubControl.unbound([this._impl]) : super.unbound(); 669 _NfcTransmissionStubControl.unbound([this._impl]) : super.unbound();
641 670
642 String get serviceName => NfcTransmission.serviceName; 671 String get serviceName => NfcTransmission.serviceName;
643 672
644 673
645 674
646 dynamic handleMessage(bindings.ServiceMessage message) { 675 void handleMessage(bindings.ServiceMessage message) {
647 if (bindings.ControlMessageHandler.isControlMessage(message)) { 676 if (bindings.ControlMessageHandler.isControlMessage(message)) {
648 return bindings.ControlMessageHandler.handleMessage(this, 677 bindings.ControlMessageHandler.handleMessage(
649 0, 678 this, 0, message);
650 message); 679 return;
651 } 680 }
652 if (_impl == null) { 681 if (_impl == null) {
653 throw new core.MojoApiError("$this has no implementation set"); 682 throw new core.MojoApiError("$this has no implementation set");
654 } 683 }
655 switch (message.header.type) { 684 switch (message.header.type) {
656 case _nfcTransmissionMethodCancelName: 685 case _nfcTransmissionMethodCancelName:
657 _impl.cancel(); 686 _impl.cancel();
658 break; 687 break;
659 default: 688 default:
660 throw new bindings.MojoCodecError("Unexpected message name"); 689 throw new bindings.MojoCodecError("Unexpected message name");
661 break; 690 break;
662 } 691 }
663 return null;
664 } 692 }
665 693
666 NfcTransmission get impl => _impl; 694 NfcTransmission get impl => _impl;
667 set impl(NfcTransmission d) { 695 set impl(NfcTransmission d) {
668 if (d == null) { 696 if (d == null) {
669 throw new core.MojoApiError("$this: Cannot set a null implementation"); 697 throw new core.MojoApiError("$this: Cannot set a null implementation");
670 } 698 }
671 if (isBound && (_impl == null)) { 699 if (isBound && (_impl == null)) {
672 beginHandlingEvents(); 700 beginHandlingEvents();
673 } 701 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 743
716 744
717 void cancel() { 745 void cancel() {
718 return impl.cancel(); 746 return impl.cancel();
719 } 747 }
720 } 748 }
721 749
722 const int _nfcReceiverMethodOnReceivedNfcDataName = 0; 750 const int _nfcReceiverMethodOnReceivedNfcDataName = 0;
723 751
724 class _NfcReceiverServiceDescription implements service_describer.ServiceDescrip tion { 752 class _NfcReceiverServiceDescription implements service_describer.ServiceDescrip tion {
725 dynamic getTopLevelInterface([Function responseFactory]) => 753 void getTopLevelInterface(Function responder) {
726 responseFactory(null); 754 responder(null);
755 }
727 756
728 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 757 void getTypeDefinition(String typeKey, Function responder) {
729 responseFactory(null); 758 responder(null);
759 }
730 760
731 dynamic getAllTypeDefinitions([Function responseFactory]) => 761 void getAllTypeDefinitions(Function responder) {
732 responseFactory(null); 762 responder(null);
763 }
733 } 764 }
734 765
735 abstract class NfcReceiver { 766 abstract class NfcReceiver {
736 static const String serviceName = "nfc::NfcReceiver"; 767 static const String serviceName = "nfc::NfcReceiver";
737 768
738 static service_describer.ServiceDescription _cachedServiceDescription; 769 static service_describer.ServiceDescription _cachedServiceDescription;
739 static service_describer.ServiceDescription get serviceDescription { 770 static service_describer.ServiceDescription get serviceDescription {
740 if (_cachedServiceDescription == null) { 771 if (_cachedServiceDescription == null) {
741 _cachedServiceDescription = new _NfcReceiverServiceDescription(); 772 _cachedServiceDescription = new _NfcReceiverServiceDescription();
742 } 773 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 : super.fromHandle(handle, autoBegin: impl != null) { 903 : super.fromHandle(handle, autoBegin: impl != null) {
873 _impl = impl; 904 _impl = impl;
874 } 905 }
875 906
876 _NfcReceiverStubControl.unbound([this._impl]) : super.unbound(); 907 _NfcReceiverStubControl.unbound([this._impl]) : super.unbound();
877 908
878 String get serviceName => NfcReceiver.serviceName; 909 String get serviceName => NfcReceiver.serviceName;
879 910
880 911
881 912
882 dynamic handleMessage(bindings.ServiceMessage message) { 913 void handleMessage(bindings.ServiceMessage message) {
883 if (bindings.ControlMessageHandler.isControlMessage(message)) { 914 if (bindings.ControlMessageHandler.isControlMessage(message)) {
884 return bindings.ControlMessageHandler.handleMessage(this, 915 bindings.ControlMessageHandler.handleMessage(
885 0, 916 this, 0, message);
886 message); 917 return;
887 } 918 }
888 if (_impl == null) { 919 if (_impl == null) {
889 throw new core.MojoApiError("$this has no implementation set"); 920 throw new core.MojoApiError("$this has no implementation set");
890 } 921 }
891 switch (message.header.type) { 922 switch (message.header.type) {
892 case _nfcReceiverMethodOnReceivedNfcDataName: 923 case _nfcReceiverMethodOnReceivedNfcDataName:
893 var params = _NfcReceiverOnReceivedNfcDataParams.deserialize( 924 var params = _NfcReceiverOnReceivedNfcDataParams.deserialize(
894 message.payload); 925 message.payload);
895 _impl.onReceivedNfcData(params.nfcData); 926 _impl.onReceivedNfcData(params.nfcData);
896 break; 927 break;
897 default: 928 default:
898 throw new bindings.MojoCodecError("Unexpected message name"); 929 throw new bindings.MojoCodecError("Unexpected message name");
899 break; 930 break;
900 } 931 }
901 return null;
902 } 932 }
903 933
904 NfcReceiver get impl => _impl; 934 NfcReceiver get impl => _impl;
905 set impl(NfcReceiver d) { 935 set impl(NfcReceiver d) {
906 if (d == null) { 936 if (d == null) {
907 throw new core.MojoApiError("$this: Cannot set a null implementation"); 937 throw new core.MojoApiError("$this: Cannot set a null implementation");
908 } 938 }
909 if (isBound && (_impl == null)) { 939 if (isBound && (_impl == null)) {
910 beginHandlingEvents(); 940 beginHandlingEvents();
911 } 941 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 void onReceivedNfcData(NfcData nfcData) { 985 void onReceivedNfcData(NfcData nfcData) {
956 return impl.onReceivedNfcData(nfcData); 986 return impl.onReceivedNfcData(nfcData);
957 } 987 }
958 } 988 }
959 989
960 const int _nfcMethodTransmitOnNextConnectionName = 0; 990 const int _nfcMethodTransmitOnNextConnectionName = 0;
961 const int _nfcMethodRegisterName = 1; 991 const int _nfcMethodRegisterName = 1;
962 const int _nfcMethodUnregisterName = 2; 992 const int _nfcMethodUnregisterName = 2;
963 993
964 class _NfcServiceDescription implements service_describer.ServiceDescription { 994 class _NfcServiceDescription implements service_describer.ServiceDescription {
965 dynamic getTopLevelInterface([Function responseFactory]) => 995 void getTopLevelInterface(Function responder) {
966 responseFactory(null); 996 responder(null);
997 }
967 998
968 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 999 void getTypeDefinition(String typeKey, Function responder) {
969 responseFactory(null); 1000 responder(null);
1001 }
970 1002
971 dynamic getAllTypeDefinitions([Function responseFactory]) => 1003 void getAllTypeDefinitions(Function responder) {
972 responseFactory(null); 1004 responder(null);
1005 }
973 } 1006 }
974 1007
975 abstract class Nfc { 1008 abstract class Nfc {
976 static const String serviceName = "nfc::Nfc"; 1009 static const String serviceName = "nfc::Nfc";
977 1010
978 static service_describer.ServiceDescription _cachedServiceDescription; 1011 static service_describer.ServiceDescription _cachedServiceDescription;
979 static service_describer.ServiceDescription get serviceDescription { 1012 static service_describer.ServiceDescription get serviceDescription {
980 if (_cachedServiceDescription == null) { 1013 if (_cachedServiceDescription == null) {
981 _cachedServiceDescription = new _NfcServiceDescription(); 1014 _cachedServiceDescription = new _NfcServiceDescription();
982 } 1015 }
983 return _cachedServiceDescription; 1016 return _cachedServiceDescription;
984 } 1017 }
985 1018
986 static NfcProxy connectToService( 1019 static NfcProxy connectToService(
987 bindings.ServiceConnector s, String url, [String serviceName]) { 1020 bindings.ServiceConnector s, String url, [String serviceName]) {
988 NfcProxy p = new NfcProxy.unbound(); 1021 NfcProxy p = new NfcProxy.unbound();
989 String name = serviceName ?? Nfc.serviceName; 1022 String name = serviceName ?? Nfc.serviceName;
990 if ((name == null) || name.isEmpty) { 1023 if ((name == null) || name.isEmpty) {
991 throw new core.MojoApiError( 1024 throw new core.MojoApiError(
992 "If an interface has no ServiceName, then one must be provided."); 1025 "If an interface has no ServiceName, then one must be provided.");
993 } 1026 }
994 s.connectToService(url, p, name); 1027 s.connectToService(url, p, name);
995 return p; 1028 return p;
996 } 1029 }
997 dynamic transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceReque st transmission,[Function responseFactory = null]); 1030 void transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceRequest transmission,void callback(bool success));
998 void register(); 1031 void register();
999 void unregister(); 1032 void unregister();
1000 } 1033 }
1001 1034
1002 abstract class NfcInterface 1035 abstract class NfcInterface
1003 implements bindings.MojoInterface<Nfc>, 1036 implements bindings.MojoInterface<Nfc>,
1004 Nfc { 1037 Nfc {
1005 factory NfcInterface([Nfc impl]) => 1038 factory NfcInterface([Nfc impl]) =>
1006 new NfcStub.unbound(impl); 1039 new NfcStub.unbound(impl);
1007 1040
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1072
1040 void handleResponse(bindings.ServiceMessage message) { 1073 void handleResponse(bindings.ServiceMessage message) {
1041 switch (message.header.type) { 1074 switch (message.header.type) {
1042 case _nfcMethodTransmitOnNextConnectionName: 1075 case _nfcMethodTransmitOnNextConnectionName:
1043 var r = NfcTransmitOnNextConnectionResponseParams.deserialize( 1076 var r = NfcTransmitOnNextConnectionResponseParams.deserialize(
1044 message.payload); 1077 message.payload);
1045 if (!message.header.hasRequestId) { 1078 if (!message.header.hasRequestId) {
1046 proxyError("Expected a message with a valid request Id."); 1079 proxyError("Expected a message with a valid request Id.");
1047 return; 1080 return;
1048 } 1081 }
1049 Completer c = completerMap[message.header.requestId]; 1082 Function callback = callbackMap[message.header.requestId];
1050 if (c == null) { 1083 if (callback == null) {
1051 proxyError( 1084 proxyError(
1052 "Message had unknown request Id: ${message.header.requestId}"); 1085 "Message had unknown request Id: ${message.header.requestId}");
1053 return; 1086 return;
1054 } 1087 }
1055 completerMap.remove(message.header.requestId); 1088 callbackMap.remove(message.header.requestId);
1056 if (c.isCompleted) { 1089 callback(r.success );
1057 proxyError("Response completer already completed");
1058 return;
1059 }
1060 c.complete(r);
1061 break; 1090 break;
1062 default: 1091 default:
1063 proxyError("Unexpected message type: ${message.header.type}"); 1092 proxyError("Unexpected message type: ${message.header.type}");
1064 close(immediate: true); 1093 close(immediate: true);
1065 break; 1094 break;
1066 } 1095 }
1067 } 1096 }
1068 1097
1069 @override 1098 @override
1070 String toString() { 1099 String toString() {
(...skipping 24 matching lines...) Expand all
1095 return newMockedProxy; 1124 return newMockedProxy;
1096 } 1125 }
1097 1126
1098 static NfcProxy newFromEndpoint( 1127 static NfcProxy newFromEndpoint(
1099 core.MojoMessagePipeEndpoint endpoint) { 1128 core.MojoMessagePipeEndpoint endpoint) {
1100 assert(endpoint.setDescription("For NfcProxy")); 1129 assert(endpoint.setDescription("For NfcProxy"));
1101 return new NfcProxy.fromEndpoint(endpoint); 1130 return new NfcProxy.fromEndpoint(endpoint);
1102 } 1131 }
1103 1132
1104 1133
1105 dynamic transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceReque st transmission,[Function responseFactory = null]) { 1134 void transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceRequest transmission,void callback(bool success)) {
1106 if (impl != null) { 1135 if (impl != null) {
1107 return new Future(() => impl.transmitOnNextConnection(nfcData,transmission ,_NfcStubControl._nfcTransmitOnNextConnectionResponseParamsFactory)); 1136 impl.transmitOnNextConnection(nfcData,transmission,callback);
1137 return;
1108 } 1138 }
1109 var params = new _NfcTransmitOnNextConnectionParams(); 1139 var params = new _NfcTransmitOnNextConnectionParams();
1110 params.nfcData = nfcData; 1140 params.nfcData = nfcData;
1111 params.transmission = transmission; 1141 params.transmission = transmission;
1112 return ctrl.sendMessageWithRequestId( 1142 ctrl.sendMessageWithRequestId(
1113 params, 1143 params,
1114 _nfcMethodTransmitOnNextConnectionName, 1144 _nfcMethodTransmitOnNextConnectionName,
1115 -1, 1145 -1,
1116 bindings.MessageHeader.kMessageExpectsResponse); 1146 bindings.MessageHeader.kMessageExpectsResponse,
1147 callback);
1117 } 1148 }
1118 void register() { 1149 void register() {
1119 if (impl != null) { 1150 if (impl != null) {
1120 impl.register(); 1151 impl.register();
1121 return; 1152 return;
1122 } 1153 }
1123 if (!ctrl.isBound) { 1154 if (!ctrl.isBound) {
1124 ctrl.proxyError("The Proxy is closed."); 1155 ctrl.proxyError("The Proxy is closed.");
1125 return; 1156 return;
1126 } 1157 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 core.MojoHandle handle, [Nfc impl]) 1189 core.MojoHandle handle, [Nfc impl])
1159 : super.fromHandle(handle, autoBegin: impl != null) { 1190 : super.fromHandle(handle, autoBegin: impl != null) {
1160 _impl = impl; 1191 _impl = impl;
1161 } 1192 }
1162 1193
1163 _NfcStubControl.unbound([this._impl]) : super.unbound(); 1194 _NfcStubControl.unbound([this._impl]) : super.unbound();
1164 1195
1165 String get serviceName => Nfc.serviceName; 1196 String get serviceName => Nfc.serviceName;
1166 1197
1167 1198
1168 static NfcTransmitOnNextConnectionResponseParams _nfcTransmitOnNextConnectionR esponseParamsFactory(bool success) { 1199 Function _nfcTransmitOnNextConnectionResponseParamsResponder(
1169 var result = new NfcTransmitOnNextConnectionResponseParams(); 1200 int requestId) {
1170 result.success = success; 1201 return (bool success) {
1171 return result; 1202 var result = new NfcTransmitOnNextConnectionResponseParams();
1203 result.success = success;
1204 sendResponse(buildResponseWithId(
1205 result,
1206 _nfcMethodTransmitOnNextConnectionName,
1207 requestId,
1208 bindings.MessageHeader.kMessageIsResponse));
1209 };
1172 } 1210 }
1173 1211
1174 dynamic handleMessage(bindings.ServiceMessage message) { 1212 void handleMessage(bindings.ServiceMessage message) {
1175 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1213 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1176 return bindings.ControlMessageHandler.handleMessage(this, 1214 bindings.ControlMessageHandler.handleMessage(
1177 0, 1215 this, 0, message);
1178 message); 1216 return;
1179 } 1217 }
1180 if (_impl == null) { 1218 if (_impl == null) {
1181 throw new core.MojoApiError("$this has no implementation set"); 1219 throw new core.MojoApiError("$this has no implementation set");
1182 } 1220 }
1183 switch (message.header.type) { 1221 switch (message.header.type) {
1184 case _nfcMethodTransmitOnNextConnectionName: 1222 case _nfcMethodTransmitOnNextConnectionName:
1185 var params = _NfcTransmitOnNextConnectionParams.deserialize( 1223 var params = _NfcTransmitOnNextConnectionParams.deserialize(
1186 message.payload); 1224 message.payload);
1187 var response = _impl.transmitOnNextConnection(params.nfcData,params.tran smission,_nfcTransmitOnNextConnectionResponseParamsFactory); 1225 _impl.transmitOnNextConnection(params.nfcData, params.transmission, _nfc TransmitOnNextConnectionResponseParamsResponder(message.header.requestId));
1188 if (response is Future) {
1189 return response.then((response) {
1190 if (response != null) {
1191 return buildResponseWithId(
1192 response,
1193 _nfcMethodTransmitOnNextConnectionName,
1194 message.header.requestId,
1195 bindings.MessageHeader.kMessageIsResponse);
1196 }
1197 });
1198 } else if (response != null) {
1199 return buildResponseWithId(
1200 response,
1201 _nfcMethodTransmitOnNextConnectionName,
1202 message.header.requestId,
1203 bindings.MessageHeader.kMessageIsResponse);
1204 }
1205 break; 1226 break;
1206 case _nfcMethodRegisterName: 1227 case _nfcMethodRegisterName:
1207 _impl.register(); 1228 _impl.register();
1208 break; 1229 break;
1209 case _nfcMethodUnregisterName: 1230 case _nfcMethodUnregisterName:
1210 _impl.unregister(); 1231 _impl.unregister();
1211 break; 1232 break;
1212 default: 1233 default:
1213 throw new bindings.MojoCodecError("Unexpected message name"); 1234 throw new bindings.MojoCodecError("Unexpected message name");
1214 break; 1235 break;
1215 } 1236 }
1216 return null;
1217 } 1237 }
1218 1238
1219 Nfc get impl => _impl; 1239 Nfc get impl => _impl;
1220 set impl(Nfc d) { 1240 set impl(Nfc d) {
1221 if (d == null) { 1241 if (d == null) {
1222 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1242 throw new core.MojoApiError("$this: Cannot set a null implementation");
1223 } 1243 }
1224 if (isBound && (_impl == null)) { 1244 if (isBound && (_impl == null)) {
1225 beginHandlingEvents(); 1245 beginHandlingEvents();
1226 } 1246 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 core.MojoHandle handle, [Nfc impl]) 1280 core.MojoHandle handle, [Nfc impl])
1261 : super(new _NfcStubControl.fromHandle(handle, impl)); 1281 : super(new _NfcStubControl.fromHandle(handle, impl));
1262 1282
1263 static NfcStub newFromEndpoint( 1283 static NfcStub newFromEndpoint(
1264 core.MojoMessagePipeEndpoint endpoint) { 1284 core.MojoMessagePipeEndpoint endpoint) {
1265 assert(endpoint.setDescription("For NfcStub")); 1285 assert(endpoint.setDescription("For NfcStub"));
1266 return new NfcStub.fromEndpoint(endpoint); 1286 return new NfcStub.fromEndpoint(endpoint);
1267 } 1287 }
1268 1288
1269 1289
1270 dynamic transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceReque st transmission,[Function responseFactory = null]) { 1290 void transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceRequest transmission,void callback(bool success)) {
1271 return impl.transmitOnNextConnection(nfcData,transmission,responseFactory); 1291 return impl.transmitOnNextConnection(nfcData,transmission,callback);
1272 } 1292 }
1273 void register() { 1293 void register() {
1274 return impl.register(); 1294 return impl.register();
1275 } 1295 }
1276 void unregister() { 1296 void unregister() {
1277 return impl.unregister(); 1297 return impl.unregister();
1278 } 1298 }
1279 } 1299 }
1280 1300
1281 1301
1282 1302
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698