Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align Terminology of VSS model classes / public API #94

Merged
merged 23 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5748884
refactor: Align Terminology of VSS model classes / public API
Chrylo Feb 28, 2024
5dbcb42
chore: Combine VssNode + VssSpecification
Chrylo Feb 28, 2024
4420cee
chore: Rename VssSpecification -> VssNode
Chrylo Feb 28, 2024
819c648
chore: Adapt generator for merged VssSpecification + VssNode
Chrylo Feb 29, 2024
6d55337
chore: Rename VssSpecification -> VssNode
Chrylo Feb 29, 2024
ed2f24a
chore: Rename VssDefinition -> VssModelGenerator
Chrylo Feb 29, 2024
11fd909
chore: Sort DataBroker classes into packages
Chrylo Mar 1, 2024
8335f51
chore: Correct missed naming
Chrylo Mar 1, 2024
c359191
chore: Update AGP + Compose versions
Chrylo Mar 1, 2024
bc4738d
Merge remote-tracking branch 'eclipse/main' into task-70
Chrylo Mar 1, 2024
ea1054d
chore: Replace Property with DataBrokerRequests
Chrylo Mar 4, 2024
6ad4459
chore: Rename PropertyListener -> VssPathListener
Chrylo Mar 5, 2024
db3ed59
test: Adapt test naming
Chrylo Mar 6, 2024
3ecbac8
chore: Rename VssNode extensions
Chrylo Mar 6, 2024
defb3a1
chore: Converts varargs -> Collection for performance
Chrylo Mar 7, 2024
25d5447
chore: Rename missed Specification -> VssNode
Chrylo Mar 7, 2024
a1d0025
Merge remote-tracking branch 'eclipse/main' into task-70
Chrylo Mar 7, 2024
c0a06a2
test: Adapt tests to vararg change
Chrylo Mar 7, 2024
b897e0f
chore: Adapt QUICKSTART to vararg API
Chrylo Mar 8, 2024
505b13a
chore: Introduce VssSignal + VssBranch
Chrylo Mar 8, 2024
4975b33
chore: Fix missing child in heritage
Chrylo Mar 14, 2024
3579307
chore: Simplify filter logic for VssNode.findSignal()
Chrylo Mar 14, 2024
474602b
Merge branch 'main' into task-70
Chrylo Mar 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fun connectInsecure(host: String, port: Int) {
```kotlin
wba2hi marked this conversation as resolved.
Show resolved Hide resolved
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
fun fetch() {
lifecycleScope.launch {
val property = Property("Vehicle.Speed", listOf(Field.FIELD_VALUE))
val response = dataBrokerConnection?.fetch(property) ?: return@launch
val request = FetchRequest("Vehicle.Speed", listOf(Field.FIELD_VALUE))
val response = dataBrokerConnection?.fetch(request) ?: return@launch
val entry = entriesList.first() // Don't forget to handle empty responses
val value = entry.value
val speed = value.float
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@

import androidx.annotation.NonNull;

import org.eclipse.kuksa.CoroutineCallback;
import org.eclipse.kuksa.DataBrokerConnection;
import org.eclipse.kuksa.DataBrokerConnector;
import org.eclipse.kuksa.DisconnectListener;
import org.eclipse.kuksa.PropertyListener;
import org.eclipse.kuksa.VssSpecificationListener;
import org.eclipse.kuksa.model.Property;
import org.eclipse.kuksa.connectivity.databroker.DataBrokerConnection;
import org.eclipse.kuksa.connectivity.databroker.DataBrokerConnector;
import org.eclipse.kuksa.connectivity.databroker.listener.DisconnectListener;
import org.eclipse.kuksa.connectivity.databroker.listener.VssPathListener;
import org.eclipse.kuksa.connectivity.databroker.listener.VssNodeListener;
import org.eclipse.kuksa.connectivity.databroker.request.FetchRequest;
import org.eclipse.kuksa.connectivity.databroker.request.SubscribeRequest;
import org.eclipse.kuksa.connectivity.databroker.request.UpdateRequest;
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeFetchRequest;
import org.eclipse.kuksa.connectivity.databroker.request.VssNodeSubscribeRequest;
import org.eclipse.kuksa.coroutine.CoroutineCallback;
import org.eclipse.kuksa.proto.v1.KuksaValV1.GetResponse;
import org.eclipse.kuksa.proto.v1.KuksaValV1.SetResponse;
import org.eclipse.kuksa.proto.v1.Types;
import org.eclipse.kuksa.proto.v1.Types.Datapoint;
import org.eclipse.kuksa.testapp.databroker.connection.DataBrokerConnectorFactory;
import org.eclipse.kuksa.testapp.databroker.model.ConnectionInfo;
import org.eclipse.kuksa.vsscore.model.VssSpecification;
import org.eclipse.kuksa.vsscore.model.VssNode;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -91,7 +92,7 @@ public void onError(@NonNull Throwable error) {
}

@Override
public void fetch(@NonNull Property property, @NonNull CoroutineCallback<GetResponse> callback) {
public void fetch(@NonNull FetchRequest property, @NonNull CoroutineCallback<GetResponse> callback) {
if (dataBrokerConnection == null) {
return;
}
Expand All @@ -100,73 +101,60 @@ public void fetch(@NonNull Property property, @NonNull CoroutineCallback<GetResp
}

@Override
public <T extends VssSpecification> void fetch(
@NonNull T specification,
public <T extends VssNode> void fetch(
@NonNull VssNodeFetchRequest<T> request,
@NonNull CoroutineCallback<T> callback
) {
if (dataBrokerConnection == null) {
return;
}

dataBrokerConnection.fetch(specification, callback);
dataBrokerConnection.fetch(request, callback);
}

@Override
public void update(
@NonNull Property property,
@NonNull Datapoint datapoint,
@NonNull UpdateRequest request,
@NonNull CoroutineCallback<SetResponse> callback
) {
if (dataBrokerConnection == null) {
return;
}

dataBrokerConnection.update(property, datapoint, callback);
dataBrokerConnection.update(request, callback);
}

@Override
public void subscribe(@NonNull Property property, @NonNull PropertyListener propertyListener) {
public void subscribe(@NonNull SubscribeRequest request, @NonNull VssPathListener listener) {
if (dataBrokerConnection == null) {
return;
}

dataBrokerConnection.subscribe(property, propertyListener);
dataBrokerConnection.subscribe(request, listener);
}

@Override
public <T extends VssSpecification> void subscribe(
@NonNull T specification,
@NonNull VssSpecificationListener<T> specificationListener
public <T extends VssNode> void subscribe(
@NonNull VssNodeSubscribeRequest<T> request,
@NonNull VssNodeListener<T> vssNodeListener
) {
if (dataBrokerConnection == null) {
return;
}

ArrayList<Types.Field> fields = new ArrayList<>() {
{
add(Types.Field.FIELD_VALUE);
}
};

dataBrokerConnection.subscribe(specification, fields, specificationListener);
dataBrokerConnection.subscribe(request, vssNodeListener);
}

@Override
public <T extends VssSpecification> void unsubscribe(
@NonNull T specification,
@NonNull VssSpecificationListener<T> specificationListener
public <T extends VssNode> void unsubscribe(
@NonNull VssNodeSubscribeRequest<T> request,
@NonNull VssNodeListener<T> vssNodeListener
) {
if (dataBrokerConnection == null) {
return;
}

ArrayList<Types.Field> fields = new ArrayList<>() {
{
add(Types.Field.FIELD_VALUE);
}
};

dataBrokerConnection.unsubscribe(specification, fields, specificationListener);
dataBrokerConnection.unsubscribe(request, vssNodeListener);
}

public void disconnect() {
Expand Down Expand Up @@ -206,9 +194,9 @@ public void unregisterDisconnectListener(@NonNull DisconnectListener listener) {
}

@Override
public void unsubscribe(@NonNull Property property, @NonNull PropertyListener propertyListener) {
public void unsubscribe(@NonNull SubscribeRequest request, @NonNull VssPathListener listener) {
if (dataBrokerConnection != null) {
dataBrokerConnection.unsubscribe(property, propertyListener);
dataBrokerConnection.unsubscribe(request, listener);
}
}
}
Loading
Loading