VBTEST -- LOGic COM example

This Visual Basic sample illustrates how to use LOGic's Windows  COM (Common Object Module)  interface feature to easily interface your program

This example is written in Visual Basic 6. However, any language or product supporting COM may be used, including ASP.  If you do not have Visual Basic, you can look at vbtest.frm with any text editor to see the methods and properties exposed by LOGic's COM interface, and examples of how to use them.

Contact Dennis Hevener at PDA if you have any questions or need functionality you don't see in this example.  Sorry, we do not have a full list of all properties and methods available to you.  Pretty much the whole LOGic application is exposed thru the interface, so there are literally thousands of properties and methods available!


Here is some miscellaneous stuff that you can do with the LOGic interface--not too well organized--just stuff people have asked about:

Of course you must first

MyLogic=CREATEOBJECT("LOGICSERVER.SERVER")

Other radio functions

MyLogic.ifc.LOGic.Global.radio1ref.a_equals_b()

Do the VFO A=B function

Communicating directly with the radio

MyLogic.ifc.LOGic.Global.radio1ref.comm.output="MYCOMMAND"+CHR(13)

Send your own carriage return CHR(13) at the end of the command for the Orion

MyLogic.ifc.LOGic.Global.radio1ref.ifc_ok

returns TRUE or FALSE depending on whether or not LOGic is successfully communicating with the radio.

MyLogic.ifc.LOGic.Global.polling_ok

Set or return polling of all rigs. Turn off if you want to read from the rig yourself.

To read the rig:

This info is for the Orion and other rigs that use ASCII text for their control.

First, you can wait for a specific character to be received in the buffer. This waits for a carriage return to be sent. If not sent in 350 milliseconds, it returns FALSE.

MyLogic.ifc.LOGic.Global.radio1ref.Comm.wait_char(Chr(13),350)

The wait time must be less than the polling timer interval! If if returns false, you may want to wait and retry, and after a few retries, alert the user.

Oh, before you can use wait_char(), you should know about

MyLogic.LOGic.Global.radio1ref.comm.inputlen

It sets or returns the number of characters that the MSCOMM control will receive before firing the ONCOMM event.  It must be set to 1 to use wait_char().  It probably already is set for you, but you may want to check it.

To just read what is in the buffer, read

MyLogic.LOGic.Global.radio1ref.comm.input

This command is specific to the Orion and possibly a few other rigs that use text input and output:

MyLogic.ifc.LOGic.Global.radio1ref.poll(Command)

This sends the Command, waits for a response, and then returns the response. It automatically appends CHR(13) to the command.  It automatically handles retrying and alerting the user if the rig disappears.

Other radio interface stuff:

MyLogic.ifc.LOGic.Global.radio1ref.Comm.flushrx(cnt)

Flush cnt characters from the receive buffer, or pass 0 to flush all.

MyLogic.ifc.LOGic.Global.radio1ref.Comm.InputMode

sets and reads the InputMode property. returned by the Iput property of .comm. 0 is text, 1 is binary, returned in an array.

MyLogic.ifc.LOGic.Global.radio1ref.Comm.ReadBinStr(Cnt)

Reads Cnt characters from the port and returns them as a string. Pass 0 to read all characters in the rx buffer. This will read all ASCII characters, including chr(0) (be careful if using character strings in the C language!). I think InputMode has to be set to 1 first.

.Comm is simply a reference to the Microsoft Comm control MSCOMMLib.MScomm  Consult the microsoft documentation for more info.

VOICE PTT

Here is how to control the Voice Push-To-Talk in LOGic. The "Voice" PTT is actually a general-purpose PTT control, useful for keying the transmitter from a digital communications program, for instance. (The CW Keyer PTT in LOGic is a separate object in LOGic. It is a part of the CW Keyer form.)

To see if the user has set up Voice PTT, check that

MyLogic.ifc.LOGic.Global.voicepttobj

is not .null.

To key PTT:

MyLogic.ifc.LOGic.Global.voicepttobj.voice_ptt(True)

To unkey:

MyLogic.ifc.LOGic.Global.voicepttobj.voice_ptt(False)

You can check the key-down state by checking this property:

MyLogic.ifc.LOGic.Global.voice_ptt_down

It will be True or False.