FET 2.0
cocoaPTT 2.0

Kok Chen, W7AY [w7ay (at) arrl (dot) net]
Last updated: November 5, 2008



Introduction

cocoaPTT 2.0 is an AppleScriptable application to provide push-to-transmit (PTT) capability to applications that don't natively support the PTT function. In addition to the AppleScript path, the application also provides a small control panel interface to directly key the PTT line on or off.

cocoaPTT 2.0 is built as a Universal Binary application and works natively with both PowerPC and Intel based Macintoshes. You can download cocoaPTT 2.0 here.

The original cocoaPTT application controlled PTT through the Request To Send (RTS) or the Data Terminal Ready (DTR) pin of a serial port. In addition to the RTS/DTR serial control lines, cocoaPTT 2.0 now supports PTT through the µH Router, the MacLoggerDX PTT scripts, and a user defined set of AppleScripts to handle other PTT situations.

cocoaPTT 2.0 is not a supported program. For non-commercial use, the Xcode project and sources are available at the download page.

poff

Configuration

Before calling cocoaPTT 2.0 from another application, you will need to configure the interface. First make sure that any PTT device that you might use (microKeyer, serial port, etc) are connected before launching cocoaPTT.

Select the Preferences... menu item in the cocoaPTT menu in the Menu Bar (or use the Command-comma keyboard shortcut) to bring up the Preference panel.

The preferences panel contains a tab view. You use the tab view to select which PTT device to use.



When Off is selected, cocoaPTT will accept AppleScripts normally, but it will not perform any PTT activity.

pserial

When Serial Port is selected, you are presented with an interface that is similar to the original cocoaPTT.

The popup menu has a list of available serial ports. If you don’t see the port you need, double check that your serial port is connected to the ISB bus. Then select the Off tab and the Serial Port tab again to make cocoaPTT rescan for devices.

If you still don;t see the device, you can try to look for it in the System Profiler (an application that is in the MacOS Utilities folder). If you cannot find a serial port port in the System Profiler, cocoaPTT will not be able to find it either. Please be aware that most USB serial port adapters will require a manufacturer supplied driver that works in the version of Mac OS X that you are running.

The above figure the preference panel after a Keyspan USB PDA adapter (KeySerial1) is selected.


In addition to choosing which serial port to use, you can also choose whether to use the RTS or the DTR pin of the port. You can also choose whether the polarity of the RS-232 signal is high (positive voltage at the serial port pin) to key PTT, or low (negative voltage at the serial port pin) to key the PTT line of the transceiver. The choice of polarity depends on how you’ve designed your interface and what the transceiver needs.

There is a third choice under RTS and DTR. This allows you to key both RTS and DTR at the same time. You can use this selection if you are not sure if RTS or DTR is the signal that is being used and both signals are not being used by other applications, or if the PTT device has wired-ORed the hardware RTS and DTR signals, as with the RIGblaster nomic.

Please note that different drivers / serial ports will launch to either active or inactive states (and might cause your transceiver to key before cocoaPTT is launched). There is not much you can do about that except to invert the logic state before the keying signal to the transceiver.

prouter

When the µH Router tab is selected, cocoaPTT 2.0 will launch the µH Router application to perform PTT on the microHAM keyers. As seen in the above figure, you can select the DIGI KEYER, the microKeyer (original or version II) or the CW keyer. Please note that the microHAM USB Interface II is a simple serial port device; you should use the Serial Port tab instead of the µH Router tab to control the USB Interface II.

If you select MacLoggerDX tab, cocoaPTT will send AppleScripts to the MacLoggerDX application to perform PTT.

puser

The User Defined tab, shown above, behaves in the same way as the User Defined PTT mechanism in cocoaModem. This allows you to execute custom scripts to command other applications (such as TS2K) to perform PTT.

The User Defined PTT tab allows you to place three script files, called pttKey.scpt, pttUnkey.scpt and pttQuit.scpt in a folder. The last script file is not mandatory and can be absent. When you send cocoaPTT a key or unkey AppleScript, cocoaPTT will run the script files that are in the designated folder.

Notice that the preference panel includes a checkbox called "Ignore Quit AppleScript." This checkbox allows you to set cocoaPTT to ignore any "Quit" AppleScript message. It can be useful when there are more than one application using cocoaPTT and not all of them have set the connection count (see AppleScript Interface below).


Control Panel

When in the idle state, the cocoaPTT control panel looks like the following.

unkeyed

Click on the Key button to activate PTT. The interface turns into the following. Click on the Unkey button to get back to the idle state.


keyed

This panel can be closed (use the red button at the left of the panel’s title bar) if you don’t need to look at it -- for example when you are controlling cocoaPTT through a separate application using the AppleScript interface.

To reopen the control panel, make the cocoaPTT app active and then select the Show PTT Control Panel menu item in the Window menu in cocoaPTT’s menu bar.

You can also reopen the control panel by selecting the Show PTT Control Panel menu item that is displayed when you hold down the mouse button over the cocoaPTT item in the Dock (see figure below):

pttdock

The serial port and RTS/DTR selections and the control panel position are saved to a property list file called w7ay.cocoaPTT.plist in your user Preferences folder when you quit cocoaPTT.


AppleScript Interface

cocoaPTT can be controlled through AppleScript. The following is a script to activate PTT on the currently selected device (the selected tab view in the Preferences panel). This is the same script as the one in the old cocoPTT.

tell application “cocoaPTT"
set keyState to 1
end tell

The following is a script to deactivate PTT.

tell application “cocoaPTT”
set keyState to 0
end tell

In addition, you can control individual devices directly. This will bypass the control panel (i.e., the control panel will not show the correct PTT state). An example is

tell application “cocoaPTT"
set pttState of serialPTT to 1
end tell

The above will key the PTT on the serial port. Setting the pttState to 0 will unkey the PTT line on the serial port. The other devices are addressed by using routerPTT, mldxPTT and userDefinedPTT.

This allows multiple applications to share cocoaPTT 2.0. To prevent an application from causing cocoaPTT to quit while another application is still using it, you can use the following script to keep a "retain count" for your application:

tell application “cocoaPTT"
connect
end tell

Each connect message will increase the connection count in cocoaPTT by 1. As long as the connection count is non-zero, cocoaPTT will not quit through AppleScript.

When your application has finished using cocoaPTT, you should send a disconnect message to reduce the connection count by 1:

tell application “cocoaPTT"
disconnect
end tell

Both connect and disconnect returns an integer of the updated connection count.

Finally, you can send a quit message:

tell application “cocoaPTT"
quit
end tell

This will cause cocoaPTT to quit if there are no longer any active connections. The script returns the number of active connections. If a zero is returned, cocoaPTT would quit within 2 seconds upon receiving the quit message.