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.
Create TeltonikaPayloadFactory using Factory pattern
This should be the start of a cleaner MQTTHandler code and reducing the overall lines of code. Hopefully it's gonna end with an elegant way of implementing new devices/manufacturers.
- Loading branch information
Showing
6 changed files
with
417 additions
and
356 deletions.
There are no files selected for viewing
9 changes: 0 additions & 9 deletions
9
...ger/src/main/java/org/openremote/manager/custom/telematics/TelematicsDeviceProcessor.java
This file was deleted.
Oops, something went wrong.
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
26 changes: 26 additions & 0 deletions
26
...java/org/openremote/manager/custom/telematics/processors/teltonika/ITeltonikaPayload.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,26 @@ | ||
package org.openremote.manager.custom.telematics.processors.teltonika; | ||
|
||
import org.openremote.container.timer.TimerService; | ||
import org.openremote.model.asset.Asset; | ||
import org.openremote.model.attribute.Attribute; | ||
import org.openremote.model.attribute.AttributeMap; | ||
import org.openremote.model.teltonika.TeltonikaConfiguration; | ||
import org.openremote.model.teltonika.TeltonikaParameter; | ||
|
||
import java.util.Map; | ||
import java.util.logging.Logger; | ||
|
||
public interface ITeltonikaPayload { | ||
|
||
/** | ||
* Returns list of attributes depending on the Teltonika JSON Payload. | ||
* Uses the logic and results from parsing the Teltonika Parameter IDs. | ||
* | ||
* @param payloadContent Payload coming from Teltonika device | ||
* @return Map of {@link Attribute}s to be assigned to the {@link Asset}. | ||
*/ | ||
AttributeMap getAttributesFromPayload(TeltonikaConfiguration config, TimerService timerService); | ||
|
||
AttributeMap getAttributes(Map<Map.Entry<String, TeltonikaParameter>, Object> payloadMap, Logger logger); | ||
|
||
} |
Oops, something went wrong.