********************************************************************************
*
* K2S is a copyright work by Danh Le, KE6D. It is intended for personal
* use only. The program is a charityware - which means that if you use
* it, like it and decide to contribute, you may want to contribute $10
* to $15 to a charity organization of your choice (Red Cross is my
* favorite organization) The contribution will give me an inspiration
* to develop and improve K2S further. You may also send me a qsl card
* to let me know how much you like K2S.
*
* Please send suggestion and bug reports to ke6d@attbi.com (or
* ke6d@juno.com) so that can improve K2S.
*
* Tnx es 73
* Dan, KE6D
*
* Danh Le, KE6D
* 245 Valmy Street
* Milpitas, CA 95035
*
* Email:    ke6d@attbi.com
* Web Page: www.qsl.net/ke6d
*
********************************************************************************

********************************************************************************
*
* 10/25/2001 K2S Initial Release version 0.1
*
********************************************************************************

This is my first attempt to release a "work in progress" software
so the whole installation process is a manual process for now.

**** A few notes on the K2S software:


1. ****** Installing and configuring K2S (Updated on 11/26/2002)

There are 3 main files that come in the zip package:

- The main file is K2S.exe which is the main K2 control software. This
file should be copy to a location (directory of your choice, i.e, C:\k2s)

-  The other DLLs (mfc42.dll, msvcrt.dll) should be
copy to the directory where K2S.exe resides, or Windows\system or
Windows\system32 directory. I guess the easiest way is to unzip everything
in to the K2S directy... (These are Microsoft Foundation
class DLLs and objects)

- Once you finish copying the files, create a shortcut on your destop
that points to the K2S program.

- Double click on K2S from your destop.

- When the main dialog box appears, click on the right mouse button
when you have the mouse pointer points to the top of the dialog box.

- A menu will appear. Select system config to edit a few important
things such as your name, qth, callsign and COM port parameter (Port#,
4800, N, 8, 1) Except the COM port parameters, everything is not currently
in use.

- Once you complete editing these parameters, click on apply to save it.

- Click on OK on the main dialog box to exit out from K2S completely.

- Configuration is now completed.

Note: K2S is default to COM1 when the program runs the very first time. After
that, it uses whatever the user configured from the steps above.

2. ****** Running K2S

- Be sure you have the K2 serial cable connected to the correct COM port.

- Verify that the KIO2 works correctly by using a terminal software such
as Hyperterminal and type "FA;" you should see a string like "FAxxxxxxxxxxx"
coming right back. If you don't see it, check the connection to make sure
that the cable is hooked up correctly (you must have verified that your
KIO2 functioned properly when you built it, didn't you?)

- Turn on the K2

- Launch K2S, the main dialog should be updated with the current K2 status.

3. ****** Using K2S

- As you can tell, I cut the one dialog box off from the main project which I
currently work on and created K2S so that you can play with controlling the
K2 at the moment. I have a lot of features for K2S in mind which I plan to
build but I am not able to complete most of them at the moment. Releasing
the code that control the basic feature of the K2 right now will enable you
to play with the KIO2 while I am working on...

- Here are a few tips (instructions?) when using the K2S program:

	* The radio buttons indicate the current settings of the K2. Clicking
	  on the next button positions selects a different K2 setting. Noise
	  blanker and AFIL work differently since there isn't a way to select
	  a particular setting directly. Clicking on any setting on AFIL or NB
	  will advance it to the next position.

	* Drag on the Power and CW speed slider will select corresponding power
	  and CW speed.
	  
	* VFOs selections work like this:
	
		+ The active VFO is displayed in LIGHT BLUE (in normal mode)
		  Inactive VFO is in light gray.
		+ The TX VFO is in RED and RX VFO is in DARK BLUE (in split mode)
		+ Clicking on a VFO display will enable you to enter the frequency
		  directly. Be sure to click on the "<<" or ">>" buttons after you
          finish entering the frequency.
		+ There are 3 buttons on top of each VFO. Click on "Tx" if you
		  want to select split mode operation (split mode is selected if
		  the TX VFO is different than the active VFO). Click "Rx" if you
		  want to cancel split or just selecting an active VFO. "A>B" and
		  "B>A" transfer frequency from one VFO to another.

	* RIT/XIT work like this
	
		+ When RIT/XIT is disable RIT/XIT frequency is display in light
		  gray. Clicking on RIT will change the display to MAGENTA and
		  enable RIT. Click on RIT again to disable RIT mode. Clicking
		  on XIT will change the display to RED and enable XIT. Clicking
		  on XIT again will disable it. Whenever the RIT/XIT is enable, the
		  RIT tuning buttons will be anabled along with it. Clicking on CLR
		  will clear the RIT offset.

          I noticed that once can engage both RIT and XIT buttons from the
          K2 front panel, this has got to be a bug from the K2 firmware since
          I don't know enable RIT/XIT simultaneously is going to do!

	* Clicking on Connect button will send the initial status command to to
	  the K2, then update the connection status on the top of the main dialog
	  box.


********************************************************************************
*
* Well, that is all the instructions about K2S I have at the moment. I will
* update this file as time goes by...
*
********************************************************************************



72/73 es Enjoy,

Dan, KE6D

********************************************************************************
*
* 10/29/01 Release version 0.1A for testing
*
********************************************************************************

	* New in this release:
		- Active VFO frequency slider is now working. One can now "slide"
                  the frequency within a given HAM band.
		- Quick band changing is now implemented also. One can quickly change
  		  to any given HAM band with one or two clicks of the mouse.
		- VFO lock is implemented.
		- A "Tune" button is implemented to quickly tune the transmitter if
		  your K2 has an built in ATU

+++++ Some one mentioned about Keyboard CW. It is probably what I am going to implement
      next since K2S can now control the K2 very well.

********************************************************************************
*
* 11/07/01 Release version 0.1B for testing
*
********************************************************************************
	* New in this release:
		- Last visited VFO frequencies for the 9 HAM bands are now memorized.
		- HAM band info are stored in registry for editing later.
		- Change the COMM port selection to 18.
		- Add speed and power slider debouncing so that the controls are not so touchy
		- Add Active VFO slider tuning range selection. 4 ranges are available. The
		  default is "Full" band tuning which means the VFO slider range is set to the
		  whole HAM band the Active VFO is on at the time. 3 others ranges, 100K, 40K
		  5K, are also implemented. Once selected, K2S will try to set the slider
		  range to the current frequency +/- range/2 if it can. If, for some reasons,
		  the lower or higher limit falls outside the band edge. The band edge will be
		  used for that limit.
		- Keyboard CW is now implemented (I think you will like this feature) Here is how
		  it works:
			+ Start typing into the keyboard CW text input window will cause the K2 to
			  transmit at the end of that token. A token is defined as a string of
			  characters that is terminated by one of these characters " ,=.?+(%*"
			  (not including the ") For example, if you were going to type

			  Hello OM.

			  As soon as you finish typing the space character, the K2 will go into transmit
			  mode. If you made mistake while typing the characters, you can use backspace
			  to correct for it. You can only backspace upto the most recent break character
			  (" ,=.?+(%*") however. The reason for that was the message text input window
			  constantly parses out tokens as you type and sends them over to the CW transmit
			  thread (task) to queue up for sending to the K2 at the next available moment.

			  The K2 recognizes these characters as CW prosigns:

					(			KN
					+			AR
					=			BT
					%			AS
					*			SK

			+ Clicking on Abort CW button while the K2 is in transmit mode will cause it
			  to stop transmit immediately.

			+ Clicking on Clear Text will clear the text input buffer area.

********************************************************************************
*
* 12/13/01 Release version 0.2 for testing
*
********************************************************************************

After a long period of hybernation due to job change, I decided to fire up the old
computer and started to "burn some midnight oil again". Based useful inputs from
many users, especially from John, KH7T,  I decided to rewrite the CW transmit portion
of K2S for better user interface. Under the new scheme, only one push button [Keyboard CW]
will active the CW transmit section. This would allow users who are only interested in
remote control of the K2 to see less of what they don't care much about!

	* New in this release:
        + Ability to edit the HAM band edges (useful for tuning if you are into SWL)
        + Transmit memory keys (11 of them are provided)
        + An "echo" screen to let the user "sees" what is in the transmit buffer of K2S
        + [Abort CW] stop the transmitter, clear all text in the type ahead buffer, transmit
          ring buffer, etc...
        + Fix a major bug with the type ahead ring buffer (and token parser) that under
          certain condition would stop sending tokens to the ring buffer. 
        + Due to the 24 character buffer limitation of the K2 KIO, another token parser
          has to be implemented on the MsgSender to avoid breaking up words in the middle
          (as in half of the characters of a word was send when the 24 character limit reached)
          as much as possible.
        + A dialog that allows display, edit, and send memory key to the K2 on the fly was implemented.
          This dialog let the user see what is currently "memorized" in memory.

    The following paragraphs describe how the new features work in CW transmit:


        + Click on the [Keyboard CW] button once, the transmit dialog screen will "slide" out
          from the main front panel screen. There are three main areas of this screen. The read only
          only section displays the text which had been sent to the transmit task for sending to the
          K2. This screen will scroll as more text is added to the buffer. As soon as a block of text
          is sent to the K2 for transmitting, that block of text is remove from the transmit buffer.
        + Start typing on to the text input line, token(s) (one that is terminated by one of
          these " ,=.?+(%*" characters) will be sent over to the transmit thread for transmitting.
        + Click on one of the memory keys will send the content of that memory key to the transmit
          thread. If a memory key is empty, its button will be disabled.
        + Click on [Abort CW] will stop the transmitter, clear all text in the type ahead buffer and
          transmit ring buffer.
        + Click on [Show Keys] once, the Memory Keys Edit dialog will "slide" out from the Front
          Panel Dialog. This dialog shows the contents of the memory keys. Each memory key has 2
          buttons associated with it. [...] lets the user edit that memory key content, [>>] sends
          the content of that memory key for transmit (same as clicking on one of the [M??] key on
          the Transmit dialog]
        + Clicking [...] button will change the read only status of that memory location to
          editable. Move the mouse over to the text of the memory, click once then edit the text.
          Once done either press [Enter] or click the mouse somewhere else, the content of that
          memory location will be updated automatically. Pressing [Esc] will cancel memory editing
          and restore the old content of that memory location.
        + A scratch pad type memory location is provided (one without a memory label attached to it),
          the user can type anything to this location, then click the [>>] to send it. It is useful
          when you are receiving in a QSO and wanting to reply, but don't want to activate the
          transmitter yet (typing into the text input in the transmit window will activate the
          transmitter immediately as soon as a token is recognized). Once the other station completes,
          click on the [>>] of the scratch pad memory to send its content, then go back to the
          text input screen to add more text to your transmit message.

    Please note that K2S v0.2 uses a dialog sliding scheme to present more info to the user as needed.
    A single button is needed to either activate/deactivate the corresponding panel(s). So if you
    are clicking on [Keyboard CW] while the transmit screen is already open, it will slide close. If
    the transmit screen also has the memory edit screen open ([Show Keys] activated), the memory
    edit screen will slide close first followed by the transmit screen.

********************************************************************************
*
* 12/13/01 Release version 0.2a for testing
*
********************************************************************************

	* New in this release:
        + Fix a bug with direct entry of VFO A and B (Tnx to w0cz)


********************************************************************************
*
*           Release version 0.3 for testing
*
********************************************************************************

    * Lot of enhancements in this release:
        + While the Transmit input text has focus (the input window that let you type in
          text for transmit), pressing F1-F11 will send the content of that memory location
          (if it is not empty - enable) to the transmit task for transmit
        + John, KH7T, convinces me to rewire the A>B and B>A buttons logic.
        + Color indicators are implemented for the TX, RX, and RIT, XIT buttons. The color is
          turned on to indicate the active VFO function or RIT/XIT function
        + Moving the mouse over to the Tx dialog memory button will highlight that button. If
          the mouse is "hovered" over that button, the content of that particular memory
          location is also displayed on the mouse tool-tip (this is particularly useful
          for me since I never seem to remember the content of the memory keys)
        + Autoplay of a memory key is now implemented. Autoplay works as follows:
            - You must have at least 1 memory location (F1-F11) defined
            - Click on AutoPlay will bring up the AutoPlay configuration on the bottom
              right of the K2 front panel window
            - Click on the memory list box to select the memory location to play
            - Click on the spinner buttons on the frequency (in seconds) this message
              is going to be repeated
            - Click on the check box "Play until Interrupted" to select whether this
              memory is going to be played until the user click on "Abort Tx" or until
              the number of times had been exceeded. Uncheck this box would allow the
              user to select the number of times this message is played.
            - Click on "Go" to play the message. Once clicked, all the Memory buttons,
              "AutoPlay" "APlay Repeat" will be disabled, an "AutoPlay" indicator will
              change to Light Brown, and the memory message will be played repeatedly.

              NOTE: SINCE K2S HAS NO WAY OF KNOWING HOW LONG IT TAKES THE K2 TO TRANSMIT
              THE MESSAGE. THE TIMER ON K2S CAN ONLY START WHENEVER A MESSAGE IS SENT OVER
              TO THE K2 FOR TRANSMIT. SO IF THE K2 HAS NOT FINISHED THE PREVIOUS MESSAGE AND
              THE TIMER FIRES AGAIN, YOU NEED TO SELECT A LONGER "RESTING" INTERVAL SO THAT
              THERE IS SOME "RESTING TIME" BETWEEN PLAYBACK. I WILL ADDRESS THIS PROBLEM ON
              FUTURE K2S RELEASE.

        + "Autoplay Repeat" repeat the last autoplay message without going to the memory
           selection process. The only difference is that "AutoPlay Repeat" will keep
           playing until interrupted.

        + [Abort CW] changes to [Abort TX] and changes color to RED whenever there is text
          send to the K2.
        + An indicator to indicate that K2S is in memory autoplay mode. This indicator changes
          to light brown in autoplay and returns to gray when autoplay is interrupted.

********************************************************************************
*
*           Release version 0.3a for testing
*
********************************************************************************

    * Add support for macro expansion in memory keys. Below is a list of macros
      currently recognized:

            ~mc         my call
            ~mn         my name
            ~mq         my qth
            ~ms         my signal
            ~hc         his call
            ~hn         his name
            ~hq         his qth
            ~hs         his signal

        For example, if my call is set to KE6D and one were to program F1 memory
        with "cq cq cq de ~mc ~mc/qrp ~mc k", it would be expanded to "cq cq cq de ke6d 
        ke6d/qrp ke6d k"

        A handy memory to program to one of the FKeys is "~hc de ~mc =".

        To set the other station information, move the mouse to anywhere within the
        transmitting window, then click the rightmouse button. A popup memu will appear.
        Select "QSO Info" to enter the other station information.

    * Add support for sharing K2 radio data with other Windows application. This feature
      is intended to allow K2S to work "side by side" with a contest logging software.
      The author may wish to use the K2 radio data for logging purpose, but doesn't want
      to implement the K2 control code in his/her software. Please see the file
      "K2SCommunication.txt" for more detail on this feature.


********************************************************************************
*
*           Release version 0.3b for testing
*
********************************************************************************

    * Fix a bug with the type ahead buffer
    * COM port is now default to COM1


********************************************************************************
*
* 06/11/02 Version 1.0 :=)
*
********************************************************************************

    * I have not been working on K2S at all due to a conversion to a CORBA based
      K2 control software (K2Server/K2AnyWhere combination) But due to the
      complication of the software involved, I probably won't release this package
      at all. It will probably remain a "playground" for me for quite sometimes in
      the future.

    * New in this release:

        - The active vfo slider will remain where the user set it last. It will be
          defaulted to full band when K2S starts, but after the user selects a new
          range, it would stay in the new range.
        - Still more bug fix with the type ahead buffer. I think I got it this time.
        - Implement stacking registers (5)
        - Implement radio memory save/restore (100)
        - Add support for the 100W amplifier from Elecraft
        - Add quick keys for the following functions:
            + ALT-F1    : Save to stack register
            + ALT-F2    : Recall from stack register
            + ALT-F3    : Save Radio memory
            + ALT-F4    : Recall radio memory
            + ALT-T     : Enable/Disable the Keyboard CW panel
            + ALT-X     : Exit from the software

********************************************************************************
*
* 07/30/02 Version 0.99 :=)
*
********************************************************************************
    * Implement a serial number macro (~sn). The serial macro command can also be
      followed by a '+' or '-' to increment/decrement the counter by one. ~sn+ will
      play the serial number and increase it by 1 afterward. ~sn- does the opposite.
      The serial number macro can also be configured to send a maximum number of
      digits (upto 5) and the '0' can also be configured to to be sent as a cut
      number.
    * A basic qso logging facility is now implemented. There are 2 logging modes
      available: normal logging (call, name, qth, rst, comments) and contest style
      logging (call, exchange, comment). The logging style is selected when a log
      file is opened or configured from the configuration panel.
    * Here are things that can be done while the qso logger is opened:
        + Log info are entered in the info dialog box. Click <log it> button will
          send the log to the qso logger for logging along with radio info
        + Double click on the first column (VC++ 5.0/MFC quirk - will be changed to
          full row selection when I switched over to 6.0) of the log report will bring
          up the edit dialog box for that qso.
        + Log can be saved or loaded to/from different log file names

********************************************************************************
*
* 11/20/02 Release Version 1.0 :=)
*
********************************************************************************
	* New RIT/XIT slider is implemented (range now is from -1000hz to 1000hz)
	* A +/- 10hz RIT/XIT buttons are implemented to allow finer RIT/XIT tuning.
	* Virtual switch panel is implemented. This panel simulate the the all the
		switches on the K2.
	* An LCD display is implemented. This display reflects what the K2 is
		displaying most of the time.
	* VFO slider now has a special mode. A right click once on the VFO slider
		changes tuning from normal tuning to SLEUTH tuning. SLEUTH tuning means
		that the frequency only changes when the left mouse button is released.

********************************************************************************
*
* 11/24/02 Release version 1.0a :=)
*
********************************************************************************
	* Fix a problem with scanning limits. Add a button to retrieve the band
                limits for the current band.
	* Fix a small problem with the COM port string background.
	* Update the splash screen with an image of my setup

********************************************************************************
*
* 11/26/02
*
********************************************************************************

    * Fix a bug with direct frequency input due to LCD and Bargraph display. Clicking
        on the active VFO display (the one that shows in light blue) enable direct
        VFO entry. When you finish typing the frequency (in KHz, ie, 7040.00 for
        7.040 MHz) clicks on the button (that changed color when you clicked on
        the VFO display)  next to the VFO display to change it.

    * Update the VFO slider indicator when the frequency change.
	* Fix the jumpy RIT/XIT display
	* Fix the squech slider (it appears that the K2 only changes by 25)

********************************************************************************
*
* 01/08/2003 Release version 1.0b :=)
*
********************************************************************************
    * Change the buttons to reflect GUI change on K2Anywhere
    * Add thump wheel to change active VFO frequency

********************************************************************************
*
* 05/08/2003 Release version 1.1 :=)
*
********************************************************************************

===== More to follow soon...

Have Fun...

Dan, KE6D