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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Update to master and regenerate mojoms Created 4 years, 11 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 speech_recognizer_mojom; 5 library speech_recognizer_mojom;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection';
8 9
9 import 'package:mojo/bindings.dart' as bindings; 10 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core; 11 import 'package:mojo/core.dart' as core;
11 12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
13 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
12 class Error extends bindings.MojoEnum { 14 class Error extends bindings.MojoEnum {
13 static const Error networkTimeout = const Error._(1); 15 static const Error networkTimeout = const Error._(1);
14 static const Error network = const Error._(2); 16 static const Error network = const Error._(2);
15 static const Error audio = const Error._(3); 17 static const Error audio = const Error._(3);
16 static const Error server = const Error._(4); 18 static const Error server = const Error._(4);
17 static const Error client = const Error._(5); 19 static const Error client = const Error._(5);
18 static const Error speechTimeout = const Error._(6); 20 static const Error speechTimeout = const Error._(6);
19 static const Error noMatch = const Error._(7); 21 static const Error noMatch = const Error._(7);
20 static const Error recognizerBusy = const Error._(8); 22 static const Error recognizerBusy = const Error._(8);
21 static const Error insufficientPermissions = const Error._(9); 23 static const Error insufficientPermissions = const Error._(9);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 case client: 97 case client:
96 return 'Error.client'; 98 return 'Error.client';
97 case speechTimeout: 99 case speechTimeout:
98 return 'Error.speechTimeout'; 100 return 'Error.speechTimeout';
99 case noMatch: 101 case noMatch:
100 return 'Error.noMatch'; 102 return 'Error.noMatch';
101 case recognizerBusy: 103 case recognizerBusy:
102 return 'Error.recognizerBusy'; 104 return 'Error.recognizerBusy';
103 case insufficientPermissions: 105 case insufficientPermissions:
104 return 'Error.insufficientPermissions'; 106 return 'Error.insufficientPermissions';
107 default:
108 return null;
105 } 109 }
106 } 110 }
107 111
108 int toJson() => mojoEnumValue; 112 int toJson() => mojoEnumValue;
109 } 113 }
110 114
115 mojom_types.MojomEnum _speech_recognizer_Error__() {
116 return new mojom_types.MojomEnum()
117 ..declData = (new mojom_types.DeclarationData()
118 ..shortName = 'Error'
119 ..fullIdentifier = 'speech_recognizer.Error')
120 ..values = <mojom_types.EnumValue>[new mojom_types.EnumValue()
121 ..declData = (new mojom_types.DeclarationData()..shortName = 'NetworkTim eout')
122 ..enumTypeKey = '_speech_recognizer_Error__'
123 ..intValue = 1,new mojom_types.EnumValue()
124 ..declData = (new mojom_types.DeclarationData()..shortName = 'Network')
125 ..enumTypeKey = '_speech_recognizer_Error__'
126 ..intValue = 2,new mojom_types.EnumValue()
127 ..declData = (new mojom_types.DeclarationData()..shortName = 'Audio')
128 ..enumTypeKey = '_speech_recognizer_Error__'
129 ..intValue = 3,new mojom_types.EnumValue()
130 ..declData = (new mojom_types.DeclarationData()..shortName = 'Server')
131 ..enumTypeKey = '_speech_recognizer_Error__'
132 ..intValue = 4,new mojom_types.EnumValue()
133 ..declData = (new mojom_types.DeclarationData()..shortName = 'Client')
134 ..enumTypeKey = '_speech_recognizer_Error__'
135 ..intValue = 5,new mojom_types.EnumValue()
136 ..declData = (new mojom_types.DeclarationData()..shortName = 'SpeechTime out')
137 ..enumTypeKey = '_speech_recognizer_Error__'
138 ..intValue = 6,new mojom_types.EnumValue()
139 ..declData = (new mojom_types.DeclarationData()..shortName = 'NoMatch')
140 ..enumTypeKey = '_speech_recognizer_Error__'
141 ..intValue = 7,new mojom_types.EnumValue()
142 ..declData = (new mojom_types.DeclarationData()..shortName = 'Recognizer Busy')
143 ..enumTypeKey = '_speech_recognizer_Error__'
144 ..intValue = 8,new mojom_types.EnumValue()
145 ..declData = (new mojom_types.DeclarationData()..shortName = 'Insufficie ntPermissions')
146 ..enumTypeKey = '_speech_recognizer_Error__'
147 ..intValue = 9,];
148 }
149
111 150
112 151
113 class UtteranceCandidate extends bindings.Struct { 152 class UtteranceCandidate extends bindings.Struct {
114 static const List<bindings.StructDataHeader> kVersions = const [ 153 static const List<bindings.StructDataHeader> kVersions = const [
115 const bindings.StructDataHeader(24, 0) 154 const bindings.StructDataHeader(24, 0)
116 ]; 155 ];
117 String text = null; 156 String text = null;
118 double confidenceScore = 0.0; 157 double confidenceScore = 0.0;
119 158
120 UtteranceCandidate() : super(kVersions.last.size); 159 UtteranceCandidate() : super(kVersions.last.size);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 "confidenceScore: $confidenceScore" ")"; 216 "confidenceScore: $confidenceScore" ")";
178 } 217 }
179 218
180 Map toJson() { 219 Map toJson() {
181 Map map = new Map(); 220 Map map = new Map();
182 map["text"] = text; 221 map["text"] = text;
183 map["confidenceScore"] = confidenceScore; 222 map["confidenceScore"] = confidenceScore;
184 return map; 223 return map;
185 } 224 }
186 } 225 }
226 mojom_types.MojomStruct _speech_recognizer_UtteranceCandidate__() {
227 return new mojom_types.MojomStruct()
228 ..declData = (new mojom_types.DeclarationData()
229 ..shortName = 'UtteranceCandidate'
230 ..fullIdentifier = 'speech_recognizer.UtteranceCandidate')
231 ..fields = <mojom_types.StructField>[
232 new mojom_types.StructField()
233 ..declData = (new mojom_types.DeclarationData()..shortName = 'Text')
234 ..type = (new mojom_types.Type()
235 ..stringType = (new mojom_types.StringType()..nullable = false)),
236
237 new mojom_types.StructField()
238 ..declData = (new mojom_types.DeclarationData()..shortName = 'Confidence Score')
239 ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.fl oat),
240 ];
241 }
187 242
188 243
189 class _SpeechRecognizerServiceListenParams extends bindings.Struct { 244 class _SpeechRecognizerServiceListenParams extends bindings.Struct {
190 static const List<bindings.StructDataHeader> kVersions = const [ 245 static const List<bindings.StructDataHeader> kVersions = const [
191 const bindings.StructDataHeader(8, 0) 246 const bindings.StructDataHeader(8, 0)
192 ]; 247 ];
193 248
194 _SpeechRecognizerServiceListenParams() : super(kVersions.last.size); 249 _SpeechRecognizerServiceListenParams() : super(kVersions.last.size);
195 250
196 static _SpeechRecognizerServiceListenParams deserialize(bindings.Message messa ge) { 251 static _SpeechRecognizerServiceListenParams deserialize(bindings.Message messa ge) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 290
236 String toString() { 291 String toString() {
237 return "_SpeechRecognizerServiceListenParams("")"; 292 return "_SpeechRecognizerServiceListenParams("")";
238 } 293 }
239 294
240 Map toJson() { 295 Map toJson() {
241 Map map = new Map(); 296 Map map = new Map();
242 return map; 297 return map;
243 } 298 }
244 } 299 }
300 mojom_types.MojomStruct _speech_recognizer_SpeechRecognizerService_Listen_Params __() {
301 return new mojom_types.MojomStruct()
302 ..declData = (new mojom_types.DeclarationData()
303 ..shortName = '_SpeechRecognizerServiceListenParams'
304 ..fullIdentifier = 'speech_recognizer._SpeechRecognizerServiceListenParams ')
305 ..fields = <mojom_types.StructField>[];
306 }
245 307
246 308
247 class SpeechRecognizerServiceListenResponseParams extends bindings.Struct { 309 class SpeechRecognizerServiceListenResponseParams extends bindings.Struct {
248 static const List<bindings.StructDataHeader> kVersions = const [ 310 static const List<bindings.StructDataHeader> kVersions = const [
249 const bindings.StructDataHeader(24, 0) 311 const bindings.StructDataHeader(24, 0)
250 ]; 312 ];
251 ResultOrError resultOrError = null; 313 ResultOrError resultOrError = null;
252 314
253 SpeechRecognizerServiceListenResponseParams() : super(kVersions.last.size); 315 SpeechRecognizerServiceListenResponseParams() : super(kVersions.last.size);
254 316
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return "SpeechRecognizerServiceListenResponseParams(" 368 return "SpeechRecognizerServiceListenResponseParams("
307 "resultOrError: $resultOrError" ")"; 369 "resultOrError: $resultOrError" ")";
308 } 370 }
309 371
310 Map toJson() { 372 Map toJson() {
311 Map map = new Map(); 373 Map map = new Map();
312 map["resultOrError"] = resultOrError; 374 map["resultOrError"] = resultOrError;
313 return map; 375 return map;
314 } 376 }
315 } 377 }
378 mojom_types.MojomStruct _speech_recognizer_SpeechRecognizerService_Listen_Respon seParams__() {
379 return new mojom_types.MojomStruct()
380 ..declData = (new mojom_types.DeclarationData()
381 ..shortName = 'SpeechRecognizerServiceListenResponseParams'
382 ..fullIdentifier = 'speech_recognizer.SpeechRecognizerServiceListenRespons eParams')
383 ..fields = <mojom_types.StructField>[
384 new mojom_types.StructField()
385 ..declData = (new mojom_types.DeclarationData()..shortName = 'ResultOrEr ror')
386 ..type = (new mojom_types.Type()
387 ..typeReference = (new mojom_types.TypeReference()
388
389 ..identifier = '_speech_recognizer_ResultOrError__'
390 ..typeKey = '_speech_recognizer_ResultOrError__'
391 )),
392 ];
393 }
316 394
317 395
318 class _SpeechRecognizerServiceStopListeningParams extends bindings.Struct { 396 class _SpeechRecognizerServiceStopListeningParams extends bindings.Struct {
319 static const List<bindings.StructDataHeader> kVersions = const [ 397 static const List<bindings.StructDataHeader> kVersions = const [
320 const bindings.StructDataHeader(8, 0) 398 const bindings.StructDataHeader(8, 0)
321 ]; 399 ];
322 400
323 _SpeechRecognizerServiceStopListeningParams() : super(kVersions.last.size); 401 _SpeechRecognizerServiceStopListeningParams() : super(kVersions.last.size);
324 402
325 static _SpeechRecognizerServiceStopListeningParams deserialize(bindings.Messag e message) { 403 static _SpeechRecognizerServiceStopListeningParams deserialize(bindings.Messag e message) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 442
365 String toString() { 443 String toString() {
366 return "_SpeechRecognizerServiceStopListeningParams("")"; 444 return "_SpeechRecognizerServiceStopListeningParams("")";
367 } 445 }
368 446
369 Map toJson() { 447 Map toJson() {
370 Map map = new Map(); 448 Map map = new Map();
371 return map; 449 return map;
372 } 450 }
373 } 451 }
452 mojom_types.MojomStruct _speech_recognizer_SpeechRecognizerService_StopListening _Params__() {
453 return new mojom_types.MojomStruct()
454 ..declData = (new mojom_types.DeclarationData()
455 ..shortName = '_SpeechRecognizerServiceStopListeningParams'
456 ..fullIdentifier = 'speech_recognizer._SpeechRecognizerServiceStopListenin gParams')
457 ..fields = <mojom_types.StructField>[];
458 }
374 459
375 460
376 461
377 enum ResultOrErrorTag { 462 enum ResultOrErrorTag {
378 errorCode, 463 errorCode,
379 results, 464 results,
380 unknown 465 unknown
381 } 466 }
382 467
383 class ResultOrError extends bindings.Union { 468 class ResultOrError extends bindings.Union {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 case ResultOrErrorTag.results: 576 case ResultOrErrorTag.results:
492 result += "results"; 577 result += "results";
493 break; 578 break;
494 default: 579 default:
495 result += "unknown"; 580 result += "unknown";
496 } 581 }
497 result += ": $_data)"; 582 result += ": $_data)";
498 return result; 583 return result;
499 } 584 }
500 } 585 }
586
587 mojom_types.MojomUnion _speech_recognizer_ResultOrError__() {
588 return new mojom_types.MojomUnion()
589 ..declData = (new mojom_types.DeclarationData()
590 ..shortName = 'ResultOrError'
591 ..fullIdentifier = 'speech_recognizer.ResultOrError')
592 ..fields = <mojom_types.UnionField>[
593 new mojom_types.UnionField()
594 ..declData = (new mojom_types.DeclarationData()..shortName = 'ErrorCode' )
595 ..type = (new mojom_types.Type()
596 ..typeReference = (new mojom_types.TypeReference()
597
598 ..identifier = '_speech_recognizer_Error__'
599 ..typeKey = '_speech_recognizer_Error__'
600 ))
601 ..tag = 0,
602
603 new mojom_types.UnionField()
604 ..declData = (new mojom_types.DeclarationData()..shortName = 'Results')
605 ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType ()
606 ..elementType = (new mojom_types.Type()
607 ..typeReference = (new mojom_types.TypeReference()
608
609 ..identifier = '_speech_recognizer_UtteranceCandidate__'
610 ..typeKey = '_speech_recognizer_UtteranceCandidate__'
611 ))))
612 ..tag = 1,
613 ];
614 }
615
501 const int _SpeechRecognizerService_listenName = 0; 616 const int _SpeechRecognizerService_listenName = 0;
502 const int _SpeechRecognizerService_stopListeningName = 1; 617 const int _SpeechRecognizerService_stopListeningName = 1;
503 618
619 mojom_types.MojomInterface _speech_recognizer_SpeechRecognizerService__() {
620 return new mojom_types.MojomInterface()
621 ..declData = (new mojom_types.DeclarationData()
622 ..shortName = 'SpeechRecognizerService'
623 ..fullIdentifier = 'speech_recognizer.SpeechRecognizerService')
624 ..interfaceName = 'SpeechRecognizerService'
625 ..methods = <int, mojom_types.MojomMethod>{
626 _SpeechRecognizerService_listenName: new mojom_types.MojomMethod()
627 ..declData = (new mojom_types.DeclarationData()..shortName = 'Listen')
628 ..ordinal = _SpeechRecognizerService_listenName
629 ..responseParams = _speech_recognizer_SpeechRecognizerService_Listen_Res ponseParams__()..parameters = _speech_recognizer_SpeechRecognizerService_Listen_ Params__(),_SpeechRecognizerService_stopListeningName: new mojom_types.MojomMeth od()
630 ..declData = (new mojom_types.DeclarationData()..shortName = 'StopListen ing')
631 ..ordinal = _SpeechRecognizerService_stopListeningName..parameters = _sp eech_recognizer_SpeechRecognizerService_StopListening_Params__(),
632 };
633 }
634
635 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se rviceDescription {
636 dynamic getTopLevelInterface([Function responseFactory = null]) {
637 return _speech_recognizer_SpeechRecognizerService__();
638 }
639 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) {
640 return getAllMojomTypeDefinitions()[typeKey];
641 }
642 dynamic getAllTypeDefinitions([Function responseFactory = null]) {
643 return getAllMojomTypeDefinitions();
644 }
645 }
646
504 abstract class SpeechRecognizerService { 647 abstract class SpeechRecognizerService {
505 static const String serviceName = "speech_recognizer::SpeechRecognizerService" ; 648 static const String serviceName = "speech_recognizer::SpeechRecognizerService" ;
506 dynamic listen([Function responseFactory = null]); 649 dynamic listen([Function responseFactory = null]);
507 void stopListening(); 650 void stopListening();
508 } 651 }
509 652
510 653
511 class _SpeechRecognizerServiceProxyImpl extends bindings.Proxy { 654 class _SpeechRecognizerServiceProxyImpl extends bindings.Proxy {
512 _SpeechRecognizerServiceProxyImpl.fromEndpoint( 655 _SpeechRecognizerServiceProxyImpl.fromEndpoint(
513 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 656 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
514 657
515 _SpeechRecognizerServiceProxyImpl.fromHandle(core.MojoHandle handle) : 658 _SpeechRecognizerServiceProxyImpl.fromHandle(core.MojoHandle handle) :
516 super.fromHandle(handle); 659 super.fromHandle(handle);
517 660
518 _SpeechRecognizerServiceProxyImpl.unbound() : super.unbound(); 661 _SpeechRecognizerServiceProxyImpl.unbound() : super.unbound();
519 662
520 static _SpeechRecognizerServiceProxyImpl newFromEndpoint( 663 static _SpeechRecognizerServiceProxyImpl newFromEndpoint(
521 core.MojoMessagePipeEndpoint endpoint) { 664 core.MojoMessagePipeEndpoint endpoint) {
522 assert(endpoint.setDescription("For _SpeechRecognizerServiceProxyImpl")); 665 assert(endpoint.setDescription("For _SpeechRecognizerServiceProxyImpl"));
523 return new _SpeechRecognizerServiceProxyImpl.fromEndpoint(endpoint); 666 return new _SpeechRecognizerServiceProxyImpl.fromEndpoint(endpoint);
524 } 667 }
525 668
669 service_describer.ServiceDescription get serviceDescription =>
670 new _SpeechRecognizerServiceServiceDescription();
671
526 void handleResponse(bindings.ServiceMessage message) { 672 void handleResponse(bindings.ServiceMessage message) {
527 switch (message.header.type) { 673 switch (message.header.type) {
528 case _SpeechRecognizerService_listenName: 674 case _SpeechRecognizerService_listenName:
529 var r = SpeechRecognizerServiceListenResponseParams.deserialize( 675 var r = SpeechRecognizerServiceListenResponseParams.deserialize(
530 message.payload); 676 message.payload);
531 if (!message.header.hasRequestId) { 677 if (!message.header.hasRequestId) {
532 proxyError("Expected a message with a valid request Id."); 678 proxyError("Expected a message with a valid request Id.");
533 return; 679 return;
534 } 680 }
535 Completer c = completerMap[message.header.requestId]; 681 Completer c = completerMap[message.header.requestId];
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 assert(_impl == null); 859 assert(_impl == null);
714 _impl = d; 860 _impl = d;
715 } 861 }
716 862
717 String toString() { 863 String toString() {
718 var superString = super.toString(); 864 var superString = super.toString();
719 return "SpeechRecognizerServiceStub($superString)"; 865 return "SpeechRecognizerServiceStub($superString)";
720 } 866 }
721 867
722 int get version => 0; 868 int get version => 0;
869
870
871 service_describer.ServiceDescription get serviceDescription =>
872 new _SpeechRecognizerServiceServiceDescription();
723 } 873 }
724 874
725 875
876
877
878
879
880
881 Map<String, mojom_types.UserDefinedType> _initDescriptions() {
882 var map = new HashMap<String, mojom_types.UserDefinedType>();
883 map["_speech_recognizer_Error__"] =
884 new mojom_types.UserDefinedType()
885 ..enumType = _speech_recognizer_Error__();
886 map["_speech_recognizer_UtteranceCandidate__"] =
887 new mojom_types.UserDefinedType()
888 ..structType = _speech_recognizer_UtteranceCandidate__();
889 map["_speech_recognizer_SpeechRecognizerService_Listen_Params__"] =
890 new mojom_types.UserDefinedType()
891 ..structType = _speech_recognizer_SpeechRecognizerService_Listen_Params__( );
892 map["_speech_recognizer_SpeechRecognizerService_Listen_ResponseParams__"] =
893 new mojom_types.UserDefinedType()
894 ..structType = _speech_recognizer_SpeechRecognizerService_Listen_ResponseP arams__();
895 map["_speech_recognizer_SpeechRecognizerService_StopListening_Params__"] =
896 new mojom_types.UserDefinedType()
897 ..structType = _speech_recognizer_SpeechRecognizerService_StopListening_Pa rams__();
898 map["_speech_recognizer_ResultOrError__"] =
899 new mojom_types.UserDefinedType()
900 ..unionType = _speech_recognizer_ResultOrError__();
901 map["_speech_recognizer_SpeechRecognizerService__"] =
902 new mojom_types.UserDefinedType()
903 ..interfaceType = _speech_recognizer_SpeechRecognizerService__();
904
905 return map;
906 }
907
908 var _MojomDesc;
909 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
910 if (_MojomDesc == null) {
911 _MojomDesc = _initDescriptions();
912 }
913 return _MojomDesc;
914 }
915
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698