Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Commit

Permalink
template fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
radevgit committed Jan 17, 2017
1 parent efdb23c commit 52dcdc2
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 22 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ The below device configuration **devices.json** defines complex json payload usi
where the **template.json** file is:
```sh
{
"sn": {$sdid},
"sn": "{$sdid}",
"data": {
"light": {
"value": {$light_value},
"value": "{$light_value}",
"unit": "mLux"
},
"temp": {
"value": {$temp_value},
"value": "{$temp_value}",
"unit": "mCelsius"
},
"pressure": {
"value": {$pressure_value},
"value": "{$pressure_value}",
"unit": "Pascal"
},
"humidity": {
"value": {$humidity_value},
"value": "{$humidity_value}",
"unit": "%rh"
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/iosynth/device/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public SDID getSDID() {
/**
* @param sdid
*/
public void setSDID(SDID uuid) {
this.sdid = uuid;
public void setSDID(SDID sdid) {
this.sdid = sdid;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/iosynth/device/DeviceTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public DeviceTemplate(String jsonFileName, Sensor sensors[]) {
* @param jsonIn
*/
public void parseJson(String jsonIn){
template = jsonIn.split("\\{\\$"); // "{$variable}"
template = jsonIn.split("\"\\{\\$"); // "{$variable}"
}

/**
Expand All @@ -58,7 +58,7 @@ public void parseJson(String jsonIn){
public void matchVariables(Sensor sensors[]){
String tmp[];
for (int i = 1; i < template.length; i++) {
tmp = template[i].split("}", 2);
tmp = template[i].split("}\"", 2);
if (tmp.length < 2) {
logger.severe("Parser error: " + template[i]);
System.exit(1);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/iosynth/device/DevicesFromJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import net.iosynth.sensor.SensorStringRandom;
import net.iosynth.sensor.SensorTimestamp;
import net.iosynth.sensor.SensorSdid;
import net.iosynth.util.GeneratorDevCount;
import net.iosynth.util.GeneratorMAC;
import net.iosynth.util.RuntimeTypeAdapterFactory;
import net.iosynth.util.Xoroshiro128;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/iosynth/device/SDID.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*
*/
public abstract class SDID {
protected String uuid;
protected String sdid;

/**
*
*/
public SDID() {
uuid = new String("sdid");
sdid = new String("sdid");
}

/**
Expand All @@ -30,14 +30,14 @@ public SDID() {
* @return the sdid
*/
public String getUUID() {
return uuid;
return sdid;
}

/**
* @param sdid the sdid to set
* @param sdid
*/
public void setUUID(String uuid) {
this.uuid = uuid;
public void setUUID(String sdid) {
this.sdid = sdid;
}

}
2 changes: 1 addition & 1 deletion src/main/java/net/iosynth/device/SDIDMac48.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void checkParameters() {
*/
@Override
public void replicate() {
uuid = GeneratorMAC.getNext48();
sdid = GeneratorMAC.getNext48();
}

}
2 changes: 1 addition & 1 deletion src/main/java/net/iosynth/device/SDIDMac64.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void checkParameters() {
*/
@Override
public void replicate() {
uuid = GeneratorMAC.getNext64();
sdid = GeneratorMAC.getNext64();
}

}
2 changes: 1 addition & 1 deletion src/main/java/net/iosynth/device/SDIDString.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void checkParameters() {
*/
@Override
public void replicate() {
uuid = value + String.format(format, GeneratorDevCount.getNext());
sdid = value + String.format(format, GeneratorDevCount.getNext());
}

}
2 changes: 1 addition & 1 deletion src/main/java/net/iosynth/device/SDIDUuid.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void checkParameters() {
*/
@Override
public void replicate() {
uuid = UUID.randomUUID().toString();
sdid = UUID.randomUUID().toString();
}

}
4 changes: 2 additions & 2 deletions src/main/java/net/iosynth/sensor/SensorSdid.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public String getValue(){
/**
* @param sdid
*/
public void SetValue(String uuid){
value = uuid;
public void SetValue(String sdid){
value = sdid;
}

@Override
Expand Down

0 comments on commit 52dcdc2

Please sign in to comment.