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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 10 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 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:mojo/bindings.dart' as bindings; 9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core; 10 import 'package:mojo/core.dart' as core;
11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
11 13
12 14
13 15
14 class NfcData extends bindings.Struct { 16 class NfcData extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [ 17 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(16, 0) 18 const bindings.StructDataHeader(16, 0)
17 ]; 19 ];
18 List<int> data = null; 20 List<int> data = null;
19 21
20 NfcData() : super(kVersions.last.size); 22 NfcData() : super(kVersions.last.size);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 73 }
72 74
73 Map toJson() { 75 Map toJson() {
74 Map map = new Map(); 76 Map map = new Map();
75 map["data"] = data; 77 map["data"] = data;
76 return map; 78 return map;
77 } 79 }
78 } 80 }
79 81
80 82
83
84
81 class _NfcTransmissionCancelParams extends bindings.Struct { 85 class _NfcTransmissionCancelParams extends bindings.Struct {
82 static const List<bindings.StructDataHeader> kVersions = const [ 86 static const List<bindings.StructDataHeader> kVersions = const [
83 const bindings.StructDataHeader(8, 0) 87 const bindings.StructDataHeader(8, 0)
84 ]; 88 ];
85 89
86 _NfcTransmissionCancelParams() : super(kVersions.last.size); 90 _NfcTransmissionCancelParams() : super(kVersions.last.size);
87 91
88 static _NfcTransmissionCancelParams deserialize(bindings.Message message) { 92 static _NfcTransmissionCancelParams deserialize(bindings.Message message) {
89 var decoder = new bindings.Decoder(message); 93 var decoder = new bindings.Decoder(message);
90 var result = decode(decoder); 94 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return "_NfcTransmissionCancelParams("")"; 133 return "_NfcTransmissionCancelParams("")";
130 } 134 }
131 135
132 Map toJson() { 136 Map toJson() {
133 Map map = new Map(); 137 Map map = new Map();
134 return map; 138 return map;
135 } 139 }
136 } 140 }
137 141
138 142
143
144
139 class _NfcReceiverOnReceivedNfcDataParams extends bindings.Struct { 145 class _NfcReceiverOnReceivedNfcDataParams extends bindings.Struct {
140 static const List<bindings.StructDataHeader> kVersions = const [ 146 static const List<bindings.StructDataHeader> kVersions = const [
141 const bindings.StructDataHeader(16, 0) 147 const bindings.StructDataHeader(16, 0)
142 ]; 148 ];
143 NfcData nfcData = null; 149 NfcData nfcData = null;
144 150
145 _NfcReceiverOnReceivedNfcDataParams() : super(kVersions.last.size); 151 _NfcReceiverOnReceivedNfcDataParams() : super(kVersions.last.size);
146 152
147 static _NfcReceiverOnReceivedNfcDataParams deserialize(bindings.Message messag e) { 153 static _NfcReceiverOnReceivedNfcDataParams deserialize(bindings.Message messag e) {
148 var decoder = new bindings.Decoder(message); 154 var decoder = new bindings.Decoder(message);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 203 }
198 204
199 Map toJson() { 205 Map toJson() {
200 Map map = new Map(); 206 Map map = new Map();
201 map["nfcData"] = nfcData; 207 map["nfcData"] = nfcData;
202 return map; 208 return map;
203 } 209 }
204 } 210 }
205 211
206 212
213
214
207 class _NfcTransmitOnNextConnectionParams extends bindings.Struct { 215 class _NfcTransmitOnNextConnectionParams extends bindings.Struct {
208 static const List<bindings.StructDataHeader> kVersions = const [ 216 static const List<bindings.StructDataHeader> kVersions = const [
209 const bindings.StructDataHeader(24, 0) 217 const bindings.StructDataHeader(24, 0)
210 ]; 218 ];
211 NfcData nfcData = null; 219 NfcData nfcData = null;
212 Object transmission = null; 220 Object transmission = null;
213 221
214 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size); 222 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size);
215 223
216 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message ) { 224 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message ) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 "transmission: $transmission" ")"; 280 "transmission: $transmission" ")";
273 } 281 }
274 282
275 Map toJson() { 283 Map toJson() {
276 throw new bindings.MojoCodecError( 284 throw new bindings.MojoCodecError(
277 'Object containing handles cannot be encoded to JSON.'); 285 'Object containing handles cannot be encoded to JSON.');
278 } 286 }
279 } 287 }
280 288
281 289
290
291
282 class NfcTransmitOnNextConnectionResponseParams extends bindings.Struct { 292 class NfcTransmitOnNextConnectionResponseParams extends bindings.Struct {
283 static const List<bindings.StructDataHeader> kVersions = const [ 293 static const List<bindings.StructDataHeader> kVersions = const [
284 const bindings.StructDataHeader(16, 0) 294 const bindings.StructDataHeader(16, 0)
285 ]; 295 ];
286 bool success = false; 296 bool success = false;
287 297
288 NfcTransmitOnNextConnectionResponseParams() : super(kVersions.last.size); 298 NfcTransmitOnNextConnectionResponseParams() : super(kVersions.last.size);
289 299
290 static NfcTransmitOnNextConnectionResponseParams deserialize(bindings.Message message) { 300 static NfcTransmitOnNextConnectionResponseParams deserialize(bindings.Message message) {
291 var decoder = new bindings.Decoder(message); 301 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 349 }
340 350
341 Map toJson() { 351 Map toJson() {
342 Map map = new Map(); 352 Map map = new Map();
343 map["success"] = success; 353 map["success"] = success;
344 return map; 354 return map;
345 } 355 }
346 } 356 }
347 357
348 358
359
360
349 class _NfcRegisterParams extends bindings.Struct { 361 class _NfcRegisterParams extends bindings.Struct {
350 static const List<bindings.StructDataHeader> kVersions = const [ 362 static const List<bindings.StructDataHeader> kVersions = const [
351 const bindings.StructDataHeader(8, 0) 363 const bindings.StructDataHeader(8, 0)
352 ]; 364 ];
353 365
354 _NfcRegisterParams() : super(kVersions.last.size); 366 _NfcRegisterParams() : super(kVersions.last.size);
355 367
356 static _NfcRegisterParams deserialize(bindings.Message message) { 368 static _NfcRegisterParams deserialize(bindings.Message message) {
357 var decoder = new bindings.Decoder(message); 369 var decoder = new bindings.Decoder(message);
358 var result = decode(decoder); 370 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 return "_NfcRegisterParams("")"; 409 return "_NfcRegisterParams("")";
398 } 410 }
399 411
400 Map toJson() { 412 Map toJson() {
401 Map map = new Map(); 413 Map map = new Map();
402 return map; 414 return map;
403 } 415 }
404 } 416 }
405 417
406 418
419
420
407 class _NfcUnregisterParams extends bindings.Struct { 421 class _NfcUnregisterParams extends bindings.Struct {
408 static const List<bindings.StructDataHeader> kVersions = const [ 422 static const List<bindings.StructDataHeader> kVersions = const [
409 const bindings.StructDataHeader(8, 0) 423 const bindings.StructDataHeader(8, 0)
410 ]; 424 ];
411 425
412 _NfcUnregisterParams() : super(kVersions.last.size); 426 _NfcUnregisterParams() : super(kVersions.last.size);
413 427
414 static _NfcUnregisterParams deserialize(bindings.Message message) { 428 static _NfcUnregisterParams deserialize(bindings.Message message) {
415 var decoder = new bindings.Decoder(message); 429 var decoder = new bindings.Decoder(message);
416 var result = decode(decoder); 430 var result = decode(decoder);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 String toString() { 468 String toString() {
455 return "_NfcUnregisterParams("")"; 469 return "_NfcUnregisterParams("")";
456 } 470 }
457 471
458 Map toJson() { 472 Map toJson() {
459 Map map = new Map(); 473 Map map = new Map();
460 return map; 474 return map;
461 } 475 }
462 } 476 }
463 477
478
479
480
464 const int _NfcTransmission_cancelName = 0; 481 const int _NfcTransmission_cancelName = 0;
465 482
483
484
485 class _NfcTransmissionServiceDescription implements service_describer.ServiceDes cription {
486 dynamic getTopLevelInterface([Function responseFactory]) => null;
487
488 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
489
490 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
491 }
492
466 abstract class NfcTransmission { 493 abstract class NfcTransmission {
467 static const String serviceName = null; 494 static const String serviceName = null;
468 void cancel(); 495 void cancel();
469 } 496 }
470 497
471 498
472 class _NfcTransmissionProxyImpl extends bindings.Proxy { 499 class _NfcTransmissionProxyImpl extends bindings.Proxy {
473 _NfcTransmissionProxyImpl.fromEndpoint( 500 _NfcTransmissionProxyImpl.fromEndpoint(
474 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 501 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
475 502
476 _NfcTransmissionProxyImpl.fromHandle(core.MojoHandle handle) : 503 _NfcTransmissionProxyImpl.fromHandle(core.MojoHandle handle) :
477 super.fromHandle(handle); 504 super.fromHandle(handle);
478 505
479 _NfcTransmissionProxyImpl.unbound() : super.unbound(); 506 _NfcTransmissionProxyImpl.unbound() : super.unbound();
480 507
481 static _NfcTransmissionProxyImpl newFromEndpoint( 508 static _NfcTransmissionProxyImpl newFromEndpoint(
482 core.MojoMessagePipeEndpoint endpoint) { 509 core.MojoMessagePipeEndpoint endpoint) {
483 assert(endpoint.setDescription("For _NfcTransmissionProxyImpl")); 510 assert(endpoint.setDescription("For _NfcTransmissionProxyImpl"));
484 return new _NfcTransmissionProxyImpl.fromEndpoint(endpoint); 511 return new _NfcTransmissionProxyImpl.fromEndpoint(endpoint);
485 } 512 }
486 513
514 service_describer.ServiceDescription get serviceDescription =>
515 new _NfcTransmissionServiceDescription();
516
487 void handleResponse(bindings.ServiceMessage message) { 517 void handleResponse(bindings.ServiceMessage message) {
488 switch (message.header.type) { 518 switch (message.header.type) {
489 default: 519 default:
490 proxyError("Unexpected message type: ${message.header.type}"); 520 proxyError("Unexpected message type: ${message.header.type}");
491 close(immediate: true); 521 close(immediate: true);
492 break; 522 break;
493 } 523 }
494 } 524 }
495 525
496 String toString() { 526 String toString() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 assert(_impl == null); 649 assert(_impl == null);
620 _impl = d; 650 _impl = d;
621 } 651 }
622 652
623 String toString() { 653 String toString() {
624 var superString = super.toString(); 654 var superString = super.toString();
625 return "NfcTransmissionStub($superString)"; 655 return "NfcTransmissionStub($superString)";
626 } 656 }
627 657
628 int get version => 0; 658 int get version => 0;
659
660 service_describer.ServiceDescription get serviceDescription =>
661 new _NfcTransmissionServiceDescription();
629 } 662 }
630 663
631 const int _NfcReceiver_onReceivedNfcDataName = 0; 664 const int _NfcReceiver_onReceivedNfcDataName = 0;
632 665
666
667
668 class _NfcReceiverServiceDescription implements service_describer.ServiceDescrip tion {
669 dynamic getTopLevelInterface([Function responseFactory]) => null;
670
671 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
672
673 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
674 }
675
633 abstract class NfcReceiver { 676 abstract class NfcReceiver {
634 static const String serviceName = "nfc::NfcReceiver"; 677 static const String serviceName = "nfc::NfcReceiver";
635 void onReceivedNfcData(NfcData nfcData); 678 void onReceivedNfcData(NfcData nfcData);
636 } 679 }
637 680
638 681
639 class _NfcReceiverProxyImpl extends bindings.Proxy { 682 class _NfcReceiverProxyImpl extends bindings.Proxy {
640 _NfcReceiverProxyImpl.fromEndpoint( 683 _NfcReceiverProxyImpl.fromEndpoint(
641 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 684 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
642 685
643 _NfcReceiverProxyImpl.fromHandle(core.MojoHandle handle) : 686 _NfcReceiverProxyImpl.fromHandle(core.MojoHandle handle) :
644 super.fromHandle(handle); 687 super.fromHandle(handle);
645 688
646 _NfcReceiverProxyImpl.unbound() : super.unbound(); 689 _NfcReceiverProxyImpl.unbound() : super.unbound();
647 690
648 static _NfcReceiverProxyImpl newFromEndpoint( 691 static _NfcReceiverProxyImpl newFromEndpoint(
649 core.MojoMessagePipeEndpoint endpoint) { 692 core.MojoMessagePipeEndpoint endpoint) {
650 assert(endpoint.setDescription("For _NfcReceiverProxyImpl")); 693 assert(endpoint.setDescription("For _NfcReceiverProxyImpl"));
651 return new _NfcReceiverProxyImpl.fromEndpoint(endpoint); 694 return new _NfcReceiverProxyImpl.fromEndpoint(endpoint);
652 } 695 }
653 696
697 service_describer.ServiceDescription get serviceDescription =>
698 new _NfcReceiverServiceDescription();
699
654 void handleResponse(bindings.ServiceMessage message) { 700 void handleResponse(bindings.ServiceMessage message) {
655 switch (message.header.type) { 701 switch (message.header.type) {
656 default: 702 default:
657 proxyError("Unexpected message type: ${message.header.type}"); 703 proxyError("Unexpected message type: ${message.header.type}");
658 close(immediate: true); 704 close(immediate: true);
659 break; 705 break;
660 } 706 }
661 } 707 }
662 708
663 String toString() { 709 String toString() {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 assert(_impl == null); 833 assert(_impl == null);
788 _impl = d; 834 _impl = d;
789 } 835 }
790 836
791 String toString() { 837 String toString() {
792 var superString = super.toString(); 838 var superString = super.toString();
793 return "NfcReceiverStub($superString)"; 839 return "NfcReceiverStub($superString)";
794 } 840 }
795 841
796 int get version => 0; 842 int get version => 0;
843
844 service_describer.ServiceDescription get serviceDescription =>
845 new _NfcReceiverServiceDescription();
797 } 846 }
798 847
799 const int _Nfc_transmitOnNextConnectionName = 0; 848 const int _Nfc_transmitOnNextConnectionName = 0;
800 const int _Nfc_registerName = 1; 849 const int _Nfc_registerName = 1;
801 const int _Nfc_unregisterName = 2; 850 const int _Nfc_unregisterName = 2;
802 851
852
853
854 class _NfcServiceDescription implements service_describer.ServiceDescription {
855 dynamic getTopLevelInterface([Function responseFactory]) => null;
856
857 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
858
859 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
860 }
861
803 abstract class Nfc { 862 abstract class Nfc {
804 static const String serviceName = "nfc::Nfc"; 863 static const String serviceName = "nfc::Nfc";
805 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]); 864 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]);
806 void register(); 865 void register();
807 void unregister(); 866 void unregister();
808 } 867 }
809 868
810 869
811 class _NfcProxyImpl extends bindings.Proxy { 870 class _NfcProxyImpl extends bindings.Proxy {
812 _NfcProxyImpl.fromEndpoint( 871 _NfcProxyImpl.fromEndpoint(
813 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 872 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
814 873
815 _NfcProxyImpl.fromHandle(core.MojoHandle handle) : 874 _NfcProxyImpl.fromHandle(core.MojoHandle handle) :
816 super.fromHandle(handle); 875 super.fromHandle(handle);
817 876
818 _NfcProxyImpl.unbound() : super.unbound(); 877 _NfcProxyImpl.unbound() : super.unbound();
819 878
820 static _NfcProxyImpl newFromEndpoint( 879 static _NfcProxyImpl newFromEndpoint(
821 core.MojoMessagePipeEndpoint endpoint) { 880 core.MojoMessagePipeEndpoint endpoint) {
822 assert(endpoint.setDescription("For _NfcProxyImpl")); 881 assert(endpoint.setDescription("For _NfcProxyImpl"));
823 return new _NfcProxyImpl.fromEndpoint(endpoint); 882 return new _NfcProxyImpl.fromEndpoint(endpoint);
824 } 883 }
825 884
885 service_describer.ServiceDescription get serviceDescription =>
886 new _NfcServiceDescription();
887
826 void handleResponse(bindings.ServiceMessage message) { 888 void handleResponse(bindings.ServiceMessage message) {
827 switch (message.header.type) { 889 switch (message.header.type) {
828 case _Nfc_transmitOnNextConnectionName: 890 case _Nfc_transmitOnNextConnectionName:
829 var r = NfcTransmitOnNextConnectionResponseParams.deserialize( 891 var r = NfcTransmitOnNextConnectionResponseParams.deserialize(
830 message.payload); 892 message.payload);
831 if (!message.header.hasRequestId) { 893 if (!message.header.hasRequestId) {
832 proxyError("Expected a message with a valid request Id."); 894 proxyError("Expected a message with a valid request Id.");
833 return; 895 return;
834 } 896 }
835 Completer c = completerMap[message.header.requestId]; 897 Completer c = completerMap[message.header.requestId];
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 assert(_impl == null); 1090 assert(_impl == null);
1029 _impl = d; 1091 _impl = d;
1030 } 1092 }
1031 1093
1032 String toString() { 1094 String toString() {
1033 var superString = super.toString(); 1095 var superString = super.toString();
1034 return "NfcStub($superString)"; 1096 return "NfcStub($superString)";
1035 } 1097 }
1036 1098
1037 int get version => 0; 1099 int get version => 0;
1100
1101 service_describer.ServiceDescription get serviceDescription =>
1102 new _NfcServiceDescription();
1038 } 1103 }
1039 1104
1040 1105
1106
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698