Skip to content

Commit

Permalink
improove generic creation
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAhrdt committed Jan 12, 2024
1 parent a2184e5 commit b296b09
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 14 additions & 3 deletions lib/modules/directorieshandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class messagehandlerClass {
}
},
configuration:{
safeDirectory: this.safeableDirectories.downlinkConfiguration,
refreshRate:{
isState: true,
stateVal: 2,
Expand Down Expand Up @@ -164,10 +165,10 @@ class messagehandlerClass {
if(!this.reachableDirectories){
this.reachableDirectories = {};
}
if(!this.reachableDirectories[`${message.end_device_ids.application_ids.application_id}.${message.end_device_ids.dev_eui}.${message.end_device_ids.device_id}`]){
this.reachableDirectories[`${message.end_device_ids.application_ids.application_id}.${message.end_device_ids.dev_eui}.${message.end_device_ids.device_id}`] = {};
if(!this.reachableDirectories[this.getObjectDirectory(message,this.searchableAttributeNames.deviceId)]){
this.reachableDirectories[this.getObjectDirectory(message,this.searchableAttributeNames.deviceId)] = {};
}
this.reachableDirectories[`${message.end_device_ids.application_ids.application_id}.${message.end_device_ids.dev_eui}.${message.end_device_ids.device_id}`][obj[elementName].safeDirectory] = objectId;
this.reachableDirectories[this.getObjectDirectory(message,this.searchableAttributeNames.deviceId)][obj[elementName].safeDirectory] = objectId;
}
await this.adapter.setObjectNotExistsAsync(objectId,{
// @ts-ignore
Expand Down Expand Up @@ -282,6 +283,16 @@ class messagehandlerClass {
}
}

getObjectDirectory(message,resolvetype){
// Select search in case of origin
if(this.adapter.config.ttn){
return this.getTtnObjectDirectory(message,resolvetype);
}
else if(this.adapter.config.chirpstack){
// this.handleChirpstack(topic,message);
}
}

getTtnObjectDirectory(message,resolvetype){
if(typeof message !== "string"){
switch(resolvetype){
Expand Down
1 change: 0 additions & 1 deletion lib/modules/messagehandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class messagehandlerClass {
}*/
try{
await this.directoryhandler.generateRekursivObjects(this.directoryhandler.directories,"",message);

/*********************************************************************
* ************************* Infodata ********************************
* ******************************************************************/
Expand Down

0 comments on commit b296b09

Please sign in to comment.