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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Move and Standardize Mojom Type Functions 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 sensors_mojom; 5 library sensors_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 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;
12 class SensorType extends bindings.MojoEnum { 13 class SensorType extends bindings.MojoEnum {
13 static const SensorType accelerometer = const SensorType._(0); 14 static const SensorType accelerometer = const SensorType._(0);
14 static const SensorType ambientTemperature = const SensorType._(1); 15 static const SensorType ambientTemperature = const SensorType._(1);
15 static const SensorType gameRotationVector = const SensorType._(2); 16 static const SensorType gameRotationVector = const SensorType._(2);
16 static const SensorType geomagneticRotationVector = const SensorType._(3); 17 static const SensorType geomagneticRotationVector = const SensorType._(3);
17 static const SensorType gravity = const SensorType._(4); 18 static const SensorType gravity = const SensorType._(4);
18 static const SensorType gyroscope = const SensorType._(5); 19 static const SensorType gyroscope = const SensorType._(5);
19 static const SensorType gyroscopeUncalibrated = const SensorType._(6); 20 static const SensorType gyroscopeUncalibrated = const SensorType._(6);
20 static const SensorType heartRate = const SensorType._(7); 21 static const SensorType heartRate = const SensorType._(7);
21 static const SensorType light = const SensorType._(8); 22 static const SensorType light = const SensorType._(8);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 case relativeHumidity: 166 case relativeHumidity:
166 return 'SensorType.relativeHumidity'; 167 return 'SensorType.relativeHumidity';
167 case rotationVector: 168 case rotationVector:
168 return 'SensorType.rotationVector'; 169 return 'SensorType.rotationVector';
169 case significantMotion: 170 case significantMotion:
170 return 'SensorType.significantMotion'; 171 return 'SensorType.significantMotion';
171 case stepCounter: 172 case stepCounter:
172 return 'SensorType.stepCounter'; 173 return 'SensorType.stepCounter';
173 case stepDetector: 174 case stepDetector:
174 return 'SensorType.stepDetector'; 175 return 'SensorType.stepDetector';
176 default:
177 return null;
175 } 178 }
176 } 179 }
177 180
178 int toJson() => mojoEnumValue; 181 int toJson() => mojoEnumValue;
179 } 182 }
180 183
181 184
182 185
186
187
183 class SensorData extends bindings.Struct { 188 class SensorData extends bindings.Struct {
184 static const List<bindings.StructDataHeader> kVersions = const [ 189 static const List<bindings.StructDataHeader> kVersions = const [
185 const bindings.StructDataHeader(32, 0) 190 const bindings.StructDataHeader(32, 0)
186 ]; 191 ];
187 int accuracy = 0; 192 int accuracy = 0;
188 int timeStamp = 0; 193 int timeStamp = 0;
189 List<double> values = null; 194 List<double> values = null;
190 195
191 SensorData() : super(kVersions.last.size); 196 SensorData() : super(kVersions.last.size);
192 197
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 Map toJson() { 263 Map toJson() {
259 Map map = new Map(); 264 Map map = new Map();
260 map["accuracy"] = accuracy; 265 map["accuracy"] = accuracy;
261 map["timeStamp"] = timeStamp; 266 map["timeStamp"] = timeStamp;
262 map["values"] = values; 267 map["values"] = values;
263 return map; 268 return map;
264 } 269 }
265 } 270 }
266 271
267 272
273
274
268 class _SensorListenerOnAccuracyChangedParams extends bindings.Struct { 275 class _SensorListenerOnAccuracyChangedParams extends bindings.Struct {
269 static const List<bindings.StructDataHeader> kVersions = const [ 276 static const List<bindings.StructDataHeader> kVersions = const [
270 const bindings.StructDataHeader(16, 0) 277 const bindings.StructDataHeader(16, 0)
271 ]; 278 ];
272 int accuracy = 0; 279 int accuracy = 0;
273 280
274 _SensorListenerOnAccuracyChangedParams() : super(kVersions.last.size); 281 _SensorListenerOnAccuracyChangedParams() : super(kVersions.last.size);
275 282
276 static _SensorListenerOnAccuracyChangedParams deserialize(bindings.Message mes sage) { 283 static _SensorListenerOnAccuracyChangedParams deserialize(bindings.Message mes sage) {
277 var decoder = new bindings.Decoder(message); 284 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 332 }
326 333
327 Map toJson() { 334 Map toJson() {
328 Map map = new Map(); 335 Map map = new Map();
329 map["accuracy"] = accuracy; 336 map["accuracy"] = accuracy;
330 return map; 337 return map;
331 } 338 }
332 } 339 }
333 340
334 341
342
343
335 class _SensorListenerOnSensorChangedParams extends bindings.Struct { 344 class _SensorListenerOnSensorChangedParams extends bindings.Struct {
336 static const List<bindings.StructDataHeader> kVersions = const [ 345 static const List<bindings.StructDataHeader> kVersions = const [
337 const bindings.StructDataHeader(16, 0) 346 const bindings.StructDataHeader(16, 0)
338 ]; 347 ];
339 SensorData data = null; 348 SensorData data = null;
340 349
341 _SensorListenerOnSensorChangedParams() : super(kVersions.last.size); 350 _SensorListenerOnSensorChangedParams() : super(kVersions.last.size);
342 351
343 static _SensorListenerOnSensorChangedParams deserialize(bindings.Message messa ge) { 352 static _SensorListenerOnSensorChangedParams deserialize(bindings.Message messa ge) {
344 var decoder = new bindings.Decoder(message); 353 var decoder = new bindings.Decoder(message);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 402 }
394 403
395 Map toJson() { 404 Map toJson() {
396 Map map = new Map(); 405 Map map = new Map();
397 map["data"] = data; 406 map["data"] = data;
398 return map; 407 return map;
399 } 408 }
400 } 409 }
401 410
402 411
412
413
403 class _SensorServiceAddListenerParams extends bindings.Struct { 414 class _SensorServiceAddListenerParams extends bindings.Struct {
404 static const List<bindings.StructDataHeader> kVersions = const [ 415 static const List<bindings.StructDataHeader> kVersions = const [
405 const bindings.StructDataHeader(24, 0) 416 const bindings.StructDataHeader(24, 0)
406 ]; 417 ];
407 SensorType type = null; 418 SensorType type = null;
408 Object listener = null; 419 Object listener = null;
409 420
410 _SensorServiceAddListenerParams() : super(kVersions.last.size); 421 _SensorServiceAddListenerParams() : super(kVersions.last.size);
411 422
412 static _SensorServiceAddListenerParams deserialize(bindings.Message message) { 423 static _SensorServiceAddListenerParams deserialize(bindings.Message message) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 "type: $type" ", " 481 "type: $type" ", "
471 "listener: $listener" ")"; 482 "listener: $listener" ")";
472 } 483 }
473 484
474 Map toJson() { 485 Map toJson() {
475 throw new bindings.MojoCodecError( 486 throw new bindings.MojoCodecError(
476 'Object containing handles cannot be encoded to JSON.'); 487 'Object containing handles cannot be encoded to JSON.');
477 } 488 }
478 } 489 }
479 490
491
492
493
480 const int _SensorListener_onAccuracyChangedName = 0; 494 const int _SensorListener_onAccuracyChangedName = 0;
481 const int _SensorListener_onSensorChangedName = 1; 495 const int _SensorListener_onSensorChangedName = 1;
482 496
497
498
499 class _SensorListenerServiceDescription implements service_describer.ServiceDesc ription {
500 dynamic getTopLevelInterface([Function responseFactory = null]) => null;
501
502 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = >
503 null;
504
505 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null;
506 }
507
483 abstract class SensorListener { 508 abstract class SensorListener {
484 static const String serviceName = null; 509 static const String serviceName = null;
485 void onAccuracyChanged(int accuracy); 510 void onAccuracyChanged(int accuracy);
486 void onSensorChanged(SensorData data); 511 void onSensorChanged(SensorData data);
487 } 512 }
488 513
489 514
490 class _SensorListenerProxyImpl extends bindings.Proxy { 515 class _SensorListenerProxyImpl extends bindings.Proxy {
491 _SensorListenerProxyImpl.fromEndpoint( 516 _SensorListenerProxyImpl.fromEndpoint(
492 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 517 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
493 518
494 _SensorListenerProxyImpl.fromHandle(core.MojoHandle handle) : 519 _SensorListenerProxyImpl.fromHandle(core.MojoHandle handle) :
495 super.fromHandle(handle); 520 super.fromHandle(handle);
496 521
497 _SensorListenerProxyImpl.unbound() : super.unbound(); 522 _SensorListenerProxyImpl.unbound() : super.unbound();
498 523
499 static _SensorListenerProxyImpl newFromEndpoint( 524 static _SensorListenerProxyImpl newFromEndpoint(
500 core.MojoMessagePipeEndpoint endpoint) { 525 core.MojoMessagePipeEndpoint endpoint) {
501 assert(endpoint.setDescription("For _SensorListenerProxyImpl")); 526 assert(endpoint.setDescription("For _SensorListenerProxyImpl"));
502 return new _SensorListenerProxyImpl.fromEndpoint(endpoint); 527 return new _SensorListenerProxyImpl.fromEndpoint(endpoint);
503 } 528 }
504 529
530 service_describer.ServiceDescription get serviceDescription =>
531 new _SensorListenerServiceDescription();
532
505 void handleResponse(bindings.ServiceMessage message) { 533 void handleResponse(bindings.ServiceMessage message) {
506 switch (message.header.type) { 534 switch (message.header.type) {
507 default: 535 default:
508 proxyError("Unexpected message type: ${message.header.type}"); 536 proxyError("Unexpected message type: ${message.header.type}");
509 close(immediate: true); 537 close(immediate: true);
510 break; 538 break;
511 } 539 }
512 } 540 }
513 541
514 String toString() { 542 String toString() {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 assert(_impl == null); 680 assert(_impl == null);
653 _impl = d; 681 _impl = d;
654 } 682 }
655 683
656 String toString() { 684 String toString() {
657 var superString = super.toString(); 685 var superString = super.toString();
658 return "SensorListenerStub($superString)"; 686 return "SensorListenerStub($superString)";
659 } 687 }
660 688
661 int get version => 0; 689 int get version => 0;
690
691 service_describer.ServiceDescription get serviceDescription =>
692 new _SensorListenerServiceDescription();
662 } 693 }
663 694
664 const int _SensorService_addListenerName = 0; 695 const int _SensorService_addListenerName = 0;
665 696
697
698
699 class _SensorServiceServiceDescription implements service_describer.ServiceDescr iption {
700 dynamic getTopLevelInterface([Function responseFactory = null]) => null;
701
702 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = >
703 null;
704
705 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null;
706 }
707
666 abstract class SensorService { 708 abstract class SensorService {
667 static const String serviceName = "sensors::SensorService"; 709 static const String serviceName = "sensors::SensorService";
668 void addListener(SensorType type, Object listener); 710 void addListener(SensorType type, Object listener);
669 } 711 }
670 712
671 713
672 class _SensorServiceProxyImpl extends bindings.Proxy { 714 class _SensorServiceProxyImpl extends bindings.Proxy {
673 _SensorServiceProxyImpl.fromEndpoint( 715 _SensorServiceProxyImpl.fromEndpoint(
674 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 716 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
675 717
676 _SensorServiceProxyImpl.fromHandle(core.MojoHandle handle) : 718 _SensorServiceProxyImpl.fromHandle(core.MojoHandle handle) :
677 super.fromHandle(handle); 719 super.fromHandle(handle);
678 720
679 _SensorServiceProxyImpl.unbound() : super.unbound(); 721 _SensorServiceProxyImpl.unbound() : super.unbound();
680 722
681 static _SensorServiceProxyImpl newFromEndpoint( 723 static _SensorServiceProxyImpl newFromEndpoint(
682 core.MojoMessagePipeEndpoint endpoint) { 724 core.MojoMessagePipeEndpoint endpoint) {
683 assert(endpoint.setDescription("For _SensorServiceProxyImpl")); 725 assert(endpoint.setDescription("For _SensorServiceProxyImpl"));
684 return new _SensorServiceProxyImpl.fromEndpoint(endpoint); 726 return new _SensorServiceProxyImpl.fromEndpoint(endpoint);
685 } 727 }
686 728
729 service_describer.ServiceDescription get serviceDescription =>
730 new _SensorServiceServiceDescription();
731
687 void handleResponse(bindings.ServiceMessage message) { 732 void handleResponse(bindings.ServiceMessage message) {
688 switch (message.header.type) { 733 switch (message.header.type) {
689 default: 734 default:
690 proxyError("Unexpected message type: ${message.header.type}"); 735 proxyError("Unexpected message type: ${message.header.type}");
691 close(immediate: true); 736 close(immediate: true);
692 break; 737 break;
693 } 738 }
694 } 739 }
695 740
696 String toString() { 741 String toString() {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 assert(_impl == null); 866 assert(_impl == null);
822 _impl = d; 867 _impl = d;
823 } 868 }
824 869
825 String toString() { 870 String toString() {
826 var superString = super.toString(); 871 var superString = super.toString();
827 return "SensorServiceStub($superString)"; 872 return "SensorServiceStub($superString)";
828 } 873 }
829 874
830 int get version => 0; 875 int get version => 0;
876
877 service_describer.ServiceDescription get serviceDescription =>
878 new _SensorServiceServiceDescription();
831 } 879 }
832 880
833 881
882
883
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698