Hamlib/README_VB

89 wiersze
3.0 KiB
Plaintext

This file originates from a mail by Michael Benz who did the work.
It explains how to proceed to have the VB Wrapper used with
VB.NET 2002 with Framework 1.1 (others not tested)
In the newer VB Modules (.BAS) don't exist anymore. So they were replaced by the
Classes (.VB)
The Wrapper is not in final Condition, many DLL Function are still not covered now,
but it will be a good start.
To Import the "Wrapper" use the Folder "Project" and "Import existing Element"
Now import the Class "Hamlib.VB". It alsough seems to import into Sharpdevelop,
so anybody can try it out for free!
http://www.icsharpcode.net/OpenSource/SD/Default.aspx
This Class contains Your Enumeration as well as the DLLImport to get Access to the
Hamlib DLL.
Covered are:
- Init Rig with Comport and Speed
- set/ get Frequency
- set/get Mode
- set/get VFO
- get Riginfo
-rig_debug_level_e not verified (Function is Void, VB Dokumentation
sais this is not possible to be marshaled, but Compiler is still accapting this)
To get access to the Class you have to add something like this in your Main Class
Dim RigLib As RigControll = New RigControll 'get Acces to RigLib Klass
here is an Example how to use the Class:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Dim tokenlookup As String = "rig_pathname"
'Dim tokenlookup As Object = "serial_speed"
'Dim Info As String
Dim Frequenz As Double
Dim ZeichenOut As String
Dim TokenPointer As System.Int32
Dim VFO As Integer
Dim Mode As RigControll.RMode_t
Dim Bandbreite As Long
' Dim RigLib As RigControll = New RigControll
Button3.Enabled() = True
Button2.Enabled() = False
RigLib.rig_set_debug(RigControll.rig_debug_level_e.RIG_DEBUG_TRACE)
myrig = RigLib.rig_init(RigNumber.Text)
TBmyrig.Text = myrig.ToString 'convert myrig to String
TokenPointer = RigLib.rig_token_lookup(myrig, "rig_pathname")
TBZeichen.Text = RigLib.rig_set_conf(myrig, TokenPointer, ComboBox2.Text)
Token.Text = TokenPointer
TokenPointer = RigLib.rig_token_lookup(myrig, "serial_speed")
TBZeichen.Text = RigLib.rig_set_conf(myrig, TokenPointer, ComboBox3.Text)
Token.Text = TokenPointer
RigLib.rig_open(myrig)
TB_Riginfo.Text = RigLib.rig_get_info(myrig)
RigLib.rig_get_vfo(myrig, VFO)
TextBox8.Text = VFO.ToString
RigLib.rig_get_freq(myrig, VFO, Frequenz)
TextBox2.Text() = Frequenz
RigLib.rig_get_mode(myrig, VFO, Mode, Bandbreite)
TextBox3.Text = [Enum].GetName(GetType(RigControll.RMode_t), Mode)
TextBox4.Text = Bandbreite
End Sub
+++++++++++++++++++++++++++++++++
kind Regard
Michael
PS: For help, patches, report, please use send mail at
hamlib-developer@lists.sourceforge.net mailing list
or http://sourceforge.net/projects/hamlib/