VB Net Blank Trigge...
 
Notifications
Clear all

VB Net Blank Trigger Template

10 Posts
3 Users
0 Reactions
7,181 Views
Posts: 10
Topic starter
(@jduck)
Active Member
Joined: 19 years ago
[#1590]

Hey fellows,

I'm not a C# sharp programmer so I'm throwing this out for any other fellow VB programmers. Hope it helps.

Imports Vixen


Namespace ModbusTrigger

    Public Class Modbus

        Implements Vixen.ITriggerPlugin

        Private m_trigger As ITrigger
        'change if you want more than 1 trigger
        Private NumTriggers As Integer = 1
        Dim vthread= New Thread(New ThreadStart(AddressOf UpdateStatus))



        Public Sub UpdateStatus()
        
            While True
                'Check your hardware or whatever

                If (dValue) Then
                    'adjust statement if you use more than one trigger
                    m_trigger.ActivateTrigger(InterfaceTypeName, 0)

                End If

                Thread.Sleep(1000)

            End While

        End Sub


        Public Sub Setup() Implements Vixen.ITriggerPlugin.Setup

        End Sub


        Public Sub Loading(ByVal dataNode As System.Xml.XmlNode) Implements Vixen.ILoadable.Loading

            Dim obj As Object

            If Vixen.Interfaces.Available.TryGetValue("ITrigger", obj) Then
                m_trigger = CType(obj, Vixen.ITrigger)
            End If

            vthread.start()

        End Sub


        Public Sub Unloading() Implements Vixen.ILoadable.Unloading

            vthread.abort()

        End Sub


        Public ReadOnly Property Author() As String Implements Vixen.IPlugIn.Author
            Get
                Return "Your Name"
            End Get
        End Property


        Public ReadOnly Property Description() As String Implements Vixen.IPlugIn.Description
            Get
                Return "Trigger Description"
            End Get
        End Property


        Public ReadOnly Property Name() As String Implements Vixen.IPlugIn.Name
            Get
                Return "Trigger"
            End Get
        End Property


        Public Overloads Overrides Function ToString() As String Implements Vixen.IPlugIn.ToString
            Return Name
        End Function


        Public ReadOnly Property InterfaceTypeName() As String Implements Vixen.ITriggerPlugin.InterfaceTypeName
            Get
                Return Name
            End Get
        End Property


        Public ReadOnly Property TriggerCount() As Integer Implements Vixen.ITriggerPlugin.TriggerCount
            Get
                Return NumTriggers
            End Get
        End Property


        Public ReadOnly Property DataLocationPreference() As Vixen.LoadableDataLocation Implements Vixen.ILoadable.DataLocationPreference
            Get
                Return LoadableDataLocation.Sequence
            End Get
        End Property

    End Class

End Namespace

9 Replies
Posts: 6
(@slartibartfast)
Active Member
Joined: 19 years ago

Hey, jduck,
I am a nub and I am trying to make a vb plugin for a custom serial controller. i need a decimal sent out through the serial port. I need some more comments for your blank program and how to use it.


Reply
teberle
Posts: 641
(@teberle)
Honorable Member
Joined: 20 years ago

The template above is for a trigger not for a plugin. The code will be different. I have a blank template I can send you for this.

What is your level of software development?


Reply
Posts: 6
(@slartibartfast)
Active Member
Joined: 19 years ago

Thanks, that would be great! 😀


Reply
Posts: 6
(@slartibartfast)
Active Member
Joined: 19 years ago

VB 2008


Reply
Posts: 10
Topic starter
(@jduck)
Active Member
Joined: 19 years ago

I’ll post the modbus output plugin I wrote when I get to the house. It takes the event data, 1 byte per channel, and assigns the value to a single bit, off or on. If the value is greater than zero than the bit is set to true. The routine then converts an array of bits to an integer value and then transmits via modbus. You could easily replace the modbus send routine with a serial command. It might get close to where you want to be.


Reply
Posts: 10
Topic starter
(@jduck)
Active Member
Joined: 19 years ago

ModbusTCP Output Trigger

If you get rid of the Modbus code this mght get you closer to where ou need to be.


Reply
Posts: 6
(@slartibartfast)
Active Member
Joined: 19 years ago

Thanks! 😀


Reply
Posts: 6
(@slartibartfast)
Active Member
Joined: 19 years ago

First of all, thanks for the help from everyone - although I'm not getting anywhere....I'm a very inexperienced programmer (8th grade). I'm using VB express edition and have written only windows form applications and basic stamp stuff - so when it comes to plugins I'm lost. I was excited to find vixen and looking at the stuff in cs it didn't seem to far away from vb code so I figure I'd give it a try. However, I've not a clue how to set up a project to build a ,dll - and it's not really fair to ask you guys to be my vb tutor. But I'll ask anyway...I'm happy writing the guts of code but I can't figure out the directories that are zipped up - when I try to load any of the vbproj files, I get a mess that doesn't do anything when I compile (doesn't generate any files.) So - (and now the please and groveling begins) Would you have a 'complete' vb project setup that I can download and compile (to see if my environment will consume and generate a plugin that vixen(1.1.11) will eat) and then that I can modify to do my fiddly bits? Again, my hump is (probably) not the code itself, but things like 'couldn't register library blah blah blah' messages and stuff that is a decade away from my skill...
Thanks - It's fun to be part of a responsive group! 😀


Reply
teberle
Posts: 641
(@teberle)
Honorable Member
Joined: 20 years ago

slartibartfast,

Attached is a vb_skeleton project. It will compile a dll for you, but it references and implements vixen 2.0. I can make a new one for Vixen 1.0 but I won't be able to deliver until tomorrow.

Tony


Reply
Share: