| 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 speech_recognizer_mojom; | 5 library speech_recognizer_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/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/service_describer.mojom.dart' as service_describer; |
| 11 class Error extends bindings.MojoEnum { | 13 class Error extends bindings.MojoEnum { |
| 12 static const NETWORK_TIMEOUT = const Error._(1); | 14 static const NETWORK_TIMEOUT = const Error._(1); |
| 13 static const NETWORK = const Error._(2); | 15 static const NETWORK = const Error._(2); |
| 14 static const AUDIO = const Error._(3); | 16 static const AUDIO = const Error._(3); |
| 15 static const SERVER = const Error._(4); | 17 static const SERVER = const Error._(4); |
| 16 static const CLIENT = const Error._(5); | 18 static const CLIENT = const Error._(5); |
| 17 static const SPEECH_TIMEOUT = const Error._(6); | 19 static const SPEECH_TIMEOUT = const Error._(6); |
| 18 static const NO_MATCH = const Error._(7); | 20 static const NO_MATCH = const Error._(7); |
| 19 static const RECOGNIZER_BUSY = const Error._(8); | 21 static const RECOGNIZER_BUSY = const Error._(8); |
| 20 static const INSUFFICIENT_PERMISSIONS = const Error._(9); | 22 static const INSUFFICIENT_PERMISSIONS = const Error._(9); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 case CLIENT: | 96 case CLIENT: |
| 95 return 'Error.CLIENT'; | 97 return 'Error.CLIENT'; |
| 96 case SPEECH_TIMEOUT: | 98 case SPEECH_TIMEOUT: |
| 97 return 'Error.SPEECH_TIMEOUT'; | 99 return 'Error.SPEECH_TIMEOUT'; |
| 98 case NO_MATCH: | 100 case NO_MATCH: |
| 99 return 'Error.NO_MATCH'; | 101 return 'Error.NO_MATCH'; |
| 100 case RECOGNIZER_BUSY: | 102 case RECOGNIZER_BUSY: |
| 101 return 'Error.RECOGNIZER_BUSY'; | 103 return 'Error.RECOGNIZER_BUSY'; |
| 102 case INSUFFICIENT_PERMISSIONS: | 104 case INSUFFICIENT_PERMISSIONS: |
| 103 return 'Error.INSUFFICIENT_PERMISSIONS'; | 105 return 'Error.INSUFFICIENT_PERMISSIONS'; |
| 106 default: |
| 107 return null; |
| 104 } | 108 } |
| 105 } | 109 } |
| 106 | 110 |
| 107 int toJson() => value; | 111 int toJson() => value; |
| 108 } | 112 } |
| 109 | 113 |
| 114 mojom_types.MojomEnum _speech_recognizer_Error__() { |
| 115 return new mojom_types.MojomEnum() |
| 116 ..declData = (new mojom_types.DeclarationData()..shortName = "Error") |
| 117 ..values = <mojom_types.EnumValue>[new mojom_types.EnumValue() |
| 118 ..declData = (new mojom_types.DeclarationData()..shortName = "NETWORK_TI
MEOUT") |
| 119 ..enumTypeKey = '_speech_recognizer_Error__' |
| 120 ..intValue = 1,new mojom_types.EnumValue() |
| 121 ..declData = (new mojom_types.DeclarationData()..shortName = "NETWORK") |
| 122 ..enumTypeKey = '_speech_recognizer_Error__' |
| 123 ..intValue = 2,new mojom_types.EnumValue() |
| 124 ..declData = (new mojom_types.DeclarationData()..shortName = "AUDIO") |
| 125 ..enumTypeKey = '_speech_recognizer_Error__' |
| 126 ..intValue = 3,new mojom_types.EnumValue() |
| 127 ..declData = (new mojom_types.DeclarationData()..shortName = "SERVER") |
| 128 ..enumTypeKey = '_speech_recognizer_Error__' |
| 129 ..intValue = 4,new mojom_types.EnumValue() |
| 130 ..declData = (new mojom_types.DeclarationData()..shortName = "CLIENT") |
| 131 ..enumTypeKey = '_speech_recognizer_Error__' |
| 132 ..intValue = 5,new mojom_types.EnumValue() |
| 133 ..declData = (new mojom_types.DeclarationData()..shortName = "SPEECH_TIM
EOUT") |
| 134 ..enumTypeKey = '_speech_recognizer_Error__' |
| 135 ..intValue = 6,new mojom_types.EnumValue() |
| 136 ..declData = (new mojom_types.DeclarationData()..shortName = "NO_MATCH") |
| 137 ..enumTypeKey = '_speech_recognizer_Error__' |
| 138 ..intValue = 7,new mojom_types.EnumValue() |
| 139 ..declData = (new mojom_types.DeclarationData()..shortName = "RECOGNIZER
_BUSY") |
| 140 ..enumTypeKey = '_speech_recognizer_Error__' |
| 141 ..intValue = 8,new mojom_types.EnumValue() |
| 142 ..declData = (new mojom_types.DeclarationData()..shortName = "INSUFFICIE
NT_PERMISSIONS") |
| 143 ..enumTypeKey = '_speech_recognizer_Error__' |
| 144 ..intValue = 9,]; |
| 145 } |
| 146 |
| 110 | 147 |
| 111 | 148 |
| 112 class UtteranceCandidate extends bindings.Struct { | 149 class UtteranceCandidate extends bindings.Struct { |
| 113 static const List<bindings.StructDataHeader> kVersions = const [ | 150 static const List<bindings.StructDataHeader> kVersions = const [ |
| 114 const bindings.StructDataHeader(24, 0) | 151 const bindings.StructDataHeader(24, 0) |
| 115 ]; | 152 ]; |
| 116 String text = null; | 153 String text = null; |
| 117 double confidenceScore = 0.0; | 154 double confidenceScore = 0.0; |
| 118 | 155 |
| 119 UtteranceCandidate() : super(kVersions.last.size); | 156 UtteranceCandidate() : super(kVersions.last.size); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 214 } |
| 178 | 215 |
| 179 Map toJson() { | 216 Map toJson() { |
| 180 Map map = new Map(); | 217 Map map = new Map(); |
| 181 map["text"] = text; | 218 map["text"] = text; |
| 182 map["confidenceScore"] = confidenceScore; | 219 map["confidenceScore"] = confidenceScore; |
| 183 return map; | 220 return map; |
| 184 } | 221 } |
| 185 } | 222 } |
| 186 | 223 |
| 224 mojom_types.MojomStruct _speech_recognizer_UtteranceCandidate__() { |
| 225 return new mojom_types.MojomStruct() |
| 226 ..declData = (new mojom_types.DeclarationData()..shortName = 'UtteranceCandi
date') |
| 227 ..fields = <mojom_types.StructField>[ |
| 228 new mojom_types.StructField() |
| 229 ..declData = (new mojom_types.DeclarationData()..shortName = 'Text') |
| 230 ..type = (new mojom_types.Type() |
| 231 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 232 |
| 233 new mojom_types.StructField() |
| 234 ..declData = (new mojom_types.DeclarationData()..shortName = 'Confidence
Score') |
| 235 ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.FL
OAT), |
| 236 ]; |
| 237 } |
| 238 |
| 187 | 239 |
| 188 class SpeechRecognizerServiceListenParams extends bindings.Struct { | 240 class SpeechRecognizerServiceListenParams extends bindings.Struct { |
| 189 static const List<bindings.StructDataHeader> kVersions = const [ | 241 static const List<bindings.StructDataHeader> kVersions = const [ |
| 190 const bindings.StructDataHeader(8, 0) | 242 const bindings.StructDataHeader(8, 0) |
| 191 ]; | 243 ]; |
| 192 | 244 |
| 193 SpeechRecognizerServiceListenParams() : super(kVersions.last.size); | 245 SpeechRecognizerServiceListenParams() : super(kVersions.last.size); |
| 194 | 246 |
| 195 static SpeechRecognizerServiceListenParams deserialize(bindings.Message messag
e) { | 247 static SpeechRecognizerServiceListenParams deserialize(bindings.Message messag
e) { |
| 196 var decoder = new bindings.Decoder(message); | 248 var decoder = new bindings.Decoder(message); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 String toString() { | 287 String toString() { |
| 236 return "SpeechRecognizerServiceListenParams("")"; | 288 return "SpeechRecognizerServiceListenParams("")"; |
| 237 } | 289 } |
| 238 | 290 |
| 239 Map toJson() { | 291 Map toJson() { |
| 240 Map map = new Map(); | 292 Map map = new Map(); |
| 241 return map; | 293 return map; |
| 242 } | 294 } |
| 243 } | 295 } |
| 244 | 296 |
| 297 mojom_types.MojomStruct _speech_recognizer_SpeechRecognizerService_Listen_Params
__() { |
| 298 return new mojom_types.MojomStruct() |
| 299 ..declData = (new mojom_types.DeclarationData()..shortName = 'SpeechRecogniz
erServiceListenParams') |
| 300 ..fields = <mojom_types.StructField>[]; |
| 301 } |
| 302 |
| 245 | 303 |
| 246 class SpeechRecognizerServiceListenResponseParams extends bindings.Struct { | 304 class SpeechRecognizerServiceListenResponseParams extends bindings.Struct { |
| 247 static const List<bindings.StructDataHeader> kVersions = const [ | 305 static const List<bindings.StructDataHeader> kVersions = const [ |
| 248 const bindings.StructDataHeader(24, 0) | 306 const bindings.StructDataHeader(24, 0) |
| 249 ]; | 307 ]; |
| 250 ResultOrError resultOrError = null; | 308 ResultOrError resultOrError = null; |
| 251 | 309 |
| 252 SpeechRecognizerServiceListenResponseParams() : super(kVersions.last.size); | 310 SpeechRecognizerServiceListenResponseParams() : super(kVersions.last.size); |
| 253 | 311 |
| 254 static SpeechRecognizerServiceListenResponseParams deserialize(bindings.Messag
e message) { | 312 static SpeechRecognizerServiceListenResponseParams deserialize(bindings.Messag
e message) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 "resultOrError: $resultOrError" ")"; | 364 "resultOrError: $resultOrError" ")"; |
| 307 } | 365 } |
| 308 | 366 |
| 309 Map toJson() { | 367 Map toJson() { |
| 310 Map map = new Map(); | 368 Map map = new Map(); |
| 311 map["resultOrError"] = resultOrError; | 369 map["resultOrError"] = resultOrError; |
| 312 return map; | 370 return map; |
| 313 } | 371 } |
| 314 } | 372 } |
| 315 | 373 |
| 374 mojom_types.MojomStruct _speech_recognizer_SpeechRecognizerService_Listen_Respon
seParams__() { |
| 375 return new mojom_types.MojomStruct() |
| 376 ..declData = (new mojom_types.DeclarationData()..shortName = 'SpeechRecogniz
erServiceListenResponseParams') |
| 377 ..fields = <mojom_types.StructField>[ |
| 378 new mojom_types.StructField() |
| 379 ..declData = (new mojom_types.DeclarationData()..shortName = 'ResultOrEr
ror') |
| 380 ..type = (new mojom_types.Type() |
| 381 ..typeReference = (new mojom_types.TypeReference() |
| 382 |
| 383 ..identifier = '_speech_recognizer_ResultOrError__' |
| 384 ..typeKey = '_speech_recognizer_ResultOrError__' |
| 385 )), |
| 386 ]; |
| 387 } |
| 388 |
| 316 | 389 |
| 317 class SpeechRecognizerServiceStopListeningParams extends bindings.Struct { | 390 class SpeechRecognizerServiceStopListeningParams extends bindings.Struct { |
| 318 static const List<bindings.StructDataHeader> kVersions = const [ | 391 static const List<bindings.StructDataHeader> kVersions = const [ |
| 319 const bindings.StructDataHeader(8, 0) | 392 const bindings.StructDataHeader(8, 0) |
| 320 ]; | 393 ]; |
| 321 | 394 |
| 322 SpeechRecognizerServiceStopListeningParams() : super(kVersions.last.size); | 395 SpeechRecognizerServiceStopListeningParams() : super(kVersions.last.size); |
| 323 | 396 |
| 324 static SpeechRecognizerServiceStopListeningParams deserialize(bindings.Message
message) { | 397 static SpeechRecognizerServiceStopListeningParams deserialize(bindings.Message
message) { |
| 325 var decoder = new bindings.Decoder(message); | 398 var decoder = new bindings.Decoder(message); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 String toString() { | 437 String toString() { |
| 365 return "SpeechRecognizerServiceStopListeningParams("")"; | 438 return "SpeechRecognizerServiceStopListeningParams("")"; |
| 366 } | 439 } |
| 367 | 440 |
| 368 Map toJson() { | 441 Map toJson() { |
| 369 Map map = new Map(); | 442 Map map = new Map(); |
| 370 return map; | 443 return map; |
| 371 } | 444 } |
| 372 } | 445 } |
| 373 | 446 |
| 447 mojom_types.MojomStruct _speech_recognizer_SpeechRecognizerService_StopListening
_Params__() { |
| 448 return new mojom_types.MojomStruct() |
| 449 ..declData = (new mojom_types.DeclarationData()..shortName = 'SpeechRecogniz
erServiceStopListeningParams') |
| 450 ..fields = <mojom_types.StructField>[]; |
| 451 } |
| 452 |
| 374 | 453 |
| 375 | 454 |
| 376 enum ResultOrErrorTag { | 455 enum ResultOrErrorTag { |
| 377 errorCode, | 456 errorCode, |
| 378 results, | 457 results, |
| 379 unknown | 458 unknown |
| 380 } | 459 } |
| 381 | 460 |
| 382 class ResultOrError extends bindings.Union { | 461 class ResultOrError extends bindings.Union { |
| 383 static final _tag_to_int = const { | 462 static final _tag_to_int = const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 _data = value; | 496 _data = value; |
| 418 } | 497 } |
| 419 | 498 |
| 420 static ResultOrError decode(bindings.Decoder decoder0, int offset) { | 499 static ResultOrError decode(bindings.Decoder decoder0, int offset) { |
| 421 int size = decoder0.decodeUint32(offset); | 500 int size = decoder0.decodeUint32(offset); |
| 422 if (size == 0) { | 501 if (size == 0) { |
| 423 return null; | 502 return null; |
| 424 } | 503 } |
| 425 ResultOrError result = new ResultOrError(); | 504 ResultOrError result = new ResultOrError(); |
| 426 | 505 |
| 427 // TODO(azani): Handle unknown union member. | 506 // TODO(azani): Handle unknown union member. An assert breaks validation_uni
ttest. |
| 428 ResultOrErrorTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; | 507 ResultOrErrorTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
| 429 switch (tag) { | 508 switch (tag) { |
| 430 case ResultOrErrorTag.errorCode: | 509 case ResultOrErrorTag.errorCode: |
| 431 | 510 |
| 432 result.errorCode = Error.decode(decoder0, offset + 8); | 511 result.errorCode = Error.decode(decoder0, offset + 8); |
| 433 if (result.errorCode == null) { | 512 if (result.errorCode == null) { |
| 434 throw new bindings.MojoCodecError( | 513 throw new bindings.MojoCodecError( |
| 435 'Trying to decode null union for non-nullable Error.'); | 514 'Trying to decode null union for non-nullable Error.'); |
| 436 } | 515 } |
| 437 break; | 516 break; |
| 438 case ResultOrErrorTag.results: | 517 case ResultOrErrorTag.results: |
| 439 | 518 |
| 440 var decoder1 = decoder0.decodePointer(offset + 8, false); | 519 var decoder1 = decoder0.decodePointer(offset + 8, false); |
| 441 { | 520 { |
| 442 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecifi
edArrayLength); | 521 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecifi
edArrayLength); |
| 443 result.results = new List<UtteranceCandidate>(si1.numElements); | 522 result.results = new List<UtteranceCandidate>(si1.numElements); |
| 444 for (int i1 = 0; i1 < si1.numElements; ++i1) { | 523 for (int i1 = 0; i1 < si1.numElements; ++i1) { |
| 445 | 524 |
| 446 var decoder2 = decoder1.decodePointer(bindings.ArrayDataHeader.kHead
erSize + bindings.kPointerSize * i1, false); | 525 var decoder2 = decoder1.decodePointer(bindings.ArrayDataHeader.kHead
erSize + bindings.kPointerSize * i1, false); |
| 447 result.results[i1] = UtteranceCandidate.decode(decoder2); | 526 result.results[i1] = UtteranceCandidate.decode(decoder2); |
| 448 } | 527 } |
| 449 } | 528 } |
| 450 break; | 529 break; |
| 530 default: |
| 531 break; |
| 451 } | 532 } |
| 452 | 533 |
| 453 return result; | 534 return result; |
| 454 } | 535 } |
| 455 | 536 |
| 456 void encode(bindings.Encoder encoder0, int offset) { | 537 void encode(bindings.Encoder encoder0, int offset) { |
| 457 // TODO(azani): Error when trying to encode an unknown member. | 538 // TODO(azani): Error when trying to encode an unknown member. |
| 458 encoder0.encodeUint32(16, offset); | 539 encoder0.encodeUint32(16, offset); |
| 459 encoder0.encodeUint32(_tag_to_int[_tag], offset + 4); | 540 encoder0.encodeUint32(_tag_to_int[_tag], offset + 4); |
| 460 switch (_tag) { | 541 switch (_tag) { |
| 461 case ResultOrErrorTag.errorCode: | 542 case ResultOrErrorTag.errorCode: |
| 462 | 543 |
| 463 encoder0.encodeEnum(errorCode, offset + 8); | 544 encoder0.encodeEnum(errorCode, offset + 8); |
| 464 break; | 545 break; |
| 465 case ResultOrErrorTag.results: | 546 case ResultOrErrorTag.results: |
| 466 | 547 |
| 467 if (results == null) { | 548 if (results == null) { |
| 468 encoder0.encodeNullPointer(offset + 8, false); | 549 encoder0.encodeNullPointer(offset + 8, false); |
| 469 } else { | 550 } else { |
| 470 var encoder1 = encoder0.encodePointerArray(results.length, offset + 8,
bindings.kUnspecifiedArrayLength); | 551 var encoder1 = encoder0.encodePointerArray(results.length, offset + 8,
bindings.kUnspecifiedArrayLength); |
| 471 for (int i0 = 0; i0 < results.length; ++i0) { | 552 for (int i0 = 0; i0 < results.length; ++i0) { |
| 472 | 553 |
| 473 encoder1.encodeStruct(results[i0], bindings.ArrayDataHeader.kHeaderS
ize + bindings.kPointerSize * i0, false); | 554 encoder1.encodeStruct(results[i0], bindings.ArrayDataHeader.kHeaderS
ize + bindings.kPointerSize * i0, false); |
| 474 } | 555 } |
| 475 } | 556 } |
| 476 break; | 557 break; |
| 558 default: |
| 559 break; |
| 477 } | 560 } |
| 478 } | 561 } |
| 479 | 562 |
| 480 String toString() { | 563 String toString() { |
| 481 String result = "ResultOrError("; | 564 String result = "ResultOrError("; |
| 482 switch (_tag) { | 565 switch (_tag) { |
| 483 case ResultOrErrorTag.errorCode: | 566 case ResultOrErrorTag.errorCode: |
| 484 result += "errorCode"; | 567 result += "errorCode"; |
| 485 break; | 568 break; |
| 486 case ResultOrErrorTag.results: | 569 case ResultOrErrorTag.results: |
| 487 result += "results"; | 570 result += "results"; |
| 488 break; | 571 break; |
| 489 default: | 572 default: |
| 490 result += "unknown"; | 573 result += "unknown"; |
| 491 } | 574 } |
| 492 result += ": $_data)"; | 575 result += ": $_data)"; |
| 493 return result; | 576 return result; |
| 494 } | 577 } |
| 495 } | 578 } |
| 579 |
| 580 mojom_types.MojomUnion _speech_recognizer_ResultOrError__() { |
| 581 return new mojom_types.MojomUnion() |
| 582 ..declData = (new mojom_types.DeclarationData()..shortName = 'ResultOrError'
) |
| 583 ..fields = <mojom_types.UnionField>[ |
| 584 new mojom_types.UnionField() |
| 585 ..declData = (new mojom_types.DeclarationData()..shortName = 'ErrorCode'
) |
| 586 ..type = (new mojom_types.Type() |
| 587 ..typeReference = (new mojom_types.TypeReference() |
| 588 |
| 589 ..identifier = '_speech_recognizer_Error__' |
| 590 ..typeKey = '_speech_recognizer_Error__' |
| 591 )) |
| 592 ..tag = 0, |
| 593 |
| 594 new mojom_types.UnionField() |
| 595 ..declData = (new mojom_types.DeclarationData()..shortName = 'Results') |
| 596 ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType
() |
| 597 ..elementType = (new mojom_types.Type() |
| 598 ..typeReference = (new mojom_types.TypeReference() |
| 599 |
| 600 ..identifier = '_speech_recognizer_UtteranceCandidate__' |
| 601 ..typeKey = '_speech_recognizer_UtteranceCandidate__' |
| 602 )))) |
| 603 ..tag = 1, |
| 604 ]; |
| 605 } |
| 606 |
| 496 const int kSpeechRecognizerService_listen_name = 0; | 607 const int kSpeechRecognizerService_listen_name = 0; |
| 497 const int kSpeechRecognizerService_stopListening_name = 1; | 608 const int kSpeechRecognizerService_stopListening_name = 1; |
| 498 | 609 |
| 499 const String SpeechRecognizerServiceName = | 610 const String SpeechRecognizerServiceName = |
| 500 'speech_recognizer::SpeechRecognizerService'; | 611 'speech_recognizer::SpeechRecognizerService'; |
| 501 | 612 |
| 613 mojom_types.MojomInterface _speech_recognizer_SpeechRecognizerService__() { |
| 614 return new mojom_types.MojomInterface() |
| 615 ..declData = (new mojom_types.DeclarationData()..shortName = "SpeechRecogniz
erService") |
| 616 ..interfaceName = "SpeechRecognizerService" |
| 617 ..methods = <int, mojom_types.MojomMethod>{ |
| 618 kSpeechRecognizerService_listen_name: new mojom_types.MojomMethod() |
| 619 ..declData = (new mojom_types.DeclarationData()..shortName = "Listen") |
| 620 ..ordinal = kSpeechRecognizerService_listen_name |
| 621 ..responseParams = _speech_recognizer_SpeechRecognizerService_Listen_Res
ponseParams__()..parameters = _speech_recognizer_SpeechRecognizerService_Listen_
Params__(),kSpeechRecognizerService_stopListening_name: new mojom_types.MojomMet
hod() |
| 622 ..declData = (new mojom_types.DeclarationData()..shortName = "StopListen
ing") |
| 623 ..ordinal = kSpeechRecognizerService_stopListening_name..parameters = _s
peech_recognizer_SpeechRecognizerService_StopListening_Params__(), |
| 624 }; |
| 625 } |
| 626 |
| 627 class _SpeechRecognizerServiceServiceDescription extends service_describer.Servi
ceDescription { |
| 628 // Avoid infinite loop by overriding serviceDescription field. |
| 629 final service_describer.ServiceDescription serviceDescription = null; |
| 630 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 631 return _speech_recognizer_SpeechRecognizerService__(); |
| 632 } |
| 633 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 634 return getAllMojomTypeDefinitions()[typeKey]; |
| 635 } |
| 636 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 637 return getAllMojomTypeDefinitions(); |
| 638 } |
| 639 } |
| 640 |
| 502 abstract class SpeechRecognizerService { | 641 abstract class SpeechRecognizerService { |
| 503 dynamic listen([Function responseFactory = null]); | 642 dynamic listen([Function responseFactory = null]); |
| 504 void stopListening(); | 643 void stopListening(); |
| 505 | 644 |
| 506 } | 645 } |
| 507 | 646 |
| 508 | 647 |
| 509 class SpeechRecognizerServiceProxyImpl extends bindings.Proxy { | 648 class SpeechRecognizerServiceProxyImpl extends bindings.Proxy { |
| 510 SpeechRecognizerServiceProxyImpl.fromEndpoint( | 649 SpeechRecognizerServiceProxyImpl.fromEndpoint( |
| 511 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 650 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 512 | 651 |
| 513 SpeechRecognizerServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 652 SpeechRecognizerServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
| 514 super.fromHandle(handle); | 653 super.fromHandle(handle); |
| 515 | 654 |
| 516 SpeechRecognizerServiceProxyImpl.unbound() : super.unbound(); | 655 SpeechRecognizerServiceProxyImpl.unbound() : super.unbound(); |
| 517 | 656 |
| 518 static SpeechRecognizerServiceProxyImpl newFromEndpoint( | 657 static SpeechRecognizerServiceProxyImpl newFromEndpoint( |
| 519 core.MojoMessagePipeEndpoint endpoint) { | 658 core.MojoMessagePipeEndpoint endpoint) { |
| 520 assert(endpoint.setDescription("For SpeechRecognizerServiceProxyImpl")); | 659 assert(endpoint.setDescription("For SpeechRecognizerServiceProxyImpl")); |
| 521 return new SpeechRecognizerServiceProxyImpl.fromEndpoint(endpoint); | 660 return new SpeechRecognizerServiceProxyImpl.fromEndpoint(endpoint); |
| 522 } | 661 } |
| 523 | 662 |
| 524 String get name => SpeechRecognizerServiceName; | 663 String get name => SpeechRecognizerServiceName; |
| 525 | 664 |
| 665 service_describer.ServiceDescription get serviceDescription => |
| 666 new _SpeechRecognizerServiceServiceDescription(); |
| 667 |
| 526 void handleResponse(bindings.ServiceMessage message) { | 668 void handleResponse(bindings.ServiceMessage message) { |
| 527 switch (message.header.type) { | 669 switch (message.header.type) { |
| 528 case kSpeechRecognizerService_listen_name: | 670 case kSpeechRecognizerService_listen_name: |
| 529 var r = SpeechRecognizerServiceListenResponseParams.deserialize( | 671 var r = SpeechRecognizerServiceListenResponseParams.deserialize( |
| 530 message.payload); | 672 message.payload); |
| 531 if (!message.header.hasRequestId) { | 673 if (!message.header.hasRequestId) { |
| 532 proxyError("Expected a message with a valid request Id."); | 674 proxyError("Expected a message with a valid request Id."); |
| 533 return; | 675 return; |
| 534 } | 676 } |
| 535 Completer c = completerMap[message.header.requestId]; | 677 Completer c = completerMap[message.header.requestId]; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 assert(_impl == null); | 857 assert(_impl == null); |
| 716 _impl = d; | 858 _impl = d; |
| 717 } | 859 } |
| 718 | 860 |
| 719 String toString() { | 861 String toString() { |
| 720 var superString = super.toString(); | 862 var superString = super.toString(); |
| 721 return "SpeechRecognizerServiceStub($superString)"; | 863 return "SpeechRecognizerServiceStub($superString)"; |
| 722 } | 864 } |
| 723 | 865 |
| 724 int get version => 0; | 866 int get version => 0; |
| 867 |
| 868 service_describer.ServiceDescription get serviceDescription => |
| 869 new _SpeechRecognizerServiceServiceDescription(); |
| 725 } | 870 } |
| 726 | 871 |
| 727 | 872 |
| 873 |
| 874 |
| 875 |
| 876 |
| 877 |
| 878 |
| 879 var _MojomDesc__ = _initDescriptions(); |
| 880 |
| 881 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 882 var map = new Map<String, mojom_types.UserDefinedType>(); |
| 883 |
| 884 map["_speech_recognizer_Error__"] = |
| 885 new mojom_types.UserDefinedType() |
| 886 ..enumType = _speech_recognizer_Error__(); |
| 887 |
| 888 |
| 889 map["_speech_recognizer_UtteranceCandidate__"] = |
| 890 new mojom_types.UserDefinedType() |
| 891 ..structType = _speech_recognizer_UtteranceCandidate__(); |
| 892 |
| 893 |
| 894 |
| 895 |
| 896 |
| 897 |
| 898 |
| 899 map["_speech_recognizer_SpeechRecognizerService_Listen_Params__"] = |
| 900 new mojom_types.UserDefinedType() |
| 901 ..structType = _speech_recognizer_SpeechRecognizerService_Listen_Params__(
); |
| 902 |
| 903 |
| 904 |
| 905 map["_speech_recognizer_SpeechRecognizerService_Listen_ResponseParams__"] = |
| 906 new mojom_types.UserDefinedType() |
| 907 ..structType = _speech_recognizer_SpeechRecognizerService_Listen_ResponseP
arams__(); |
| 908 |
| 909 |
| 910 map["_speech_recognizer_ResultOrError__"] = |
| 911 new mojom_types.UserDefinedType() |
| 912 ..unionType = _speech_recognizer_ResultOrError__(); |
| 913 |
| 914 |
| 915 |
| 916 |
| 917 |
| 918 |
| 919 |
| 920 |
| 921 |
| 922 map["_speech_recognizer_SpeechRecognizerService_StopListening_Params__"] = |
| 923 new mojom_types.UserDefinedType() |
| 924 ..structType = _speech_recognizer_SpeechRecognizerService_StopListening_Pa
rams__(); |
| 925 |
| 926 |
| 927 |
| 928 |
| 929 map["_speech_recognizer_SpeechRecognizerService__"] = |
| 930 new mojom_types.UserDefinedType() |
| 931 ..interfaceType = _speech_recognizer_SpeechRecognizerService__(); |
| 932 |
| 933 return map; |
| 934 } |
| 935 |
| 936 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 937 return _MojomDesc__; |
| 938 } |
| 939 |
| 940 |
| OLD | NEW |