|
30 | 30 | import org.thingml.thingmltools.ThingMLTool;
|
31 | 31 | import org.thingml.xtext.constraints.ThingMLHelpers;
|
32 | 32 | import org.thingml.xtext.helpers.AnnotatedElementHelper;
|
| 33 | +import org.thingml.xtext.thingML.ByteLiteral; |
33 | 34 | import org.thingml.xtext.thingML.Function;
|
34 | 35 | import org.thingml.xtext.thingML.Handler;
|
35 | 36 | import org.thingml.xtext.thingML.Import;
|
@@ -123,40 +124,52 @@ public boolean compile(ThingMLModel model, String... options) {
|
123 | 124 | final Message m = (Message) o;
|
124 | 125 | final PlatformAnnotation ma = ThingMLFactory.eINSTANCE.createPlatformAnnotation();
|
125 | 126 | ma.setName("id");
|
126 |
| - ma.setValue(Byte.toString(ByteHelper.messageID())); |
| 127 | + final ByteLiteral id = ThingMLFactory.eINSTANCE.createByteLiteral(); |
| 128 | + id.setByteValue(ByteHelper.messageID()); |
| 129 | + ma.setValue(id); |
127 | 130 | m.getAnnotations().add(ma);
|
128 | 131 | } else if (o instanceof Port) {
|
129 | 132 | final Port port = (Port) o;
|
130 | 133 | final PlatformAnnotation ma = ThingMLFactory.eINSTANCE.createPlatformAnnotation();
|
131 | 134 | ma.setName("id");
|
132 |
| - ma.setValue(Byte.toString(ByteHelper.portID())); |
| 135 | + final ByteLiteral id = ThingMLFactory.eINSTANCE.createByteLiteral(); |
| 136 | + id.setByteValue(ByteHelper.messageID()); |
| 137 | + ma.setValue(id); |
133 | 138 | port.getAnnotations().add(ma);
|
134 | 139 | }else if (o instanceof Thing) {
|
135 | 140 | final Thing thing = (Thing) o;
|
136 | 141 | if (AnnotatedElementHelper.isDefined(thing, "monitor", "not") || !AnnotatedElementHelper.hasAnnotation(thing, "monitor")) continue;
|
137 | 142 | final PlatformAnnotation ma = ThingMLFactory.eINSTANCE.createPlatformAnnotation();
|
138 | 143 | ma.setName("id");
|
139 |
| - ma.setValue(Byte.toString(ByteHelper.thingID())); |
| 144 | + final ByteLiteral id = ThingMLFactory.eINSTANCE.createByteLiteral(); |
| 145 | + id.setByteValue(ByteHelper.messageID()); |
| 146 | + ma.setValue(id); |
140 | 147 | thing.getAnnotations().add(ma);
|
141 | 148 | } else if (o instanceof Function) {
|
142 | 149 | final Function f = (Function) o;
|
143 | 150 | if (f.isAbstract() || AnnotatedElementHelper.isDefined(f, "monitor", "not")) continue;
|
144 | 151 | final PlatformAnnotation ma = ThingMLFactory.eINSTANCE.createPlatformAnnotation();
|
145 | 152 | ma.setName("id");
|
146 |
| - ma.setValue(Byte.toString(ByteHelper.functionID())); |
| 153 | + final ByteLiteral id = ThingMLFactory.eINSTANCE.createByteLiteral(); |
| 154 | + id.setByteValue(ByteHelper.messageID()); |
| 155 | + ma.setValue(id); |
147 | 156 | f.getAnnotations().add(ma);
|
148 | 157 | } else if (o instanceof Property) {
|
149 | 158 | final Property p = (Property) o;
|
150 | 159 | if (AnnotatedElementHelper.isDefined(p, "monitor", "not")) continue;
|
151 | 160 | final PlatformAnnotation ma = ThingMLFactory.eINSTANCE.createPlatformAnnotation();
|
152 | 161 | ma.setName("id");
|
153 |
| - ma.setValue(Byte.toString(ByteHelper.varID())); |
| 162 | + final ByteLiteral id = ThingMLFactory.eINSTANCE.createByteLiteral(); |
| 163 | + id.setByteValue(ByteHelper.messageID()); |
| 164 | + ma.setValue(id); |
154 | 165 | p.getAnnotations().add(ma);
|
155 | 166 | } else if (o instanceof Handler) {
|
156 | 167 | final Handler h = (Handler) o;
|
157 | 168 | final PlatformAnnotation ma = ThingMLFactory.eINSTANCE.createPlatformAnnotation();
|
158 | 169 | ma.setName("id");
|
159 |
| - ma.setValue(Byte.toString(ByteHelper.handlerID())); |
| 170 | + final ByteLiteral id = ThingMLFactory.eINSTANCE.createByteLiteral(); |
| 171 | + id.setByteValue(ByteHelper.messageID()); |
| 172 | + ma.setValue(id); |
160 | 173 | h.getAnnotations().add(ma);
|
161 | 174 | }
|
162 | 175 | }
|
|
0 commit comments