Skip to content

Commit

Permalink
Fix generated code that uses DBusStruct.
Browse files Browse the repository at this point in the history
This was broken in 544b44f when the data type was changed from DBusStruct to List<DBusValue>
  • Loading branch information
robert-ancell committed Nov 16, 2023
1 parent 0715d7b commit fd88d3d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/src/dbus_dart_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class DBusUnixFdType extends DBusDartType {
class DBusStructType extends DBusDartType {
@override
String get nativeType {
return 'DBusStruct';
return 'List<DBusValue>';
}

@override
Expand Down
2 changes: 1 addition & 1 deletion test/generated-code/method-multiple-inputs.client.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ComExampleTest extends DBusRemoteObject {
ComExampleTest(DBusClient client, String destination, DBusObjectPath path) : super(client, name: destination, path: path);

/// Invokes com.example.Test.Hello()
Future<void> callHello(int byte_value, bool boolean_value, int int16_value, int uint16_value, int int32_value, int uint32_value, int int64_value, int uint64_value, double double_value, String string_value, String object_path_value, DBusSignature signature_value, DBusValue variant_value, ResourceHandle unix_fd_value, DBusStruct struct_value, List<int> array_value_y, List<bool> array_value_b, List<int> array_value_n, List<int> array_value_q, List<int> array_value_u, List<int> array_value_n, List<int> array_value_x, List<int> array_value_t, List<double> array_value_d, List<String> array_value_s, List<String> array_value_o, List<DBusSignature> array_value_g, List<DBusValue> array_value_v, List<ResourceHandle> array_value_h, List<DBusStruct> array_value_struct, List<List<String>> array_value_array, Map<String, DBusValue> dict_value_sv, Map<int, String> dict_value_us, Map<String, Map<String, DBusValue>> dict_value_dict, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async {
Future<void> callHello(int byte_value, bool boolean_value, int int16_value, int uint16_value, int int32_value, int uint32_value, int int64_value, int uint64_value, double double_value, String string_value, String object_path_value, DBusSignature signature_value, DBusValue variant_value, ResourceHandle unix_fd_value, List<DBusValue> struct_value, List<int> array_value_y, List<bool> array_value_b, List<int> array_value_n, List<int> array_value_q, List<int> array_value_u, List<int> array_value_n, List<int> array_value_x, List<int> array_value_t, List<double> array_value_d, List<String> array_value_s, List<String> array_value_o, List<DBusSignature> array_value_g, List<DBusValue> array_value_v, List<ResourceHandle> array_value_h, List<List<DBusValue>> array_value_struct, List<List<String>> array_value_array, Map<String, DBusValue> dict_value_sv, Map<int, String> dict_value_us, Map<String, Map<String, DBusValue>> dict_value_dict, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async {
await callMethod('com.example.Test', 'Hello', [DBusByte(byte_value), DBusBoolean(boolean_value), DBusInt16(int16_value), DBusUint16(uint16_value), DBusInt32(int32_value), DBusUint32(uint32_value), DBusInt64(int64_value), DBusUint64(uint64_value), DBusDouble(double_value), DBusString(string_value), DBusObjectPath(object_path_value), signature_value, DBusVariant(variant_value), DBusUnixFd(unix_fd_value), struct_value, DBusArray.byte(array_value_y), DBusArray.boolean(array_value_b), DBusArray.int16(array_value_n), DBusArray.uint16(array_value_q), DBusArray.int32(array_value_u), DBusArray.uint32(array_value_n), DBusArray.int64(array_value_x), DBusArray.uint64(array_value_t), DBusArray.double(array_value_d), DBusArray.string(array_value_s), DBusArray.objectPath(array_value_o), DBusArray.signature(array_value_g), DBusArray.variant(array_value_v), DBusArray.unixFd(array_value_h), DBusArray(DBusSignature('(si)'), array_value_struct.map((child) => child)), DBusArray(DBusSignature('as'), array_value_array.map((child) => DBusArray.string(child))), DBusDict.stringVariant(dict_value_sv), DBusDict(DBusSignature('u'), DBusSignature('s'), dict_value_us.map((key, value) => MapEntry(DBusUint32(key), DBusString(value)))), DBusDict(DBusSignature('s'), DBusSignature('a{sv}'), dict_value_dict.map((key, value) => MapEntry(DBusString(key), DBusDict.stringVariant(value))))], replySignature: DBusSignature(''), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization);
}
}
2 changes: 1 addition & 1 deletion test/generated-code/method-multiple-inputs.server.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ComExampleTest extends DBusObject {
ComExampleTest({DBusObjectPath path = const DBusObjectPath.unchecked('/')}) : super(path);

/// Implementation of com.example.Test.Hello()
Future<DBusMethodResponse> doHello(int byte_value, bool boolean_value, int int16_value, int uint16_value, int int32_value, int uint32_value, int int64_value, int uint64_value, double double_value, String string_value, String object_path_value, DBusSignature signature_value, DBusValue variant_value, ResourceHandle unix_fd_value, DBusStruct struct_value, List<int> array_value_y, List<bool> array_value_b, List<int> array_value_n, List<int> array_value_q, List<int> array_value_u, List<int> array_value_n, List<int> array_value_x, List<int> array_value_t, List<double> array_value_d, List<String> array_value_s, List<String> array_value_o, List<DBusSignature> array_value_g, List<DBusValue> array_value_v, List<ResourceHandle> array_value_h, List<DBusStruct> array_value_struct, List<List<String>> array_value_array, Map<String, DBusValue> dict_value_sv, Map<int, String> dict_value_us, Map<String, Map<String, DBusValue>> dict_value_dict) async {
Future<DBusMethodResponse> doHello(int byte_value, bool boolean_value, int int16_value, int uint16_value, int int32_value, int uint32_value, int int64_value, int uint64_value, double double_value, String string_value, String object_path_value, DBusSignature signature_value, DBusValue variant_value, ResourceHandle unix_fd_value, List<DBusValue> struct_value, List<int> array_value_y, List<bool> array_value_b, List<int> array_value_n, List<int> array_value_q, List<int> array_value_u, List<int> array_value_n, List<int> array_value_x, List<int> array_value_t, List<double> array_value_d, List<String> array_value_s, List<String> array_value_o, List<DBusSignature> array_value_g, List<DBusValue> array_value_v, List<ResourceHandle> array_value_h, List<List<DBusValue>> array_value_struct, List<List<String>> array_value_array, Map<String, DBusValue> dict_value_sv, Map<int, String> dict_value_us, Map<String, Map<String, DBusValue>> dict_value_dict) async {
return DBusMethodErrorResponse.failed('com.example.Test.Hello() not implemented');
}

Expand Down
4 changes: 2 additions & 2 deletions test/generated-code/properties.client.out
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ class ComExampleTest extends DBusRemoteObject {
}

/// Gets com.example.Test.StructProperty
Future<DBusStruct> getStructProperty() async {
Future<List<DBusValue>> getStructProperty() async {
var value = await getProperty('com.example.Test', 'StructProperty', signature: DBusSignature('(si)'));
return value.asStruct();
}

/// Sets com.example.Test.StructProperty
Future<void> setStructProperty (DBusStruct value) async {
Future<void> setStructProperty (List<DBusValue> value) async {
await setProperty('com.example.Test', 'StructProperty', value);
}

Expand Down
2 changes: 1 addition & 1 deletion test/generated-code/properties.server.out
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class ComExampleTest extends DBusObject {
}

/// Sets property com.example.Test.StructProperty
Future<DBusMethodResponse> setStructProperty(DBusStruct value) async {
Future<DBusMethodResponse> setStructProperty(List<DBusValue> value) async {
return DBusMethodErrorResponse.failed('Set com.example.Test.StructProperty not implemented');
}

Expand Down
4 changes: 2 additions & 2 deletions test/generated-code/signal-multiple-args.client.out
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ComExampleTestEvent extends DBusSignal {
DBusSignature get signature_value => values[11].asSignature();
DBusValue get variant_value => values[12].asVariant();
ResourceHandle get unix_fd_value => values[13].asUnixFd();
DBusStruct get struct_value => values[14].asStruct();
List<DBusValue> get struct_value => values[14].asStruct();
List<int> get array_value_y => values[15].asByteArray().toList();
List<bool> get array_value_b => values[16].asBooleanArray().toList();
List<int> get array_value_n => values[17].asInt16Array().toList();
Expand All @@ -31,7 +31,7 @@ class ComExampleTestEvent extends DBusSignal {
List<DBusSignature> get array_value_g => values[26].asSignatureArray().toList();
List<DBusValue> get array_value_v => values[27].asVariantArray().toList();
List<ResourceHandle> get array_value_h => values[28].asUnixFdArray().toList();
List<DBusStruct> get array_value_struct => values[29].asArray().map((child) => child.asStruct()).toList();
List<List<DBusValue>> get array_value_struct => values[29].asArray().map((child) => child.asStruct()).toList();
List<List<String>> get array_value_array => values[30].asArray().map((child) => child.asStringArray().toList()).toList();
Map<String, DBusValue> get dict_value_sv => values[31].asStringVariantDict();
Map<int, String> get dict_value_us => values[32].asDict().map((key, value) => MapEntry(key.asUint32(), value.asString()));
Expand Down
2 changes: 1 addition & 1 deletion test/generated-code/signal-multiple-args.server.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ComExampleTest extends DBusObject {
ComExampleTest({DBusObjectPath path = const DBusObjectPath.unchecked('/')}) : super(path);

/// Emits signal com.example.Test.Event
Future<void> emitEvent(int byte_value, bool boolean_value, int int16_value, int uint16_value, int int32_value, int uint32_value, int int64_value, int uint64_value, double double_value, String string_value, String object_path_value, DBusSignature signature_value, DBusValue variant_value, ResourceHandle unix_fd_value, DBusStruct struct_value, List<int> array_value_y, List<bool> array_value_b, List<int> array_value_n, List<int> array_value_q, List<int> array_value_u, List<int> array_value_n_, List<int> array_value_x, List<int> array_value_t, List<double> array_value_d, List<String> array_value_s, List<String> array_value_o, List<DBusSignature> array_value_g, List<DBusValue> array_value_v, List<ResourceHandle> array_value_h, List<DBusStruct> array_value_struct, List<List<String>> array_value_array, Map<String, DBusValue> dict_value_sv, Map<int, String> dict_value_us, Map<String, Map<String, DBusValue>> dict_value_dict) async {
Future<void> emitEvent(int byte_value, bool boolean_value, int int16_value, int uint16_value, int int32_value, int uint32_value, int int64_value, int uint64_value, double double_value, String string_value, String object_path_value, DBusSignature signature_value, DBusValue variant_value, ResourceHandle unix_fd_value, List<DBusValue> struct_value, List<int> array_value_y, List<bool> array_value_b, List<int> array_value_n, List<int> array_value_q, List<int> array_value_u, List<int> array_value_n_, List<int> array_value_x, List<int> array_value_t, List<double> array_value_d, List<String> array_value_s, List<String> array_value_o, List<DBusSignature> array_value_g, List<DBusValue> array_value_v, List<ResourceHandle> array_value_h, List<List<DBusValue>> array_value_struct, List<List<String>> array_value_array, Map<String, DBusValue> dict_value_sv, Map<int, String> dict_value_us, Map<String, Map<String, DBusValue>> dict_value_dict) async {
await emitSignal('com.example.Test', 'Event', [DBusByte(byte_value), DBusBoolean(boolean_value), DBusInt16(int16_value), DBusUint16(uint16_value), DBusInt32(int32_value), DBusUint32(uint32_value), DBusInt64(int64_value), DBusUint64(uint64_value), DBusDouble(double_value), DBusString(string_value), DBusObjectPath(object_path_value), signature_value, DBusVariant(variant_value), DBusUnixFd(unix_fd_value), struct_value, DBusArray.byte(array_value_y), DBusArray.boolean(array_value_b), DBusArray.int16(array_value_n), DBusArray.uint16(array_value_q), DBusArray.int32(array_value_u), DBusArray.uint32(array_value_n_), DBusArray.int64(array_value_x), DBusArray.uint64(array_value_t), DBusArray.double(array_value_d), DBusArray.string(array_value_s), DBusArray.objectPath(array_value_o), DBusArray.signature(array_value_g), DBusArray.variant(array_value_v), DBusArray.unixFd(array_value_h), DBusArray(DBusSignature('(si)'), array_value_struct.map((child) => child)), DBusArray(DBusSignature('as'), array_value_array.map((child) => DBusArray.string(child))), DBusDict.stringVariant(dict_value_sv), DBusDict(DBusSignature('u'), DBusSignature('s'), dict_value_us.map((key, value) => MapEntry(DBusUint32(key), DBusString(value)))), DBusDict(DBusSignature('s'), DBusSignature('a{sv}'), dict_value_dict.map((key, value) => MapEntry(DBusString(key), DBusDict.stringVariant(value))))]);
}

Expand Down

0 comments on commit fd88d3d

Please sign in to comment.