diff --git a/lib/src/components/board/board.dart b/lib/src/components/board/board.dart index d9c4b7a92e7..c2c010116a2 100644 --- a/lib/src/components/board/board.dart +++ b/lib/src/components/board/board.dart @@ -7,6 +7,7 @@ import '../../robot/client.dart'; /// Tick of a digital interrupt typedef Tick = StreamTicksResponse; +typedef AnalogValue = ReadAnalogReaderResponse; /// Board represents a physical general purpose compute board that contains various /// components such as analog readers, and digital interrupts. @@ -32,7 +33,7 @@ abstract class Board extends Resource { Future setPwmFrequency(String pin, int frequencyHz, {Map? extra}); /// Read the current value of an analog reader of a board. - Future analogReaderValue(String analogReaderName, {Map? extra}); + Future analogReaderValue(String analogReaderName, {Map? extra}); /// Return the current value of the interrupt which is based on the type of Interrupt. Future digitalInterruptValue(String digitalInterruptName, {Map? extra}); diff --git a/lib/src/components/board/client.dart b/lib/src/components/board/client.dart index 980eff0df5d..f10c14e3d75 100644 --- a/lib/src/components/board/client.dart +++ b/lib/src/components/board/client.dart @@ -95,13 +95,13 @@ class BoardClient extends Board implements ResourceRPCClient { } @override - Future analogReaderValue(String analogReaderName, {Map? extra}) async { + Future analogReaderValue(String analogReaderName, {Map? extra}) async { final request = ReadAnalogReaderRequest() ..boardName = name ..analogReaderName = analogReaderName ..extra = extra?.toStruct() ?? Struct(); final response = await client.readAnalogReader(request); - return response.value; + return response; } @override diff --git a/lib/src/components/board/service.dart b/lib/src/components/board/service.dart index 3de17110f23..02b32d56bd0 100644 --- a/lib/src/components/board/service.dart +++ b/lib/src/components/board/service.dart @@ -61,8 +61,8 @@ class BoardService extends BoardServiceBase { @override Future readAnalogReader(ServiceCall call, ReadAnalogReaderRequest request) async { final board = _fromManager(request.boardName); - final value = await board.analogReaderValue(request.analogReaderName, extra: request.extra.toMap()); - return ReadAnalogReaderResponse()..value = value; + final result = await board.analogReaderValue(request.analogReaderName, extra: request.extra.toMap()); + return result; } @override diff --git a/lib/src/gen/app/packages/v1/packages.pb.dart b/lib/src/gen/app/packages/v1/packages.pb.dart index ae68c6896eb..7d3b1aaa0f5 100644 --- a/lib/src/gen/app/packages/v1/packages.pb.dart +++ b/lib/src/gen/app/packages/v1/packages.pb.dart @@ -24,6 +24,7 @@ class FileInfo extends $pb.GeneratedMessage { factory FileInfo({ $core.String? name, $fixnum.Int64? size, + $core.bool? isDirectory, }) { final $result = create(); if (name != null) { @@ -32,6 +33,9 @@ class FileInfo extends $pb.GeneratedMessage { if (size != null) { $result.size = size; } + if (isDirectory != null) { + $result.isDirectory = isDirectory; + } return $result; } FileInfo._() : super(); @@ -41,6 +45,7 @@ class FileInfo extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FileInfo', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.app.packages.v1'), createEmptyInstance: create) ..aOS(1, _omitFieldNames ? '' : 'name') ..a<$fixnum.Int64>(2, _omitFieldNames ? '' : 'size', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO) + ..aOB(3, _omitFieldNames ? '' : 'isDirectory') ..hasRequiredFields = false ; @@ -82,6 +87,15 @@ class FileInfo extends $pb.GeneratedMessage { $core.bool hasSize() => $_has(1); @$pb.TagNumber(2) void clearSize() => clearField(2); + + @$pb.TagNumber(3) + $core.bool get isDirectory => $_getBF(2); + @$pb.TagNumber(3) + set isDirectory($core.bool v) { $_setBool(2, v); } + @$pb.TagNumber(3) + $core.bool hasIsDirectory() => $_has(2); + @$pb.TagNumber(3) + void clearIsDirectory() => clearField(3); } class PackageInfo extends $pb.GeneratedMessage { diff --git a/lib/src/gen/app/packages/v1/packages.pbjson.dart b/lib/src/gen/app/packages/v1/packages.pbjson.dart index 6a7ce79bcd8..95d13cc98eb 100644 --- a/lib/src/gen/app/packages/v1/packages.pbjson.dart +++ b/lib/src/gen/app/packages/v1/packages.pbjson.dart @@ -39,12 +39,17 @@ const FileInfo$json = { '2': [ {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, {'1': 'size', '3': 2, '4': 1, '5': 4, '10': 'size'}, + {'1': 'is_directory', '3': 3, '4': 1, '5': 8, '9': 0, '10': 'isDirectory', '17': true}, + ], + '8': [ + {'1': '_is_directory'}, ], }; /// Descriptor for `FileInfo`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List fileInfoDescriptor = $convert.base64Decode( - 'CghGaWxlSW5mbxISCgRuYW1lGAEgASgJUgRuYW1lEhIKBHNpemUYAiABKARSBHNpemU='); + 'CghGaWxlSW5mbxISCgRuYW1lGAEgASgJUgRuYW1lEhIKBHNpemUYAiABKARSBHNpemUSJgoMaX' + 'NfZGlyZWN0b3J5GAMgASgISABSC2lzRGlyZWN0b3J5iAEBQg8KDV9pc19kaXJlY3Rvcnk='); @$core.Deprecated('Use packageInfoDescriptor instead') const PackageInfo$json = { diff --git a/lib/src/gen/common/v1/common.pb.dart b/lib/src/gen/common/v1/common.pb.dart index 0df4e152bb8..1843ef60a95 100644 --- a/lib/src/gen/common/v1/common.pb.dart +++ b/lib/src/gen/common/v1/common.pb.dart @@ -999,10 +999,9 @@ class GeoPoint extends $pb.GeneratedMessage { void clearLongitude() => clearField(2); } -/// GeoObstacle contains information about the geometric structure of an obstacle and the location of the obstacle, -/// captured in latitude and longitude. -class GeoObstacle extends $pb.GeneratedMessage { - factory GeoObstacle({ +/// GeoGeometry contains information describing Geometry(s) that is located at a GeoPoint +class GeoGeometry extends $pb.GeneratedMessage { + factory GeoGeometry({ GeoPoint? location, $core.Iterable? geometries, }) { @@ -1015,11 +1014,11 @@ class GeoObstacle extends $pb.GeneratedMessage { } return $result; } - GeoObstacle._() : super(); - factory GeoObstacle.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GeoObstacle.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + GeoGeometry._() : super(); + factory GeoGeometry.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GeoGeometry.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GeoObstacle', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.common.v1'), createEmptyInstance: create) + static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GeoGeometry', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.common.v1'), createEmptyInstance: create) ..aOM(1, _omitFieldNames ? '' : 'location', subBuilder: GeoPoint.create) ..pc(2, _omitFieldNames ? '' : 'geometries', $pb.PbFieldType.PM, subBuilder: Geometry.create) ..hasRequiredFields = false @@ -1029,24 +1028,24 @@ class GeoObstacle extends $pb.GeneratedMessage { 'Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' 'Will be removed in next major version') - GeoObstacle clone() => GeoObstacle()..mergeFromMessage(this); + GeoGeometry clone() => GeoGeometry()..mergeFromMessage(this); @$core.Deprecated( 'Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 'Will be removed in next major version') - GeoObstacle copyWith(void Function(GeoObstacle) updates) => super.copyWith((message) => updates(message as GeoObstacle)) as GeoObstacle; + GeoGeometry copyWith(void Function(GeoGeometry) updates) => super.copyWith((message) => updates(message as GeoGeometry)) as GeoGeometry; $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') - static GeoObstacle create() => GeoObstacle._(); - GeoObstacle createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static GeoGeometry create() => GeoGeometry._(); + GeoGeometry createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static GeoObstacle getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GeoObstacle? _defaultInstance; + static GeoGeometry getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GeoGeometry? _defaultInstance; - /// Location of the obstacle + /// Location of the geometry @$pb.TagNumber(1) GeoPoint get location => $_getN(0); @$pb.TagNumber(1) @@ -1058,7 +1057,7 @@ class GeoObstacle extends $pb.GeneratedMessage { @$pb.TagNumber(1) GeoPoint ensureLocation() => $_ensure(0); - /// Geometries that describe the obstacle, where embedded Pose data is with respect to the specified location + /// Geometries associated with the location, where embedded Pose data is with respect to the specified location @$pb.TagNumber(2) $core.List get geometries => $_getList(1); } @@ -1202,7 +1201,8 @@ class WorldState extends $pb.GeneratedMessage { @$pb.TagNumber(1) $core.List get obstacles => $_getList(0); - /// a list of Transforms, optionally with geometries. Used as supplemental transforms to transform a pose from one reference frame to another, or to attach moving geometries to the frame system. This field is optional + /// a list of Transforms, optionally with geometries. Used as supplemental transforms to transform a pose from one reference frame to + /// another, or to attach moving geometries to the frame system. This field is optional @$pb.TagNumber(3) $core.List get transforms => $_getList(1); } diff --git a/lib/src/gen/common/v1/common.pbjson.dart b/lib/src/gen/common/v1/common.pbjson.dart index 0017969a071..e6e4cfb94b6 100644 --- a/lib/src/gen/common/v1/common.pbjson.dart +++ b/lib/src/gen/common/v1/common.pbjson.dart @@ -215,18 +215,18 @@ final $typed_data.Uint8List geoPointDescriptor = $convert.base64Decode( 'CghHZW9Qb2ludBIaCghsYXRpdHVkZRgBIAEoAVIIbGF0aXR1ZGUSHAoJbG9uZ2l0dWRlGAIgAS' 'gBUglsb25naXR1ZGU='); -@$core.Deprecated('Use geoObstacleDescriptor instead') -const GeoObstacle$json = { - '1': 'GeoObstacle', +@$core.Deprecated('Use geoGeometryDescriptor instead') +const GeoGeometry$json = { + '1': 'GeoGeometry', '2': [ {'1': 'location', '3': 1, '4': 1, '5': 11, '6': '.viam.common.v1.GeoPoint', '10': 'location'}, {'1': 'geometries', '3': 2, '4': 3, '5': 11, '6': '.viam.common.v1.Geometry', '10': 'geometries'}, ], }; -/// Descriptor for `GeoObstacle`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List geoObstacleDescriptor = $convert.base64Decode( - 'CgtHZW9PYnN0YWNsZRI0Cghsb2NhdGlvbhgBIAEoCzIYLnZpYW0uY29tbW9uLnYxLkdlb1BvaW' +/// Descriptor for `GeoGeometry`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List geoGeometryDescriptor = $convert.base64Decode( + 'CgtHZW9HZW9tZXRyeRI0Cghsb2NhdGlvbhgBIAEoCzIYLnZpYW0uY29tbW9uLnYxLkdlb1BvaW' '50Ughsb2NhdGlvbhI4CgpnZW9tZXRyaWVzGAIgAygLMhgudmlhbS5jb21tb24udjEuR2VvbWV0' 'cnlSCmdlb21ldHJpZXM='); diff --git a/lib/src/gen/service/motion/v1/motion.pb.dart b/lib/src/gen/service/motion/v1/motion.pb.dart index 1d62dc81981..bfaafa2fb05 100644 --- a/lib/src/gen/service/motion/v1/motion.pb.dart +++ b/lib/src/gen/service/motion/v1/motion.pb.dart @@ -602,8 +602,9 @@ class MoveOnGlobeRequest extends $pb.GeneratedMessage { $core.double? heading, $1.ResourceName? componentName, $1.ResourceName? movementSensorName, - $core.Iterable<$1.GeoObstacle>? obstacles, + $core.Iterable<$1.GeoGeometry>? obstacles, MotionConfiguration? motionConfiguration, + $core.Iterable<$1.GeoGeometry>? boundingRegions, $2.Struct? extra, }) { final $result = create(); @@ -628,6 +629,9 @@ class MoveOnGlobeRequest extends $pb.GeneratedMessage { if (motionConfiguration != null) { $result.motionConfiguration = motionConfiguration; } + if (boundingRegions != null) { + $result.boundingRegions.addAll(boundingRegions); + } if (extra != null) { $result.extra = extra; } @@ -643,8 +647,9 @@ class MoveOnGlobeRequest extends $pb.GeneratedMessage { ..a<$core.double>(3, _omitFieldNames ? '' : 'heading', $pb.PbFieldType.OD) ..aOM<$1.ResourceName>(4, _omitFieldNames ? '' : 'componentName', subBuilder: $1.ResourceName.create) ..aOM<$1.ResourceName>(5, _omitFieldNames ? '' : 'movementSensorName', subBuilder: $1.ResourceName.create) - ..pc<$1.GeoObstacle>(6, _omitFieldNames ? '' : 'obstacles', $pb.PbFieldType.PM, subBuilder: $1.GeoObstacle.create) + ..pc<$1.GeoGeometry>(6, _omitFieldNames ? '' : 'obstacles', $pb.PbFieldType.PM, subBuilder: $1.GeoGeometry.create) ..aOM(7, _omitFieldNames ? '' : 'motionConfiguration', subBuilder: MotionConfiguration.create) + ..pc<$1.GeoGeometry>(8, _omitFieldNames ? '' : 'boundingRegions', $pb.PbFieldType.PM, subBuilder: $1.GeoGeometry.create) ..aOM<$2.Struct>(99, _omitFieldNames ? '' : 'extra', subBuilder: $2.Struct.create) ..hasRequiredFields = false ; @@ -728,7 +733,7 @@ class MoveOnGlobeRequest extends $pb.GeneratedMessage { /// Obstacles to be considered for motion planning @$pb.TagNumber(6) - $core.List<$1.GeoObstacle> get obstacles => $_getList(5); + $core.List<$1.GeoGeometry> get obstacles => $_getList(5); /// Optional set of motion configuration options @$pb.TagNumber(7) @@ -742,17 +747,21 @@ class MoveOnGlobeRequest extends $pb.GeneratedMessage { @$pb.TagNumber(7) MotionConfiguration ensureMotionConfiguration() => $_ensure(6); + /// Set of obstacles which the robot must remain within while navigating + @$pb.TagNumber(8) + $core.List<$1.GeoGeometry> get boundingRegions => $_getList(7); + /// Additional arguments to the method @$pb.TagNumber(99) - $2.Struct get extra => $_getN(7); + $2.Struct get extra => $_getN(8); @$pb.TagNumber(99) set extra($2.Struct v) { setField(99, v); } @$pb.TagNumber(99) - $core.bool hasExtra() => $_has(7); + $core.bool hasExtra() => $_has(8); @$pb.TagNumber(99) void clearExtra() => clearField(99); @$pb.TagNumber(99) - $2.Struct ensureExtra() => $_ensure(7); + $2.Struct ensureExtra() => $_ensure(8); } class MoveOnGlobeResponse extends $pb.GeneratedMessage { diff --git a/lib/src/gen/service/motion/v1/motion.pbjson.dart b/lib/src/gen/service/motion/v1/motion.pbjson.dart index 36f328ba8d4..eb76c8cb6f8 100644 --- a/lib/src/gen/service/motion/v1/motion.pbjson.dart +++ b/lib/src/gen/service/motion/v1/motion.pbjson.dart @@ -168,8 +168,9 @@ const MoveOnGlobeRequest$json = { {'1': 'heading', '3': 3, '4': 1, '5': 1, '9': 0, '10': 'heading', '17': true}, {'1': 'component_name', '3': 4, '4': 1, '5': 11, '6': '.viam.common.v1.ResourceName', '10': 'componentName'}, {'1': 'movement_sensor_name', '3': 5, '4': 1, '5': 11, '6': '.viam.common.v1.ResourceName', '10': 'movementSensorName'}, - {'1': 'obstacles', '3': 6, '4': 3, '5': 11, '6': '.viam.common.v1.GeoObstacle', '10': 'obstacles'}, + {'1': 'obstacles', '3': 6, '4': 3, '5': 11, '6': '.viam.common.v1.GeoGeometry', '10': 'obstacles'}, {'1': 'motion_configuration', '3': 7, '4': 1, '5': 11, '6': '.viam.service.motion.v1.MotionConfiguration', '9': 1, '10': 'motionConfiguration', '17': true}, + {'1': 'bounding_regions', '3': 8, '4': 3, '5': 11, '6': '.viam.common.v1.GeoGeometry', '10': 'boundingRegions'}, {'1': 'extra', '3': 99, '4': 1, '5': 11, '6': '.google.protobuf.Struct', '10': 'extra'}, ], '8': [ @@ -185,11 +186,12 @@ final $typed_data.Uint8List moveOnGlobeRequestDescriptor = $convert.base64Decode 'GAMgASgBSABSB2hlYWRpbmeIAQESQwoOY29tcG9uZW50X25hbWUYBCABKAsyHC52aWFtLmNvbW' '1vbi52MS5SZXNvdXJjZU5hbWVSDWNvbXBvbmVudE5hbWUSTgoUbW92ZW1lbnRfc2Vuc29yX25h' 'bWUYBSABKAsyHC52aWFtLmNvbW1vbi52MS5SZXNvdXJjZU5hbWVSEm1vdmVtZW50U2Vuc29yTm' - 'FtZRI5CglvYnN0YWNsZXMYBiADKAsyGy52aWFtLmNvbW1vbi52MS5HZW9PYnN0YWNsZVIJb2Jz' + 'FtZRI5CglvYnN0YWNsZXMYBiADKAsyGy52aWFtLmNvbW1vbi52MS5HZW9HZW9tZXRyeVIJb2Jz' 'dGFjbGVzEmMKFG1vdGlvbl9jb25maWd1cmF0aW9uGAcgASgLMisudmlhbS5zZXJ2aWNlLm1vdG' - 'lvbi52MS5Nb3Rpb25Db25maWd1cmF0aW9uSAFSE21vdGlvbkNvbmZpZ3VyYXRpb26IAQESLQoF' - 'ZXh0cmEYYyABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0UgVleHRyYUIKCghfaGVhZGluZ0' - 'IXChVfbW90aW9uX2NvbmZpZ3VyYXRpb24='); + 'lvbi52MS5Nb3Rpb25Db25maWd1cmF0aW9uSAFSE21vdGlvbkNvbmZpZ3VyYXRpb26IAQESRgoQ' + 'Ym91bmRpbmdfcmVnaW9ucxgIIAMoCzIbLnZpYW0uY29tbW9uLnYxLkdlb0dlb21ldHJ5Ug9ib3' + 'VuZGluZ1JlZ2lvbnMSLQoFZXh0cmEYYyABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0UgVl' + 'eHRyYUIKCghfaGVhZGluZ0IXChVfbW90aW9uX2NvbmZpZ3VyYXRpb24='); @$core.Deprecated('Use moveOnGlobeResponseDescriptor instead') const MoveOnGlobeResponse$json = { diff --git a/lib/src/gen/service/navigation/v1/navigation.pb.dart b/lib/src/gen/service/navigation/v1/navigation.pb.dart index 907424f9d8f..7a3427a7f07 100644 --- a/lib/src/gen/service/navigation/v1/navigation.pb.dart +++ b/lib/src/gen/service/navigation/v1/navigation.pb.dart @@ -862,7 +862,7 @@ class GetObstaclesRequest extends $pb.GeneratedMessage { class GetObstaclesResponse extends $pb.GeneratedMessage { factory GetObstaclesResponse({ - $core.Iterable<$1.GeoObstacle>? obstacles, + $core.Iterable<$1.GeoGeometry>? obstacles, }) { final $result = create(); if (obstacles != null) { @@ -875,7 +875,7 @@ class GetObstaclesResponse extends $pb.GeneratedMessage { factory GetObstaclesResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetObstaclesResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.service.navigation.v1'), createEmptyInstance: create) - ..pc<$1.GeoObstacle>(1, _omitFieldNames ? '' : 'obstacles', $pb.PbFieldType.PM, subBuilder: $1.GeoObstacle.create) + ..pc<$1.GeoGeometry>(1, _omitFieldNames ? '' : 'obstacles', $pb.PbFieldType.PM, subBuilder: $1.GeoGeometry.create) ..hasRequiredFields = false ; @@ -902,7 +902,7 @@ class GetObstaclesResponse extends $pb.GeneratedMessage { /// List of all known geometries @$pb.TagNumber(1) - $core.List<$1.GeoObstacle> get obstacles => $_getList(0); + $core.List<$1.GeoGeometry> get obstacles => $_getList(0); } /// A user provided destination and the set of geopoints that diff --git a/lib/src/gen/service/navigation/v1/navigation.pbjson.dart b/lib/src/gen/service/navigation/v1/navigation.pbjson.dart index e6287ab9e90..76cf3bb43cc 100644 --- a/lib/src/gen/service/navigation/v1/navigation.pbjson.dart +++ b/lib/src/gen/service/navigation/v1/navigation.pbjson.dart @@ -233,14 +233,14 @@ final $typed_data.Uint8List getObstaclesRequestDescriptor = $convert.base64Decod const GetObstaclesResponse$json = { '1': 'GetObstaclesResponse', '2': [ - {'1': 'obstacles', '3': 1, '4': 3, '5': 11, '6': '.viam.common.v1.GeoObstacle', '10': 'obstacles'}, + {'1': 'obstacles', '3': 1, '4': 3, '5': 11, '6': '.viam.common.v1.GeoGeometry', '10': 'obstacles'}, ], }; /// Descriptor for `GetObstaclesResponse`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List getObstaclesResponseDescriptor = $convert.base64Decode( 'ChRHZXRPYnN0YWNsZXNSZXNwb25zZRI5CglvYnN0YWNsZXMYASADKAsyGy52aWFtLmNvbW1vbi' - '52MS5HZW9PYnN0YWNsZVIJb2JzdGFjbGVz'); + '52MS5HZW9HZW9tZXRyeVIJb2JzdGFjbGVz'); @$core.Deprecated('Use pathDescriptor instead') const Path$json = { diff --git a/test/unit_test/components/board_test.dart b/test/unit_test/components/board_test.dart index ace6c35576c..aa2bc30b31b 100644 --- a/test/unit_test/components/board_test.dart +++ b/test/unit_test/components/board_test.dart @@ -11,11 +11,18 @@ import 'package:viam_sdk/viam_sdk.dart'; import '../../test_utils.dart'; +AnalogValue expectedAnalog = AnalogValue() + ..value = 0 + ..minRange = 0 + ..maxRange = 5 + ..stepSize = 1; + class FakeBoard extends Board { final Map gpioMap = {'pin': false}; final Map pwmMap = {'pin': 0.0}; final Map frequencyMap = {'pin': 0}; final Map analogMap = {'pin': 0}; + AnalogValue analogResponse = expectedAnalog; PowerMode powerMode = PowerMode.POWER_MODE_NORMAL; final Map> tickCallbackMap = {}; Map? extra; @@ -31,9 +38,9 @@ class FakeBoard extends Board { } @override - Future analogReaderValue(String analogReaderName, {Map? extra}) async { + Future analogReaderValue(String analogReaderName, {Map? extra}) async { this.extra = extra; - return 0; + return analogResponse; } @override @@ -120,8 +127,7 @@ void main() { }); test('analogReaderValue', () async { - const expected = 0; - expect(await board.analogReaderValue('1'), expected); + expect(await board.analogReaderValue('1'), expectedAnalog); }); test('digitalInterruptValue', () async { @@ -219,12 +225,10 @@ void main() { group('Board Service Tests', () { test('analogReaderValue', () async { final client = BoardServiceClient(channel); - const expected = 0; - final response = await client.readAnalogReader(ReadAnalogReaderRequest() ..boardName = name ..analogReaderName = '1'); - expect(response.value, expected); + expect(response, expectedAnalog); }); test('digitalInterruptValue', () async { @@ -363,8 +367,7 @@ void main() { group('Board Client Tests', () { test('analogReaderValue', () async { final client = BoardClient(name, channel); - const expected = 0; - expect(await client.analogReaderValue('1'), expected); + expect(await client.analogReaderValue('1'), expectedAnalog); }); test('digitalInterruptValue', () async {