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

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

Issue 1964193002: Dart: Refactors Proxies (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 4 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library nfc_mojom; 5 library nfc_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 10
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 dynamic getAllTypeDefinitions([Function responseFactory]) => 497 dynamic getAllTypeDefinitions([Function responseFactory]) =>
498 responseFactory(null); 498 responseFactory(null);
499 } 499 }
500 500
501 abstract class NfcTransmission { 501 abstract class NfcTransmission {
502 static const String serviceName = null; 502 static const String serviceName = null;
503 void cancel(); 503 void cancel();
504 } 504 }
505 505
506 506
507 class _NfcTransmissionProxyImpl extends bindings.Proxy { 507 class _NfcTransmissionProxyControl extends bindings.ProxyMessageHandler
508 _NfcTransmissionProxyImpl.fromEndpoint( 508 implements bindings.ProxyControl {
509 _NfcTransmissionProxyControl.fromEndpoint(
509 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 510 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
510 511
511 _NfcTransmissionProxyImpl.fromHandle(core.MojoHandle handle) : 512 _NfcTransmissionProxyControl.fromHandle(
512 super.fromHandle(handle); 513 core.MojoHandle handle) : super.fromHandle(handle);
513 514
514 _NfcTransmissionProxyImpl.unbound() : super.unbound(); 515 _NfcTransmissionProxyControl.unbound() : super.unbound();
515
516 static _NfcTransmissionProxyImpl newFromEndpoint(
517 core.MojoMessagePipeEndpoint endpoint) {
518 assert(endpoint.setDescription("For _NfcTransmissionProxyImpl"));
519 return new _NfcTransmissionProxyImpl.fromEndpoint(endpoint);
520 }
521 516
522 service_describer.ServiceDescription get serviceDescription => 517 service_describer.ServiceDescription get serviceDescription =>
523 new _NfcTransmissionServiceDescription(); 518 new _NfcTransmissionServiceDescription();
524 519
520 String get serviceName => NfcTransmission.serviceName;
521
522 @override
525 void handleResponse(bindings.ServiceMessage message) { 523 void handleResponse(bindings.ServiceMessage message) {
526 switch (message.header.type) { 524 switch (message.header.type) {
527 default: 525 default:
528 proxyError("Unexpected message type: ${message.header.type}"); 526 proxyError("Unexpected message type: ${message.header.type}");
529 close(immediate: true); 527 close(immediate: true);
530 break; 528 break;
531 } 529 }
532 } 530 }
533 531
532 @override
534 String toString() { 533 String toString() {
535 var superString = super.toString(); 534 var superString = super.toString();
536 return "_NfcTransmissionProxyImpl($superString)"; 535 return "_NfcTransmissionProxyControl($superString)";
537 } 536 }
538 } 537 }
539 538
540 539
541 class _NfcTransmissionProxyCalls implements NfcTransmission { 540 class NfcTransmissionProxy extends bindings.Proxy
542 _NfcTransmissionProxyImpl _proxyImpl; 541 implements NfcTransmission {
542 NfcTransmissionProxy.fromEndpoint(
543 core.MojoMessagePipeEndpoint endpoint)
544 : super(new _NfcTransmissionProxyControl.fromEndpoint(endpoint));
543 545
544 _NfcTransmissionProxyCalls(this._proxyImpl); 546 NfcTransmissionProxy.fromHandle(core.MojoHandle handle)
545 void cancel() { 547 : super(new _NfcTransmissionProxyControl.fromHandle(handle));
546 if (!_proxyImpl.isBound) {
547 _proxyImpl.proxyError("The Proxy is closed.");
548 return;
549 }
550 var params = new _NfcTransmissionCancelParams();
551 _proxyImpl.sendMessage(params, _nfcTransmissionMethodCancelName);
552 }
553 }
554 548
549 NfcTransmissionProxy.unbound()
550 : super(new _NfcTransmissionProxyControl.unbound());
555 551
556 class NfcTransmissionProxy implements bindings.ProxyBase { 552 static NfcTransmissionProxy newFromEndpoint(
557 final bindings.Proxy impl; 553 core.MojoMessagePipeEndpoint endpoint) {
558 NfcTransmission ptr; 554 assert(endpoint.setDescription("For NfcTransmissionProxy"));
559 555 return new NfcTransmissionProxy.fromEndpoint(endpoint);
560 NfcTransmissionProxy(_NfcTransmissionProxyImpl proxyImpl) :
561 impl = proxyImpl,
562 ptr = new _NfcTransmissionProxyCalls(proxyImpl);
563
564 NfcTransmissionProxy.fromEndpoint(
565 core.MojoMessagePipeEndpoint endpoint) :
566 impl = new _NfcTransmissionProxyImpl.fromEndpoint(endpoint) {
567 ptr = new _NfcTransmissionProxyCalls(impl);
568 }
569
570 NfcTransmissionProxy.fromHandle(core.MojoHandle handle) :
571 impl = new _NfcTransmissionProxyImpl.fromHandle(handle) {
572 ptr = new _NfcTransmissionProxyCalls(impl);
573 }
574
575 NfcTransmissionProxy.unbound() :
576 impl = new _NfcTransmissionProxyImpl.unbound() {
577 ptr = new _NfcTransmissionProxyCalls(impl);
578 } 556 }
579 557
580 factory NfcTransmissionProxy.connectToService( 558 factory NfcTransmissionProxy.connectToService(
581 bindings.ServiceConnector s, String url, [String serviceName]) { 559 bindings.ServiceConnector s, String url, [String serviceName]) {
582 NfcTransmissionProxy p = new NfcTransmissionProxy.unbound(); 560 NfcTransmissionProxy p = new NfcTransmissionProxy.unbound();
583 s.connectToService(url, p, serviceName); 561 s.connectToService(url, p, serviceName);
584 return p; 562 return p;
585 } 563 }
586 564
587 static NfcTransmissionProxy newFromEndpoint(
588 core.MojoMessagePipeEndpoint endpoint) {
589 assert(endpoint.setDescription("For NfcTransmissionProxy"));
590 return new NfcTransmissionProxy.fromEndpoint(endpoint);
591 }
592 565
593 String get serviceName => NfcTransmission.serviceName; 566 void cancel() {
594 567 if (!ctrl.isBound) {
595 Future close({bool immediate: false}) => impl.close(immediate: immediate); 568 ctrl.proxyError("The Proxy is closed.");
596 569 return;
597 Future responseOrError(Future f) => impl.responseOrError(f); 570 }
598 571 var params = new _NfcTransmissionCancelParams();
599 Future get errorFuture => impl.errorFuture; 572 ctrl.sendMessage(params,
600 573 _nfcTransmissionMethodCancelName);
601 int get version => impl.version;
602
603 Future<int> queryVersion() => impl.queryVersion();
604
605 void requireVersion(int requiredVersion) {
606 impl.requireVersion(requiredVersion);
607 }
608
609 String toString() {
610 return "NfcTransmissionProxy($impl)";
611 } 574 }
612 } 575 }
613 576
614 577
615 class NfcTransmissionStub extends bindings.Stub { 578 class NfcTransmissionStub extends bindings.Stub {
616 NfcTransmission _impl; 579 NfcTransmission _impl;
617 580
618 NfcTransmissionStub.fromEndpoint( 581 NfcTransmissionStub.fromEndpoint(
619 core.MojoMessagePipeEndpoint endpoint, [NfcTransmission impl]) 582 core.MojoMessagePipeEndpoint endpoint, [NfcTransmission impl])
620 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 583 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 dynamic getAllTypeDefinitions([Function responseFactory]) => 667 dynamic getAllTypeDefinitions([Function responseFactory]) =>
705 responseFactory(null); 668 responseFactory(null);
706 } 669 }
707 670
708 abstract class NfcReceiver { 671 abstract class NfcReceiver {
709 static const String serviceName = "nfc::NfcReceiver"; 672 static const String serviceName = "nfc::NfcReceiver";
710 void onReceivedNfcData(NfcData nfcData); 673 void onReceivedNfcData(NfcData nfcData);
711 } 674 }
712 675
713 676
714 class _NfcReceiverProxyImpl extends bindings.Proxy { 677 class _NfcReceiverProxyControl extends bindings.ProxyMessageHandler
715 _NfcReceiverProxyImpl.fromEndpoint( 678 implements bindings.ProxyControl {
679 _NfcReceiverProxyControl.fromEndpoint(
716 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 680 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
717 681
718 _NfcReceiverProxyImpl.fromHandle(core.MojoHandle handle) : 682 _NfcReceiverProxyControl.fromHandle(
719 super.fromHandle(handle); 683 core.MojoHandle handle) : super.fromHandle(handle);
720 684
721 _NfcReceiverProxyImpl.unbound() : super.unbound(); 685 _NfcReceiverProxyControl.unbound() : super.unbound();
722
723 static _NfcReceiverProxyImpl newFromEndpoint(
724 core.MojoMessagePipeEndpoint endpoint) {
725 assert(endpoint.setDescription("For _NfcReceiverProxyImpl"));
726 return new _NfcReceiverProxyImpl.fromEndpoint(endpoint);
727 }
728 686
729 service_describer.ServiceDescription get serviceDescription => 687 service_describer.ServiceDescription get serviceDescription =>
730 new _NfcReceiverServiceDescription(); 688 new _NfcReceiverServiceDescription();
731 689
690 String get serviceName => NfcReceiver.serviceName;
691
692 @override
732 void handleResponse(bindings.ServiceMessage message) { 693 void handleResponse(bindings.ServiceMessage message) {
733 switch (message.header.type) { 694 switch (message.header.type) {
734 default: 695 default:
735 proxyError("Unexpected message type: ${message.header.type}"); 696 proxyError("Unexpected message type: ${message.header.type}");
736 close(immediate: true); 697 close(immediate: true);
737 break; 698 break;
738 } 699 }
739 } 700 }
740 701
702 @override
741 String toString() { 703 String toString() {
742 var superString = super.toString(); 704 var superString = super.toString();
743 return "_NfcReceiverProxyImpl($superString)"; 705 return "_NfcReceiverProxyControl($superString)";
744 } 706 }
745 } 707 }
746 708
747 709
748 class _NfcReceiverProxyCalls implements NfcReceiver { 710 class NfcReceiverProxy extends bindings.Proxy
749 _NfcReceiverProxyImpl _proxyImpl; 711 implements NfcReceiver {
712 NfcReceiverProxy.fromEndpoint(
713 core.MojoMessagePipeEndpoint endpoint)
714 : super(new _NfcReceiverProxyControl.fromEndpoint(endpoint));
750 715
751 _NfcReceiverProxyCalls(this._proxyImpl); 716 NfcReceiverProxy.fromHandle(core.MojoHandle handle)
752 void onReceivedNfcData(NfcData nfcData) { 717 : super(new _NfcReceiverProxyControl.fromHandle(handle));
753 if (!_proxyImpl.isBound) {
754 _proxyImpl.proxyError("The Proxy is closed.");
755 return;
756 }
757 var params = new _NfcReceiverOnReceivedNfcDataParams();
758 params.nfcData = nfcData;
759 _proxyImpl.sendMessage(params, _nfcReceiverMethodOnReceivedNfcDataName);
760 }
761 }
762 718
719 NfcReceiverProxy.unbound()
720 : super(new _NfcReceiverProxyControl.unbound());
763 721
764 class NfcReceiverProxy implements bindings.ProxyBase { 722 static NfcReceiverProxy newFromEndpoint(
765 final bindings.Proxy impl; 723 core.MojoMessagePipeEndpoint endpoint) {
766 NfcReceiver ptr; 724 assert(endpoint.setDescription("For NfcReceiverProxy"));
767 725 return new NfcReceiverProxy.fromEndpoint(endpoint);
768 NfcReceiverProxy(_NfcReceiverProxyImpl proxyImpl) :
769 impl = proxyImpl,
770 ptr = new _NfcReceiverProxyCalls(proxyImpl);
771
772 NfcReceiverProxy.fromEndpoint(
773 core.MojoMessagePipeEndpoint endpoint) :
774 impl = new _NfcReceiverProxyImpl.fromEndpoint(endpoint) {
775 ptr = new _NfcReceiverProxyCalls(impl);
776 }
777
778 NfcReceiverProxy.fromHandle(core.MojoHandle handle) :
779 impl = new _NfcReceiverProxyImpl.fromHandle(handle) {
780 ptr = new _NfcReceiverProxyCalls(impl);
781 }
782
783 NfcReceiverProxy.unbound() :
784 impl = new _NfcReceiverProxyImpl.unbound() {
785 ptr = new _NfcReceiverProxyCalls(impl);
786 } 726 }
787 727
788 factory NfcReceiverProxy.connectToService( 728 factory NfcReceiverProxy.connectToService(
789 bindings.ServiceConnector s, String url, [String serviceName]) { 729 bindings.ServiceConnector s, String url, [String serviceName]) {
790 NfcReceiverProxy p = new NfcReceiverProxy.unbound(); 730 NfcReceiverProxy p = new NfcReceiverProxy.unbound();
791 s.connectToService(url, p, serviceName); 731 s.connectToService(url, p, serviceName);
792 return p; 732 return p;
793 } 733 }
794 734
795 static NfcReceiverProxy newFromEndpoint(
796 core.MojoMessagePipeEndpoint endpoint) {
797 assert(endpoint.setDescription("For NfcReceiverProxy"));
798 return new NfcReceiverProxy.fromEndpoint(endpoint);
799 }
800 735
801 String get serviceName => NfcReceiver.serviceName; 736 void onReceivedNfcData(NfcData nfcData) {
802 737 if (!ctrl.isBound) {
803 Future close({bool immediate: false}) => impl.close(immediate: immediate); 738 ctrl.proxyError("The Proxy is closed.");
804 739 return;
805 Future responseOrError(Future f) => impl.responseOrError(f); 740 }
806 741 var params = new _NfcReceiverOnReceivedNfcDataParams();
807 Future get errorFuture => impl.errorFuture; 742 params.nfcData = nfcData;
808 743 ctrl.sendMessage(params,
809 int get version => impl.version; 744 _nfcReceiverMethodOnReceivedNfcDataName);
810
811 Future<int> queryVersion() => impl.queryVersion();
812
813 void requireVersion(int requiredVersion) {
814 impl.requireVersion(requiredVersion);
815 }
816
817 String toString() {
818 return "NfcReceiverProxy($impl)";
819 } 745 }
820 } 746 }
821 747
822 748
823 class NfcReceiverStub extends bindings.Stub { 749 class NfcReceiverStub extends bindings.Stub {
824 NfcReceiver _impl; 750 NfcReceiver _impl;
825 751
826 NfcReceiverStub.fromEndpoint( 752 NfcReceiverStub.fromEndpoint(
827 core.MojoMessagePipeEndpoint endpoint, [NfcReceiver impl]) 753 core.MojoMessagePipeEndpoint endpoint, [NfcReceiver impl])
828 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 754 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 } 844 }
919 845
920 abstract class Nfc { 846 abstract class Nfc {
921 static const String serviceName = "nfc::Nfc"; 847 static const String serviceName = "nfc::Nfc";
922 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]); 848 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]);
923 void register(); 849 void register();
924 void unregister(); 850 void unregister();
925 } 851 }
926 852
927 853
928 class _NfcProxyImpl extends bindings.Proxy { 854 class _NfcProxyControl extends bindings.ProxyMessageHandler
929 _NfcProxyImpl.fromEndpoint( 855 implements bindings.ProxyControl {
856 _NfcProxyControl.fromEndpoint(
930 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 857 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
931 858
932 _NfcProxyImpl.fromHandle(core.MojoHandle handle) : 859 _NfcProxyControl.fromHandle(
933 super.fromHandle(handle); 860 core.MojoHandle handle) : super.fromHandle(handle);
934 861
935 _NfcProxyImpl.unbound() : super.unbound(); 862 _NfcProxyControl.unbound() : super.unbound();
936
937 static _NfcProxyImpl newFromEndpoint(
938 core.MojoMessagePipeEndpoint endpoint) {
939 assert(endpoint.setDescription("For _NfcProxyImpl"));
940 return new _NfcProxyImpl.fromEndpoint(endpoint);
941 }
942 863
943 service_describer.ServiceDescription get serviceDescription => 864 service_describer.ServiceDescription get serviceDescription =>
944 new _NfcServiceDescription(); 865 new _NfcServiceDescription();
945 866
867 String get serviceName => Nfc.serviceName;
868
869 @override
946 void handleResponse(bindings.ServiceMessage message) { 870 void handleResponse(bindings.ServiceMessage message) {
947 switch (message.header.type) { 871 switch (message.header.type) {
948 case _nfcMethodTransmitOnNextConnectionName: 872 case _nfcMethodTransmitOnNextConnectionName:
949 var r = NfcTransmitOnNextConnectionResponseParams.deserialize( 873 var r = NfcTransmitOnNextConnectionResponseParams.deserialize(
950 message.payload); 874 message.payload);
951 if (!message.header.hasRequestId) { 875 if (!message.header.hasRequestId) {
952 proxyError("Expected a message with a valid request Id."); 876 proxyError("Expected a message with a valid request Id.");
953 return; 877 return;
954 } 878 }
955 Completer c = completerMap[message.header.requestId]; 879 Completer c = completerMap[message.header.requestId];
956 if (c == null) { 880 if (c == null) {
957 proxyError( 881 proxyError(
958 "Message had unknown request Id: ${message.header.requestId}"); 882 "Message had unknown request Id: ${message.header.requestId}");
959 return; 883 return;
960 } 884 }
961 completerMap.remove(message.header.requestId); 885 completerMap.remove(message.header.requestId);
962 if (c.isCompleted) { 886 if (c.isCompleted) {
963 proxyError("Response completer already completed"); 887 proxyError("Response completer already completed");
964 return; 888 return;
965 } 889 }
966 c.complete(r); 890 c.complete(r);
967 break; 891 break;
968 default: 892 default:
969 proxyError("Unexpected message type: ${message.header.type}"); 893 proxyError("Unexpected message type: ${message.header.type}");
970 close(immediate: true); 894 close(immediate: true);
971 break; 895 break;
972 } 896 }
973 } 897 }
974 898
899 @override
975 String toString() { 900 String toString() {
976 var superString = super.toString(); 901 var superString = super.toString();
977 return "_NfcProxyImpl($superString)"; 902 return "_NfcProxyControl($superString)";
978 } 903 }
979 } 904 }
980 905
981 906
982 class _NfcProxyCalls implements Nfc { 907 class NfcProxy extends bindings.Proxy
983 _NfcProxyImpl _proxyImpl; 908 implements Nfc {
909 NfcProxy.fromEndpoint(
910 core.MojoMessagePipeEndpoint endpoint)
911 : super(new _NfcProxyControl.fromEndpoint(endpoint));
984 912
985 _NfcProxyCalls(this._proxyImpl); 913 NfcProxy.fromHandle(core.MojoHandle handle)
986 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Functi on responseFactory = null]) { 914 : super(new _NfcProxyControl.fromHandle(handle));
987 var params = new _NfcTransmitOnNextConnectionParams();
988 params.nfcData = nfcData;
989 params.transmission = transmission;
990 return _proxyImpl.sendMessageWithRequestId(
991 params,
992 _nfcMethodTransmitOnNextConnectionName,
993 -1,
994 bindings.MessageHeader.kMessageExpectsResponse);
995 }
996 void register() {
997 if (!_proxyImpl.isBound) {
998 _proxyImpl.proxyError("The Proxy is closed.");
999 return;
1000 }
1001 var params = new _NfcRegisterParams();
1002 _proxyImpl.sendMessage(params, _nfcMethodRegisterName);
1003 }
1004 void unregister() {
1005 if (!_proxyImpl.isBound) {
1006 _proxyImpl.proxyError("The Proxy is closed.");
1007 return;
1008 }
1009 var params = new _NfcUnregisterParams();
1010 _proxyImpl.sendMessage(params, _nfcMethodUnregisterName);
1011 }
1012 }
1013 915
916 NfcProxy.unbound()
917 : super(new _NfcProxyControl.unbound());
1014 918
1015 class NfcProxy implements bindings.ProxyBase { 919 static NfcProxy newFromEndpoint(
1016 final bindings.Proxy impl; 920 core.MojoMessagePipeEndpoint endpoint) {
1017 Nfc ptr; 921 assert(endpoint.setDescription("For NfcProxy"));
1018 922 return new NfcProxy.fromEndpoint(endpoint);
1019 NfcProxy(_NfcProxyImpl proxyImpl) :
1020 impl = proxyImpl,
1021 ptr = new _NfcProxyCalls(proxyImpl);
1022
1023 NfcProxy.fromEndpoint(
1024 core.MojoMessagePipeEndpoint endpoint) :
1025 impl = new _NfcProxyImpl.fromEndpoint(endpoint) {
1026 ptr = new _NfcProxyCalls(impl);
1027 }
1028
1029 NfcProxy.fromHandle(core.MojoHandle handle) :
1030 impl = new _NfcProxyImpl.fromHandle(handle) {
1031 ptr = new _NfcProxyCalls(impl);
1032 }
1033
1034 NfcProxy.unbound() :
1035 impl = new _NfcProxyImpl.unbound() {
1036 ptr = new _NfcProxyCalls(impl);
1037 } 923 }
1038 924
1039 factory NfcProxy.connectToService( 925 factory NfcProxy.connectToService(
1040 bindings.ServiceConnector s, String url, [String serviceName]) { 926 bindings.ServiceConnector s, String url, [String serviceName]) {
1041 NfcProxy p = new NfcProxy.unbound(); 927 NfcProxy p = new NfcProxy.unbound();
1042 s.connectToService(url, p, serviceName); 928 s.connectToService(url, p, serviceName);
1043 return p; 929 return p;
1044 } 930 }
1045 931
1046 static NfcProxy newFromEndpoint( 932
1047 core.MojoMessagePipeEndpoint endpoint) { 933 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]) {
1048 assert(endpoint.setDescription("For NfcProxy")); 934 var params = new _NfcTransmitOnNextConnectionParams();
1049 return new NfcProxy.fromEndpoint(endpoint); 935 params.nfcData = nfcData;
936 params.transmission = transmission;
937 return ctrl.sendMessageWithRequestId(
938 params,
939 _nfcMethodTransmitOnNextConnectionName,
940 -1,
941 bindings.MessageHeader.kMessageExpectsResponse);
1050 } 942 }
1051 943 void register() {
1052 String get serviceName => Nfc.serviceName; 944 if (!ctrl.isBound) {
1053 945 ctrl.proxyError("The Proxy is closed.");
1054 Future close({bool immediate: false}) => impl.close(immediate: immediate); 946 return;
1055 947 }
1056 Future responseOrError(Future f) => impl.responseOrError(f); 948 var params = new _NfcRegisterParams();
1057 949 ctrl.sendMessage(params,
1058 Future get errorFuture => impl.errorFuture; 950 _nfcMethodRegisterName);
1059
1060 int get version => impl.version;
1061
1062 Future<int> queryVersion() => impl.queryVersion();
1063
1064 void requireVersion(int requiredVersion) {
1065 impl.requireVersion(requiredVersion);
1066 } 951 }
1067 952 void unregister() {
1068 String toString() { 953 if (!ctrl.isBound) {
1069 return "NfcProxy($impl)"; 954 ctrl.proxyError("The Proxy is closed.");
955 return;
956 }
957 var params = new _NfcUnregisterParams();
958 ctrl.sendMessage(params,
959 _nfcMethodUnregisterName);
1070 } 960 }
1071 } 961 }
1072 962
1073 963
1074 class NfcStub extends bindings.Stub { 964 class NfcStub extends bindings.Stub {
1075 Nfc _impl; 965 Nfc _impl;
1076 966
1077 NfcStub.fromEndpoint( 967 NfcStub.fromEndpoint(
1078 core.MojoMessagePipeEndpoint endpoint, [Nfc impl]) 968 core.MojoMessagePipeEndpoint endpoint, [Nfc impl])
1079 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 969 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 static service_describer.ServiceDescription get serviceDescription { 1066 static service_describer.ServiceDescription get serviceDescription {
1177 if (_cachedServiceDescription == null) { 1067 if (_cachedServiceDescription == null) {
1178 _cachedServiceDescription = new _NfcServiceDescription(); 1068 _cachedServiceDescription = new _NfcServiceDescription();
1179 } 1069 }
1180 return _cachedServiceDescription; 1070 return _cachedServiceDescription;
1181 } 1071 }
1182 } 1072 }
1183 1073
1184 1074
1185 1075
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698