logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Personal function - spot alerts
vk4iu
#1 Posted : Tuesday, November 12, 2013 1:16:39 AM(UTC)
VK4IU

Rank: Advanced Member

Groups: Moderator, Registered, Administrators
Posts: 404
Man
Location: Hodgleigh QLD

Thanks: 6 times
Was thanked: 77 time(s) in 68 post(s)
G'Day All,

Dennis: Thanks for your tips on values in the spot filters.
Bill W7OO: Are you ready! This is what you need until Dennis comes up with a better idea.

I have been mucking about today to see if I can write a "private function" to use for alerts and the spot log - to surpress repeated alerts - and try to discover what else might be possible.

I am assuming the spot log will be small, and my PC is fast, and will multi-task with Logic. I need to do more work with UTC time. My goals were to gain experience with a real problem, and have fun.

Who is willing to give it a go - do some testing to see that it works for them? Reply to this topic or email me.

The code returns FALSE if a specific spot has been seen in the last "spot_delay" seconds and is called in an alert filter by, for example ...

.T. AND check_alert( CALL, BAND, MODE, 600, 3000 ) AND <filter expression>

... the leading .T. allows one to "turn the alert off completely", check_alert surpresses repeated alerts by returning .F., and <filter> is the actual alert. The result puts 600 seconds between alerts and flashes a message box for 3 seconds when a spot is surpressed. The message box will go when it is proven to work correctly.

I started with this simple code ...


LPARAMETERS spot_call, spot_band, spot_mode, spot_delay, box_delay
MESSAGEBOX(spot_call,36,"Alert",1)
RETURN .T.


... which I compiled in Advanced, Database commands and it worked as expected. Then I added the scan through the spots for the call, to return FALSE if a spot log record is found in the last "spot_delay" seconds. Much reading of manuals and the Internet was included.

I added an index to the spot log for "CALL+DTOC(TIMESTAMP)" to facilitate the scan of the spots.

The following code works for me, surpressing alerts for calls for "spot_delay" seconds. UTC time needs to correctly implemented.


LPARAMETERS spot_call, spot_band, spot_mode, spot_delay, box_delay

* Spot time stamps are UTC
* UTC midnight is 36000 seconds after local midnight
* need to get utc time from the system and stop using the SECONDS() function.

utc = 36000

spot_alias = alias()
if not used("my_spots") then
use spots again shared noupdate order call_time alias my_spots in 0
endif

select my_spots

status = .T.

scan for ;
my_spots.call = spot_call and ;
my_spots.band = spot_band and ;
my_spots.mode = spot_mode and ;
between((seconds() - utc - ((hour(my_spots.timestamp)*60) + minute(my_spots.timestamp))*60),0,spot_delay)

status = .F.

endscan

IF status = .F.
MESSAGEBOX(spot_call + " " + transform(status),36,"Alert",box_delay)
ENDIF

IF EMPTY( spot_alias )

SELECT 0
ELSE
SELECT ( spot_alias )

ENDIF

return status


Dennis: Assistance with getting UTC time from Foxpro would be appreciated.

If you would rather I did not do this - just say so. No worries.
If I am "biting off more than I can chew" - just say so. No worries.

But, if a few hints will get me there - thanks in advanced.

My priority: Low - but others may have a higher priority.

Peter VK4IU
Peter VK4IU
You can help by posting images of any errors and including your Logic version.
1 user thanked vk4iu for this useful post.
WN4AZY on 11/12/2013(UTC)
Sponsor
Note: We receive a commission from Amazon when you purchase via this link. It does not affect your cost. Thank you!
vk4iu
#2 Posted : Tuesday, November 12, 2013 3:57:16 AM(UTC)
VK4IU

Rank: Advanced Member

Groups: Moderator, Registered, Administrators
Posts: 404
Man
Location: Hodgleigh QLD

Thanks: 6 times
Was thanked: 77 time(s) in 68 post(s)
G'Day All,

The latest code is ready for others to test. The files are attached. I have added UTC times so the code is universal. Dennis: Is there a better way?

This program adds to the functionality of Logic. The code makes no modifications to any of Logic's existing code, or databases. Open the source code in any text editor and have a look at the code.

There are two files - the code, and a compiled file of the source code.

To use it, you must UNZIP the files and do either of the following ....

Save the compiled CHECK_ALERT.FXP file to the main Logic installation directory - usually something like "C:\Program Files (x86)\LOGic" or c:\logic or c:\logic9.

OR

Save the source CHECK_ALERT.PRG file to the main Logic installation directory. Usually something like "C:\Program Files (x86)\LOGic" or c:\logic or c:\logic9. Then Open the Tools, Advanced, Database commands window and type

COMPILE CHECK_ALERT.PRG

and press <enter>.

That is it. Now you need to modify your Alert filters to include the check for repeated spot alerts.

Update any of your Alert filters to read like this ...

check_alert(call,band,mode,600,3000) AND <filter>

where <filter> is your original filter. Any duplicated spot alerts will only be repeated after 600 seconds, and the message that a spot alert has been surpressed will display for 3 seconds (3000 milliseconds). You can change these last two values to whatever suits your operating. Set the "message delay" to ZERO to NOT display message.

Should you choose to use the code, your feedback would be gretfully appreciated. You may modify the code to your needs.

Dennis: If the code can be improved, or please make suggestions.

Peter VK4IU
File Attachment(s):
check_alert.zip (3kb) downloaded 18 time(s).
Peter VK4IU
You can help by posting images of any errors and including your Logic version.
W7OO
#3 Posted : Tuesday, November 12, 2013 1:32:44 PM(UTC)
Rank: Advanced Member

Groups: Registered
Posts: 164
Location: Carnation, WA

Thanks: 1 times
Was thanked: 5 time(s) in 4 post(s)
Hi Dennis,

Is there a possibility that you could work something out with Peter to include this code in your next release of LOGic 9? It is a significant addition to the filtering tools we already have.

Thanks,

Bill
W7OO
vk4iu
#4 Posted : Friday, November 15, 2013 6:16:50 PM(UTC)
VK4IU

Rank: Advanced Member

Groups: Moderator, Registered, Administrators
Posts: 404
Man
Location: Hodgleigh QLD

Thanks: 6 times
Was thanked: 77 time(s) in 68 post(s)
G'Day,

The latest version of "check_alert.prg" is attached.

As already indicated, copy "check_alert.prg" to your Logic installation folder, and use Tools, Advanced, Database Commands and type "compile check_alert<enter>". Close Database Commands.

Place a call to "check_alert" in any of your alert filters. The call is ...

check_alert(call, band, mode, <delay>, <log>)

... <delay> is the length of time for which you want duplicates suppressed. That is, if a spot arrives less than <delay> seconds after an alert for a spot with the same call, band, and mode was made, the new alert will be suppressed.

... <log> will create a log on screen if greater than 0. Do not use this while operating. Setting this value to 1 will show a log on screen of exactly what alerts are being suppressed. Set <log> to ZERO, when you have confidence in the process.

An alert filter should read like this ...

check_filter(call,band,mode,600,0) and call='K9W'
or
check_filter(call,band,mode,240,0) and bandmodest=3

Keep in mind the alert has been suppressed - not the actual spot. Suppressing duplicate alerts will mean the alert list will be missing the "comment" on those suppressed alerts. Use the main Spot Log panel and a quick filter on the call to see all the details for all the spots for that call - or use the Advanced Filter to see the specific call,band,mode spots.

This code makes no changes to Logic. Nothing is updated or removed. It will survive the installation of any updates to Logic.

To completely remove check_alert, remove check_alert from all your alert filters. Delete check_alert.* from the Logic installation directory.

Have fun.

Peter VK4IU
File Attachment(s):
check_alert.zip (3kb) downloaded 16 time(s).
Peter VK4IU
You can help by posting images of any errors and including your Logic version.
vk4iu
#5 Posted : Monday, December 2, 2013 5:21:24 AM(UTC)
VK4IU

Rank: Advanced Member

Groups: Moderator, Registered, Administrators
Posts: 404
Man
Location: Hodgleigh QLD

Thanks: 6 times
Was thanked: 77 time(s) in 68 post(s)
G'Day,

I have been experimenting with alerts.

A better arrangement with the filter is to put my "alert checker" last. Foxpro will abandon further effort if any one term of a "logical expression" is false.

So like this, the check for duplicates occurs no matter what the call sign is

check_filter(call,band,mode,600,0) and call='K9W'

A better check is

call='K9W' and check_filter(call,band,mode,600,0)

The call to check_filter will only occur if the call is actually K9W.

This is clearly more efficient.

Peter VK4IU
You can help by posting images of any errors and including your Logic version.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.049 seconds.