Skip to content

Commit

Permalink
First part of applying merge
Browse files Browse the repository at this point in the history
Edit TeltonikaMQTTHandler to apply required refactors for breaking functionality
  • Loading branch information
pankalog committed Jan 30, 2024
1 parent 3841c4b commit f1383e0
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ private void handleAssetConfigurationChange(AttributeEvent attributeEvent) {

if(eventFilter.apply(attributeEvent) == null) return;

Asset<?> asset = assetStorageService.find(attributeEvent.getAttributeRef().getId());
Asset<?> asset = assetStorageService.find(attributeEvent.getRef().getId());
// if (asset.getType() == )

if(Objects.equals(attributeEvent.getAttributeName(), TeltonikaModelConfigurationAsset.PARAMETER_MAP.getName())) return;
if(Objects.equals(attributeEvent.getName(), TeltonikaModelConfigurationAsset.PARAMETER_MAP.getName())) return;

if (Objects.equals(attributeEvent.getAttributeName(), TeltonikaModelConfigurationAsset.PARAMETER_DATA.getName())){
if (Objects.equals(attributeEvent.getName(), TeltonikaModelConfigurationAsset.PARAMETER_DATA.getName())){
TeltonikaParameter[] newParamList = (TeltonikaParameter[]) attributeEvent.getValue().orElseThrow();
if(newParamList.length == 0) return;
getLogger().info("Model map configuration event: " + Arrays.toString(newParamList));
Expand Down Expand Up @@ -243,13 +243,13 @@ private void handleAttributeMessage(AttributeEvent event) {
TeltonikaConfiguration config = getConfig();

// If this is not an AttributeEvent that updates a config.config.getCommandAttribute().getValue().orElse("sendToDevice") field, ignore
if (!Objects.equals(event.getAttributeName(), config.getCommandAttribute().getValue().orElse("sendToDevice"))) return;
if (!Objects.equals(event.getName(), config.getCommandAttribute().getValue().orElse("sendToDevice"))) return;
//Find the asset in question
CarAsset asset = assetStorageService.find(event.getAssetId(), CarAsset.class);
CarAsset asset = assetStorageService.find(event.getId(), CarAsset.class);

// Double check, remove later, sanity checks
if(asset.hasAttribute(config.getCommandAttribute().getValue().orElse("sendToDevice"))){
if(Objects.equals(event.getAssetId(), asset.getId())){
if(Objects.equals(event.getId(), asset.getId())){

//Get the IMEI of the device
Optional<Attribute<String>> imei;
Expand Down

0 comments on commit f1383e0

Please sign in to comment.