generated from openremote/custom-project
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
model/src/main/java/org/openremote/model/custom/TeltonikaConfigurationAsset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.openremote.model.custom; | ||
|
||
import jakarta.persistence.Entity; | ||
import org.openremote.model.asset.Asset; | ||
import org.openremote.model.asset.AssetDescriptor; | ||
import org.openremote.model.geo.GeoJSONPoint; | ||
import org.openremote.model.value.AttributeDescriptor; | ||
import org.openremote.model.value.ValueType; | ||
|
||
@Entity | ||
public class TeltonikaConfigurationAsset extends Asset<TeltonikaConfigurationAsset> { | ||
public static final AttributeDescriptor<String[]> WHITELIST = new AttributeDescriptor<>("deviceIMEIWhitelist", ValueType.TEXT.asArray()).withOptional(true); | ||
public static final AttributeDescriptor<Boolean> ENABLED = new AttributeDescriptor<>("Enabled", ValueType.BOOLEAN); | ||
public static final AttributeDescriptor<Boolean> CHECK_FOR_IMEI = new AttributeDescriptor<>("CheckForValidIMEI", ValueType.BOOLEAN); | ||
|
||
public static final AssetDescriptor<TeltonikaConfigurationAsset> DESCRIPTOR = new AssetDescriptor<>("gear", null, TeltonikaConfigurationAsset.class); | ||
|
||
protected TeltonikaConfigurationAsset(){ | ||
|
||
} | ||
|
||
public TeltonikaConfigurationAsset(String name){ | ||
super(name); | ||
super.setLocation(new GeoJSONPoint(0,0,0)); | ||
super.setNotes(""); | ||
} | ||
|
||
public TeltonikaConfigurationAsset setWhitelist(String[] whitelist) { | ||
getAttributes().getOrCreate(WHITELIST).setValue(whitelist); | ||
return this; | ||
} | ||
public TeltonikaConfigurationAsset setEnabled(boolean enabled) { | ||
getAttributes().getOrCreate(ENABLED).setValue(enabled); | ||
return this; | ||
} | ||
|
||
public TeltonikaConfigurationAsset setCheckForImei(boolean enabled) { | ||
getAttributes().getOrCreate(CHECK_FOR_IMEI).setValue(enabled); | ||
return this; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
model/src/main/java/org/openremote/model/custom/TeltonikaModelConfigurationAsset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.openremote.model.custom; | ||
|
||
import jakarta.persistence.Entity; | ||
import net.fortuna.ical4j.model.property.Geo; | ||
import org.openremote.model.asset.Asset; | ||
import org.openremote.model.asset.AssetDescriptor; | ||
import org.openremote.model.geo.GeoJSONPoint; | ||
import org.openremote.model.teltonika.TeltonikaParameter; | ||
import org.openremote.model.value.AttributeDescriptor; | ||
import org.openremote.model.value.ValueType; | ||
|
||
@Entity | ||
public class TeltonikaModelConfigurationAsset extends Asset<TeltonikaModelConfigurationAsset> { | ||
public static final AttributeDescriptor<String> MODEL_NUMBER = new AttributeDescriptor<>("modelNumber", ValueType.TEXT); | ||
public static final AttributeDescriptor<TeltonikaParameter[]> PARAMETER_DATA = new AttributeDescriptor<>("TeltonikaParameterData", CustomValueTypes.TELTONIKA_PARAMETER.asArray()); | ||
public static final AssetDescriptor<TeltonikaModelConfigurationAsset> DESCRIPTOR = new AssetDescriptor<>("switch", null, TeltonikaModelConfigurationAsset.class); | ||
|
||
protected TeltonikaModelConfigurationAsset(){} | ||
|
||
public TeltonikaModelConfigurationAsset(String name){ | ||
super(name); | ||
super.setLocation(new GeoJSONPoint(0,0,0)); | ||
super.setNotes(""); | ||
} | ||
|
||
public TeltonikaModelConfigurationAsset setModelNumber(String name) { | ||
getAttributes().getOrCreate(MODEL_NUMBER).setValue(name); | ||
return this; | ||
} | ||
|
||
public TeltonikaModelConfigurationAsset setParameterData(TeltonikaParameter[] data) { | ||
getAttributes().getOrCreate(PARAMETER_DATA).setValue(data); | ||
return this; | ||
} | ||
} |