You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Move packages around to be able to execute single tests + fix signature parsing for nested objects
* move kotlin test file to correct package + write more tests for the signature parser
* Add dict_entry signature parsing and validation
* Refactor whole java serialization process (+13% performance)
* Refactor serialization test (WIP) + fix primitive array support + add test for them
* Fix class cache
* Finish test refactor + optimize imports
* Implement dict_entry serialization + small JNI code refactor/optimization
* Fix nested array serialization in JNI code
* Set dict_entry signature to NULL(refer to dbus doc for mroe info)
* Comment code + small JNI refactor + fix some bug about complex arrays
* Get ready for release
* Fix merge conflicts
Copy file name to clipboardExpand all lines: README.md
+34-5
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ public class SubObject extends Message{
95
95
96
96
### Arrays
97
97
98
-
DBus array type is mapped to the `List` collection. AList can contain anything serializable, including other lists. AsJNIDBus uses reflection to know the type of the List items, the generic type must always be explicitly used in the getters and setters
98
+
TheDBus array type is mapped to either the `List` classor to native arrays . A List/array can contain anything serializable, including other lists/arrays. As JNIDBus uses reflection to know the type of the List items, the generic type must always be explicitly used in the getters and setters
99
99
100
100
*<u>example for a nested list message:</u>*
101
101
@@ -116,6 +116,32 @@ public class CollectionOfCollectionArray extends Message {
116
116
}
117
117
```
118
118
119
+
### Dictionaries (`Maps`)
120
+
121
+
TheDBus arrays of `dict_entries` are mapped to the `Map` class, the key must be a primitive DBustype (refertotheDBusdocumentationforadefinitionofprimitive) and its value can contain nested objects, arrays or maps. As for the `List`, the generic types must be explicitly used in the getters/setters.
122
+
123
+
*<u>example for a map message:</u>*
124
+
125
+
```java
126
+
@DBusType(
127
+
/* This signature correspond to an array containing dict_entries of a string and an * integer. In the java world, it's a Map with a string as key and integers as values
128
+
*/
129
+
signature = "a{si}",
130
+
fields = "map"
131
+
)
132
+
public class MapMessage extends Message {
133
+
privateMap<String,Integer> map;
134
+
135
+
//always explicitly give the precise generic type
136
+
publicMap<String,Integer> getMap() ...
137
+
138
+
//for setters too
139
+
publicvoid setMap(Map<String,Integer> map) ...
140
+
}
141
+
```
142
+
143
+
144
+
119
145
### TheEmptyMessage
120
146
121
147
if your message does not contain any data, the `Message` classcontains a static `EMPTY` property which contains an empty Message that can be used. Using this object allows some internal optimizations and it is recommended to use it whenever you can.
@@ -344,19 +370,22 @@ suspend fun suspendingDBusCall() : SingleStringMessage{
344
370
345
371
346
372
347
-
## Planned features
373
+
## Planned tasks
348
374
349
-
- Support `DICT_ENTRY` type
375
+
- Support `OBJECT_PATH` type
376
+
- Refactor `serialization.cpp` to use proper OOP and cleanup the code
377
+
- Add the capability to create downcasted typed array in JNI code instead of plain `Object[]` objects
378
+
- Use direct `ByteBuffer` instead of plain `Object` arrays to avoid copies.
350
379
351
380
## FAQ
352
381
353
382
##### Which java versions are compatible?
354
383
355
-
Java 7 and Java 11 where tested. You will also need `libc` and `libdbus-1` to run the native code
384
+
Java 8 to Java 11 are tested by the CI, Java 7 should run but is not tested. You will also need `libc` and `libdbus-1` to run the native code
356
385
357
386
##### How fast is this library
358
387
359
-
I was able to get around 35k complex signals (nested lists and objects) sent and received on a single event loop on my modest i3-4130 work machine. I was able to get around 58k empty signals with the same setup. This should satisfy most of the use cases so unless you really need to push DBus to its limit it's enough.
388
+
I was able to get around 40k/s "complex" signals sent and received on a single event loop on my modest i3-4130 work machine. I was able to get around 95k/s empty signals with the same setup. This should satisfy most of the use cases so unless you really need to push DBus to its limit it's enough.
thrownewMessageCheckException("the field "+field.getName()+" is not of a List of Integer");
168
-
}else {
169
-
if (!fieldType.equals(type.getBoxedType()) && !fieldType.equals(type.getPrimitiveType())) thrownewMessageCheckException("the field " + field.getName() + " is not of type "+type);
170
-
}
171
-
}elseif(element.isArray()){
172
-
//recursively check the content of the nested list
if(!Serializable.class.isAssignableFrom((Class)fieldType)) thrownewMessageCheckException("the field "+field.getName()+" does not contain a serializable type");
0 commit comments