Skip to content
Snippets Groups Projects
Commit 78c62801 authored by Stefan Duenhuber's avatar Stefan Duenhuber
Browse files

change logic for UIDs

parent bc7e2f4c
No related branches found
No related tags found
No related merge requests found
......@@ -45,16 +45,14 @@ abstract class V2VGeneratorExtensionBase<T extends EObject> extends
/** {@inheritDoc} */
@Override
public final String getSingletonInitializationCode() {
// get model
// RaspberryPiImpl piimpl = (RaspberryPiImpl)modelElement.eContainer();
public String getSingletonInitializationCode() {
// build string
StringBuilder sb = new StringBuilder();
sb.append("// initialize the v2v communicaton\n");
// initialize the v2v communicaton
sb.append("srand((unsigned int)time(NULL));\n");
sb.append("af3_v2v_activate( 9990, (uint16_t)rand(), true);\n");
sb.append("af3_v2v_activate( 9990, -1, true);\n");
return sb.toString();
}
/** {@inheritDoc} */
......
......@@ -15,14 +15,17 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.raspberry.generator.extension.v2v;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.platform.raspberry.generator.framework.IWriteableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.v2v.V2VLeaderUIDOutput;
/**
* @author duenhuber
* Executable for v2v output {@link V2VLeaderUIDOutput}.
* @param <T>
*/
public class V2VLeaderUIDOutputGeneratorExtension extends
V2VOutputGeneratorExtension<V2VLeaderUIDOutput> {
V2VGeneratorExtensionBase<V2VLeaderUIDOutput> implements IWriteableGeneratorExtension {
/** Constructor. */
public V2VLeaderUIDOutputGeneratorExtension(V2VLeaderUIDOutput modelElement) {
super(modelElement);
......@@ -30,9 +33,15 @@ public class V2VLeaderUIDOutputGeneratorExtension extends
/** {@inheritDoc} */
@Override
protected String getV2VMessageType() {
public String getWriteCode(OutputPort logicalSignal, String value) {
return "af3_v2v_set_leader_vehicle_of_interest_uid(" + value + ");\n";
}
/** {@inheritDoc} */
@Override
public String getNoValWriteCode(OutputPort logicalSignal) {
// TODO Auto-generated method stub
return "V2V_MSG_TYPE_LEADERUID";
return null;
}
}
......@@ -15,6 +15,8 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.raspberry.generator.extension.v2v;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.platform.raspberry.generator.framework.IWriteableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.v2v.V2VLocalUIDOutput;
/**
......@@ -22,7 +24,7 @@ import org.fortiss.af3.platform.raspberry.model.v2v.V2VLocalUIDOutput;
* Executable for v2v output {@link V2VLocalUIDOutput}.
*/
public class V2VLocalUIDOutputGeneratorExtension extends
V2VOutputGeneratorExtension<V2VLocalUIDOutput> {
V2VGeneratorExtensionBase<V2VLocalUIDOutput> implements IWriteableGeneratorExtension {
/** Constructor. */
public V2VLocalUIDOutputGeneratorExtension(V2VLocalUIDOutput modelElement) {
super(modelElement);
......@@ -30,9 +32,14 @@ public class V2VLocalUIDOutputGeneratorExtension extends
/** {@inheritDoc} */
@Override
protected String getV2VMessageType() {
// TODO Auto-generated method stub
return "V2V_MSG_TYPE_LOCALUID";
public String getWriteCode(OutputPort logicalSignal, String value) {
return "af3_v2v_set_local_uid(" + value + ");\n";
}
/** {@inheritDoc} */
@Override
public String getNoValWriteCode(OutputPort logicalSignal) {
// TODO Auto-generated method stub
return null;
}
}
......@@ -15,6 +15,8 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.raspberry.generator.extension.v2v;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.platform.raspberry.generator.framework.IWriteableGeneratorExtension;
import org.fortiss.af3.platform.raspberry.model.v2v.V2VPrecedingUIDOuput;
/**
......@@ -22,7 +24,7 @@ import org.fortiss.af3.platform.raspberry.model.v2v.V2VPrecedingUIDOuput;
* Executable for v2v output {@link V2VPrecedingUIDOuput}.
*/
public class V2VPrecedingUIDOutputGeneratorExtension extends
V2VOutputGeneratorExtension<V2VPrecedingUIDOuput> {
V2VGeneratorExtensionBase<V2VPrecedingUIDOuput> implements IWriteableGeneratorExtension {
/** Constructor. */
public V2VPrecedingUIDOutputGeneratorExtension(V2VPrecedingUIDOuput modelElement) {
super(modelElement);
......@@ -30,9 +32,16 @@ public class V2VPrecedingUIDOutputGeneratorExtension extends
/** {@inheritDoc} */
@Override
protected String getV2VMessageType() {
public String getWriteCode(OutputPort logicalSignal, String value) {
// TODO Auto-generated method stub
return "V2V_MSG_TYPE_PRECEDINGUID";
return "af3_v2v_set_preceding_vehicle_of_interest_uid(" + value + ");\n";
}
/** {@inheritDoc} */
@Override
public String getNoValWriteCode(OutputPort logicalSignal) {
// TODO Auto-generated method stub
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment