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 sensors_mojom; | 5 library sensors_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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 dynamic getAllTypeDefinitions([Function responseFactory]) => | 526 dynamic getAllTypeDefinitions([Function responseFactory]) => |
527 responseFactory(null); | 527 responseFactory(null); |
528 } | 528 } |
529 | 529 |
530 abstract class SensorListener { | 530 abstract class SensorListener { |
531 static const String serviceName = null; | 531 static const String serviceName = null; |
532 void onAccuracyChanged(int accuracy); | 532 void onAccuracyChanged(int accuracy); |
533 void onSensorChanged(SensorData data); | 533 void onSensorChanged(SensorData data); |
534 } | 534 } |
535 | 535 |
536 | 536 class _SensorListenerProxyControl |
537 class _SensorListenerProxyControl extends bindings.ProxyMessageHandler | 537 extends bindings.ProxyMessageHandler |
538 implements bindings.ProxyControl { | 538 implements bindings.ProxyControl { |
539 _SensorListenerProxyControl.fromEndpoint( | 539 _SensorListenerProxyControl.fromEndpoint( |
540 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 540 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
541 | 541 |
542 _SensorListenerProxyControl.fromHandle( | 542 _SensorListenerProxyControl.fromHandle( |
543 core.MojoHandle handle) : super.fromHandle(handle); | 543 core.MojoHandle handle) : super.fromHandle(handle); |
544 | 544 |
545 _SensorListenerProxyControl.unbound() : super.unbound(); | 545 _SensorListenerProxyControl.unbound() : super.unbound(); |
546 | 546 |
547 service_describer.ServiceDescription get serviceDescription => | 547 service_describer.ServiceDescription get serviceDescription => |
548 new _SensorListenerServiceDescription(); | 548 new _SensorListenerServiceDescription(); |
549 | 549 |
550 String get serviceName => SensorListener.serviceName; | 550 String get serviceName => SensorListener.serviceName; |
551 | 551 |
552 @override | |
553 void handleResponse(bindings.ServiceMessage message) { | 552 void handleResponse(bindings.ServiceMessage message) { |
554 switch (message.header.type) { | 553 switch (message.header.type) { |
555 default: | 554 default: |
556 proxyError("Unexpected message type: ${message.header.type}"); | 555 proxyError("Unexpected message type: ${message.header.type}"); |
557 close(immediate: true); | 556 close(immediate: true); |
558 break; | 557 break; |
559 } | 558 } |
560 } | 559 } |
561 | 560 |
562 @override | 561 @override |
563 String toString() { | 562 String toString() { |
564 var superString = super.toString(); | 563 var superString = super.toString(); |
565 return "_SensorListenerProxyControl($superString)"; | 564 return "_SensorListenerProxyControl($superString)"; |
566 } | 565 } |
567 } | 566 } |
568 | 567 |
569 | 568 class SensorListenerProxy |
570 class SensorListenerProxy extends bindings.Proxy | 569 extends bindings.Proxy |
571 implements SensorListener { | 570 implements SensorListener { |
572 SensorListenerProxy.fromEndpoint( | 571 SensorListenerProxy.fromEndpoint( |
573 core.MojoMessagePipeEndpoint endpoint) | 572 core.MojoMessagePipeEndpoint endpoint) |
574 : super(new _SensorListenerProxyControl.fromEndpoint(endpoint)); | 573 : super(new _SensorListenerProxyControl.fromEndpoint(endpoint)); |
575 | 574 |
576 SensorListenerProxy.fromHandle(core.MojoHandle handle) | 575 SensorListenerProxy.fromHandle(core.MojoHandle handle) |
577 : super(new _SensorListenerProxyControl.fromHandle(handle)); | 576 : super(new _SensorListenerProxyControl.fromHandle(handle)); |
578 | 577 |
579 SensorListenerProxy.unbound() | 578 SensorListenerProxy.unbound() |
580 : super(new _SensorListenerProxyControl.unbound()); | 579 : super(new _SensorListenerProxyControl.unbound()); |
581 | 580 |
(...skipping 26 matching lines...) Expand all Loading... |
608 ctrl.proxyError("The Proxy is closed."); | 607 ctrl.proxyError("The Proxy is closed."); |
609 return; | 608 return; |
610 } | 609 } |
611 var params = new _SensorListenerOnSensorChangedParams(); | 610 var params = new _SensorListenerOnSensorChangedParams(); |
612 params.data = data; | 611 params.data = data; |
613 ctrl.sendMessage(params, | 612 ctrl.sendMessage(params, |
614 _sensorListenerMethodOnSensorChangedName); | 613 _sensorListenerMethodOnSensorChangedName); |
615 } | 614 } |
616 } | 615 } |
617 | 616 |
618 | 617 class _SensorListenerStubControl |
619 class SensorListenerStub extends bindings.Stub { | 618 extends bindings.StubMessageHandler |
| 619 implements bindings.StubControl<SensorListener> { |
620 SensorListener _impl; | 620 SensorListener _impl; |
621 | 621 |
622 SensorListenerStub.fromEndpoint( | 622 _SensorListenerStubControl.fromEndpoint( |
623 core.MojoMessagePipeEndpoint endpoint, [SensorListener impl]) | 623 core.MojoMessagePipeEndpoint endpoint, [SensorListener impl]) |
624 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 624 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
625 _impl = impl; | 625 _impl = impl; |
626 } | 626 } |
627 | 627 |
628 SensorListenerStub.fromHandle( | 628 _SensorListenerStubControl.fromHandle( |
629 core.MojoHandle handle, [SensorListener impl]) | 629 core.MojoHandle handle, [SensorListener impl]) |
630 : super.fromHandle(handle, autoBegin: impl != null) { | 630 : super.fromHandle(handle, autoBegin: impl != null) { |
631 _impl = impl; | 631 _impl = impl; |
632 } | 632 } |
633 | 633 |
634 SensorListenerStub.unbound([this._impl]) : super.unbound(); | 634 _SensorListenerStubControl.unbound([this._impl]) : super.unbound(); |
635 | |
636 static SensorListenerStub newFromEndpoint( | |
637 core.MojoMessagePipeEndpoint endpoint) { | |
638 assert(endpoint.setDescription("For SensorListenerStub")); | |
639 return new SensorListenerStub.fromEndpoint(endpoint); | |
640 } | |
641 | 635 |
642 | 636 |
643 | 637 |
644 dynamic handleMessage(bindings.ServiceMessage message) { | 638 dynamic handleMessage(bindings.ServiceMessage message) { |
645 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 639 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
646 return bindings.ControlMessageHandler.handleMessage(this, | 640 return bindings.ControlMessageHandler.handleMessage(this, |
647 0, | 641 0, |
648 message); | 642 message); |
649 } | 643 } |
650 if (_impl == null) { | 644 if (_impl == null) { |
(...skipping 29 matching lines...) Expand all Loading... |
680 } | 674 } |
681 | 675 |
682 @override | 676 @override |
683 void bind(core.MojoMessagePipeEndpoint endpoint) { | 677 void bind(core.MojoMessagePipeEndpoint endpoint) { |
684 super.bind(endpoint); | 678 super.bind(endpoint); |
685 if (!isOpen && (_impl != null)) { | 679 if (!isOpen && (_impl != null)) { |
686 beginHandlingEvents(); | 680 beginHandlingEvents(); |
687 } | 681 } |
688 } | 682 } |
689 | 683 |
| 684 @override |
690 String toString() { | 685 String toString() { |
691 var superString = super.toString(); | 686 var superString = super.toString(); |
692 return "SensorListenerStub($superString)"; | 687 return "_SensorListenerStubControl($superString)"; |
693 } | 688 } |
694 | 689 |
695 int get version => 0; | 690 int get version => 0; |
696 | 691 |
697 static service_describer.ServiceDescription _cachedServiceDescription; | 692 static service_describer.ServiceDescription _cachedServiceDescription; |
698 static service_describer.ServiceDescription get serviceDescription { | 693 static service_describer.ServiceDescription get serviceDescription { |
699 if (_cachedServiceDescription == null) { | 694 if (_cachedServiceDescription == null) { |
700 _cachedServiceDescription = new _SensorListenerServiceDescription(); | 695 _cachedServiceDescription = new _SensorListenerServiceDescription(); |
701 } | 696 } |
702 return _cachedServiceDescription; | 697 return _cachedServiceDescription; |
703 } | 698 } |
704 } | 699 } |
705 | 700 |
| 701 class SensorListenerStub |
| 702 extends bindings.Stub<SensorListener> |
| 703 implements SensorListener { |
| 704 SensorListenerStub.fromEndpoint( |
| 705 core.MojoMessagePipeEndpoint endpoint, [SensorListener impl]) |
| 706 : super(new _SensorListenerStubControl.fromEndpoint(endpoint, impl)); |
| 707 |
| 708 SensorListenerStub.fromHandle( |
| 709 core.MojoHandle handle, [SensorListener impl]) |
| 710 : super(new _SensorListenerStubControl.fromHandle(handle, impl)); |
| 711 |
| 712 SensorListenerStub.unbound([SensorListener impl]) |
| 713 : super(new _SensorListenerStubControl.unbound(impl)); |
| 714 |
| 715 static SensorListenerStub newFromEndpoint( |
| 716 core.MojoMessagePipeEndpoint endpoint) { |
| 717 assert(endpoint.setDescription("For SensorListenerStub")); |
| 718 return new SensorListenerStub.fromEndpoint(endpoint); |
| 719 } |
| 720 |
| 721 static service_describer.ServiceDescription get serviceDescription => |
| 722 _SensorListenerStubControl.serviceDescription; |
| 723 |
| 724 |
| 725 void onAccuracyChanged(int accuracy) { |
| 726 return impl.onAccuracyChanged(accuracy); |
| 727 } |
| 728 void onSensorChanged(SensorData data) { |
| 729 return impl.onSensorChanged(data); |
| 730 } |
| 731 } |
| 732 |
706 const int _sensorServiceMethodAddListenerName = 0; | 733 const int _sensorServiceMethodAddListenerName = 0; |
707 | 734 |
708 class _SensorServiceServiceDescription implements service_describer.ServiceDescr
iption { | 735 class _SensorServiceServiceDescription implements service_describer.ServiceDescr
iption { |
709 dynamic getTopLevelInterface([Function responseFactory]) => | 736 dynamic getTopLevelInterface([Function responseFactory]) => |
710 responseFactory(null); | 737 responseFactory(null); |
711 | 738 |
712 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 739 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
713 responseFactory(null); | 740 responseFactory(null); |
714 | 741 |
715 dynamic getAllTypeDefinitions([Function responseFactory]) => | 742 dynamic getAllTypeDefinitions([Function responseFactory]) => |
716 responseFactory(null); | 743 responseFactory(null); |
717 } | 744 } |
718 | 745 |
719 abstract class SensorService { | 746 abstract class SensorService { |
720 static const String serviceName = "sensors::SensorService"; | 747 static const String serviceName = "sensors::SensorService"; |
721 void addListener(SensorType type, Object listener); | 748 void addListener(SensorType type, Object listener); |
722 } | 749 } |
723 | 750 |
724 | 751 class _SensorServiceProxyControl |
725 class _SensorServiceProxyControl extends bindings.ProxyMessageHandler | 752 extends bindings.ProxyMessageHandler |
726 implements bindings.ProxyControl { | 753 implements bindings.ProxyControl { |
727 _SensorServiceProxyControl.fromEndpoint( | 754 _SensorServiceProxyControl.fromEndpoint( |
728 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 755 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
729 | 756 |
730 _SensorServiceProxyControl.fromHandle( | 757 _SensorServiceProxyControl.fromHandle( |
731 core.MojoHandle handle) : super.fromHandle(handle); | 758 core.MojoHandle handle) : super.fromHandle(handle); |
732 | 759 |
733 _SensorServiceProxyControl.unbound() : super.unbound(); | 760 _SensorServiceProxyControl.unbound() : super.unbound(); |
734 | 761 |
735 service_describer.ServiceDescription get serviceDescription => | 762 service_describer.ServiceDescription get serviceDescription => |
736 new _SensorServiceServiceDescription(); | 763 new _SensorServiceServiceDescription(); |
737 | 764 |
738 String get serviceName => SensorService.serviceName; | 765 String get serviceName => SensorService.serviceName; |
739 | 766 |
740 @override | |
741 void handleResponse(bindings.ServiceMessage message) { | 767 void handleResponse(bindings.ServiceMessage message) { |
742 switch (message.header.type) { | 768 switch (message.header.type) { |
743 default: | 769 default: |
744 proxyError("Unexpected message type: ${message.header.type}"); | 770 proxyError("Unexpected message type: ${message.header.type}"); |
745 close(immediate: true); | 771 close(immediate: true); |
746 break; | 772 break; |
747 } | 773 } |
748 } | 774 } |
749 | 775 |
750 @override | 776 @override |
751 String toString() { | 777 String toString() { |
752 var superString = super.toString(); | 778 var superString = super.toString(); |
753 return "_SensorServiceProxyControl($superString)"; | 779 return "_SensorServiceProxyControl($superString)"; |
754 } | 780 } |
755 } | 781 } |
756 | 782 |
757 | 783 class SensorServiceProxy |
758 class SensorServiceProxy extends bindings.Proxy | 784 extends bindings.Proxy |
759 implements SensorService { | 785 implements SensorService { |
760 SensorServiceProxy.fromEndpoint( | 786 SensorServiceProxy.fromEndpoint( |
761 core.MojoMessagePipeEndpoint endpoint) | 787 core.MojoMessagePipeEndpoint endpoint) |
762 : super(new _SensorServiceProxyControl.fromEndpoint(endpoint)); | 788 : super(new _SensorServiceProxyControl.fromEndpoint(endpoint)); |
763 | 789 |
764 SensorServiceProxy.fromHandle(core.MojoHandle handle) | 790 SensorServiceProxy.fromHandle(core.MojoHandle handle) |
765 : super(new _SensorServiceProxyControl.fromHandle(handle)); | 791 : super(new _SensorServiceProxyControl.fromHandle(handle)); |
766 | 792 |
767 SensorServiceProxy.unbound() | 793 SensorServiceProxy.unbound() |
768 : super(new _SensorServiceProxyControl.unbound()); | 794 : super(new _SensorServiceProxyControl.unbound()); |
769 | 795 |
(...skipping 17 matching lines...) Expand all Loading... |
787 return; | 813 return; |
788 } | 814 } |
789 var params = new _SensorServiceAddListenerParams(); | 815 var params = new _SensorServiceAddListenerParams(); |
790 params.type = type; | 816 params.type = type; |
791 params.listener = listener; | 817 params.listener = listener; |
792 ctrl.sendMessage(params, | 818 ctrl.sendMessage(params, |
793 _sensorServiceMethodAddListenerName); | 819 _sensorServiceMethodAddListenerName); |
794 } | 820 } |
795 } | 821 } |
796 | 822 |
797 | 823 class _SensorServiceStubControl |
798 class SensorServiceStub extends bindings.Stub { | 824 extends bindings.StubMessageHandler |
| 825 implements bindings.StubControl<SensorService> { |
799 SensorService _impl; | 826 SensorService _impl; |
800 | 827 |
801 SensorServiceStub.fromEndpoint( | 828 _SensorServiceStubControl.fromEndpoint( |
802 core.MojoMessagePipeEndpoint endpoint, [SensorService impl]) | 829 core.MojoMessagePipeEndpoint endpoint, [SensorService impl]) |
803 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 830 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
804 _impl = impl; | 831 _impl = impl; |
805 } | 832 } |
806 | 833 |
807 SensorServiceStub.fromHandle( | 834 _SensorServiceStubControl.fromHandle( |
808 core.MojoHandle handle, [SensorService impl]) | 835 core.MojoHandle handle, [SensorService impl]) |
809 : super.fromHandle(handle, autoBegin: impl != null) { | 836 : super.fromHandle(handle, autoBegin: impl != null) { |
810 _impl = impl; | 837 _impl = impl; |
811 } | 838 } |
812 | 839 |
813 SensorServiceStub.unbound([this._impl]) : super.unbound(); | 840 _SensorServiceStubControl.unbound([this._impl]) : super.unbound(); |
814 | |
815 static SensorServiceStub newFromEndpoint( | |
816 core.MojoMessagePipeEndpoint endpoint) { | |
817 assert(endpoint.setDescription("For SensorServiceStub")); | |
818 return new SensorServiceStub.fromEndpoint(endpoint); | |
819 } | |
820 | 841 |
821 | 842 |
822 | 843 |
823 dynamic handleMessage(bindings.ServiceMessage message) { | 844 dynamic handleMessage(bindings.ServiceMessage message) { |
824 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 845 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
825 return bindings.ControlMessageHandler.handleMessage(this, | 846 return bindings.ControlMessageHandler.handleMessage(this, |
826 0, | 847 0, |
827 message); | 848 message); |
828 } | 849 } |
829 if (_impl == null) { | 850 if (_impl == null) { |
(...skipping 24 matching lines...) Expand all Loading... |
854 } | 875 } |
855 | 876 |
856 @override | 877 @override |
857 void bind(core.MojoMessagePipeEndpoint endpoint) { | 878 void bind(core.MojoMessagePipeEndpoint endpoint) { |
858 super.bind(endpoint); | 879 super.bind(endpoint); |
859 if (!isOpen && (_impl != null)) { | 880 if (!isOpen && (_impl != null)) { |
860 beginHandlingEvents(); | 881 beginHandlingEvents(); |
861 } | 882 } |
862 } | 883 } |
863 | 884 |
| 885 @override |
864 String toString() { | 886 String toString() { |
865 var superString = super.toString(); | 887 var superString = super.toString(); |
866 return "SensorServiceStub($superString)"; | 888 return "_SensorServiceStubControl($superString)"; |
867 } | 889 } |
868 | 890 |
869 int get version => 0; | 891 int get version => 0; |
870 | 892 |
871 static service_describer.ServiceDescription _cachedServiceDescription; | 893 static service_describer.ServiceDescription _cachedServiceDescription; |
872 static service_describer.ServiceDescription get serviceDescription { | 894 static service_describer.ServiceDescription get serviceDescription { |
873 if (_cachedServiceDescription == null) { | 895 if (_cachedServiceDescription == null) { |
874 _cachedServiceDescription = new _SensorServiceServiceDescription(); | 896 _cachedServiceDescription = new _SensorServiceServiceDescription(); |
875 } | 897 } |
876 return _cachedServiceDescription; | 898 return _cachedServiceDescription; |
877 } | 899 } |
878 } | 900 } |
879 | 901 |
| 902 class SensorServiceStub |
| 903 extends bindings.Stub<SensorService> |
| 904 implements SensorService { |
| 905 SensorServiceStub.fromEndpoint( |
| 906 core.MojoMessagePipeEndpoint endpoint, [SensorService impl]) |
| 907 : super(new _SensorServiceStubControl.fromEndpoint(endpoint, impl)); |
| 908 |
| 909 SensorServiceStub.fromHandle( |
| 910 core.MojoHandle handle, [SensorService impl]) |
| 911 : super(new _SensorServiceStubControl.fromHandle(handle, impl)); |
| 912 |
| 913 SensorServiceStub.unbound([SensorService impl]) |
| 914 : super(new _SensorServiceStubControl.unbound(impl)); |
| 915 |
| 916 static SensorServiceStub newFromEndpoint( |
| 917 core.MojoMessagePipeEndpoint endpoint) { |
| 918 assert(endpoint.setDescription("For SensorServiceStub")); |
| 919 return new SensorServiceStub.fromEndpoint(endpoint); |
| 920 } |
| 921 |
| 922 static service_describer.ServiceDescription get serviceDescription => |
| 923 _SensorServiceStubControl.serviceDescription; |
| 924 |
| 925 |
| 926 void addListener(SensorType type, Object listener) { |
| 927 return impl.addListener(type, listener); |
| 928 } |
| 929 } |
| 930 |
880 | 931 |
881 | 932 |
OLD | NEW |