Skip to content

Commit

Permalink
subscribeFeedbacks on connect
Browse files Browse the repository at this point in the history
crosspoint feedback remove parsing of variable which is not accepted.
  • Loading branch information
phillipivan committed Jan 14, 2024
1 parent 15b3a1e commit 0f846ef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The alarms should match the number of configured alarm indexs in your system. Re
## Version History

### Version 1.0.2
- Minor TCP improvements
- Minor TCP improvements & fixes

### Version 1.0.1
- Update dependencies
Expand Down
14 changes: 4 additions & 10 deletions src/feedbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,11 @@ module.exports = async function (self) {
callback: ({ options }) => {
return self.connections[options.dst] == options.src
},
subscribe: async ({ options }) => {
let cmd = SOM + control.reqInterrogate + appTag.crosspoint + options.dst + paramSep + nullParam
self.addCmdtoQueue(cmd)
subscribe: ({ options }) => {
self.addCmdtoQueue(SOM + control.reqInterrogate + appTag.crosspoint + options.dst + paramSep + nullParam)
},
learn: async (feedback) => {
let dst = parseInt(await self.parseVariablesInString(feedback.options.dst))
if (isNaN(dst) || dst < 1 || dst > self.config.dst) {
self.log('warn', `an invalid varible has been passed: ${dst}`)
return undefined
}
const source = self.connections[dst]
learn: (feedback) => {
const source = self.connections[feedback.options.dst]
return {
...feedback.options,
src: source,
Expand Down
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class NTP_DOT_PROTOCOL extends InstanceBase {
this.log('debug', `destroy. ID: ${this.id}`)
clearTimeout(this.keepAliveTimer)
clearTimeout(this.cmdTimer)
this.keepAliveTimer = null
this.cmdTimer = null
delete this.keepAliveTimer
delete this.cmdTimer
if (this.socket) {
await this.sendCommand(EndSession)
this.sendCommand(EndSession)
this.socket.destroy()
} else {
this.updateStatus(InstanceStatus.Disconnected)
Expand Down
2 changes: 2 additions & 0 deletions src/tcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ module.exports = {
this.addCmdtoQueue(SOM + control.reqNotification + appTag.alive + 1 + paramSep + 0)
//request alarm notifications
this.addCmdtoQueue(SOM + control.reqNotification + appTag.alarm + 1 + paramSep + 1)
//make sure all feedbacks are accurate
this.subscribeFeedbacks()
return true
},

Expand Down

0 comments on commit 0f846ef

Please sign in to comment.