Add support for Heard Stations via AGWPE #615
                
     Open
            
            
          
      
        
          +323
        
        
          −31
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
An AGWPE client request for Heard Stations ('H' frame) requires that data for the most recent 20 heard callsigns be returned. Much of the data for this was already being collected, and displayed with the '-d m' command line option, but was not available via AGWPE.
The following changes have been made to support requests for Heard Stations:
Last heard times are now saved on a per-channel basis, since the AGWPE request specifies the channel for which data is being requested. The most recently heard time on any channel is still available using the 'chan' value, reflecting the channel on which the callsign was most recently heard.
First heard times are saved in addition to last heard times.
Two new functions, mheard_latest_for_channel and mheard_latest_for_is, are exposed from the mheard code, for use by the AGWPE server code. These two functions parallel the separation between the existing mheard_save_rf and mheard_save_is functions.
The AGWPE server responds to 'H' frame requests by constructing and returning 20 'H' frame responses (including blank responses if fewer stations have been heard). The responses include both the text and binary forms of the first and last heard times, as described in the AGWPE spec.
Macros are used to wrap the platform differences for qsort_r / qsort_s, needed to sort heard times on a per-channel basis.
Tested on Linux Mint 22.1, macOS Sequoia 15.6.1, and Windows 10.