Welcome to the FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
Need the latest SmartSDR or 4O3A Genius Product Software?
SmartSDR v3.9.19 and the SmartSDR v3.9.19 Release Notes
SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
The latest 4O3A Genius Product Software and Firmware
SmartSDR v3.9.19 and the SmartSDR v3.9.19 Release Notes
SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
The latest 4O3A Genius Product Software and Firmware
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
API Help
K1ESE
Member ✭✭✭
I want to access the API to turn a relay output off and on.
This works -
ampline$ = "tx1"
handle = TCPOpen(radioaddress$, 4992)
temp =TCPPrint(handle, "C0|interlock "; ampline$; "_enabled=f")
It turns off.
This doesn't -
ampline$ = "tx1"
handle = TCPOpen(radioaddress$, 4992)
temp =TCPPrint(handle, "C0|interlock "; ampline$; "_enabled=f")
It doesn't turn back on.
Please, what did I mess up?
K1ESE
This works -
ampline$ = "tx1"
handle = TCPOpen(radioaddress$, 4992)
temp =TCPPrint(handle, "C0|interlock "; ampline$; "_enabled=f")
It turns off.
This doesn't -
ampline$ = "tx1"
handle = TCPOpen(radioaddress$, 4992)
temp =TCPPrint(handle, "C0|interlock "; ampline$; "_enabled=f")
It doesn't turn back on.
Please, what did I mess up?
K1ESE
0
Answers
-
Did you mean to say "_enabled=t" (true) in the second snippet?
0 -
Not an expert on the FlexAPI but your two sample code fragments, as written here are identical. If that's what you really have, then I suspect you need to change "_enabled=f" to "_enabled=t".
0 -
Yes, I copied wrong from the program.
This doesn't work -
temp =TCPPrint(handle, "C3|interlock "; ampline$; "_enabled=t")
I'm guessing I have messed up the syntax somehow.
0 -
Do you issue commands C1 and C2 before issuing the C3 that doesn't work? There may be something going wrong in the intermediate code that you've not shown. Do you close the TCP/IP connection after each command?
0 -
As long as you asked...
Liberty Basic Code -
' TCP/IP socket functions by by Alex Davies
open "mesock32.dll" for dll as #me
[setup.main.Window]
nomainwin
WindowWidth = 200
WindowHeight = 146
UpperLeftX=500
UpperLeftY=200
loadbmp "Tune", "C:Tune Antenna Tuner SafelyTune.bmp"
loadbmp "Stop", "C:Tune Antenna Tuner SafelyStop.bmp"
'-----Begin GUI objects code
bmpbutton #main.start,"C:Tune Antenna Tuner SafelyTune.bmp",[startClick], UL, 0, 0
'button #main.reconn, " RESET ", [reconnClick], UL, 0, 76 , 184, 30
'-----End GUI objects code
open "TS" for window as #main
'print #main.reconn, "!font ms_sans_serif 14 bold"
print #main, "trapclose [quit]"
'read .ini file for address, RCA TX line, tune power
open "C:Tune Antenna Tuner SafelyTATS.ini" for input as #tuncfg
line input #tuncfg, radioaddress$
line input #tuncfg, ampline$
input #tuncfg, tunepower$
close #tuncfg
tuneflag=0
' handle = TCPOpen(radioaddress$, 4992)
' temp =TCPPrint(handle, "C4|transmit set tunepower=0")
[main.inputLoop]
wait
[startClick]
if tuneflag = 0 then
handle = TCPOpen(radioaddress$, 4992)
temp =TCPPrint(handle, "C0|interlock "; ampline$; "_enabled=f")
'temp =TCPPrint(handle, "C1|transmit set tunepower=";tunepower$)
temp =TCPPrint(handle, "C1|transmit tune on")
print #main.start, "bitmap Stop"
tuneflag=1
else
temp =TCPPrint(handle, "C2|transmit tune off")
'temp =TCPPrint(handle, "C4|transmit set tunepower=";tunepower$)
temp =TCPPrint(handle, "C3|interlock "; ampline$; "_enabled=T")
temp = TCPClose(handle)
print #main.start, "bitmap Tune"
tuneflag=0
end if
wait
'[reconnClick]
' temp = TCPClose(handle)
' handle = TCPOpen(radioaddress$, 4992)
' wait
[quit]
temp = TCPClose(handle)
close #me
close #main
end
''''Function TCPOpen()''''''''''
Function TCPOpen(address$,Port)
Timeout=1000
calldll #me, "Open", address$ As ptr,_
Port As Long,_
Timeout As Long, re As Long
TCPOpen=re
End Function
''''Function TCPReceive$()''''''''''
Function TCPReceive$(handle)
buffer=4096
all=0
calldll #me, "ReceiveA" ,handle As Long,_
buffer As Long,_
all As Long, re As long
if re<>0 then TCPReceive$ = winstring(re)
End Function
''''Function TCPPrint()''''''''''
Function TCPPrint(handle,text$)
calldll #me, "PrintA", handle As Long,_
text$ As ptr,re As Long
TCPPrint=re
End Function
''''Function TCPClose()''''''''''
Function TCPClose(handle)
calldll #me, "CloseA",handle As Long,_
TCPClose As Long
End Function
0 -
Is the issue that you used a capital "T" instead of lower case "t"? 73, Len, KD0RC0
Leave a Comment
Categories
- All Categories
- 349 Community Topics
- 2.1K New Ideas
- 615 The Flea Market
- 8K Software
- 2 SmartSDR+
- 6.3K SmartSDR for Windows
- 173 SmartSDR for Maestro and M models
- 412 SmartSDR for Mac
- 267 SmartSDR for iOS
- 249 SmartSDR CAT
- 186 DAX
- 375 SmartSDR API
- 9.2K Radios and Accessories
- 22 Aurora
- 207 FLEX-8000 Signature Series
- 7.1K FLEX-6000 Signature Series
- 921 Maestro
- 53 FlexControl
- 860 FLEX Series (Legacy) Radios
- 894 Genius Products
- 455 Power Genius XL Amplifier
- 323 Tuner Genius XL
- 116 Antenna Genius
- 283 Shack Infrastructure
- 199 Networking
- 444 Remote Operation (SmartLink)
- 138 Contesting
- 754 Peripherals & Station Integration
- 139 Amateur Radio Interests
- 973 Third-Party Software