OLD | NEW |
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return map; | 211 return map; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 class _NfcTransmitOnNextConnectionParams extends bindings.Struct { | 216 class _NfcTransmitOnNextConnectionParams extends bindings.Struct { |
217 static const List<bindings.StructDataHeader> kVersions = const [ | 217 static const List<bindings.StructDataHeader> kVersions = const [ |
218 const bindings.StructDataHeader(24, 0) | 218 const bindings.StructDataHeader(24, 0) |
219 ]; | 219 ]; |
220 NfcData nfcData = null; | 220 NfcData nfcData = null; |
221 Object transmission = null; | 221 NfcTransmissionInterfaceRequest transmission = null; |
222 | 222 |
223 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size); | 223 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size); |
224 | 224 |
225 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message
) { | 225 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message
) { |
226 var decoder = new bindings.Decoder(message); | 226 var decoder = new bindings.Decoder(message); |
227 var result = decode(decoder); | 227 var result = decode(decoder); |
228 if (decoder.excessHandles != null) { | 228 if (decoder.excessHandles != null) { |
229 decoder.excessHandles.forEach((h) => h.close()); | 229 decoder.excessHandles.forEach((h) => h.close()); |
230 } | 230 } |
231 return result; | 231 return result; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 493 |
494 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 494 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
495 responseFactory(null); | 495 responseFactory(null); |
496 | 496 |
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 |
| 504 static service_describer.ServiceDescription _cachedServiceDescription; |
| 505 static service_describer.ServiceDescription get serviceDescription { |
| 506 if (_cachedServiceDescription == null) { |
| 507 _cachedServiceDescription = new _NfcTransmissionServiceDescription(); |
| 508 } |
| 509 return _cachedServiceDescription; |
| 510 } |
| 511 |
| 512 static NfcTransmissionProxy connectToService( |
| 513 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 514 NfcTransmissionProxy p = new NfcTransmissionProxy.unbound(); |
| 515 String name = serviceName ?? NfcTransmission.serviceName; |
| 516 if ((name == null) || name.isEmpty) { |
| 517 throw new core.MojoApiError( |
| 518 "If an interface has no ServiceName, then one must be provided."); |
| 519 } |
| 520 s.connectToService(url, p, name); |
| 521 return p; |
| 522 } |
503 void cancel(); | 523 void cancel(); |
504 } | 524 } |
505 | 525 |
| 526 abstract class NfcTransmissionInterface |
| 527 implements bindings.MojoInterface<NfcTransmission>, |
| 528 NfcTransmission { |
| 529 factory NfcTransmissionInterface([NfcTransmission impl]) => |
| 530 new NfcTransmissionStub.unbound(impl); |
| 531 factory NfcTransmissionInterface.fromEndpoint( |
| 532 core.MojoMessagePipeEndpoint endpoint, |
| 533 [NfcTransmission impl]) => |
| 534 new NfcTransmissionStub.fromEndpoint(endpoint, impl); |
| 535 } |
| 536 |
| 537 abstract class NfcTransmissionInterfaceRequest |
| 538 implements bindings.MojoInterface<NfcTransmission>, |
| 539 NfcTransmission { |
| 540 factory NfcTransmissionInterfaceRequest() => |
| 541 new NfcTransmissionProxy.unbound(); |
| 542 } |
| 543 |
506 class _NfcTransmissionProxyControl | 544 class _NfcTransmissionProxyControl |
507 extends bindings.ProxyMessageHandler | 545 extends bindings.ProxyMessageHandler |
508 implements bindings.ProxyControl { | 546 implements bindings.ProxyControl<NfcTransmission> { |
509 _NfcTransmissionProxyControl.fromEndpoint( | 547 _NfcTransmissionProxyControl.fromEndpoint( |
510 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 548 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
511 | 549 |
512 _NfcTransmissionProxyControl.fromHandle( | 550 _NfcTransmissionProxyControl.fromHandle( |
513 core.MojoHandle handle) : super.fromHandle(handle); | 551 core.MojoHandle handle) : super.fromHandle(handle); |
514 | 552 |
515 _NfcTransmissionProxyControl.unbound() : super.unbound(); | 553 _NfcTransmissionProxyControl.unbound() : super.unbound(); |
516 | 554 |
517 service_describer.ServiceDescription get serviceDescription => | |
518 new _NfcTransmissionServiceDescription(); | |
519 | |
520 String get serviceName => NfcTransmission.serviceName; | 555 String get serviceName => NfcTransmission.serviceName; |
521 | 556 |
522 void handleResponse(bindings.ServiceMessage message) { | 557 void handleResponse(bindings.ServiceMessage message) { |
523 switch (message.header.type) { | 558 switch (message.header.type) { |
524 default: | 559 default: |
525 proxyError("Unexpected message type: ${message.header.type}"); | 560 proxyError("Unexpected message type: ${message.header.type}"); |
526 close(immediate: true); | 561 close(immediate: true); |
527 break; | 562 break; |
528 } | 563 } |
529 } | 564 } |
530 | 565 |
| 566 NfcTransmission get impl => null; |
| 567 set impl(NfcTransmission _) { |
| 568 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 569 } |
| 570 |
531 @override | 571 @override |
532 String toString() { | 572 String toString() { |
533 var superString = super.toString(); | 573 var superString = super.toString(); |
534 return "_NfcTransmissionProxyControl($superString)"; | 574 return "_NfcTransmissionProxyControl($superString)"; |
535 } | 575 } |
536 } | 576 } |
537 | 577 |
538 class NfcTransmissionProxy | 578 class NfcTransmissionProxy |
539 extends bindings.Proxy | 579 extends bindings.Proxy<NfcTransmission> |
540 implements NfcTransmission { | 580 implements NfcTransmission, |
| 581 NfcTransmissionInterface, |
| 582 NfcTransmissionInterfaceRequest { |
541 NfcTransmissionProxy.fromEndpoint( | 583 NfcTransmissionProxy.fromEndpoint( |
542 core.MojoMessagePipeEndpoint endpoint) | 584 core.MojoMessagePipeEndpoint endpoint) |
543 : super(new _NfcTransmissionProxyControl.fromEndpoint(endpoint)); | 585 : super(new _NfcTransmissionProxyControl.fromEndpoint(endpoint)); |
544 | 586 |
545 NfcTransmissionProxy.fromHandle(core.MojoHandle handle) | 587 NfcTransmissionProxy.fromHandle(core.MojoHandle handle) |
546 : super(new _NfcTransmissionProxyControl.fromHandle(handle)); | 588 : super(new _NfcTransmissionProxyControl.fromHandle(handle)); |
547 | 589 |
548 NfcTransmissionProxy.unbound() | 590 NfcTransmissionProxy.unbound() |
549 : super(new _NfcTransmissionProxyControl.unbound()); | 591 : super(new _NfcTransmissionProxyControl.unbound()); |
550 | 592 |
551 static NfcTransmissionProxy newFromEndpoint( | 593 static NfcTransmissionProxy newFromEndpoint( |
552 core.MojoMessagePipeEndpoint endpoint) { | 594 core.MojoMessagePipeEndpoint endpoint) { |
553 assert(endpoint.setDescription("For NfcTransmissionProxy")); | 595 assert(endpoint.setDescription("For NfcTransmissionProxy")); |
554 return new NfcTransmissionProxy.fromEndpoint(endpoint); | 596 return new NfcTransmissionProxy.fromEndpoint(endpoint); |
555 } | 597 } |
556 | 598 |
557 factory NfcTransmissionProxy.connectToService( | |
558 bindings.ServiceConnector s, String url, [String serviceName]) { | |
559 NfcTransmissionProxy p = new NfcTransmissionProxy.unbound(); | |
560 s.connectToService(url, p, serviceName); | |
561 return p; | |
562 } | |
563 | |
564 | 599 |
565 void cancel() { | 600 void cancel() { |
566 if (!ctrl.isBound) { | 601 if (!ctrl.isBound) { |
567 ctrl.proxyError("The Proxy is closed."); | 602 ctrl.proxyError("The Proxy is closed."); |
568 return; | 603 return; |
569 } | 604 } |
570 var params = new _NfcTransmissionCancelParams(); | 605 var params = new _NfcTransmissionCancelParams(); |
571 ctrl.sendMessage(params, | 606 ctrl.sendMessage(params, |
572 _nfcTransmissionMethodCancelName); | 607 _nfcTransmissionMethodCancelName); |
573 } | 608 } |
(...skipping 11 matching lines...) Expand all Loading... |
585 } | 620 } |
586 | 621 |
587 _NfcTransmissionStubControl.fromHandle( | 622 _NfcTransmissionStubControl.fromHandle( |
588 core.MojoHandle handle, [NfcTransmission impl]) | 623 core.MojoHandle handle, [NfcTransmission impl]) |
589 : super.fromHandle(handle, autoBegin: impl != null) { | 624 : super.fromHandle(handle, autoBegin: impl != null) { |
590 _impl = impl; | 625 _impl = impl; |
591 } | 626 } |
592 | 627 |
593 _NfcTransmissionStubControl.unbound([this._impl]) : super.unbound(); | 628 _NfcTransmissionStubControl.unbound([this._impl]) : super.unbound(); |
594 | 629 |
| 630 String get serviceName => NfcTransmission.serviceName; |
| 631 |
595 | 632 |
596 | 633 |
597 dynamic handleMessage(bindings.ServiceMessage message) { | 634 dynamic handleMessage(bindings.ServiceMessage message) { |
598 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 635 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
599 return bindings.ControlMessageHandler.handleMessage(this, | 636 return bindings.ControlMessageHandler.handleMessage(this, |
600 0, | 637 0, |
601 message); | 638 message); |
602 } | 639 } |
603 if (_impl == null) { | 640 if (_impl == null) { |
604 throw new core.MojoApiError("$this has no implementation set"); | 641 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 28 matching lines...) Expand all Loading... |
633 } | 670 } |
634 } | 671 } |
635 | 672 |
636 @override | 673 @override |
637 String toString() { | 674 String toString() { |
638 var superString = super.toString(); | 675 var superString = super.toString(); |
639 return "_NfcTransmissionStubControl($superString)"; | 676 return "_NfcTransmissionStubControl($superString)"; |
640 } | 677 } |
641 | 678 |
642 int get version => 0; | 679 int get version => 0; |
643 | |
644 static service_describer.ServiceDescription _cachedServiceDescription; | |
645 static service_describer.ServiceDescription get serviceDescription { | |
646 if (_cachedServiceDescription == null) { | |
647 _cachedServiceDescription = new _NfcTransmissionServiceDescription(); | |
648 } | |
649 return _cachedServiceDescription; | |
650 } | |
651 } | 680 } |
652 | 681 |
653 class NfcTransmissionStub | 682 class NfcTransmissionStub |
654 extends bindings.Stub<NfcTransmission> | 683 extends bindings.Stub<NfcTransmission> |
655 implements NfcTransmission { | 684 implements NfcTransmission, |
| 685 NfcTransmissionInterface, |
| 686 NfcTransmissionInterfaceRequest { |
| 687 NfcTransmissionStub.unbound([NfcTransmission impl]) |
| 688 : super(new _NfcTransmissionStubControl.unbound(impl)); |
| 689 |
656 NfcTransmissionStub.fromEndpoint( | 690 NfcTransmissionStub.fromEndpoint( |
657 core.MojoMessagePipeEndpoint endpoint, [NfcTransmission impl]) | 691 core.MojoMessagePipeEndpoint endpoint, [NfcTransmission impl]) |
658 : super(new _NfcTransmissionStubControl.fromEndpoint(endpoint, impl)); | 692 : super(new _NfcTransmissionStubControl.fromEndpoint(endpoint, impl)); |
659 | 693 |
660 NfcTransmissionStub.fromHandle( | 694 NfcTransmissionStub.fromHandle( |
661 core.MojoHandle handle, [NfcTransmission impl]) | 695 core.MojoHandle handle, [NfcTransmission impl]) |
662 : super(new _NfcTransmissionStubControl.fromHandle(handle, impl)); | 696 : super(new _NfcTransmissionStubControl.fromHandle(handle, impl)); |
663 | 697 |
664 NfcTransmissionStub.unbound([NfcTransmission impl]) | |
665 : super(new _NfcTransmissionStubControl.unbound(impl)); | |
666 | |
667 static NfcTransmissionStub newFromEndpoint( | 698 static NfcTransmissionStub newFromEndpoint( |
668 core.MojoMessagePipeEndpoint endpoint) { | 699 core.MojoMessagePipeEndpoint endpoint) { |
669 assert(endpoint.setDescription("For NfcTransmissionStub")); | 700 assert(endpoint.setDescription("For NfcTransmissionStub")); |
670 return new NfcTransmissionStub.fromEndpoint(endpoint); | 701 return new NfcTransmissionStub.fromEndpoint(endpoint); |
671 } | 702 } |
672 | 703 |
673 static service_describer.ServiceDescription get serviceDescription => | |
674 _NfcTransmissionStubControl.serviceDescription; | |
675 | |
676 | 704 |
677 void cancel() { | 705 void cancel() { |
678 return impl.cancel(); | 706 return impl.cancel(); |
679 } | 707 } |
680 } | 708 } |
681 | 709 |
682 const int _nfcReceiverMethodOnReceivedNfcDataName = 0; | 710 const int _nfcReceiverMethodOnReceivedNfcDataName = 0; |
683 | 711 |
684 class _NfcReceiverServiceDescription implements service_describer.ServiceDescrip
tion { | 712 class _NfcReceiverServiceDescription implements service_describer.ServiceDescrip
tion { |
685 dynamic getTopLevelInterface([Function responseFactory]) => | 713 dynamic getTopLevelInterface([Function responseFactory]) => |
686 responseFactory(null); | 714 responseFactory(null); |
687 | 715 |
688 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 716 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
689 responseFactory(null); | 717 responseFactory(null); |
690 | 718 |
691 dynamic getAllTypeDefinitions([Function responseFactory]) => | 719 dynamic getAllTypeDefinitions([Function responseFactory]) => |
692 responseFactory(null); | 720 responseFactory(null); |
693 } | 721 } |
694 | 722 |
695 abstract class NfcReceiver { | 723 abstract class NfcReceiver { |
696 static const String serviceName = "nfc::NfcReceiver"; | 724 static const String serviceName = "nfc::NfcReceiver"; |
| 725 |
| 726 static service_describer.ServiceDescription _cachedServiceDescription; |
| 727 static service_describer.ServiceDescription get serviceDescription { |
| 728 if (_cachedServiceDescription == null) { |
| 729 _cachedServiceDescription = new _NfcReceiverServiceDescription(); |
| 730 } |
| 731 return _cachedServiceDescription; |
| 732 } |
| 733 |
| 734 static NfcReceiverProxy connectToService( |
| 735 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 736 NfcReceiverProxy p = new NfcReceiverProxy.unbound(); |
| 737 String name = serviceName ?? NfcReceiver.serviceName; |
| 738 if ((name == null) || name.isEmpty) { |
| 739 throw new core.MojoApiError( |
| 740 "If an interface has no ServiceName, then one must be provided."); |
| 741 } |
| 742 s.connectToService(url, p, name); |
| 743 return p; |
| 744 } |
697 void onReceivedNfcData(NfcData nfcData); | 745 void onReceivedNfcData(NfcData nfcData); |
698 } | 746 } |
699 | 747 |
| 748 abstract class NfcReceiverInterface |
| 749 implements bindings.MojoInterface<NfcReceiver>, |
| 750 NfcReceiver { |
| 751 factory NfcReceiverInterface([NfcReceiver impl]) => |
| 752 new NfcReceiverStub.unbound(impl); |
| 753 factory NfcReceiverInterface.fromEndpoint( |
| 754 core.MojoMessagePipeEndpoint endpoint, |
| 755 [NfcReceiver impl]) => |
| 756 new NfcReceiverStub.fromEndpoint(endpoint, impl); |
| 757 } |
| 758 |
| 759 abstract class NfcReceiverInterfaceRequest |
| 760 implements bindings.MojoInterface<NfcReceiver>, |
| 761 NfcReceiver { |
| 762 factory NfcReceiverInterfaceRequest() => |
| 763 new NfcReceiverProxy.unbound(); |
| 764 } |
| 765 |
700 class _NfcReceiverProxyControl | 766 class _NfcReceiverProxyControl |
701 extends bindings.ProxyMessageHandler | 767 extends bindings.ProxyMessageHandler |
702 implements bindings.ProxyControl { | 768 implements bindings.ProxyControl<NfcReceiver> { |
703 _NfcReceiverProxyControl.fromEndpoint( | 769 _NfcReceiverProxyControl.fromEndpoint( |
704 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 770 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
705 | 771 |
706 _NfcReceiverProxyControl.fromHandle( | 772 _NfcReceiverProxyControl.fromHandle( |
707 core.MojoHandle handle) : super.fromHandle(handle); | 773 core.MojoHandle handle) : super.fromHandle(handle); |
708 | 774 |
709 _NfcReceiverProxyControl.unbound() : super.unbound(); | 775 _NfcReceiverProxyControl.unbound() : super.unbound(); |
710 | 776 |
711 service_describer.ServiceDescription get serviceDescription => | |
712 new _NfcReceiverServiceDescription(); | |
713 | |
714 String get serviceName => NfcReceiver.serviceName; | 777 String get serviceName => NfcReceiver.serviceName; |
715 | 778 |
716 void handleResponse(bindings.ServiceMessage message) { | 779 void handleResponse(bindings.ServiceMessage message) { |
717 switch (message.header.type) { | 780 switch (message.header.type) { |
718 default: | 781 default: |
719 proxyError("Unexpected message type: ${message.header.type}"); | 782 proxyError("Unexpected message type: ${message.header.type}"); |
720 close(immediate: true); | 783 close(immediate: true); |
721 break; | 784 break; |
722 } | 785 } |
723 } | 786 } |
724 | 787 |
| 788 NfcReceiver get impl => null; |
| 789 set impl(NfcReceiver _) { |
| 790 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 791 } |
| 792 |
725 @override | 793 @override |
726 String toString() { | 794 String toString() { |
727 var superString = super.toString(); | 795 var superString = super.toString(); |
728 return "_NfcReceiverProxyControl($superString)"; | 796 return "_NfcReceiverProxyControl($superString)"; |
729 } | 797 } |
730 } | 798 } |
731 | 799 |
732 class NfcReceiverProxy | 800 class NfcReceiverProxy |
733 extends bindings.Proxy | 801 extends bindings.Proxy<NfcReceiver> |
734 implements NfcReceiver { | 802 implements NfcReceiver, |
| 803 NfcReceiverInterface, |
| 804 NfcReceiverInterfaceRequest { |
735 NfcReceiverProxy.fromEndpoint( | 805 NfcReceiverProxy.fromEndpoint( |
736 core.MojoMessagePipeEndpoint endpoint) | 806 core.MojoMessagePipeEndpoint endpoint) |
737 : super(new _NfcReceiverProxyControl.fromEndpoint(endpoint)); | 807 : super(new _NfcReceiverProxyControl.fromEndpoint(endpoint)); |
738 | 808 |
739 NfcReceiverProxy.fromHandle(core.MojoHandle handle) | 809 NfcReceiverProxy.fromHandle(core.MojoHandle handle) |
740 : super(new _NfcReceiverProxyControl.fromHandle(handle)); | 810 : super(new _NfcReceiverProxyControl.fromHandle(handle)); |
741 | 811 |
742 NfcReceiverProxy.unbound() | 812 NfcReceiverProxy.unbound() |
743 : super(new _NfcReceiverProxyControl.unbound()); | 813 : super(new _NfcReceiverProxyControl.unbound()); |
744 | 814 |
745 static NfcReceiverProxy newFromEndpoint( | 815 static NfcReceiverProxy newFromEndpoint( |
746 core.MojoMessagePipeEndpoint endpoint) { | 816 core.MojoMessagePipeEndpoint endpoint) { |
747 assert(endpoint.setDescription("For NfcReceiverProxy")); | 817 assert(endpoint.setDescription("For NfcReceiverProxy")); |
748 return new NfcReceiverProxy.fromEndpoint(endpoint); | 818 return new NfcReceiverProxy.fromEndpoint(endpoint); |
749 } | 819 } |
750 | 820 |
751 factory NfcReceiverProxy.connectToService( | |
752 bindings.ServiceConnector s, String url, [String serviceName]) { | |
753 NfcReceiverProxy p = new NfcReceiverProxy.unbound(); | |
754 s.connectToService(url, p, serviceName); | |
755 return p; | |
756 } | |
757 | |
758 | 821 |
759 void onReceivedNfcData(NfcData nfcData) { | 822 void onReceivedNfcData(NfcData nfcData) { |
760 if (!ctrl.isBound) { | 823 if (!ctrl.isBound) { |
761 ctrl.proxyError("The Proxy is closed."); | 824 ctrl.proxyError("The Proxy is closed."); |
762 return; | 825 return; |
763 } | 826 } |
764 var params = new _NfcReceiverOnReceivedNfcDataParams(); | 827 var params = new _NfcReceiverOnReceivedNfcDataParams(); |
765 params.nfcData = nfcData; | 828 params.nfcData = nfcData; |
766 ctrl.sendMessage(params, | 829 ctrl.sendMessage(params, |
767 _nfcReceiverMethodOnReceivedNfcDataName); | 830 _nfcReceiverMethodOnReceivedNfcDataName); |
(...skipping 12 matching lines...) Expand all Loading... |
780 } | 843 } |
781 | 844 |
782 _NfcReceiverStubControl.fromHandle( | 845 _NfcReceiverStubControl.fromHandle( |
783 core.MojoHandle handle, [NfcReceiver impl]) | 846 core.MojoHandle handle, [NfcReceiver impl]) |
784 : super.fromHandle(handle, autoBegin: impl != null) { | 847 : super.fromHandle(handle, autoBegin: impl != null) { |
785 _impl = impl; | 848 _impl = impl; |
786 } | 849 } |
787 | 850 |
788 _NfcReceiverStubControl.unbound([this._impl]) : super.unbound(); | 851 _NfcReceiverStubControl.unbound([this._impl]) : super.unbound(); |
789 | 852 |
| 853 String get serviceName => NfcReceiver.serviceName; |
| 854 |
790 | 855 |
791 | 856 |
792 dynamic handleMessage(bindings.ServiceMessage message) { | 857 dynamic handleMessage(bindings.ServiceMessage message) { |
793 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 858 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
794 return bindings.ControlMessageHandler.handleMessage(this, | 859 return bindings.ControlMessageHandler.handleMessage(this, |
795 0, | 860 0, |
796 message); | 861 message); |
797 } | 862 } |
798 if (_impl == null) { | 863 if (_impl == null) { |
799 throw new core.MojoApiError("$this has no implementation set"); | 864 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 30 matching lines...) Expand all Loading... |
830 } | 895 } |
831 } | 896 } |
832 | 897 |
833 @override | 898 @override |
834 String toString() { | 899 String toString() { |
835 var superString = super.toString(); | 900 var superString = super.toString(); |
836 return "_NfcReceiverStubControl($superString)"; | 901 return "_NfcReceiverStubControl($superString)"; |
837 } | 902 } |
838 | 903 |
839 int get version => 0; | 904 int get version => 0; |
840 | |
841 static service_describer.ServiceDescription _cachedServiceDescription; | |
842 static service_describer.ServiceDescription get serviceDescription { | |
843 if (_cachedServiceDescription == null) { | |
844 _cachedServiceDescription = new _NfcReceiverServiceDescription(); | |
845 } | |
846 return _cachedServiceDescription; | |
847 } | |
848 } | 905 } |
849 | 906 |
850 class NfcReceiverStub | 907 class NfcReceiverStub |
851 extends bindings.Stub<NfcReceiver> | 908 extends bindings.Stub<NfcReceiver> |
852 implements NfcReceiver { | 909 implements NfcReceiver, |
| 910 NfcReceiverInterface, |
| 911 NfcReceiverInterfaceRequest { |
| 912 NfcReceiverStub.unbound([NfcReceiver impl]) |
| 913 : super(new _NfcReceiverStubControl.unbound(impl)); |
| 914 |
853 NfcReceiverStub.fromEndpoint( | 915 NfcReceiverStub.fromEndpoint( |
854 core.MojoMessagePipeEndpoint endpoint, [NfcReceiver impl]) | 916 core.MojoMessagePipeEndpoint endpoint, [NfcReceiver impl]) |
855 : super(new _NfcReceiverStubControl.fromEndpoint(endpoint, impl)); | 917 : super(new _NfcReceiverStubControl.fromEndpoint(endpoint, impl)); |
856 | 918 |
857 NfcReceiverStub.fromHandle( | 919 NfcReceiverStub.fromHandle( |
858 core.MojoHandle handle, [NfcReceiver impl]) | 920 core.MojoHandle handle, [NfcReceiver impl]) |
859 : super(new _NfcReceiverStubControl.fromHandle(handle, impl)); | 921 : super(new _NfcReceiverStubControl.fromHandle(handle, impl)); |
860 | 922 |
861 NfcReceiverStub.unbound([NfcReceiver impl]) | |
862 : super(new _NfcReceiverStubControl.unbound(impl)); | |
863 | |
864 static NfcReceiverStub newFromEndpoint( | 923 static NfcReceiverStub newFromEndpoint( |
865 core.MojoMessagePipeEndpoint endpoint) { | 924 core.MojoMessagePipeEndpoint endpoint) { |
866 assert(endpoint.setDescription("For NfcReceiverStub")); | 925 assert(endpoint.setDescription("For NfcReceiverStub")); |
867 return new NfcReceiverStub.fromEndpoint(endpoint); | 926 return new NfcReceiverStub.fromEndpoint(endpoint); |
868 } | 927 } |
869 | 928 |
870 static service_describer.ServiceDescription get serviceDescription => | |
871 _NfcReceiverStubControl.serviceDescription; | |
872 | |
873 | 929 |
874 void onReceivedNfcData(NfcData nfcData) { | 930 void onReceivedNfcData(NfcData nfcData) { |
875 return impl.onReceivedNfcData(nfcData); | 931 return impl.onReceivedNfcData(nfcData); |
876 } | 932 } |
877 } | 933 } |
878 | 934 |
879 const int _nfcMethodTransmitOnNextConnectionName = 0; | 935 const int _nfcMethodTransmitOnNextConnectionName = 0; |
880 const int _nfcMethodRegisterName = 1; | 936 const int _nfcMethodRegisterName = 1; |
881 const int _nfcMethodUnregisterName = 2; | 937 const int _nfcMethodUnregisterName = 2; |
882 | 938 |
883 class _NfcServiceDescription implements service_describer.ServiceDescription { | 939 class _NfcServiceDescription implements service_describer.ServiceDescription { |
884 dynamic getTopLevelInterface([Function responseFactory]) => | 940 dynamic getTopLevelInterface([Function responseFactory]) => |
885 responseFactory(null); | 941 responseFactory(null); |
886 | 942 |
887 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 943 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
888 responseFactory(null); | 944 responseFactory(null); |
889 | 945 |
890 dynamic getAllTypeDefinitions([Function responseFactory]) => | 946 dynamic getAllTypeDefinitions([Function responseFactory]) => |
891 responseFactory(null); | 947 responseFactory(null); |
892 } | 948 } |
893 | 949 |
894 abstract class Nfc { | 950 abstract class Nfc { |
895 static const String serviceName = "nfc::Nfc"; | 951 static const String serviceName = "nfc::Nfc"; |
896 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function
responseFactory = null]); | 952 |
| 953 static service_describer.ServiceDescription _cachedServiceDescription; |
| 954 static service_describer.ServiceDescription get serviceDescription { |
| 955 if (_cachedServiceDescription == null) { |
| 956 _cachedServiceDescription = new _NfcServiceDescription(); |
| 957 } |
| 958 return _cachedServiceDescription; |
| 959 } |
| 960 |
| 961 static NfcProxy connectToService( |
| 962 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 963 NfcProxy p = new NfcProxy.unbound(); |
| 964 String name = serviceName ?? Nfc.serviceName; |
| 965 if ((name == null) || name.isEmpty) { |
| 966 throw new core.MojoApiError( |
| 967 "If an interface has no ServiceName, then one must be provided."); |
| 968 } |
| 969 s.connectToService(url, p, name); |
| 970 return p; |
| 971 } |
| 972 dynamic transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceReque
st transmission,[Function responseFactory = null]); |
897 void register(); | 973 void register(); |
898 void unregister(); | 974 void unregister(); |
899 } | 975 } |
900 | 976 |
| 977 abstract class NfcInterface |
| 978 implements bindings.MojoInterface<Nfc>, |
| 979 Nfc { |
| 980 factory NfcInterface([Nfc impl]) => |
| 981 new NfcStub.unbound(impl); |
| 982 factory NfcInterface.fromEndpoint( |
| 983 core.MojoMessagePipeEndpoint endpoint, |
| 984 [Nfc impl]) => |
| 985 new NfcStub.fromEndpoint(endpoint, impl); |
| 986 } |
| 987 |
| 988 abstract class NfcInterfaceRequest |
| 989 implements bindings.MojoInterface<Nfc>, |
| 990 Nfc { |
| 991 factory NfcInterfaceRequest() => |
| 992 new NfcProxy.unbound(); |
| 993 } |
| 994 |
901 class _NfcProxyControl | 995 class _NfcProxyControl |
902 extends bindings.ProxyMessageHandler | 996 extends bindings.ProxyMessageHandler |
903 implements bindings.ProxyControl { | 997 implements bindings.ProxyControl<Nfc> { |
904 _NfcProxyControl.fromEndpoint( | 998 _NfcProxyControl.fromEndpoint( |
905 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 999 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
906 | 1000 |
907 _NfcProxyControl.fromHandle( | 1001 _NfcProxyControl.fromHandle( |
908 core.MojoHandle handle) : super.fromHandle(handle); | 1002 core.MojoHandle handle) : super.fromHandle(handle); |
909 | 1003 |
910 _NfcProxyControl.unbound() : super.unbound(); | 1004 _NfcProxyControl.unbound() : super.unbound(); |
911 | 1005 |
912 service_describer.ServiceDescription get serviceDescription => | |
913 new _NfcServiceDescription(); | |
914 | |
915 String get serviceName => Nfc.serviceName; | 1006 String get serviceName => Nfc.serviceName; |
916 | 1007 |
917 void handleResponse(bindings.ServiceMessage message) { | 1008 void handleResponse(bindings.ServiceMessage message) { |
918 switch (message.header.type) { | 1009 switch (message.header.type) { |
919 case _nfcMethodTransmitOnNextConnectionName: | 1010 case _nfcMethodTransmitOnNextConnectionName: |
920 var r = NfcTransmitOnNextConnectionResponseParams.deserialize( | 1011 var r = NfcTransmitOnNextConnectionResponseParams.deserialize( |
921 message.payload); | 1012 message.payload); |
922 if (!message.header.hasRequestId) { | 1013 if (!message.header.hasRequestId) { |
923 proxyError("Expected a message with a valid request Id."); | 1014 proxyError("Expected a message with a valid request Id."); |
924 return; | 1015 return; |
(...skipping 11 matching lines...) Expand all Loading... |
936 } | 1027 } |
937 c.complete(r); | 1028 c.complete(r); |
938 break; | 1029 break; |
939 default: | 1030 default: |
940 proxyError("Unexpected message type: ${message.header.type}"); | 1031 proxyError("Unexpected message type: ${message.header.type}"); |
941 close(immediate: true); | 1032 close(immediate: true); |
942 break; | 1033 break; |
943 } | 1034 } |
944 } | 1035 } |
945 | 1036 |
| 1037 Nfc get impl => null; |
| 1038 set impl(Nfc _) { |
| 1039 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 1040 } |
| 1041 |
946 @override | 1042 @override |
947 String toString() { | 1043 String toString() { |
948 var superString = super.toString(); | 1044 var superString = super.toString(); |
949 return "_NfcProxyControl($superString)"; | 1045 return "_NfcProxyControl($superString)"; |
950 } | 1046 } |
951 } | 1047 } |
952 | 1048 |
953 class NfcProxy | 1049 class NfcProxy |
954 extends bindings.Proxy | 1050 extends bindings.Proxy<Nfc> |
955 implements Nfc { | 1051 implements Nfc, |
| 1052 NfcInterface, |
| 1053 NfcInterfaceRequest { |
956 NfcProxy.fromEndpoint( | 1054 NfcProxy.fromEndpoint( |
957 core.MojoMessagePipeEndpoint endpoint) | 1055 core.MojoMessagePipeEndpoint endpoint) |
958 : super(new _NfcProxyControl.fromEndpoint(endpoint)); | 1056 : super(new _NfcProxyControl.fromEndpoint(endpoint)); |
959 | 1057 |
960 NfcProxy.fromHandle(core.MojoHandle handle) | 1058 NfcProxy.fromHandle(core.MojoHandle handle) |
961 : super(new _NfcProxyControl.fromHandle(handle)); | 1059 : super(new _NfcProxyControl.fromHandle(handle)); |
962 | 1060 |
963 NfcProxy.unbound() | 1061 NfcProxy.unbound() |
964 : super(new _NfcProxyControl.unbound()); | 1062 : super(new _NfcProxyControl.unbound()); |
965 | 1063 |
966 static NfcProxy newFromEndpoint( | 1064 static NfcProxy newFromEndpoint( |
967 core.MojoMessagePipeEndpoint endpoint) { | 1065 core.MojoMessagePipeEndpoint endpoint) { |
968 assert(endpoint.setDescription("For NfcProxy")); | 1066 assert(endpoint.setDescription("For NfcProxy")); |
969 return new NfcProxy.fromEndpoint(endpoint); | 1067 return new NfcProxy.fromEndpoint(endpoint); |
970 } | 1068 } |
971 | 1069 |
972 factory NfcProxy.connectToService( | |
973 bindings.ServiceConnector s, String url, [String serviceName]) { | |
974 NfcProxy p = new NfcProxy.unbound(); | |
975 s.connectToService(url, p, serviceName); | |
976 return p; | |
977 } | |
978 | 1070 |
979 | 1071 dynamic transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceReque
st transmission,[Function responseFactory = null]) { |
980 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function
responseFactory = null]) { | |
981 var params = new _NfcTransmitOnNextConnectionParams(); | 1072 var params = new _NfcTransmitOnNextConnectionParams(); |
982 params.nfcData = nfcData; | 1073 params.nfcData = nfcData; |
983 params.transmission = transmission; | 1074 params.transmission = transmission; |
984 return ctrl.sendMessageWithRequestId( | 1075 return ctrl.sendMessageWithRequestId( |
985 params, | 1076 params, |
986 _nfcMethodTransmitOnNextConnectionName, | 1077 _nfcMethodTransmitOnNextConnectionName, |
987 -1, | 1078 -1, |
988 bindings.MessageHeader.kMessageExpectsResponse); | 1079 bindings.MessageHeader.kMessageExpectsResponse); |
989 } | 1080 } |
990 void register() { | 1081 void register() { |
(...skipping 28 matching lines...) Expand all Loading... |
1019 } | 1110 } |
1020 | 1111 |
1021 _NfcStubControl.fromHandle( | 1112 _NfcStubControl.fromHandle( |
1022 core.MojoHandle handle, [Nfc impl]) | 1113 core.MojoHandle handle, [Nfc impl]) |
1023 : super.fromHandle(handle, autoBegin: impl != null) { | 1114 : super.fromHandle(handle, autoBegin: impl != null) { |
1024 _impl = impl; | 1115 _impl = impl; |
1025 } | 1116 } |
1026 | 1117 |
1027 _NfcStubControl.unbound([this._impl]) : super.unbound(); | 1118 _NfcStubControl.unbound([this._impl]) : super.unbound(); |
1028 | 1119 |
| 1120 String get serviceName => Nfc.serviceName; |
| 1121 |
1029 | 1122 |
1030 NfcTransmitOnNextConnectionResponseParams _nfcTransmitOnNextConnectionResponse
ParamsFactory(bool success) { | 1123 NfcTransmitOnNextConnectionResponseParams _nfcTransmitOnNextConnectionResponse
ParamsFactory(bool success) { |
1031 var result = new NfcTransmitOnNextConnectionResponseParams(); | 1124 var result = new NfcTransmitOnNextConnectionResponseParams(); |
1032 result.success = success; | 1125 result.success = success; |
1033 return result; | 1126 return result; |
1034 } | 1127 } |
1035 | 1128 |
1036 dynamic handleMessage(bindings.ServiceMessage message) { | 1129 dynamic handleMessage(bindings.ServiceMessage message) { |
1037 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1130 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
1038 return bindings.ControlMessageHandler.handleMessage(this, | 1131 return bindings.ControlMessageHandler.handleMessage(this, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 } | 1190 } |
1098 } | 1191 } |
1099 | 1192 |
1100 @override | 1193 @override |
1101 String toString() { | 1194 String toString() { |
1102 var superString = super.toString(); | 1195 var superString = super.toString(); |
1103 return "_NfcStubControl($superString)"; | 1196 return "_NfcStubControl($superString)"; |
1104 } | 1197 } |
1105 | 1198 |
1106 int get version => 0; | 1199 int get version => 0; |
1107 | |
1108 static service_describer.ServiceDescription _cachedServiceDescription; | |
1109 static service_describer.ServiceDescription get serviceDescription { | |
1110 if (_cachedServiceDescription == null) { | |
1111 _cachedServiceDescription = new _NfcServiceDescription(); | |
1112 } | |
1113 return _cachedServiceDescription; | |
1114 } | |
1115 } | 1200 } |
1116 | 1201 |
1117 class NfcStub | 1202 class NfcStub |
1118 extends bindings.Stub<Nfc> | 1203 extends bindings.Stub<Nfc> |
1119 implements Nfc { | 1204 implements Nfc, |
| 1205 NfcInterface, |
| 1206 NfcInterfaceRequest { |
| 1207 NfcStub.unbound([Nfc impl]) |
| 1208 : super(new _NfcStubControl.unbound(impl)); |
| 1209 |
1120 NfcStub.fromEndpoint( | 1210 NfcStub.fromEndpoint( |
1121 core.MojoMessagePipeEndpoint endpoint, [Nfc impl]) | 1211 core.MojoMessagePipeEndpoint endpoint, [Nfc impl]) |
1122 : super(new _NfcStubControl.fromEndpoint(endpoint, impl)); | 1212 : super(new _NfcStubControl.fromEndpoint(endpoint, impl)); |
1123 | 1213 |
1124 NfcStub.fromHandle( | 1214 NfcStub.fromHandle( |
1125 core.MojoHandle handle, [Nfc impl]) | 1215 core.MojoHandle handle, [Nfc impl]) |
1126 : super(new _NfcStubControl.fromHandle(handle, impl)); | 1216 : super(new _NfcStubControl.fromHandle(handle, impl)); |
1127 | 1217 |
1128 NfcStub.unbound([Nfc impl]) | |
1129 : super(new _NfcStubControl.unbound(impl)); | |
1130 | |
1131 static NfcStub newFromEndpoint( | 1218 static NfcStub newFromEndpoint( |
1132 core.MojoMessagePipeEndpoint endpoint) { | 1219 core.MojoMessagePipeEndpoint endpoint) { |
1133 assert(endpoint.setDescription("For NfcStub")); | 1220 assert(endpoint.setDescription("For NfcStub")); |
1134 return new NfcStub.fromEndpoint(endpoint); | 1221 return new NfcStub.fromEndpoint(endpoint); |
1135 } | 1222 } |
1136 | 1223 |
1137 static service_describer.ServiceDescription get serviceDescription => | |
1138 _NfcStubControl.serviceDescription; | |
1139 | 1224 |
1140 | 1225 dynamic transmitOnNextConnection(NfcData nfcData,NfcTransmissionInterfaceReque
st transmission,[Function responseFactory = null]) { |
1141 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function
responseFactory = null]) { | |
1142 return impl.transmitOnNextConnection(nfcData,transmission,responseFactory); | 1226 return impl.transmitOnNextConnection(nfcData,transmission,responseFactory); |
1143 } | 1227 } |
1144 void register() { | 1228 void register() { |
1145 return impl.register(); | 1229 return impl.register(); |
1146 } | 1230 } |
1147 void unregister() { | 1231 void unregister() { |
1148 return impl.unregister(); | 1232 return impl.unregister(); |
1149 } | 1233 } |
1150 } | 1234 } |
1151 | 1235 |
1152 | 1236 |
1153 | 1237 |
OLD | NEW |