Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitkumaragarwal committed Dec 5, 2023
2 parents 9111e5f + ef41254 commit 54c98c5
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export default class TabGenerator {
*/
generateTab (content) {
this.containerList.push(new Tab(this.contentDiv, content, this.selector))
// If it is the first, then show it
if (this.containerList.length === 1) {
this.containerList[0].select()
}
}

/**
Expand Down Expand Up @@ -87,7 +91,7 @@ export default class TabGenerator {

close (point) {
for (const tab of this.containerList) {
if (point.name === tab.content.title) {
if (!point || point.name === tab.content.title) {
tab.close()
}
}
Expand Down Expand Up @@ -135,8 +139,14 @@ class Tab {
this.selectorArea.appendChild(this.button)
}

select () {
this.button.onclick()
}

close () {
this.selectorArea.removeChild(this.button)
this.content.close()
if (this.content && this.content.close) {
this.content.close()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export default class EndpointGraphics extends BasicScreen {
constructor (title) {
super(title)
this.endpointUrl = ''

console.log('========================================================= open 0')
}

close () {
Expand All @@ -41,6 +43,8 @@ export default class EndpointGraphics extends BasicScreen {
this.backGround.innerHTML = 'EndpointUrl: ' + endpointUrl
this.socketHandler = new SocketHandler(socket, endpointUrl)

// console.log('========================================================= open 1')

// mixing background and current tab content here

const tabGenerator = new TabGenerator(this.backGround, 'TabSelector' + endpointUrl)
Expand All @@ -63,7 +67,7 @@ export default class EndpointGraphics extends BasicScreen {
const eventGraphics = new EventGraphics(eventManager, modelManager)
tabGenerator.generateTab(eventGraphics, false)
const resultManager = new ResultManager(this.connectionManager, eventManager)
const assets = new AssetManager(addressSpace, this.socketHandler)
const assets = new AssetManager(addressSpace, this.connectionManager)
const asstetGraphics = new AssetGraphics(assets)
tabGenerator.generateTab(asstetGraphics)
const traceGraphics = new TraceGraphics(['angle', 'torque'], addressSpace, resultManager)
Expand All @@ -75,19 +79,20 @@ export default class EndpointGraphics extends BasicScreen {
/* **************** Set up socket listeners to handle input from server ******************/

// Listen to error messages
this.socketHandler.registerMandatory('error message', function (msg) {
this.connectionManager.socketHandler.registerMandatory('error message', function (msg) {
console.log(msg.message)
// servers.messageDisplay(msg.message)
tabGenerator.displayError(msg)
})

window.onbeforeunload = function () {
this.connectionManager.close()
}
console.log('========================================================= o3 ' + this.endpointUrl)

// console.log('========================================================= o4 ' + this.endpointUrl)

/*
/*
if (window.performance.getEntriesByType) {
if (window.performance.getEntriesByType('navigation')[0].type === 'reload') {
console.log('===== When reloaded ======================================= Close 2 ' + this.endpointUrl + ' : ' + this.rndseed)
this.connectionManager.close()
}
} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import BasicScreen from '../GraphicSupport/BasicScreen.mjs'
import EndpointGraphics from './EndpointGraphics.mjs'

export default class ServerGraphics extends BasicScreen {
constructor (io, endpointTabGenerator) {
constructor (socket, endpointTabGenerator) {
super('+')
this.socket = io
this.socket = socket
this.endpointTabGenerator = endpointTabGenerator

const makeLabel = function (text) {
Expand Down Expand Up @@ -123,6 +123,7 @@ export default class ServerGraphics extends BasicScreen {
newConnection.instantiate(point.address, socket)
endpointTabGenerator.generateTab(newConnection, true)
}

function disconnect (point, endpointTabGenerator) {
endpointTabGenerator.close(point)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* a representation of the assets
*/
export class AssetManager {
constructor (addressSpace, socketHandler) {
this.socketHandler = socketHandler
constructor (addressSpace, connectionManager) {
this.socketHandler = connectionManager.socketHandler
this.addressSpace = addressSpace
this.counter = 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,28 @@ export class NodeOPCUAInterface {
connectionObject.translateBrowsePath(callid, nodeId, path)
})

socket.on('terminate connection', (endpoint) => {
console.log('Recieving terminate session request (' + endpoint + ')')
const connectionObject = this.connectionList[endpoint]
socket.on('terminate connection', (endpointUrl) => {
console.log('**********************************************------------------------')
console.log('Recieving terminate session request (' + endpointUrl + ')')
const connectionObject = this.connectionList[endpointUrl]
if (!connectionObject) {
console.log('Nodejs OPC UA client failed to find EndpointUrl ' + this.endpointUrl + ' for termination')
console.log('Nodejs OPC UA client failed to find EndpointUrl ' + endpointUrl + ' for termination')
return
}
connectionObject.closeConnection()
this.connectionList[endpointUrl] = null
})

socket.on('disconnect from', endpointUrl => {
console.log('**********************************************------------------------')
console.log('Nodejs OPC UA client attempting to disconnect from ' + endpointUrl)
if (endpointUrl) {
const connection = this.connectionList[endpointUrl]
if (connection) {
connection.closeConnection()
}
this.connectionList[endpointUrl] = null
}
})

socket.on('get connectionpoints', () => {
Expand All @@ -142,18 +156,6 @@ export class NodeOPCUAInterface {
}
})

socket.on('disconnect from', endpointUrl => {
console.log('**********************************************')
console.log('Nodejs OPC UA client attempting to disconnect from ' + endpointUrl)
if (endpointUrl) {
const connection = this.connectionList[endpointUrl]
if (connection) {
connection.closeConnection()
}
this.connectionList[endpointUrl] = null
}
})

socket.on('subscribe event', (endpoint, msg, subscriberDetails) => {
// console.log('Nodejs OPC UA client attempting to subscribe to ' + msg)
const connectionObject = this.connectionList[endpoint]
Expand Down Expand Up @@ -457,8 +459,10 @@ class Connection {
console.log('Disconnect client. (' + this.endpointUrl + ')')
if (this.client) {
this.client.disconnect(function () {
console.log('Client disconnected.\n**********************************************')
this.io.emit('client disconnected', { endpointurl: this.endpointUrl })
console.log('Client disconnected.\n=========================================')
if (this && this.io) {
this.io.emit('client disconnected', { endpointurl: this.endpointUrl })
}
})
}
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"connectionpoints":[{"name":"Local","address":"opc.tcp://127.0.0.1:40451","autoconnect":false},{"name":"Windows simulation","address":"opc.tcp://10.46.19.106:40451","autoconnect":true},{"name":"ICB-A","address":"opc.tcp://10.46.16.68:40451","autoconnect":false},{"name":"PF80000","address":"opc.tcp://10.46.16.174:40451","autoconnect":false}]}
{"connectionpoints":[{"name":"Local","address":"opc.tcp://127.0.0.1:40451","autoconnect":true},{"name":"Windows simulation","address":"opc.tcp://10.46.19.106:40451","autoconnect":true},{"name":"ICB-A","address":"opc.tcp://10.46.16.68:40451","autoconnect":false},{"name":"PF80000","address":"opc.tcp://10.46.16.174:40451","autoconnect":false}]}
12 changes: 11 additions & 1 deletion OPC_UA_Clients/NodeOPCUA_IJT_Client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,27 @@
import TabGenerator from 'views/GraphicSupport/TabGenerator.mjs'
import EndpointGraphics from 'views/Servers/EndpointGraphics.mjs'

// Set up essentials
// Set up websocket to the server
var socket = io()

// Create background
const baseDiv = document.createElement('div')
baseDiv.classList.add('startScreen')
document.body.appendChild(baseDiv)

//create the top tab handler
const tabGenerator = new TabGenerator(baseDiv, 'topLevelTabSelector')

// Create the server management tab
const servers = new ServerGraphics(socket, tabGenerator)
tabGenerator.generateTab(servers)

// Ensure all connections are closed when leaving page or refreshing it
window.onbeforeunload = function (event) {
tabGenerator.close()
// event.returnValue = 'test'
}

</script>
</body>

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# UA-for-Industrial-Joining-Technologies
The purpose of the IJT group is to define data models and data access standards for various joining techniques such as Tightening, Gluing, Riveting, Flow Drill Fastening, etc.
The purpose of the **VDMA Industrial Joining Technologies (IJT)** Working Group is to define standard information model for various **joining** **technologies** such as Tightening, Gluing, Riveting, Flow Drill Fastening, etc.
The **Joining** **Specification** **(OPC 40450)** is the **Base** part for various joining technologies.

OPC UA Reference Server based on OPC **40451-1** UA CS for **Tightening** Systems **1.00.0** is available in the following location:

OPC_UA_Servers/**Release1**/**IJT_OPC_UA_Server_Simulator.zip**

OPC UA Reference Server based on the following specifications:
OPC **40450-1** UA CS for **Joining** Systems 1.00.0 **RC**.
OPC **40451-1** UA CS for **Tightening** Systems **2.00.0** **RC**.
is available in the following location:

OPC_UA_Servers/**Release2**/**OPC_UA_IJT_Server_Simulator**

OPC_UA_Servers\Release1\IJT_OPC_UA_Server_Simulator.zip is the OPC UA Server Simulation based on OPC 40451-1 UA CS for Tightening Systems 1.00.

0 comments on commit 54c98c5

Please sign in to comment.