Files
effector.main/Supervisor/Comms/MachineManager.vb
T
Emmanuele Sassi fad64bb5b4 - implementata lista macchine configurabili
- aggiunte funzioni lua
- corretta esportazione funzioni per plugin
- aggiunta funzione che lancia eseguibile per cam
2024-08-09 11:42:31 +02:00

68 lines
2.2 KiB
VB.net

Imports NGP_COMM_DLL
Public Class MachineManager
'
'
' !!!! TO DO : use a list of n machines, not just 2 !!!!
Private m_MachineList(20) As NC.NC_generic
Friend ReadOnly Property MachineList As NC.NC_generic()
Get
Return m_MachineList
End Get
End Property
Private m_Machine1 As NC.NC_generic
Public ReadOnly Property Machine1 As NC.NC_generic
Get
Return m_Machine1
End Get
End Property
Private m_Machine2 As NC.NC_generic
Public ReadOnly Property Machine2 As NC.NC_generic
Get
Return m_Machine2
End Get
End Property
Sub New()
End Sub
Sub Init()
If GetMainPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) = 1 Then
Dim nMachineIndex As Integer = 1
Dim sMachine As String = ""
While GetMainPrivateProfileString(S_NC, K_MACHINE & nMachineIndex.ToString(), "", sMachine) > 0
Dim NewSimulatedMachine As New NC.Simulated
NewSimulatedMachine.Connect("")
m_MachineList(nMachineIndex) = NewSimulatedMachine
nMachineIndex += 1
End While
Else
Dim nMachineIndex As Integer = 1
Dim sMachine As String = ""
While GetMainPrivateProfileString(S_NC, K_MACHINE & nMachineIndex.ToString(), "", sMachine) > 0
Dim sMachineSplit() As String = sMachine.Split(","c)
Dim nType As Integer = 0
If sMachineSplit.Count >= 1 AndAlso Not String.IsNullOrWhiteSpace(sMachineSplit(0)) AndAlso Integer.TryParse(sMachineSplit(0), nType) Then
Select Case nType
Case 1 ' OsaiOpen
If sMachineSplit.Count >= 2 AndAlso Not String.IsNullOrWhiteSpace(sMachineSplit(1)) Then
Dim NewOsaiOpen As New NC.OsaiOpen
NewOsaiOpen.Connect(sMachineSplit(1))
m_MachineList(nMachineIndex) = NewOsaiOpen
End If
End Select
End If
nMachineIndex += 1
End While
End If
End Sub
Sub Close()
m_Machine1.Disconnect()
m_Machine2.Disconnect()
End Sub
End Class